Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26c785f7f4 | ||
|
|
c36547fb62 | ||
|
|
a7ec40805a | ||
|
|
f8ba98843a |
No files matched your search
+2
-1
@@ -45,4 +45,5 @@ massif.*
|
||||
\#[^\#/]+\#$
|
||||
.lock-wscript
|
||||
.lock-wafbuild
|
||||
|
||||
*~
|
||||
\#*\#
|
||||
@@ -1,9 +1,3 @@
|
||||
Note:
|
||||
|
||||
This is a custom and unsupported fork of NS-3 simulator (http://www.nsnam.org/).
|
||||
|
||||
**The code in this repository is frequently rebased on top of the latest ns-3-dev branch**
|
||||
|
||||
|
||||
The Network Simulator, Version 3
|
||||
--------------------------------
|
||||
|
||||
@@ -122,24 +122,22 @@ RoutingExperiment::RoutingExperiment ()
|
||||
std::string
|
||||
PrintReceivedPacket (Ptr<Socket> socket, Ptr<Packet> packet)
|
||||
{
|
||||
SocketAddressTag tag;
|
||||
bool found;
|
||||
found = packet->PeekPacketTag (tag);
|
||||
Ptr<const SocketAddressTag> tag = packet->PeekPacketTag<SocketAddressTag> ();
|
||||
std::ostringstream oss;
|
||||
|
||||
oss << Simulator::Now ().GetSeconds () << " " << socket->GetNode ()->GetId ();
|
||||
|
||||
if (found)
|
||||
{
|
||||
InetSocketAddress addr = InetSocketAddress::ConvertFrom (tag.GetAddress ());
|
||||
if (tag != 0)
|
||||
{
|
||||
InetSocketAddress addr = InetSocketAddress::ConvertFrom (tag->GetAddress ());
|
||||
oss << " received one packet from " << addr.GetIpv4 ();
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
oss << " received one packet!";
|
||||
}
|
||||
}
|
||||
return oss.str ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RoutingExperiment::ReceivePacket (Ptr<Socket> socket)
|
||||
@@ -150,7 +148,7 @@ RoutingExperiment::ReceivePacket (Ptr<Socket> socket)
|
||||
bytesTotal += packet->GetSize ();
|
||||
packetsReceived += 1;
|
||||
NS_LOG_UNCOND (PrintReceivedPacket (socket, packet));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -352,9 +352,9 @@ RoutingProtocol::RouteOutput (Ptr<Packet> p, const Ipv4Header &header,
|
||||
// Actual route request will be deferred until packet will be fully formed,
|
||||
// routed to loopback, received from loopback and passed to RouteInput (see below)
|
||||
uint32_t iif = (oif ? m_ipv4->GetInterfaceForDevice (oif) : -1);
|
||||
DeferredRouteOutputTag tag (iif);
|
||||
if (!p->PeekPacketTag (tag))
|
||||
if (p->PeekPacketTag<DeferredRouteOutputTag> () == 0)
|
||||
{
|
||||
Ptr<DeferredRouteOutputTag> tag = CreateObject<DeferredRouteOutputTag> (iif);
|
||||
p->AddPacketTag (tag);
|
||||
}
|
||||
return LoopbackRoute (header, oif);
|
||||
@@ -405,8 +405,7 @@ RoutingProtocol::RouteInput (Ptr<const Packet> p, const Ipv4Header &header,
|
||||
// Deferred route request
|
||||
if (idev == m_lo)
|
||||
{
|
||||
DeferredRouteOutputTag tag;
|
||||
if (p->PeekPacketTag (tag))
|
||||
if (p->PeekPacketTag<DeferredRouteOutputTag> () != 0)
|
||||
{
|
||||
DeferredRouteOutput (p, header, ucb, ecb);
|
||||
return true;
|
||||
@@ -1594,11 +1593,11 @@ RoutingProtocol::SendPacketFromQueue (Ipv4Address dst, Ptr<Ipv4Route> route)
|
||||
QueueEntry queueEntry;
|
||||
while (m_queue.Dequeue (dst, queueEntry))
|
||||
{
|
||||
DeferredRouteOutputTag tag;
|
||||
Ptr<Packet> p = ConstCast<Packet> (queueEntry.GetPacket ());
|
||||
if (p->RemovePacketTag (tag) &&
|
||||
tag.GetInterface() != -1 &&
|
||||
tag.GetInterface() != m_ipv4->GetInterfaceForDevice (route->GetOutputDevice ()))
|
||||
Ptr<const DeferredRouteOutputTag> tag = p->RemovePacketTag<DeferredRouteOutputTag> ();
|
||||
if (tag != 0 &&
|
||||
tag->GetInterface() != -1 &&
|
||||
tag->GetInterface() != m_ipv4->GetInterfaceForDevice (route->GetOutputDevice ()))
|
||||
{
|
||||
NS_LOG_DEBUG ("Output device doesn't match. Dropped.");
|
||||
return;
|
||||
|
||||
@@ -211,8 +211,8 @@ void Radvd::Send (Ptr<RadvdInterface> config, Ipv6Address dst, bool reschedule)
|
||||
/* Router advertisements MUST always have a ttl of 255
|
||||
* The ttl value should be set as a socket option, but this is not yet implemented
|
||||
*/
|
||||
SocketIpTtlTag ttl;
|
||||
ttl.SetTtl (255);
|
||||
Ptr<SocketIpTtlTag> ttl = CreateObject<SocketIpTtlTag> ();
|
||||
ttl->SetTtl (255);
|
||||
p->AddPacketTag (ttl);
|
||||
|
||||
/* send RA */
|
||||
|
||||
@@ -317,10 +317,9 @@ RoutingProtocol::RouteOutput (Ptr<Packet> p,
|
||||
if (EnableBuffering)
|
||||
{
|
||||
uint32_t iif = (oif ? m_ipv4->GetInterfaceForDevice (oif) : -1);
|
||||
DeferredRouteOutputTag tag (iif);
|
||||
if (!p->PeekPacketTag (tag))
|
||||
if (p->PeekPacketTag<DeferredRouteOutputTag> () == 0)
|
||||
{
|
||||
p->AddPacketTag (tag);
|
||||
p->AddPacketTag (CreateObject<DeferredRouteOutputTag> (iif));
|
||||
}
|
||||
}
|
||||
return LoopbackRoute (header,oif);
|
||||
@@ -377,8 +376,7 @@ RoutingProtocol::RouteInput (Ptr<const Packet> p,
|
||||
// Deferred route request
|
||||
if (EnableBuffering == true && idev == m_lo)
|
||||
{
|
||||
DeferredRouteOutputTag tag;
|
||||
if (p->PeekPacketTag (tag))
|
||||
if (p->PeekPacketTag<DeferredRouteOutputTag> () != 0)
|
||||
{
|
||||
DeferredRouteOutput (p,header,ucb,ecb);
|
||||
return true;
|
||||
@@ -1121,11 +1119,11 @@ RoutingProtocol::SendPacketFromQueue (Ipv4Address dst,
|
||||
QueueEntry queueEntry;
|
||||
if (m_queue.Dequeue (dst,queueEntry))
|
||||
{
|
||||
DeferredRouteOutputTag tag;
|
||||
Ptr<Packet> p = ConstCast<Packet> (queueEntry.GetPacket ());
|
||||
if (p->RemovePacketTag (tag))
|
||||
Ptr<const DeferredRouteOutputTag> tag = p->RemovePacketTag<DeferredRouteOutputTag> ();
|
||||
if (tag != 0)
|
||||
{
|
||||
if (tag.oif != -1 && tag.oif != m_ipv4->GetInterfaceForDevice (route->GetOutputDevice ()))
|
||||
if (tag->oif != -1 && tag->oif != m_ipv4->GetInterfaceForDevice (route->GetOutputDevice ()))
|
||||
{
|
||||
NS_LOG_DEBUG ("Output device doesn't match. Dropped.");
|
||||
return;
|
||||
|
||||
@@ -204,8 +204,8 @@ Ipv4FlowProbe::SendOutgoingLogger (const Ipv4Header &ipHeader, Ptr<const Packet>
|
||||
|
||||
// tag the packet with the flow id and packet id, so that the packet can be identified even
|
||||
// when Ipv4Header is not accessible at some non-IPv4 protocol layer
|
||||
Ipv4FlowProbeTag fTag (flowId, packetId, size);
|
||||
ipPayload->AddPacketTag (fTag);
|
||||
Ptr<Ipv4FlowProbeTag> fTag = CreateObject<Ipv4FlowProbeTag> (flowId, packetId, size);
|
||||
ConstCast<Packet> (ipPayload)->AddPacketTag (fTag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,10 +233,9 @@ Ipv4FlowProbe::ForwardUpLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ip
|
||||
if (m_classifier->Classify (ipHeader, ipPayload, &flowId, &packetId))
|
||||
{
|
||||
// remove the tags that are added by Ipv4FlowProbe::SendOutgoingLogger ()
|
||||
Ipv4FlowProbeTag fTag;
|
||||
|
||||
// ConstCast: see http://www.nsnam.org/bugzilla/show_bug.cgi?id=904
|
||||
ConstCast<Packet> (ipPayload)->RemovePacketTag (fTag);
|
||||
ConstCast<Packet> (ipPayload)->RemovePacketTag<Ipv4FlowProbeTag> ();
|
||||
|
||||
uint32_t size = (ipPayload->GetSize () + ipHeader.GetSerializedSize ());
|
||||
NS_LOG_DEBUG ("ReportLastRx ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<");");
|
||||
@@ -272,10 +271,9 @@ Ipv4FlowProbe::DropLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPaylo
|
||||
if (m_classifier->Classify (ipHeader, ipPayload, &flowId, &packetId))
|
||||
{
|
||||
// remove the tags that are added by Ipv4FlowProbe::SendOutgoingLogger ()
|
||||
Ipv4FlowProbeTag fTag;
|
||||
|
||||
// ConstCast: see http://www.nsnam.org/bugzilla/show_bug.cgi?id=904
|
||||
ConstCast<Packet> (ipPayload)->RemovePacketTag (fTag);
|
||||
ConstCast<Packet> (ipPayload)->RemovePacketTag<Ipv4FlowProbeTag> ();
|
||||
|
||||
uint32_t size = (ipPayload->GetSize () + ipHeader.GetSerializedSize ());
|
||||
NS_LOG_DEBUG ("Drop ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<", " << reason
|
||||
@@ -325,19 +323,18 @@ void
|
||||
Ipv4FlowProbe::QueueDropLogger (Ptr<const Packet> ipPayload)
|
||||
{
|
||||
// remove the tags that are added by Ipv4FlowProbe::SendOutgoingLogger ()
|
||||
Ipv4FlowProbeTag fTag;
|
||||
|
||||
// ConstCast: see http://www.nsnam.org/bugzilla/show_bug.cgi?id=904
|
||||
bool tagFound;
|
||||
tagFound = ConstCast<Packet> (ipPayload)->RemovePacketTag (fTag);
|
||||
if (!tagFound)
|
||||
|
||||
Ptr<const Ipv4FlowProbeTag> fTag = ConstCast<Packet> (ipPayload)->RemovePacketTag<Ipv4FlowProbeTag> ();
|
||||
if (!fTag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FlowId flowId = fTag.GetFlowId ();
|
||||
FlowPacketId packetId = fTag.GetPacketId ();
|
||||
uint32_t size = fTag.GetPacketSize ();
|
||||
FlowId flowId = fTag->GetFlowId ();
|
||||
FlowPacketId packetId = fTag->GetPacketId ();
|
||||
uint32_t size = fTag->GetPacketSize ();
|
||||
|
||||
NS_LOG_DEBUG ("Drop ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<", " << DROP_QUEUE
|
||||
<< "); ");
|
||||
|
||||
@@ -110,6 +110,10 @@ def register_types(module):
|
||||
module.add_class('Ipv4AddressGenerator')
|
||||
## ipv4-address-helper.h (module 'internet'): ns3::Ipv4AddressHelper [class]
|
||||
module.add_class('Ipv4AddressHelper')
|
||||
## trie.h (module 'network'): ns3::Ipv4AddressTrieEAccessTraits [class]
|
||||
module.add_class('Ipv4AddressTrieEAccessTraits', import_from_module='ns.network')
|
||||
## trie.h (module 'network'): ns3::Ipv4AddressTrieEAccessTraits [enumeration]
|
||||
module.add_enum('', ['min_e_val', 'max_e_val', 'max_size'], outer_class=root_module['ns3::Ipv4AddressTrieEAccessTraits'], import_from_module='ns.network')
|
||||
## ipv4-end-point.h (module 'internet'): ns3::Ipv4EndPoint [class]
|
||||
module.add_class('Ipv4EndPoint')
|
||||
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress [class]
|
||||
@@ -200,8 +204,6 @@ def register_types(module):
|
||||
module.add_class('PcapHelperForIpv6', allow_subclassing=True)
|
||||
## random-variable.h (module 'core'): ns3::RandomVariable [class]
|
||||
module.add_class('RandomVariable', import_from_module='ns.core')
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory [class]
|
||||
module.add_class('RttHistory')
|
||||
## global-route-manager-impl.h (module 'internet'): ns3::SPFVertex [class]
|
||||
module.add_class('SPFVertex')
|
||||
## global-route-manager-impl.h (module 'internet'): ns3::SPFVertex::VertexType [enumeration]
|
||||
@@ -324,6 +326,8 @@ def register_types(module):
|
||||
module.add_class('InternetStackHelper', parent=[root_module['ns3::PcapHelperForIpv4'], root_module['ns3::PcapHelperForIpv6'], root_module['ns3::AsciiTraceHelperForIpv4'], root_module['ns3::AsciiTraceHelperForIpv6']])
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper [class]
|
||||
module.add_class('Ipv4GlobalRoutingHelper', parent=root_module['ns3::Ipv4RoutingHelper'])
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper::GlobalRoutingType [enumeration]
|
||||
module.add_enum('GlobalRoutingType', ['ONE_NEXT_HOP', 'ORDERED_NEXT_HOPS', 'UNORDERED_NEXT_HOPS'], outer_class=root_module['ns3::Ipv4GlobalRoutingHelper'])
|
||||
## ipv4-header.h (module 'internet'): ns3::Ipv4Header [class]
|
||||
module.add_class('Ipv4Header', parent=root_module['ns3::Header'])
|
||||
## ipv4-header.h (module 'internet'): ns3::Ipv4Header::DscpType [enumeration]
|
||||
@@ -372,10 +376,6 @@ def register_types(module):
|
||||
module.add_class('ParetoVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable'])
|
||||
## pcap-file-wrapper.h (module 'network'): ns3::PcapFileWrapper [class]
|
||||
module.add_class('PcapFileWrapper', import_from_module='ns.network', parent=root_module['ns3::Object'])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttEstimator [class]
|
||||
module.add_class('RttEstimator', parent=root_module['ns3::Object'])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttMeanDeviation [class]
|
||||
module.add_class('RttMeanDeviation', parent=root_module['ns3::RttEstimator'])
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class]
|
||||
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class]
|
||||
@@ -596,6 +596,8 @@ def register_types(module):
|
||||
module.add_class('Icmpv6L4Protocol', parent=root_module['ns3::IpL4Protocol'])
|
||||
## ipv4-global-routing.h (module 'internet'): ns3::Ipv4GlobalRouting [class]
|
||||
module.add_class('Ipv4GlobalRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ipv4GlobalRoutingOneNexthop [class]
|
||||
module.add_class('Ipv4GlobalRoutingOneNexthop', parent=root_module['ns3::Ipv4GlobalRouting'])
|
||||
## ipv4-list-routing.h (module 'internet'): ns3::Ipv4ListRouting [class]
|
||||
module.add_class('Ipv4ListRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
|
||||
## ipv6-list-routing.h (module 'internet'): ns3::Ipv6ListRouting [class]
|
||||
@@ -613,9 +615,6 @@ def register_types(module):
|
||||
typehandlers.add_type_alias('ns3::SequenceNumber< unsigned int, int >', 'ns3::SequenceNumber32')
|
||||
typehandlers.add_type_alias('ns3::SequenceNumber< unsigned int, int >*', 'ns3::SequenceNumber32*')
|
||||
typehandlers.add_type_alias('ns3::SequenceNumber< unsigned int, int >&', 'ns3::SequenceNumber32&')
|
||||
typehandlers.add_type_alias('std::deque< ns3::RttHistory, std::allocator< ns3::RttHistory > >', 'ns3::RttHistory_t')
|
||||
typehandlers.add_type_alias('std::deque< ns3::RttHistory, std::allocator< ns3::RttHistory > >*', 'ns3::RttHistory_t*')
|
||||
typehandlers.add_type_alias('std::deque< ns3::RttHistory, std::allocator< ns3::RttHistory > >&', 'ns3::RttHistory_t&')
|
||||
|
||||
## Register a nested module for the namespace FatalImpl
|
||||
|
||||
@@ -660,6 +659,7 @@ def register_methods(root_module):
|
||||
register_Ns3Ipv4Address_methods(root_module, root_module['ns3::Ipv4Address'])
|
||||
register_Ns3Ipv4AddressGenerator_methods(root_module, root_module['ns3::Ipv4AddressGenerator'])
|
||||
register_Ns3Ipv4AddressHelper_methods(root_module, root_module['ns3::Ipv4AddressHelper'])
|
||||
register_Ns3Ipv4AddressTrieEAccessTraits_methods(root_module, root_module['ns3::Ipv4AddressTrieEAccessTraits'])
|
||||
register_Ns3Ipv4EndPoint_methods(root_module, root_module['ns3::Ipv4EndPoint'])
|
||||
register_Ns3Ipv4InterfaceAddress_methods(root_module, root_module['ns3::Ipv4InterfaceAddress'])
|
||||
register_Ns3Ipv4InterfaceContainer_methods(root_module, root_module['ns3::Ipv4InterfaceContainer'])
|
||||
@@ -698,7 +698,6 @@ def register_methods(root_module):
|
||||
register_Ns3PcapHelperForIpv4_methods(root_module, root_module['ns3::PcapHelperForIpv4'])
|
||||
register_Ns3PcapHelperForIpv6_methods(root_module, root_module['ns3::PcapHelperForIpv6'])
|
||||
register_Ns3RandomVariable_methods(root_module, root_module['ns3::RandomVariable'])
|
||||
register_Ns3RttHistory_methods(root_module, root_module['ns3::RttHistory'])
|
||||
register_Ns3SPFVertex_methods(root_module, root_module['ns3::SPFVertex'])
|
||||
register_Ns3SeedManager_methods(root_module, root_module['ns3::SeedManager'])
|
||||
register_Ns3SequenceNumber32_methods(root_module, root_module['ns3::SequenceNumber32'])
|
||||
@@ -769,8 +768,6 @@ def register_methods(root_module):
|
||||
register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator'])
|
||||
register_Ns3ParetoVariable_methods(root_module, root_module['ns3::ParetoVariable'])
|
||||
register_Ns3PcapFileWrapper_methods(root_module, root_module['ns3::PcapFileWrapper'])
|
||||
register_Ns3RttEstimator_methods(root_module, root_module['ns3::RttEstimator'])
|
||||
register_Ns3RttMeanDeviation_methods(root_module, root_module['ns3::RttMeanDeviation'])
|
||||
register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >'])
|
||||
register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
|
||||
register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
|
||||
@@ -871,6 +868,7 @@ def register_methods(root_module):
|
||||
register_Ns3Icmpv4L4Protocol_methods(root_module, root_module['ns3::Icmpv4L4Protocol'])
|
||||
register_Ns3Icmpv6L4Protocol_methods(root_module, root_module['ns3::Icmpv6L4Protocol'])
|
||||
register_Ns3Ipv4GlobalRouting_methods(root_module, root_module['ns3::Ipv4GlobalRouting'])
|
||||
register_Ns3Ipv4GlobalRoutingOneNexthop_methods(root_module, root_module['ns3::Ipv4GlobalRoutingOneNexthop'])
|
||||
register_Ns3Ipv4ListRouting_methods(root_module, root_module['ns3::Ipv4ListRouting'])
|
||||
register_Ns3Ipv6ListRouting_methods(root_module, root_module['ns3::Ipv6ListRouting'])
|
||||
register_Ns3LoopbackNetDevice_methods(root_module, root_module['ns3::LoopbackNetDevice'])
|
||||
@@ -1360,10 +1358,6 @@ def register_Ns3BufferIterator_methods(root_module, cls):
|
||||
cls.add_method('Next',
|
||||
'void',
|
||||
[param('uint32_t', 'delta')])
|
||||
## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::PeekU8() [member function]
|
||||
cls.add_method('PeekU8',
|
||||
'uint8_t',
|
||||
[])
|
||||
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev() [member function]
|
||||
cls.add_method('Prev',
|
||||
'void',
|
||||
@@ -1376,10 +1370,6 @@ def register_Ns3BufferIterator_methods(root_module, cls):
|
||||
cls.add_method('Read',
|
||||
'void',
|
||||
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')])
|
||||
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(ns3::Buffer::Iterator start, uint32_t size) [member function]
|
||||
cls.add_method('Read',
|
||||
'void',
|
||||
[param('ns3::Buffer::Iterator', 'start'), param('uint32_t', 'size')])
|
||||
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadLsbtohU16() [member function]
|
||||
cls.add_method('ReadLsbtohU16',
|
||||
'uint16_t',
|
||||
@@ -1699,6 +1689,11 @@ def register_Ns3GlobalRouteManager_methods(root_module, cls):
|
||||
'void',
|
||||
[],
|
||||
is_static=True)
|
||||
## global-route-manager.h (module 'internet'): static void ns3::GlobalRouteManager::ClearLSDB() [member function]
|
||||
cls.add_method('ClearLSDB',
|
||||
'void',
|
||||
[],
|
||||
is_static=True)
|
||||
## global-route-manager.h (module 'internet'): static void ns3::GlobalRouteManager::BuildGlobalRoutingDatabase() [member function]
|
||||
cls.add_method('BuildGlobalRoutingDatabase',
|
||||
'void',
|
||||
@@ -1719,6 +1714,11 @@ def register_Ns3GlobalRouteManagerImpl_methods(root_module, cls):
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## global-route-manager-impl.h (module 'internet'): void ns3::GlobalRouteManagerImpl::ClearLSDB() [member function]
|
||||
cls.add_method('ClearLSDB',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## global-route-manager-impl.h (module 'internet'): void ns3::GlobalRouteManagerImpl::BuildGlobalRoutingDatabase() [member function]
|
||||
cls.add_method('BuildGlobalRoutingDatabase',
|
||||
'void',
|
||||
@@ -2004,9 +2004,9 @@ def register_Ns3Ipv4Address_methods(root_module, cls):
|
||||
'ns3::Ipv4Address',
|
||||
[param('uint8_t const *', 'buf')],
|
||||
is_static=True)
|
||||
## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Address::Get() const [member function]
|
||||
## ipv4-address.h (module 'network'): uint32_t const & ns3::Ipv4Address::Get() const [member function]
|
||||
cls.add_method('Get',
|
||||
'uint32_t',
|
||||
'uint32_t const &',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetAny() [member function]
|
||||
@@ -2161,6 +2161,28 @@ def register_Ns3Ipv4AddressHelper_methods(root_module, cls):
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'mask'), param('ns3::Ipv4Address', 'base', default_value='"0.0.0.1"')])
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4AddressTrieEAccessTraits_methods(root_module, cls):
|
||||
## trie.h (module 'network'): ns3::Ipv4AddressTrieEAccessTraits::Ipv4AddressTrieEAccessTraits() [constructor]
|
||||
cls.add_constructor([])
|
||||
## trie.h (module 'network'): ns3::Ipv4AddressTrieEAccessTraits::Ipv4AddressTrieEAccessTraits(ns3::Ipv4AddressTrieEAccessTraits const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4AddressTrieEAccessTraits const &', 'arg0')])
|
||||
## trie.h (module 'network'): static uint8_t const * ns3::Ipv4AddressTrieEAccessTraits::begin(ns3::Ipv4Address const & r_key) [member function]
|
||||
cls.add_method('begin',
|
||||
'uint8_t const *',
|
||||
[param('ns3::Ipv4Address const &', 'r_key')],
|
||||
is_static=True)
|
||||
## trie.h (module 'network'): static size_t ns3::Ipv4AddressTrieEAccessTraits::e_pos(uint8_t e) [member function]
|
||||
cls.add_method('e_pos',
|
||||
'size_t',
|
||||
[param('uint8_t', 'e')],
|
||||
is_static=True)
|
||||
## trie.h (module 'network'): static uint8_t const * ns3::Ipv4AddressTrieEAccessTraits::end(ns3::Ipv4Address const & r_key) [member function]
|
||||
cls.add_method('end',
|
||||
'uint8_t const *',
|
||||
[param('ns3::Ipv4Address const &', 'r_key')],
|
||||
is_static=True)
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4EndPoint_methods(root_module, cls):
|
||||
## ipv4-end-point.h (module 'internet'): ns3::Ipv4EndPoint::Ipv4EndPoint(ns3::Ipv4EndPoint const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4EndPoint const &', 'arg0')])
|
||||
@@ -2486,30 +2508,30 @@ def register_Ns3Ipv4RoutingTableEntry_methods(root_module, cls):
|
||||
cls.add_constructor([param('ns3::Ipv4RoutingTableEntry const &', 'route')])
|
||||
## ipv4-routing-table-entry.h (module 'internet'): ns3::Ipv4RoutingTableEntry::Ipv4RoutingTableEntry(ns3::Ipv4RoutingTableEntry const * route) [constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4RoutingTableEntry const *', 'route')])
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('CreateDefaultRoute',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_static=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('CreateHostRouteTo',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_static=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('CreateHostRouteTo',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_static=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('CreateNetworkRouteTo',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_static=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function]
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('CreateNetworkRouteTo',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_static=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4RoutingTableEntry::GetDest() const [member function]
|
||||
cls.add_method('GetDest',
|
||||
@@ -2536,6 +2558,11 @@ def register_Ns3Ipv4RoutingTableEntry_methods(root_module, cls):
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): uint32_t ns3::Ipv4RoutingTableEntry::GetMetric() const [member function]
|
||||
cls.add_method('GetMetric',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): bool ns3::Ipv4RoutingTableEntry::IsDefault() const [member function]
|
||||
cls.add_method('IsDefault',
|
||||
'bool',
|
||||
@@ -2556,6 +2583,10 @@ def register_Ns3Ipv4RoutingTableEntry_methods(root_module, cls):
|
||||
'bool',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): void ns3::Ipv4RoutingTableEntry::SetMetric(uint32_t metric) [member function]
|
||||
cls.add_method('SetMetric',
|
||||
'void',
|
||||
[param('uint32_t', 'metric')])
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4StaticRoutingHelper_methods(root_module, cls):
|
||||
@@ -4001,21 +4032,6 @@ def register_Ns3RandomVariable_methods(root_module, cls):
|
||||
is_const=True)
|
||||
return
|
||||
|
||||
def register_Ns3RttHistory_methods(root_module, cls):
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::RttHistory(ns3::SequenceNumber32 s, uint32_t c, ns3::Time t) [constructor]
|
||||
cls.add_constructor([param('ns3::SequenceNumber32', 's'), param('uint32_t', 'c'), param('ns3::Time', 't')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::RttHistory(ns3::RttHistory const & h) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RttHistory const &', 'h')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::count [variable]
|
||||
cls.add_instance_attribute('count', 'uint32_t', is_const=False)
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::retx [variable]
|
||||
cls.add_instance_attribute('retx', 'bool', is_const=False)
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::seq [variable]
|
||||
cls.add_instance_attribute('seq', 'ns3::SequenceNumber32', is_const=False)
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::time [variable]
|
||||
cls.add_instance_attribute('time', 'ns3::Time', is_const=False)
|
||||
return
|
||||
|
||||
def register_Ns3SPFVertex_methods(root_module, cls):
|
||||
## global-route-manager-impl.h (module 'internet'): ns3::SPFVertex::SPFVertex() [constructor]
|
||||
cls.add_constructor([])
|
||||
@@ -4712,6 +4728,7 @@ def register_Ns3Empty_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right'))
|
||||
@@ -4764,7 +4781,6 @@ def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('<')
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('*=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_output_stream_operator()
|
||||
@@ -6165,8 +6181,8 @@ def register_Ns3InternetStackHelper_methods(root_module, cls):
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4GlobalRoutingHelper_methods(root_module, cls):
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper() [constructor]
|
||||
cls.add_constructor([])
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper(std::string const & type="ns3::Ipv4GlobalRoutingOneNexthop") [constructor]
|
||||
cls.add_constructor([param('std::string const &', 'type', default_value='"ns3::Ipv4GlobalRoutingOneNexthop"')])
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper(ns3::Ipv4GlobalRoutingHelper const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4GlobalRoutingHelper const &', 'arg0')])
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper * ns3::Ipv4GlobalRoutingHelper::Copy() const [member function]
|
||||
@@ -6184,6 +6200,11 @@ def register_Ns3Ipv4GlobalRoutingHelper_methods(root_module, cls):
|
||||
'void',
|
||||
[],
|
||||
is_static=True)
|
||||
## ipv4-global-routing-helper.h (module 'internet'): static void ns3::Ipv4GlobalRoutingHelper::PopulateAllPossibleRoutingTables() [member function]
|
||||
cls.add_method('PopulateAllPossibleRoutingTables',
|
||||
'void',
|
||||
[],
|
||||
is_static=True)
|
||||
## ipv4-global-routing-helper.h (module 'internet'): static void ns3::Ipv4GlobalRoutingHelper::RecomputeRoutingTables() [member function]
|
||||
cls.add_method('RecomputeRoutingTables',
|
||||
'void',
|
||||
@@ -7222,126 +7243,6 @@ def register_Ns3PcapFileWrapper_methods(root_module, cls):
|
||||
[])
|
||||
return
|
||||
|
||||
def register_Ns3RttEstimator_methods(root_module, cls):
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttEstimator::RttEstimator() [constructor]
|
||||
cls.add_constructor([])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttEstimator::RttEstimator(ns3::RttEstimator const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RttEstimator const &', 'arg0')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::AckSeq(ns3::SequenceNumber32 ackSeq) [member function]
|
||||
cls.add_method('AckSeq',
|
||||
'ns3::Time',
|
||||
[param('ns3::SequenceNumber32', 'ackSeq')],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::ClearSent() [member function]
|
||||
cls.add_method('ClearSent',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Ptr<ns3::RttEstimator> ns3::RttEstimator::Copy() const [member function]
|
||||
cls.add_method('Copy',
|
||||
'ns3::Ptr< ns3::RttEstimator >',
|
||||
[],
|
||||
is_pure_virtual=True, is_const=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetCurrentEstimate() const [member function]
|
||||
cls.add_method('GetCurrentEstimate',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetMaxRto() const [member function]
|
||||
cls.add_method('GetMaxRto',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetMinRto() const [member function]
|
||||
cls.add_method('GetMinRto',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
## rtt-estimator.h (module 'internet'): static ns3::TypeId ns3::RttEstimator::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::IncreaseMultiplier() [member function]
|
||||
cls.add_method('IncreaseMultiplier',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::Measurement(ns3::Time t) [member function]
|
||||
cls.add_method('Measurement',
|
||||
'void',
|
||||
[param('ns3::Time', 't')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::Reset() [member function]
|
||||
cls.add_method('Reset',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::ResetMultiplier() [member function]
|
||||
cls.add_method('ResetMultiplier',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::RetransmitTimeout() [member function]
|
||||
cls.add_method('RetransmitTimeout',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SentSeq(ns3::SequenceNumber32 seq, uint32_t size) [member function]
|
||||
cls.add_method('SentSeq',
|
||||
'void',
|
||||
[param('ns3::SequenceNumber32', 'seq'), param('uint32_t', 'size')],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetCurrentEstimate(ns3::Time estimate) [member function]
|
||||
cls.add_method('SetCurrentEstimate',
|
||||
'void',
|
||||
[param('ns3::Time', 'estimate')])
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetMaxRto(ns3::Time maxRto) [member function]
|
||||
cls.add_method('SetMaxRto',
|
||||
'void',
|
||||
[param('ns3::Time', 'maxRto')])
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetMinRto(ns3::Time minRto) [member function]
|
||||
cls.add_method('SetMinRto',
|
||||
'void',
|
||||
[param('ns3::Time', 'minRto')])
|
||||
return
|
||||
|
||||
def register_Ns3RttMeanDeviation_methods(root_module, cls):
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttMeanDeviation::RttMeanDeviation() [constructor]
|
||||
cls.add_constructor([])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttMeanDeviation::RttMeanDeviation(ns3::RttMeanDeviation const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RttMeanDeviation const &', 'arg0')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::Ptr<ns3::RttEstimator> ns3::RttMeanDeviation::Copy() const [member function]
|
||||
cls.add_method('Copy',
|
||||
'ns3::Ptr< ns3::RttEstimator >',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttMeanDeviation::Gain(double g) [member function]
|
||||
cls.add_method('Gain',
|
||||
'void',
|
||||
[param('double', 'g')])
|
||||
## rtt-estimator.h (module 'internet'): static ns3::TypeId ns3::RttMeanDeviation::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttMeanDeviation::Measurement(ns3::Time measure) [member function]
|
||||
cls.add_method('Measurement',
|
||||
'void',
|
||||
[param('ns3::Time', 'measure')],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttMeanDeviation::Reset() [member function]
|
||||
cls.add_method('Reset',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttMeanDeviation::RetransmitTimeout() [member function]
|
||||
cls.add_method('RetransmitTimeout',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, cls):
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount() [constructor]
|
||||
cls.add_constructor([])
|
||||
@@ -8162,11 +8063,11 @@ def register_Ns3TcpSocketFactory_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Time_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_comparison_operator('<')
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', 'right'))
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_comparison_operator('<=')
|
||||
@@ -9031,14 +8932,6 @@ def register_Ns3GlobalRouter_methods(root_module, cls):
|
||||
is_static=True)
|
||||
## global-router-interface.h (module 'internet'): ns3::GlobalRouter::GlobalRouter() [constructor]
|
||||
cls.add_constructor([])
|
||||
## global-router-interface.h (module 'internet'): void ns3::GlobalRouter::SetRoutingProtocol(ns3::Ptr<ns3::Ipv4GlobalRouting> routing) [member function]
|
||||
cls.add_method('SetRoutingProtocol',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Ipv4GlobalRouting >', 'routing')])
|
||||
## global-router-interface.h (module 'internet'): ns3::Ptr<ns3::Ipv4GlobalRouting> ns3::GlobalRouter::GetRoutingProtocol() [member function]
|
||||
cls.add_method('GetRoutingProtocol',
|
||||
'ns3::Ptr< ns3::Ipv4GlobalRouting >',
|
||||
[])
|
||||
## global-router-interface.h (module 'internet'): ns3::Ipv4Address ns3::GlobalRouter::GetRouterId() const [member function]
|
||||
cls.add_method('GetRouterId',
|
||||
'ns3::Ipv4Address',
|
||||
@@ -9058,22 +8951,10 @@ def register_Ns3GlobalRouter_methods(root_module, cls):
|
||||
'bool',
|
||||
[param('uint32_t', 'n'), param('ns3::GlobalRoutingLSA &', 'lsa')],
|
||||
is_const=True)
|
||||
## global-router-interface.h (module 'internet'): void ns3::GlobalRouter::InjectRoute(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask) [member function]
|
||||
## global-router-interface.h (module 'internet'): void ns3::GlobalRouter::InjectRoute(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t metric=1) [member function]
|
||||
cls.add_method('InjectRoute',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask')])
|
||||
## global-router-interface.h (module 'internet'): uint32_t ns3::GlobalRouter::GetNInjectedRoutes() [member function]
|
||||
cls.add_method('GetNInjectedRoutes',
|
||||
'uint32_t',
|
||||
[])
|
||||
## global-router-interface.h (module 'internet'): ns3::Ipv4RoutingTableEntry * ns3::GlobalRouter::GetInjectedRoute(uint32_t i) [member function]
|
||||
cls.add_method('GetInjectedRoute',
|
||||
retval('ns3::Ipv4RoutingTableEntry *', caller_owns_return=False),
|
||||
[param('uint32_t', 'i')])
|
||||
## global-router-interface.h (module 'internet'): void ns3::GlobalRouter::RemoveInjectedRoute(uint32_t i) [member function]
|
||||
cls.add_method('RemoveInjectedRoute',
|
||||
'void',
|
||||
[param('uint32_t', 'i')])
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'metric', default_value='1')])
|
||||
## global-router-interface.h (module 'internet'): bool ns3::GlobalRouter::WithdrawRoute(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask) [member function]
|
||||
cls.add_method('WithdrawRoute',
|
||||
'bool',
|
||||
@@ -12954,36 +12835,16 @@ def register_Ns3Ipv4GlobalRouting_methods(root_module, cls):
|
||||
cls.add_constructor([param('ns3::Ipv4GlobalRouting const &', 'arg0')])
|
||||
## ipv4-global-routing.h (module 'internet'): ns3::Ipv4GlobalRouting::Ipv4GlobalRouting() [constructor]
|
||||
cls.add_constructor([])
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddASExternalRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
cls.add_method('AddASExternalRouteTo',
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Mask destMask, ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('AddRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
cls.add_method('AddHostRouteTo',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Mask', 'destMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::DeleteRoutes() [member function]
|
||||
cls.add_method('DeleteRoutes',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
|
||||
cls.add_method('AddHostRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')])
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
cls.add_method('AddNetworkRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function]
|
||||
cls.add_method('AddNetworkRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')])
|
||||
## ipv4-global-routing.h (module 'internet'): uint32_t ns3::Ipv4GlobalRouting::GetNRoutes() const [member function]
|
||||
cls.add_method('GetNRoutes',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-global-routing.h (module 'internet'): ns3::Ipv4RoutingTableEntry * ns3::Ipv4GlobalRouting::GetRoute(uint32_t i) const [member function]
|
||||
cls.add_method('GetRoute',
|
||||
retval('ns3::Ipv4RoutingTableEntry *', caller_owns_return=False),
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True)
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): static ns3::TypeId ns3::Ipv4GlobalRouting::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
@@ -13009,34 +12870,62 @@ def register_Ns3Ipv4GlobalRouting_methods(root_module, cls):
|
||||
'void',
|
||||
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
|
||||
cls.add_method('PrintRoutingTable',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
|
||||
is_const=True, is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::RemoveRoute(uint32_t i) [member function]
|
||||
cls.add_method('RemoveRoute',
|
||||
'void',
|
||||
[param('uint32_t', 'i')])
|
||||
## ipv4-global-routing.h (module 'internet'): bool ns3::Ipv4GlobalRouting::RouteInput(ns3::Ptr<const ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<const ns3::NetDevice> idev, ns3::Callback<void,ns3::Ptr<ns3::Ipv4Route>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback<void,ns3::Ptr<ns3::Ipv4MulticastRoute>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,unsigned int,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> lcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::Socket::SocketErrno,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
|
||||
cls.add_method('RouteInput',
|
||||
'bool',
|
||||
[param('ns3::Ptr< ns3::Packet const >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice const >', 'idev'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4Route >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ucb'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4MulticastRoute >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'mcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'lcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4GlobalRouting::RouteOutput(ns3::Ptr<ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<ns3::NetDevice> oif, ns3::Socket::SocketErrno & sockerr) [member function]
|
||||
cls.add_method('RouteOutput',
|
||||
'ns3::Ptr< ns3::Ipv4Route >',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice >', 'oif'), param('ns3::Socket::SocketErrno &', 'sockerr')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::SetIpv4(ns3::Ptr<ns3::Ipv4> ipv4) [member function]
|
||||
cls.add_method('SetIpv4',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Ipv4 >', 'ipv4')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4GlobalRoutingOneNexthop_methods(root_module, cls):
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ipv4GlobalRoutingOneNexthop::Ipv4GlobalRoutingOneNexthop() [constructor]
|
||||
cls.add_constructor([])
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ipv4GlobalRoutingOneNexthop::Ipv4GlobalRoutingOneNexthop(ns3::Ipv4GlobalRoutingOneNexthop const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4GlobalRoutingOneNexthop const &', 'arg0')])
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): void ns3::Ipv4GlobalRoutingOneNexthop::AddRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Mask destMask, ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('AddRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Mask', 'destMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): void ns3::Ipv4GlobalRoutingOneNexthop::DeleteRoutes() [member function]
|
||||
cls.add_method('DeleteRoutes',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): uint32_t ns3::Ipv4GlobalRoutingOneNexthop::GetNRoutes() const [member function]
|
||||
cls.add_method('GetNRoutes',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ipv4RoutingTableEntry ns3::Ipv4GlobalRoutingOneNexthop::GetRoute(uint32_t i) const [member function]
|
||||
cls.add_method('GetRoute',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): static ns3::TypeId ns3::Ipv4GlobalRoutingOneNexthop::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): void ns3::Ipv4GlobalRoutingOneNexthop::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
|
||||
cls.add_method('PrintRoutingTable',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
|
||||
is_const=True, is_virtual=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): bool ns3::Ipv4GlobalRoutingOneNexthop::RouteInput(ns3::Ptr<const ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<const ns3::NetDevice> idev, ns3::Callback<void,ns3::Ptr<ns3::Ipv4Route>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback<void,ns3::Ptr<ns3::Ipv4MulticastRoute>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,unsigned int,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> lcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::Socket::SocketErrno,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
|
||||
cls.add_method('RouteInput',
|
||||
'bool',
|
||||
[param('ns3::Ptr< ns3::Packet const >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice const >', 'idev'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4Route >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ucb'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4MulticastRoute >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'mcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'lcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4GlobalRoutingOneNexthop::RouteOutput(ns3::Ptr<ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<ns3::NetDevice> oif, ns3::Socket::SocketErrno & sockerr) [member function]
|
||||
cls.add_method('RouteOutput',
|
||||
'ns3::Ptr< ns3::Ipv4Route >',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice >', 'oif'), param('ns3::Socket::SocketErrno &', 'sockerr')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4GlobalRoutingOneNexthop::LookupGlobal(ns3::Ipv4Address dest, ns3::Ptr<ns3::NetDevice> oif=0) [member function]
|
||||
cls.add_method('LookupGlobal',
|
||||
'ns3::Ptr< ns3::Ipv4Route >',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ptr< ns3::NetDevice >', 'oif', default_value='0')],
|
||||
visibility='protected', is_virtual=True)
|
||||
return
|
||||
|
||||
|
||||
@@ -110,6 +110,10 @@ def register_types(module):
|
||||
module.add_class('Ipv4AddressGenerator')
|
||||
## ipv4-address-helper.h (module 'internet'): ns3::Ipv4AddressHelper [class]
|
||||
module.add_class('Ipv4AddressHelper')
|
||||
## trie.h (module 'network'): ns3::Ipv4AddressTrieEAccessTraits [class]
|
||||
module.add_class('Ipv4AddressTrieEAccessTraits', import_from_module='ns.network')
|
||||
## trie.h (module 'network'): ns3::Ipv4AddressTrieEAccessTraits [enumeration]
|
||||
module.add_enum('', ['min_e_val', 'max_e_val', 'max_size'], outer_class=root_module['ns3::Ipv4AddressTrieEAccessTraits'], import_from_module='ns.network')
|
||||
## ipv4-end-point.h (module 'internet'): ns3::Ipv4EndPoint [class]
|
||||
module.add_class('Ipv4EndPoint')
|
||||
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress [class]
|
||||
@@ -200,8 +204,6 @@ def register_types(module):
|
||||
module.add_class('PcapHelperForIpv6', allow_subclassing=True)
|
||||
## random-variable.h (module 'core'): ns3::RandomVariable [class]
|
||||
module.add_class('RandomVariable', import_from_module='ns.core')
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory [class]
|
||||
module.add_class('RttHistory')
|
||||
## global-route-manager-impl.h (module 'internet'): ns3::SPFVertex [class]
|
||||
module.add_class('SPFVertex')
|
||||
## global-route-manager-impl.h (module 'internet'): ns3::SPFVertex::VertexType [enumeration]
|
||||
@@ -324,6 +326,8 @@ def register_types(module):
|
||||
module.add_class('InternetStackHelper', parent=[root_module['ns3::PcapHelperForIpv4'], root_module['ns3::PcapHelperForIpv6'], root_module['ns3::AsciiTraceHelperForIpv4'], root_module['ns3::AsciiTraceHelperForIpv6']])
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper [class]
|
||||
module.add_class('Ipv4GlobalRoutingHelper', parent=root_module['ns3::Ipv4RoutingHelper'])
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper::GlobalRoutingType [enumeration]
|
||||
module.add_enum('GlobalRoutingType', ['ONE_NEXT_HOP', 'ORDERED_NEXT_HOPS', 'UNORDERED_NEXT_HOPS'], outer_class=root_module['ns3::Ipv4GlobalRoutingHelper'])
|
||||
## ipv4-header.h (module 'internet'): ns3::Ipv4Header [class]
|
||||
module.add_class('Ipv4Header', parent=root_module['ns3::Header'])
|
||||
## ipv4-header.h (module 'internet'): ns3::Ipv4Header::DscpType [enumeration]
|
||||
@@ -372,10 +376,6 @@ def register_types(module):
|
||||
module.add_class('ParetoVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable'])
|
||||
## pcap-file-wrapper.h (module 'network'): ns3::PcapFileWrapper [class]
|
||||
module.add_class('PcapFileWrapper', import_from_module='ns.network', parent=root_module['ns3::Object'])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttEstimator [class]
|
||||
module.add_class('RttEstimator', parent=root_module['ns3::Object'])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttMeanDeviation [class]
|
||||
module.add_class('RttMeanDeviation', parent=root_module['ns3::RttEstimator'])
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class]
|
||||
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class]
|
||||
@@ -596,6 +596,8 @@ def register_types(module):
|
||||
module.add_class('Icmpv6L4Protocol', parent=root_module['ns3::IpL4Protocol'])
|
||||
## ipv4-global-routing.h (module 'internet'): ns3::Ipv4GlobalRouting [class]
|
||||
module.add_class('Ipv4GlobalRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ipv4GlobalRoutingOneNexthop [class]
|
||||
module.add_class('Ipv4GlobalRoutingOneNexthop', parent=root_module['ns3::Ipv4GlobalRouting'])
|
||||
## ipv4-list-routing.h (module 'internet'): ns3::Ipv4ListRouting [class]
|
||||
module.add_class('Ipv4ListRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
|
||||
## ipv6-list-routing.h (module 'internet'): ns3::Ipv6ListRouting [class]
|
||||
@@ -613,9 +615,6 @@ def register_types(module):
|
||||
typehandlers.add_type_alias('ns3::SequenceNumber< unsigned int, int >', 'ns3::SequenceNumber32')
|
||||
typehandlers.add_type_alias('ns3::SequenceNumber< unsigned int, int >*', 'ns3::SequenceNumber32*')
|
||||
typehandlers.add_type_alias('ns3::SequenceNumber< unsigned int, int >&', 'ns3::SequenceNumber32&')
|
||||
typehandlers.add_type_alias('std::deque< ns3::RttHistory, std::allocator< ns3::RttHistory > >', 'ns3::RttHistory_t')
|
||||
typehandlers.add_type_alias('std::deque< ns3::RttHistory, std::allocator< ns3::RttHistory > >*', 'ns3::RttHistory_t*')
|
||||
typehandlers.add_type_alias('std::deque< ns3::RttHistory, std::allocator< ns3::RttHistory > >&', 'ns3::RttHistory_t&')
|
||||
|
||||
## Register a nested module for the namespace FatalImpl
|
||||
|
||||
@@ -660,6 +659,7 @@ def register_methods(root_module):
|
||||
register_Ns3Ipv4Address_methods(root_module, root_module['ns3::Ipv4Address'])
|
||||
register_Ns3Ipv4AddressGenerator_methods(root_module, root_module['ns3::Ipv4AddressGenerator'])
|
||||
register_Ns3Ipv4AddressHelper_methods(root_module, root_module['ns3::Ipv4AddressHelper'])
|
||||
register_Ns3Ipv4AddressTrieEAccessTraits_methods(root_module, root_module['ns3::Ipv4AddressTrieEAccessTraits'])
|
||||
register_Ns3Ipv4EndPoint_methods(root_module, root_module['ns3::Ipv4EndPoint'])
|
||||
register_Ns3Ipv4InterfaceAddress_methods(root_module, root_module['ns3::Ipv4InterfaceAddress'])
|
||||
register_Ns3Ipv4InterfaceContainer_methods(root_module, root_module['ns3::Ipv4InterfaceContainer'])
|
||||
@@ -698,7 +698,6 @@ def register_methods(root_module):
|
||||
register_Ns3PcapHelperForIpv4_methods(root_module, root_module['ns3::PcapHelperForIpv4'])
|
||||
register_Ns3PcapHelperForIpv6_methods(root_module, root_module['ns3::PcapHelperForIpv6'])
|
||||
register_Ns3RandomVariable_methods(root_module, root_module['ns3::RandomVariable'])
|
||||
register_Ns3RttHistory_methods(root_module, root_module['ns3::RttHistory'])
|
||||
register_Ns3SPFVertex_methods(root_module, root_module['ns3::SPFVertex'])
|
||||
register_Ns3SeedManager_methods(root_module, root_module['ns3::SeedManager'])
|
||||
register_Ns3SequenceNumber32_methods(root_module, root_module['ns3::SequenceNumber32'])
|
||||
@@ -769,8 +768,6 @@ def register_methods(root_module):
|
||||
register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator'])
|
||||
register_Ns3ParetoVariable_methods(root_module, root_module['ns3::ParetoVariable'])
|
||||
register_Ns3PcapFileWrapper_methods(root_module, root_module['ns3::PcapFileWrapper'])
|
||||
register_Ns3RttEstimator_methods(root_module, root_module['ns3::RttEstimator'])
|
||||
register_Ns3RttMeanDeviation_methods(root_module, root_module['ns3::RttMeanDeviation'])
|
||||
register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >'])
|
||||
register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
|
||||
register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
|
||||
@@ -871,6 +868,7 @@ def register_methods(root_module):
|
||||
register_Ns3Icmpv4L4Protocol_methods(root_module, root_module['ns3::Icmpv4L4Protocol'])
|
||||
register_Ns3Icmpv6L4Protocol_methods(root_module, root_module['ns3::Icmpv6L4Protocol'])
|
||||
register_Ns3Ipv4GlobalRouting_methods(root_module, root_module['ns3::Ipv4GlobalRouting'])
|
||||
register_Ns3Ipv4GlobalRoutingOneNexthop_methods(root_module, root_module['ns3::Ipv4GlobalRoutingOneNexthop'])
|
||||
register_Ns3Ipv4ListRouting_methods(root_module, root_module['ns3::Ipv4ListRouting'])
|
||||
register_Ns3Ipv6ListRouting_methods(root_module, root_module['ns3::Ipv6ListRouting'])
|
||||
register_Ns3LoopbackNetDevice_methods(root_module, root_module['ns3::LoopbackNetDevice'])
|
||||
@@ -1360,10 +1358,6 @@ def register_Ns3BufferIterator_methods(root_module, cls):
|
||||
cls.add_method('Next',
|
||||
'void',
|
||||
[param('uint32_t', 'delta')])
|
||||
## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::PeekU8() [member function]
|
||||
cls.add_method('PeekU8',
|
||||
'uint8_t',
|
||||
[])
|
||||
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev() [member function]
|
||||
cls.add_method('Prev',
|
||||
'void',
|
||||
@@ -1376,10 +1370,6 @@ def register_Ns3BufferIterator_methods(root_module, cls):
|
||||
cls.add_method('Read',
|
||||
'void',
|
||||
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')])
|
||||
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(ns3::Buffer::Iterator start, uint32_t size) [member function]
|
||||
cls.add_method('Read',
|
||||
'void',
|
||||
[param('ns3::Buffer::Iterator', 'start'), param('uint32_t', 'size')])
|
||||
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadLsbtohU16() [member function]
|
||||
cls.add_method('ReadLsbtohU16',
|
||||
'uint16_t',
|
||||
@@ -1699,6 +1689,11 @@ def register_Ns3GlobalRouteManager_methods(root_module, cls):
|
||||
'void',
|
||||
[],
|
||||
is_static=True)
|
||||
## global-route-manager.h (module 'internet'): static void ns3::GlobalRouteManager::ClearLSDB() [member function]
|
||||
cls.add_method('ClearLSDB',
|
||||
'void',
|
||||
[],
|
||||
is_static=True)
|
||||
## global-route-manager.h (module 'internet'): static void ns3::GlobalRouteManager::BuildGlobalRoutingDatabase() [member function]
|
||||
cls.add_method('BuildGlobalRoutingDatabase',
|
||||
'void',
|
||||
@@ -1719,6 +1714,11 @@ def register_Ns3GlobalRouteManagerImpl_methods(root_module, cls):
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## global-route-manager-impl.h (module 'internet'): void ns3::GlobalRouteManagerImpl::ClearLSDB() [member function]
|
||||
cls.add_method('ClearLSDB',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## global-route-manager-impl.h (module 'internet'): void ns3::GlobalRouteManagerImpl::BuildGlobalRoutingDatabase() [member function]
|
||||
cls.add_method('BuildGlobalRoutingDatabase',
|
||||
'void',
|
||||
@@ -2004,9 +2004,9 @@ def register_Ns3Ipv4Address_methods(root_module, cls):
|
||||
'ns3::Ipv4Address',
|
||||
[param('uint8_t const *', 'buf')],
|
||||
is_static=True)
|
||||
## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Address::Get() const [member function]
|
||||
## ipv4-address.h (module 'network'): uint32_t const & ns3::Ipv4Address::Get() const [member function]
|
||||
cls.add_method('Get',
|
||||
'uint32_t',
|
||||
'uint32_t const &',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetAny() [member function]
|
||||
@@ -2161,6 +2161,28 @@ def register_Ns3Ipv4AddressHelper_methods(root_module, cls):
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'mask'), param('ns3::Ipv4Address', 'base', default_value='"0.0.0.1"')])
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4AddressTrieEAccessTraits_methods(root_module, cls):
|
||||
## trie.h (module 'network'): ns3::Ipv4AddressTrieEAccessTraits::Ipv4AddressTrieEAccessTraits() [constructor]
|
||||
cls.add_constructor([])
|
||||
## trie.h (module 'network'): ns3::Ipv4AddressTrieEAccessTraits::Ipv4AddressTrieEAccessTraits(ns3::Ipv4AddressTrieEAccessTraits const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4AddressTrieEAccessTraits const &', 'arg0')])
|
||||
## trie.h (module 'network'): static uint8_t const * ns3::Ipv4AddressTrieEAccessTraits::begin(ns3::Ipv4Address const & r_key) [member function]
|
||||
cls.add_method('begin',
|
||||
'uint8_t const *',
|
||||
[param('ns3::Ipv4Address const &', 'r_key')],
|
||||
is_static=True)
|
||||
## trie.h (module 'network'): static size_t ns3::Ipv4AddressTrieEAccessTraits::e_pos(uint8_t e) [member function]
|
||||
cls.add_method('e_pos',
|
||||
'size_t',
|
||||
[param('uint8_t', 'e')],
|
||||
is_static=True)
|
||||
## trie.h (module 'network'): static uint8_t const * ns3::Ipv4AddressTrieEAccessTraits::end(ns3::Ipv4Address const & r_key) [member function]
|
||||
cls.add_method('end',
|
||||
'uint8_t const *',
|
||||
[param('ns3::Ipv4Address const &', 'r_key')],
|
||||
is_static=True)
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4EndPoint_methods(root_module, cls):
|
||||
## ipv4-end-point.h (module 'internet'): ns3::Ipv4EndPoint::Ipv4EndPoint(ns3::Ipv4EndPoint const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4EndPoint const &', 'arg0')])
|
||||
@@ -2486,30 +2508,30 @@ def register_Ns3Ipv4RoutingTableEntry_methods(root_module, cls):
|
||||
cls.add_constructor([param('ns3::Ipv4RoutingTableEntry const &', 'route')])
|
||||
## ipv4-routing-table-entry.h (module 'internet'): ns3::Ipv4RoutingTableEntry::Ipv4RoutingTableEntry(ns3::Ipv4RoutingTableEntry const * route) [constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4RoutingTableEntry const *', 'route')])
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('CreateDefaultRoute',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_static=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('CreateHostRouteTo',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_static=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('CreateHostRouteTo',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_static=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('CreateNetworkRouteTo',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_static=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function]
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('CreateNetworkRouteTo',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_static=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4RoutingTableEntry::GetDest() const [member function]
|
||||
cls.add_method('GetDest',
|
||||
@@ -2536,6 +2558,11 @@ def register_Ns3Ipv4RoutingTableEntry_methods(root_module, cls):
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): uint32_t ns3::Ipv4RoutingTableEntry::GetMetric() const [member function]
|
||||
cls.add_method('GetMetric',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): bool ns3::Ipv4RoutingTableEntry::IsDefault() const [member function]
|
||||
cls.add_method('IsDefault',
|
||||
'bool',
|
||||
@@ -2556,6 +2583,10 @@ def register_Ns3Ipv4RoutingTableEntry_methods(root_module, cls):
|
||||
'bool',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): void ns3::Ipv4RoutingTableEntry::SetMetric(uint32_t metric) [member function]
|
||||
cls.add_method('SetMetric',
|
||||
'void',
|
||||
[param('uint32_t', 'metric')])
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4StaticRoutingHelper_methods(root_module, cls):
|
||||
@@ -4001,21 +4032,6 @@ def register_Ns3RandomVariable_methods(root_module, cls):
|
||||
is_const=True)
|
||||
return
|
||||
|
||||
def register_Ns3RttHistory_methods(root_module, cls):
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::RttHistory(ns3::SequenceNumber32 s, uint32_t c, ns3::Time t) [constructor]
|
||||
cls.add_constructor([param('ns3::SequenceNumber32', 's'), param('uint32_t', 'c'), param('ns3::Time', 't')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::RttHistory(ns3::RttHistory const & h) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RttHistory const &', 'h')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::count [variable]
|
||||
cls.add_instance_attribute('count', 'uint32_t', is_const=False)
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::retx [variable]
|
||||
cls.add_instance_attribute('retx', 'bool', is_const=False)
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::seq [variable]
|
||||
cls.add_instance_attribute('seq', 'ns3::SequenceNumber32', is_const=False)
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::time [variable]
|
||||
cls.add_instance_attribute('time', 'ns3::Time', is_const=False)
|
||||
return
|
||||
|
||||
def register_Ns3SPFVertex_methods(root_module, cls):
|
||||
## global-route-manager-impl.h (module 'internet'): ns3::SPFVertex::SPFVertex() [constructor]
|
||||
cls.add_constructor([])
|
||||
@@ -4712,6 +4728,7 @@ def register_Ns3Empty_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right'))
|
||||
@@ -4764,7 +4781,6 @@ def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('<')
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('*=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_output_stream_operator()
|
||||
@@ -6165,8 +6181,8 @@ def register_Ns3InternetStackHelper_methods(root_module, cls):
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4GlobalRoutingHelper_methods(root_module, cls):
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper() [constructor]
|
||||
cls.add_constructor([])
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper(std::string const & type="ns3::Ipv4GlobalRoutingOneNexthop") [constructor]
|
||||
cls.add_constructor([param('std::string const &', 'type', default_value='"ns3::Ipv4GlobalRoutingOneNexthop"')])
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper(ns3::Ipv4GlobalRoutingHelper const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4GlobalRoutingHelper const &', 'arg0')])
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper * ns3::Ipv4GlobalRoutingHelper::Copy() const [member function]
|
||||
@@ -6184,6 +6200,11 @@ def register_Ns3Ipv4GlobalRoutingHelper_methods(root_module, cls):
|
||||
'void',
|
||||
[],
|
||||
is_static=True)
|
||||
## ipv4-global-routing-helper.h (module 'internet'): static void ns3::Ipv4GlobalRoutingHelper::PopulateAllPossibleRoutingTables() [member function]
|
||||
cls.add_method('PopulateAllPossibleRoutingTables',
|
||||
'void',
|
||||
[],
|
||||
is_static=True)
|
||||
## ipv4-global-routing-helper.h (module 'internet'): static void ns3::Ipv4GlobalRoutingHelper::RecomputeRoutingTables() [member function]
|
||||
cls.add_method('RecomputeRoutingTables',
|
||||
'void',
|
||||
@@ -7222,126 +7243,6 @@ def register_Ns3PcapFileWrapper_methods(root_module, cls):
|
||||
[])
|
||||
return
|
||||
|
||||
def register_Ns3RttEstimator_methods(root_module, cls):
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttEstimator::RttEstimator() [constructor]
|
||||
cls.add_constructor([])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttEstimator::RttEstimator(ns3::RttEstimator const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RttEstimator const &', 'arg0')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::AckSeq(ns3::SequenceNumber32 ackSeq) [member function]
|
||||
cls.add_method('AckSeq',
|
||||
'ns3::Time',
|
||||
[param('ns3::SequenceNumber32', 'ackSeq')],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::ClearSent() [member function]
|
||||
cls.add_method('ClearSent',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Ptr<ns3::RttEstimator> ns3::RttEstimator::Copy() const [member function]
|
||||
cls.add_method('Copy',
|
||||
'ns3::Ptr< ns3::RttEstimator >',
|
||||
[],
|
||||
is_pure_virtual=True, is_const=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetCurrentEstimate() const [member function]
|
||||
cls.add_method('GetCurrentEstimate',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetMaxRto() const [member function]
|
||||
cls.add_method('GetMaxRto',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetMinRto() const [member function]
|
||||
cls.add_method('GetMinRto',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
## rtt-estimator.h (module 'internet'): static ns3::TypeId ns3::RttEstimator::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::IncreaseMultiplier() [member function]
|
||||
cls.add_method('IncreaseMultiplier',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::Measurement(ns3::Time t) [member function]
|
||||
cls.add_method('Measurement',
|
||||
'void',
|
||||
[param('ns3::Time', 't')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::Reset() [member function]
|
||||
cls.add_method('Reset',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::ResetMultiplier() [member function]
|
||||
cls.add_method('ResetMultiplier',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::RetransmitTimeout() [member function]
|
||||
cls.add_method('RetransmitTimeout',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SentSeq(ns3::SequenceNumber32 seq, uint32_t size) [member function]
|
||||
cls.add_method('SentSeq',
|
||||
'void',
|
||||
[param('ns3::SequenceNumber32', 'seq'), param('uint32_t', 'size')],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetCurrentEstimate(ns3::Time estimate) [member function]
|
||||
cls.add_method('SetCurrentEstimate',
|
||||
'void',
|
||||
[param('ns3::Time', 'estimate')])
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetMaxRto(ns3::Time maxRto) [member function]
|
||||
cls.add_method('SetMaxRto',
|
||||
'void',
|
||||
[param('ns3::Time', 'maxRto')])
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetMinRto(ns3::Time minRto) [member function]
|
||||
cls.add_method('SetMinRto',
|
||||
'void',
|
||||
[param('ns3::Time', 'minRto')])
|
||||
return
|
||||
|
||||
def register_Ns3RttMeanDeviation_methods(root_module, cls):
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttMeanDeviation::RttMeanDeviation() [constructor]
|
||||
cls.add_constructor([])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttMeanDeviation::RttMeanDeviation(ns3::RttMeanDeviation const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RttMeanDeviation const &', 'arg0')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::Ptr<ns3::RttEstimator> ns3::RttMeanDeviation::Copy() const [member function]
|
||||
cls.add_method('Copy',
|
||||
'ns3::Ptr< ns3::RttEstimator >',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttMeanDeviation::Gain(double g) [member function]
|
||||
cls.add_method('Gain',
|
||||
'void',
|
||||
[param('double', 'g')])
|
||||
## rtt-estimator.h (module 'internet'): static ns3::TypeId ns3::RttMeanDeviation::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttMeanDeviation::Measurement(ns3::Time measure) [member function]
|
||||
cls.add_method('Measurement',
|
||||
'void',
|
||||
[param('ns3::Time', 'measure')],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttMeanDeviation::Reset() [member function]
|
||||
cls.add_method('Reset',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttMeanDeviation::RetransmitTimeout() [member function]
|
||||
cls.add_method('RetransmitTimeout',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, cls):
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount() [constructor]
|
||||
cls.add_constructor([])
|
||||
@@ -8162,11 +8063,11 @@ def register_Ns3TcpSocketFactory_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Time_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_comparison_operator('<')
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', 'right'))
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_comparison_operator('<=')
|
||||
@@ -9031,14 +8932,6 @@ def register_Ns3GlobalRouter_methods(root_module, cls):
|
||||
is_static=True)
|
||||
## global-router-interface.h (module 'internet'): ns3::GlobalRouter::GlobalRouter() [constructor]
|
||||
cls.add_constructor([])
|
||||
## global-router-interface.h (module 'internet'): void ns3::GlobalRouter::SetRoutingProtocol(ns3::Ptr<ns3::Ipv4GlobalRouting> routing) [member function]
|
||||
cls.add_method('SetRoutingProtocol',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Ipv4GlobalRouting >', 'routing')])
|
||||
## global-router-interface.h (module 'internet'): ns3::Ptr<ns3::Ipv4GlobalRouting> ns3::GlobalRouter::GetRoutingProtocol() [member function]
|
||||
cls.add_method('GetRoutingProtocol',
|
||||
'ns3::Ptr< ns3::Ipv4GlobalRouting >',
|
||||
[])
|
||||
## global-router-interface.h (module 'internet'): ns3::Ipv4Address ns3::GlobalRouter::GetRouterId() const [member function]
|
||||
cls.add_method('GetRouterId',
|
||||
'ns3::Ipv4Address',
|
||||
@@ -9058,22 +8951,10 @@ def register_Ns3GlobalRouter_methods(root_module, cls):
|
||||
'bool',
|
||||
[param('uint32_t', 'n'), param('ns3::GlobalRoutingLSA &', 'lsa')],
|
||||
is_const=True)
|
||||
## global-router-interface.h (module 'internet'): void ns3::GlobalRouter::InjectRoute(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask) [member function]
|
||||
## global-router-interface.h (module 'internet'): void ns3::GlobalRouter::InjectRoute(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t metric=1) [member function]
|
||||
cls.add_method('InjectRoute',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask')])
|
||||
## global-router-interface.h (module 'internet'): uint32_t ns3::GlobalRouter::GetNInjectedRoutes() [member function]
|
||||
cls.add_method('GetNInjectedRoutes',
|
||||
'uint32_t',
|
||||
[])
|
||||
## global-router-interface.h (module 'internet'): ns3::Ipv4RoutingTableEntry * ns3::GlobalRouter::GetInjectedRoute(uint32_t i) [member function]
|
||||
cls.add_method('GetInjectedRoute',
|
||||
retval('ns3::Ipv4RoutingTableEntry *', caller_owns_return=False),
|
||||
[param('uint32_t', 'i')])
|
||||
## global-router-interface.h (module 'internet'): void ns3::GlobalRouter::RemoveInjectedRoute(uint32_t i) [member function]
|
||||
cls.add_method('RemoveInjectedRoute',
|
||||
'void',
|
||||
[param('uint32_t', 'i')])
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'metric', default_value='1')])
|
||||
## global-router-interface.h (module 'internet'): bool ns3::GlobalRouter::WithdrawRoute(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask) [member function]
|
||||
cls.add_method('WithdrawRoute',
|
||||
'bool',
|
||||
@@ -12954,36 +12835,16 @@ def register_Ns3Ipv4GlobalRouting_methods(root_module, cls):
|
||||
cls.add_constructor([param('ns3::Ipv4GlobalRouting const &', 'arg0')])
|
||||
## ipv4-global-routing.h (module 'internet'): ns3::Ipv4GlobalRouting::Ipv4GlobalRouting() [constructor]
|
||||
cls.add_constructor([])
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddASExternalRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
cls.add_method('AddASExternalRouteTo',
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Mask destMask, ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('AddRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
cls.add_method('AddHostRouteTo',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Mask', 'destMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::DeleteRoutes() [member function]
|
||||
cls.add_method('DeleteRoutes',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
|
||||
cls.add_method('AddHostRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')])
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
cls.add_method('AddNetworkRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function]
|
||||
cls.add_method('AddNetworkRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')])
|
||||
## ipv4-global-routing.h (module 'internet'): uint32_t ns3::Ipv4GlobalRouting::GetNRoutes() const [member function]
|
||||
cls.add_method('GetNRoutes',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-global-routing.h (module 'internet'): ns3::Ipv4RoutingTableEntry * ns3::Ipv4GlobalRouting::GetRoute(uint32_t i) const [member function]
|
||||
cls.add_method('GetRoute',
|
||||
retval('ns3::Ipv4RoutingTableEntry *', caller_owns_return=False),
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True)
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): static ns3::TypeId ns3::Ipv4GlobalRouting::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
@@ -13009,34 +12870,62 @@ def register_Ns3Ipv4GlobalRouting_methods(root_module, cls):
|
||||
'void',
|
||||
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
|
||||
cls.add_method('PrintRoutingTable',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
|
||||
is_const=True, is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::RemoveRoute(uint32_t i) [member function]
|
||||
cls.add_method('RemoveRoute',
|
||||
'void',
|
||||
[param('uint32_t', 'i')])
|
||||
## ipv4-global-routing.h (module 'internet'): bool ns3::Ipv4GlobalRouting::RouteInput(ns3::Ptr<const ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<const ns3::NetDevice> idev, ns3::Callback<void,ns3::Ptr<ns3::Ipv4Route>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback<void,ns3::Ptr<ns3::Ipv4MulticastRoute>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,unsigned int,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> lcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::Socket::SocketErrno,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
|
||||
cls.add_method('RouteInput',
|
||||
'bool',
|
||||
[param('ns3::Ptr< ns3::Packet const >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice const >', 'idev'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4Route >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ucb'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4MulticastRoute >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'mcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'lcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4GlobalRouting::RouteOutput(ns3::Ptr<ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<ns3::NetDevice> oif, ns3::Socket::SocketErrno & sockerr) [member function]
|
||||
cls.add_method('RouteOutput',
|
||||
'ns3::Ptr< ns3::Ipv4Route >',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice >', 'oif'), param('ns3::Socket::SocketErrno &', 'sockerr')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::SetIpv4(ns3::Ptr<ns3::Ipv4> ipv4) [member function]
|
||||
cls.add_method('SetIpv4',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Ipv4 >', 'ipv4')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4GlobalRoutingOneNexthop_methods(root_module, cls):
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ipv4GlobalRoutingOneNexthop::Ipv4GlobalRoutingOneNexthop() [constructor]
|
||||
cls.add_constructor([])
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ipv4GlobalRoutingOneNexthop::Ipv4GlobalRoutingOneNexthop(ns3::Ipv4GlobalRoutingOneNexthop const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4GlobalRoutingOneNexthop const &', 'arg0')])
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): void ns3::Ipv4GlobalRoutingOneNexthop::AddRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Mask destMask, ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('AddRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Mask', 'destMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): void ns3::Ipv4GlobalRoutingOneNexthop::DeleteRoutes() [member function]
|
||||
cls.add_method('DeleteRoutes',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): uint32_t ns3::Ipv4GlobalRoutingOneNexthop::GetNRoutes() const [member function]
|
||||
cls.add_method('GetNRoutes',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ipv4RoutingTableEntry ns3::Ipv4GlobalRoutingOneNexthop::GetRoute(uint32_t i) const [member function]
|
||||
cls.add_method('GetRoute',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): static ns3::TypeId ns3::Ipv4GlobalRoutingOneNexthop::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): void ns3::Ipv4GlobalRoutingOneNexthop::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
|
||||
cls.add_method('PrintRoutingTable',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
|
||||
is_const=True, is_virtual=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): bool ns3::Ipv4GlobalRoutingOneNexthop::RouteInput(ns3::Ptr<const ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<const ns3::NetDevice> idev, ns3::Callback<void,ns3::Ptr<ns3::Ipv4Route>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback<void,ns3::Ptr<ns3::Ipv4MulticastRoute>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,unsigned int,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> lcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::Socket::SocketErrno,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
|
||||
cls.add_method('RouteInput',
|
||||
'bool',
|
||||
[param('ns3::Ptr< ns3::Packet const >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice const >', 'idev'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4Route >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ucb'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4MulticastRoute >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'mcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'lcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4GlobalRoutingOneNexthop::RouteOutput(ns3::Ptr<ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<ns3::NetDevice> oif, ns3::Socket::SocketErrno & sockerr) [member function]
|
||||
cls.add_method('RouteOutput',
|
||||
'ns3::Ptr< ns3::Ipv4Route >',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice >', 'oif'), param('ns3::Socket::SocketErrno &', 'sockerr')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4GlobalRoutingOneNexthop::LookupGlobal(ns3::Ipv4Address dest, ns3::Ptr<ns3::NetDevice> oif=0) [member function]
|
||||
cls.add_method('LookupGlobal',
|
||||
'ns3::Ptr< ns3::Ipv4Route >',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ptr< ns3::NetDevice >', 'oif', default_value='0')],
|
||||
visibility='protected', is_virtual=True)
|
||||
return
|
||||
|
||||
|
||||
@@ -20,18 +20,24 @@
|
||||
#include "ipv4-global-routing-helper.h"
|
||||
#include "ns3/global-router-interface.h"
|
||||
#include "ns3/ipv4-global-routing.h"
|
||||
#include "ns3/ipv4-global-routing-one-nexthop.h"
|
||||
#include "ns3/ipv4-list-routing.h"
|
||||
#include "ns3/log.h"
|
||||
#include "ns3/node-list.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("GlobalRoutingHelper");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper ()
|
||||
UniformVariable Ipv4GlobalRoutingHelper::m_rand;
|
||||
|
||||
Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper (const std::string &type/* = "ns3::Ipv4GlobalRoutingOneNexthop"*/)
|
||||
: m_type (type)
|
||||
{
|
||||
}
|
||||
|
||||
Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper (const Ipv4GlobalRoutingHelper &o)
|
||||
: m_type (o.m_type)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -51,8 +57,10 @@ Ipv4GlobalRoutingHelper::Create (Ptr<Node> node) const
|
||||
node->AggregateObject (globalRouter);
|
||||
|
||||
NS_LOG_LOGIC ("Adding GlobalRouting Protocol to node " << node->GetId ());
|
||||
Ptr<Ipv4GlobalRouting> globalRouting = CreateObject<Ipv4GlobalRouting> ();
|
||||
globalRouter->SetRoutingProtocol (globalRouting);
|
||||
|
||||
ObjectFactory factory;
|
||||
factory.SetTypeId (m_type);
|
||||
Ptr<Ipv4GlobalRouting> globalRouting = DynamicCast<Ipv4GlobalRouting> (factory.Create<Object> ());
|
||||
|
||||
return globalRouting;
|
||||
}
|
||||
@@ -63,6 +71,101 @@ Ipv4GlobalRoutingHelper::PopulateRoutingTables (void)
|
||||
GlobalRouteManager::BuildGlobalRoutingDatabase ();
|
||||
GlobalRouteManager::InitializeRoutes ();
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4GlobalRoutingHelper::PopulateAllPossibleRoutingTables (void)
|
||||
{
|
||||
NodeList::Iterator listEnd = NodeList::End ();
|
||||
for (NodeList::Iterator node = NodeList::Begin (); node != listEnd; node++)
|
||||
{
|
||||
// if ((*node)->GetId ()!=3) continue;
|
||||
|
||||
Ptr<Ipv4> ipv4 = (*node)->GetObject<Ipv4> ();
|
||||
NS_ASSERT (ipv4 != 0);
|
||||
|
||||
// remember interface statuses
|
||||
std::vector<uint16_t> originalMetric (ipv4->GetNInterfaces ());
|
||||
for (uint32_t iface = 1; iface < ipv4->GetNInterfaces (); iface++)
|
||||
{
|
||||
originalMetric[iface] = ipv4->GetMetric (iface);
|
||||
}
|
||||
|
||||
// enable interfaces one by one and calculate routes
|
||||
for (uint32_t enabledInterface = 1; enabledInterface < ipv4->GetNInterfaces (); enabledInterface++)
|
||||
{
|
||||
NS_LOG_ERROR ("Enabled interface: " << enabledInterface);
|
||||
|
||||
for (uint32_t iface = 1; iface < ipv4->GetNInterfaces (); iface++)
|
||||
{
|
||||
ipv4->SetMetric (iface, UINT16_MAX);
|
||||
}
|
||||
ipv4->SetMetric (enabledInterface, originalMetric[enabledInterface]);
|
||||
|
||||
GlobalRouteManager::ClearLSDB ();
|
||||
GlobalRouteManager::BuildGlobalRoutingDatabase ();
|
||||
GlobalRouteManager::InitializeRoutes ();
|
||||
}
|
||||
|
||||
// restore original interface statuses
|
||||
for (uint32_t iface = 1; iface < ipv4->GetNInterfaces (); iface++)
|
||||
{
|
||||
ipv4->SetMetric (iface, originalMetric[iface]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// void
|
||||
// Ipv4GlobalRoutingHelper::PopulateAllPossibleRoutingTables (void)
|
||||
// {
|
||||
// for (int xx = 0; xx < 100; xx++)
|
||||
// {
|
||||
// for (NodeList::Iterator node = NodeList::Begin (); node != NodeList::End (); node++)
|
||||
// {
|
||||
// Ptr<Ipv4> ipv4 = (*node)->GetObject<Ipv4> ();
|
||||
// NS_ASSERT (ipv4 != 0);
|
||||
|
||||
// // // remember interface statuses
|
||||
// // std::vector<uint16_t> originalMetric (ipv4->GetNInterfaces ());
|
||||
// // for (uint32_t iface = 1; iface < ipv4->GetNInterfaces (); iface++)
|
||||
// // {
|
||||
// // originalMetric[iface] = ipv4->GetMetric (iface);
|
||||
// // }
|
||||
|
||||
// // enable interfaces one by one and calculate routes
|
||||
// // for (uint32_t enabledInterface = 1; enabledInterface < ipv4->GetNInterfaces (); enabledInterface++)
|
||||
// // {
|
||||
// // NS_LOG_ERROR ("Enabled interface: " << enabledInterface);
|
||||
|
||||
// for (uint32_t iface = 1; iface < ipv4->GetNInterfaces (); iface++)
|
||||
// {
|
||||
// ipv4->SetMetric (iface, m_rand.GetInteger (1, 500));
|
||||
// }
|
||||
// // ipv4->SetMetric (enabledInterface, originalMetric[enabledInterface]);
|
||||
|
||||
// // }
|
||||
|
||||
// // // restore original interface statuses
|
||||
// // for (uint32_t iface = 1; iface < ipv4->GetNInterfaces (); iface++)
|
||||
// // {
|
||||
// // ipv4->SetMetric (iface, originalMetric[iface]);
|
||||
// // }
|
||||
// }
|
||||
// GlobalRouteManager::ClearLSDB ();
|
||||
// GlobalRouteManager::BuildGlobalRoutingDatabase ();
|
||||
// GlobalRouteManager::InitializeRoutes ();
|
||||
|
||||
// // Ptr<GlobalRouter> rtr =
|
||||
// // (*node)->GetObject<GlobalRouter> ();
|
||||
|
||||
// // if (rtr && rtr->GetNumLSAs () )
|
||||
// // {
|
||||
// // SimulationSingleton<GlobalRouteManagerImpl>::Get ()->
|
||||
// // SPFCalculate (rtr->GetRouterId ());
|
||||
// // }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
void
|
||||
Ipv4GlobalRoutingHelper::RecomputeRoutingTables (void)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "ns3/node-container.h"
|
||||
#include "ns3/ipv4-routing-helper.h"
|
||||
#include "ns3/random-variable.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -31,11 +32,18 @@ namespace ns3 {
|
||||
class Ipv4GlobalRoutingHelper : public Ipv4RoutingHelper
|
||||
{
|
||||
public:
|
||||
enum GlobalRoutingType
|
||||
{ ONE_NEXT_HOP = 0,
|
||||
ORDERED_NEXT_HOPS = 1,
|
||||
UNORDERED_NEXT_HOPS = 2};
|
||||
|
||||
/**
|
||||
* \brief Construct a GlobalRoutingHelper to make life easier for managing
|
||||
* global routing tasks.
|
||||
*
|
||||
* param type Type of the global routing
|
||||
*/
|
||||
Ipv4GlobalRoutingHelper ();
|
||||
Ipv4GlobalRoutingHelper (const std::string &type = "ns3::Ipv4GlobalRoutingOneNexthop");
|
||||
|
||||
/**
|
||||
* \brief Construct a GlobalRoutingHelper from another previously initialized
|
||||
@@ -70,6 +78,8 @@ public:
|
||||
*
|
||||
*/
|
||||
static void PopulateRoutingTables (void);
|
||||
|
||||
static void PopulateAllPossibleRoutingTables ();
|
||||
/**
|
||||
* \brief Remove all routes that were previously installed in a prior call
|
||||
* to either PopulateRoutingTables() or RecomputeRoutingTables(), and
|
||||
@@ -90,6 +100,10 @@ private:
|
||||
* assignment and prevent the compiler from happily inserting its own.
|
||||
*/
|
||||
Ipv4GlobalRoutingHelper &operator = (const Ipv4GlobalRoutingHelper &o);
|
||||
|
||||
std::string m_type;
|
||||
|
||||
static UniformVariable m_rand;
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
* \returns a newly-created routing protocol
|
||||
*/
|
||||
virtual Ptr<Ipv4RoutingProtocol> Create (Ptr<Node> node) const = 0;
|
||||
|
||||
|
||||
/**
|
||||
* \brief prints the routing tables of all nodes at a particular time.
|
||||
* \param printTime the time at which the routing table is supposed to be printed.
|
||||
@@ -135,12 +135,12 @@ Ptr<T> Ipv4RoutingHelper::GetRouting (Ptr<Ipv4RoutingProtocol> protocol)
|
||||
// trying to check if protocol is a list routing
|
||||
Ptr<Ipv4ListRouting> lrp = DynamicCast<Ipv4ListRouting> (protocol);
|
||||
if (lrp != 0)
|
||||
{
|
||||
for (uint32_t i = 0; i < lrp->GetNRoutingProtocols (); i++)
|
||||
{
|
||||
for (uint32_t i = 0; i < lrp->GetNRoutingProtocols (); i++)
|
||||
{
|
||||
int16_t priority;
|
||||
int16_t priority;
|
||||
ret = GetRouting<T> (lrp->GetRoutingProtocol (i, priority)); // potential recursion, if inside ListRouting is ListRouting
|
||||
if (ret != 0)
|
||||
if (ret != 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "ns3/ipv4-routing-protocol.h"
|
||||
#include "ns3/ipv4-list-routing.h"
|
||||
#include "ns3/mpi-interface.h"
|
||||
#include "ns3/ipv4-routing-helper.h"
|
||||
#include "global-router-interface.h"
|
||||
#include "global-route-manager-impl.h"
|
||||
#include "candidate-queue.h"
|
||||
@@ -566,19 +567,15 @@ GlobalRouteManagerImpl::DeleteGlobalRoutes ()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Ptr<Ipv4GlobalRouting> gr = router->GetRoutingProtocol ();
|
||||
uint32_t j = 0;
|
||||
uint32_t nRoutes = gr->GetNRoutes ();
|
||||
NS_LOG_LOGIC ("Deleting " << gr->GetNRoutes ()<< " routes from node " << node->GetId ());
|
||||
// Each time we delete route 0, the route index shifts downward
|
||||
// We can delete all routes if we delete the route numbered 0
|
||||
// nRoutes times
|
||||
for (j = 0; j < nRoutes; j++)
|
||||
{
|
||||
NS_LOG_LOGIC ("Deleting global route " << j << " from node " << node->GetId ());
|
||||
gr->RemoveRoute (0);
|
||||
}
|
||||
NS_LOG_LOGIC ("Deleted " << j << " global routes from node "<< node->GetId ());
|
||||
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
|
||||
NS_ASSERT_MSG (ipv4 != 0, "GlobalRouteManagerImpl requires IPv4 stack to be installed on the node");
|
||||
|
||||
Ptr<Ipv4GlobalRouting> gr = Ipv4RoutingHelper::
|
||||
GetRouting<Ipv4GlobalRouting> (ipv4->GetRoutingProtocol ());
|
||||
|
||||
NS_ASSERT_MSG (gr != 0, "GlobalRouteManagerImpl needs an instance of Ipv4GlobalRouting to be installed on the node");
|
||||
|
||||
gr->DeleteRoutes ();
|
||||
}
|
||||
if (m_lsdb)
|
||||
{
|
||||
@@ -588,6 +585,14 @@ GlobalRouteManagerImpl::DeleteGlobalRoutes ()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GlobalRouteManagerImpl::ClearLSDB ()
|
||||
{
|
||||
NS_LOG_LOGIC ("Deleting LSDB, creating new one");
|
||||
delete m_lsdb;
|
||||
m_lsdb = new GlobalRouteManagerLSDB ();
|
||||
}
|
||||
|
||||
//
|
||||
// In order to build the routing database, we need to walk the list of nodes
|
||||
// in the system and look for those that support the GlobalRouter interface.
|
||||
@@ -626,7 +631,14 @@ GlobalRouteManagerImpl::BuildGlobalRoutingDatabase ()
|
||||
// DiscoverLSAs () will get zero as the number since no routes have been
|
||||
// found.
|
||||
//
|
||||
Ptr<Ipv4GlobalRouting> grouting = rtr->GetRoutingProtocol ();
|
||||
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
|
||||
NS_ASSERT_MSG (ipv4 != 0, "GlobalRouteManagerImpl requires IPv4 stack to be installed on the node");
|
||||
|
||||
Ptr<Ipv4GlobalRouting> grouting = Ipv4RoutingHelper::
|
||||
GetRouting<Ipv4GlobalRouting> (ipv4->GetRoutingProtocol ());
|
||||
|
||||
NS_ASSERT_MSG (grouting != 0, "GlobalRouteManagerImpl needs an instance of Ipv4GlobalRouting to be installed on the node");
|
||||
|
||||
uint32_t numLSAs = rtr->DiscoverLSAs ();
|
||||
NS_LOG_LOGIC ("Found " << numLSAs << " LSAs");
|
||||
|
||||
@@ -692,6 +704,7 @@ GlobalRouteManagerImpl::InitializeRoutes ()
|
||||
for (NodeList::Iterator i = NodeList::Begin (); i != listEnd; i++)
|
||||
{
|
||||
Ptr<Node> node = *i;
|
||||
|
||||
//
|
||||
// Look for the GlobalRouter interface that indicates that the node is
|
||||
// participating in routing.
|
||||
@@ -876,7 +889,7 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate)
|
||||
else if (w_lsa->GetStatus () == GlobalRoutingLSA::LSA_SPF_CANDIDATE)
|
||||
{
|
||||
//
|
||||
// We have already considered the link represented by <w>. What wse have to
|
||||
// We have already considered the link represented by <w>. What we have to
|
||||
// do now is to decide if this new router represents a route with a shorter
|
||||
// distance metric.
|
||||
//
|
||||
@@ -1305,12 +1318,15 @@ GlobalRouteManagerImpl::CheckForStubNode (Ipv4Address root)
|
||||
if (lr->GetLinkId () == myRouterId)
|
||||
{
|
||||
// Next hop is stored in the LinkID field of lr
|
||||
Ptr<GlobalRouter> router = rlsa->GetNode ()->GetObject<GlobalRouter> ();
|
||||
NS_ASSERT (router);
|
||||
Ptr<Ipv4GlobalRouting> gr = router->GetRoutingProtocol ();
|
||||
NS_ASSERT (gr);
|
||||
gr->AddNetworkRouteTo (Ipv4Address ("0.0.0.0"), Ipv4Mask ("0.0.0.0"), lr->GetLinkData (),
|
||||
FindOutgoingInterfaceId (transitLink->GetLinkData ()));
|
||||
Ptr<Ipv4> ipv4 = rlsa->GetNode ()->GetObject<Ipv4> ();
|
||||
NS_ASSERT_MSG (ipv4 != 0, "GlobalRouteManagerImpl requires IPv4 stack to be installed on the node");
|
||||
|
||||
Ptr<Ipv4GlobalRouting> gr = Ipv4RoutingHelper::
|
||||
GetRouting<Ipv4GlobalRouting> (ipv4->GetRoutingProtocol ());
|
||||
|
||||
NS_ASSERT_MSG (gr != 0, "GlobalRouteManagerImpl needs an instance of Ipv4GlobalRouting to be installed on the node");
|
||||
gr->AddRouteTo (Ipv4Address ("0.0.0.0"), Ipv4Mask ("0.0.0.0"), lr->GetLinkData (),
|
||||
FindOutgoingInterfaceId (transitLink->GetLinkData ()));
|
||||
NS_LOG_LOGIC ("Inserting default route for node " << myRouterId << " to next hop " <<
|
||||
lr->GetLinkData () << " via interface " <<
|
||||
FindOutgoingInterfaceId (transitLink->GetLinkData ()));
|
||||
@@ -1329,11 +1345,8 @@ GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root)
|
||||
NS_LOG_FUNCTION (this << root);
|
||||
|
||||
SPFVertex *v;
|
||||
//
|
||||
// Initialize the Link State Database.
|
||||
//
|
||||
m_lsdb->Initialize ();
|
||||
//
|
||||
|
||||
//
|
||||
// The candidate queue is a priority queue of SPFVertex objects, with the top
|
||||
// of the queue being the closest vertex in terms of distance from the root
|
||||
// of the tree. Initially, this queue is empty.
|
||||
@@ -1351,105 +1364,115 @@ GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root)
|
||||
// We also mark this vertex as being in the SPF tree.
|
||||
//
|
||||
m_spfroot= v;
|
||||
|
||||
NS_ASSERT_MSG (m_spfroot->GetVertexType () == SPFVertex::VertexRouter,
|
||||
"Root node has to be router");
|
||||
|
||||
|
||||
//
|
||||
// Initialize the Link State Database.
|
||||
//
|
||||
m_lsdb->Initialize ();
|
||||
|
||||
v->SetDistanceFromRoot (0);
|
||||
v->GetLSA ()->SetStatus (GlobalRoutingLSA::LSA_SPF_IN_SPFTREE);
|
||||
NS_LOG_LOGIC ("Starting SPFCalculate for node " << root);
|
||||
|
||||
//
|
||||
// Optimize SPF calculation, for ns-3.
|
||||
// We do not need to calculate SPF for every node in the network if this
|
||||
// node has only one interface through which another router can be
|
||||
// reached. Instead, short-circuit this computation and just install
|
||||
// a default route in the CheckForStubNode() method.
|
||||
//
|
||||
if (NodeList::GetNNodes () > 0 && CheckForStubNode (root))
|
||||
{
|
||||
NS_LOG_LOGIC ("SPFCalculate truncated for stub node " << root);
|
||||
delete m_spfroot;
|
||||
return;
|
||||
}
|
||||
//
|
||||
// Optimize SPF calculation, for ns-3.
|
||||
// We do not need to calculate SPF for every node in the network if this
|
||||
// node has only one interface through which another router can be
|
||||
// reached. Instead, short-circuit this computation and just install
|
||||
// a default route in the CheckForStubNode() method.
|
||||
//
|
||||
// if (NodeList::GetNNodes () > 0 && CheckForStubNode (root))
|
||||
// {
|
||||
// NS_LOG_LOGIC ("SPFCalculate truncated for stub node " << root);
|
||||
// delete m_spfroot;
|
||||
// return;
|
||||
// }
|
||||
|
||||
for (;;)
|
||||
{
|
||||
//
|
||||
// The operations we need to do are given in the OSPF RFC which we reference
|
||||
// as we go along.
|
||||
//
|
||||
// RFC2328 16.1. (2).
|
||||
//
|
||||
// We examine the Global Router Link Records in the Link State
|
||||
// Advertisements of the current vertex. If there are any point-to-point
|
||||
// links to unexplored adjacent vertices we add them to the tree and update
|
||||
// the distance and next hop information on how to get there. We also add
|
||||
// the new vertices to the candidate queue (the priority queue ordered by
|
||||
// shortest path). If the new vertices represent shorter paths, we use them
|
||||
// and update the path cost.
|
||||
//
|
||||
//
|
||||
// The operations we need to do are given in the OSPF RFC which we reference
|
||||
// as we go along.
|
||||
//
|
||||
// RFC2328 16.1. (2).
|
||||
//
|
||||
// We examine the Global Router Link Records in the Link State
|
||||
// Advertisements of the current vertex. If there are any point-to-point
|
||||
// links to unexplored adjacent vertices we add them to the tree and update
|
||||
// the distance and next hop information on how to get there. We also add
|
||||
// the new vertices to the candidate queue (the priority queue ordered by
|
||||
// shortest path). If the new vertices represent shorter paths, we use them
|
||||
// and update the path cost.
|
||||
//
|
||||
SPFNext (v, candidate);
|
||||
//
|
||||
// RFC2328 16.1. (3).
|
||||
//
|
||||
// If at this step the candidate list is empty, the shortest-path tree (of
|
||||
// transit vertices) has been completely built and this stage of the
|
||||
// procedure terminates.
|
||||
//
|
||||
//
|
||||
// RFC2328 16.1. (3).
|
||||
//
|
||||
// If at this step the candidate list is empty, the shortest-path tree (of
|
||||
// transit vertices) has been completely built and this stage of the
|
||||
// procedure terminates.
|
||||
//
|
||||
if (candidate.Size () == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
//
|
||||
// Choose the vertex belonging to the candidate list that is closest to the
|
||||
// root, and add it to the shortest-path tree (removing it from the candidate
|
||||
// list in the process).
|
||||
//
|
||||
// Recall that in the previous step, we created SPFVertex structures for each
|
||||
// of the routers found in the Global Router Link Records and added tehm to
|
||||
// the candidate list.
|
||||
//
|
||||
//
|
||||
// Choose the vertex belonging to the candidate list that is closest to the
|
||||
// root, and add it to the shortest-path tree (removing it from the candidate
|
||||
// list in the process).
|
||||
//
|
||||
// Recall that in the previous step, we created SPFVertex structures for each
|
||||
// of the routers found in the Global Router Link Records and added tehm to
|
||||
// the candidate list.
|
||||
//
|
||||
NS_LOG_LOGIC (candidate);
|
||||
v = candidate.Pop ();
|
||||
NS_LOG_LOGIC ("Popped vertex " << v->GetVertexId ());
|
||||
//
|
||||
// Update the status field of the vertex to indicate that it is in the SPF
|
||||
// tree.
|
||||
//
|
||||
//
|
||||
// Update the status field of the vertex to indicate that it is in the SPF
|
||||
// tree.
|
||||
//
|
||||
v->GetLSA ()->SetStatus (GlobalRoutingLSA::LSA_SPF_IN_SPFTREE);
|
||||
//
|
||||
// The current vertex has a parent pointer. By calling this rather oddly
|
||||
// named method (blame quagga) we add the current vertex to the list of
|
||||
// children of that parent vertex. In the next hop calculation called during
|
||||
// SPFNext, the parent pointer was set but the vertex has been orphaned up
|
||||
// to now.
|
||||
//
|
||||
//
|
||||
// The current vertex has a parent pointer. By calling this rather oddly
|
||||
// named method (blame quagga) we add the current vertex to the list of
|
||||
// children of that parent vertex. In the next hop calculation called during
|
||||
// SPFNext, the parent pointer was set but the vertex has been orphaned up
|
||||
// to now.
|
||||
//
|
||||
SPFVertexAddParent (v);
|
||||
//
|
||||
// Note that when there is a choice of vertices closest to the root, network
|
||||
// vertices must be chosen before router vertices in order to necessarily
|
||||
// find all equal-cost paths.
|
||||
//
|
||||
// RFC2328 16.1. (4).
|
||||
//
|
||||
// This is the method that actually adds the routes. It'll walk the list
|
||||
// of nodes in the system, looking for the node corresponding to the router
|
||||
// ID of the root of the tree -- that is the router we're building the routes
|
||||
// for. It looks for the Ipv4 interface of that node and remembers it. So
|
||||
// we are only actually adding routes to that one node at the root of the SPF
|
||||
// tree.
|
||||
//
|
||||
// We're going to pop of a pointer to every vertex in the tree except the
|
||||
// root in order of distance from the root. For each of the vertices, we call
|
||||
// SPFIntraAddRouter (). Down in SPFIntraAddRouter, we look at all of the
|
||||
// point-to-point Global Router Link Records (the links to nodes adjacent to
|
||||
// the node represented by the vertex). We add a route to the IP address
|
||||
// specified by the m_linkData field of each of those link records. This will
|
||||
// be the *local* IP address associated with the interface attached to the
|
||||
// link. We use the outbound interface and next hop information present in
|
||||
// the vertex <v> which have possibly been inherited from the root.
|
||||
//
|
||||
// To summarize, we're going to look at the node represented by <v> and loop
|
||||
// through its point-to-point links, adding a *host* route to the local IP
|
||||
// address (at the <v> side) for each of those links.
|
||||
//
|
||||
//
|
||||
// Note that when there is a choice of vertices closest to the root, network
|
||||
// vertices must be chosen before router vertices in order to necessarily
|
||||
// find all equal-cost paths.
|
||||
//
|
||||
// RFC2328 16.1. (4).
|
||||
//
|
||||
// This is the method that actually adds the routes. It'll walk the list
|
||||
// of nodes in the system, looking for the node corresponding to the router
|
||||
// ID of the root of the tree -- that is the router we're building the routes
|
||||
// for. It looks for the Ipv4 interface of that node and remembers it. So
|
||||
// we are only actually adding routes to that one node at the root of the SPF
|
||||
// tree.
|
||||
//
|
||||
// We're going to pop of a pointer to every vertex in the tree except the
|
||||
// root in order of distance from the root. For each of the vertices, we call
|
||||
// SPFIntraAddRouter (). Down in SPFIntraAddRouter, we look at all of the
|
||||
// point-to-point Global Router Link Records (the links to nodes adjacent to
|
||||
// the node represented by the vertex). We add a route to the IP address
|
||||
// specified by the m_linkData field of each of those link records. This will
|
||||
// be the *local* IP address associated with the interface attached to the
|
||||
// link. We use the outbound interface and next hop information present in
|
||||
// the vertex <v> which have possibly been inherited from the root.
|
||||
//
|
||||
// To summarize, we're going to look at the node represented by <v> and loop
|
||||
// through its point-to-point links, adding a *host* route to the local IP
|
||||
// address (at the <v> side) for each of those links.
|
||||
//
|
||||
if (v->GetVertexType () == SPFVertex::VertexRouter)
|
||||
{
|
||||
SPFIntraAddRouter (v);
|
||||
@@ -1462,15 +1485,15 @@ GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root)
|
||||
{
|
||||
NS_ASSERT_MSG (0, "illegal SPFVertex type");
|
||||
}
|
||||
//
|
||||
// RFC2328 16.1. (5).
|
||||
//
|
||||
// Iterate the algorithm by returning to Step 2 until there are no more
|
||||
// candidate vertices.
|
||||
//
|
||||
// RFC2328 16.1. (5).
|
||||
//
|
||||
// Iterate the algorithm by returning to Step 2 until there are no more
|
||||
// candidate vertices.
|
||||
|
||||
} // end for loop
|
||||
|
||||
// Second stage of SPF calculation procedure
|
||||
// Second stage of SPF calculation procedure
|
||||
SPFProcessStubs (m_spfroot);
|
||||
for (uint32_t i = 0; i < m_lsdb->GetNumExtLSAs (); i++)
|
||||
{
|
||||
@@ -1479,7 +1502,6 @@ GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root)
|
||||
NS_LOG_LOGIC ("Processing External LSA with id " << extlsa->GetLinkStateId ());
|
||||
ProcessASExternals (m_spfroot, extlsa);
|
||||
}
|
||||
|
||||
//
|
||||
// We're all done setting the routing information for the node at the root of
|
||||
// the SPF tree. Delete all of the vertices and corresponding resources. Go
|
||||
@@ -1616,8 +1638,10 @@ GlobalRouteManagerImpl::SPFAddASExternal (GlobalRoutingLSA *extlsa, SPFVertex *v
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Ptr<Ipv4GlobalRouting> gr = router->GetRoutingProtocol ();
|
||||
NS_ASSERT (gr);
|
||||
Ptr<Ipv4GlobalRouting> gr = Ipv4RoutingHelper::
|
||||
GetRouting<Ipv4GlobalRouting> (ipv4->GetRoutingProtocol ());
|
||||
|
||||
NS_ASSERT_MSG (gr != 0, "GlobalRouteManagerImpl needs an instance of Ipv4GlobalRouting to be installed on the node");
|
||||
// walk through all next-hop-IPs and out-going-interfaces for reaching
|
||||
// the stub network gateway 'v' from the root node
|
||||
for (uint32_t i = 0; i < v->GetNRootExitDirections (); i++)
|
||||
@@ -1627,7 +1651,7 @@ GlobalRouteManagerImpl::SPFAddASExternal (GlobalRoutingLSA *extlsa, SPFVertex *v
|
||||
int32_t outIf = exit.second;
|
||||
if (outIf >= 0)
|
||||
{
|
||||
gr->AddASExternalRouteTo (tempip, tempmask, nextHop, outIf);
|
||||
gr->AddRouteTo (tempip, tempmask, nextHop, outIf, v->GetDistanceFromRoot ());
|
||||
NS_LOG_LOGIC ("(Route " << i << ") Node " << node->GetId () <<
|
||||
" add external network route to " << tempip <<
|
||||
" using next hop " << nextHop <<
|
||||
@@ -1702,7 +1726,7 @@ GlobalRouteManagerImpl::SPFIntraAddStub (GlobalRoutingLinkRecord *l, SPFVertex*
|
||||
NS_LOG_LOGIC ("Stub is on local host: " << v->GetVertexId () << "; returning");
|
||||
return;
|
||||
}
|
||||
NS_LOG_LOGIC ("Stub is on remote host: " << v->GetVertexId () << "; installing");
|
||||
NS_LOG_LOGIC ("Stub is on remote host: " << v->GetVertexId () << "; installing (" << v->GetDistanceFromRoot () << ")");
|
||||
//
|
||||
// The root of the Shortest Path First tree is the router to which we are
|
||||
// going to write the actual routing table entries. The vertex corresponding
|
||||
@@ -1787,8 +1811,10 @@ GlobalRouteManagerImpl::SPFIntraAddStub (GlobalRoutingLinkRecord *l, SPFVertex*
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Ptr<Ipv4GlobalRouting> gr = router->GetRoutingProtocol ();
|
||||
NS_ASSERT (gr);
|
||||
Ptr<Ipv4GlobalRouting> gr = Ipv4RoutingHelper::
|
||||
GetRouting<Ipv4GlobalRouting> (ipv4->GetRoutingProtocol ());
|
||||
|
||||
NS_ASSERT_MSG (gr != 0, "GlobalRouteManagerImpl needs an instance of Ipv4GlobalRouting to be installed on the node");
|
||||
// walk through all next-hop-IPs and out-going-interfaces for reaching
|
||||
// the stub network gateway 'v' from the root node
|
||||
for (uint32_t i = 0; i < v->GetNRootExitDirections (); i++)
|
||||
@@ -1798,11 +1824,12 @@ GlobalRouteManagerImpl::SPFIntraAddStub (GlobalRoutingLinkRecord *l, SPFVertex*
|
||||
int32_t outIf = exit.second;
|
||||
if (outIf >= 0)
|
||||
{
|
||||
gr->AddNetworkRouteTo (tempip, tempmask, nextHop, outIf);
|
||||
gr->AddRouteTo (tempip, tempmask, nextHop, outIf, v->GetDistanceFromRoot ());
|
||||
NS_LOG_LOGIC ("(Route " << i << ") Node " << node->GetId () <<
|
||||
" add network route to " << tempip <<
|
||||
" using next hop " << nextHop <<
|
||||
" via interface " << outIf);
|
||||
" via interface " << outIf <<
|
||||
" metric " << v->GetDistanceFromRoot () );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2021,33 +2048,36 @@ GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Ptr<Ipv4GlobalRouting> gr = router->GetRoutingProtocol ();
|
||||
NS_ASSERT (gr);
|
||||
// walk through all available exit directions due to ECMP,
|
||||
// and add host route for each of the exit direction toward
|
||||
// the vertex 'v'
|
||||
for (uint32_t i = 0; i < v->GetNRootExitDirections (); i++)
|
||||
{
|
||||
SPFVertex::NodeExit_t exit = v->GetRootExitDirection (i);
|
||||
Ipv4Address nextHop = exit.first;
|
||||
int32_t outIf = exit.second;
|
||||
if (outIf >= 0)
|
||||
{
|
||||
gr->AddHostRouteTo (lr->GetLinkData (), nextHop,
|
||||
outIf);
|
||||
NS_LOG_LOGIC ("(Route " << i << ") Node " << node->GetId () <<
|
||||
" adding host route to " << lr->GetLinkData () <<
|
||||
" using next hop " << nextHop <<
|
||||
" and outgoing interface " << outIf);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_LOGIC ("(Route " << i << ") Node " << node->GetId () <<
|
||||
" NOT able to add host route to " << lr->GetLinkData () <<
|
||||
" using next hop " << nextHop <<
|
||||
" since outgoing interface id is negative " << outIf);
|
||||
}
|
||||
} // for all routes from the root the vertex 'v'
|
||||
|
||||
// Ptr<Ipv4GlobalRouting> gr = Ipv4RoutingHelper::
|
||||
// GetRouting<Ipv4GlobalRouting> (ipv4->GetRoutingProtocol ());
|
||||
|
||||
// NS_ASSERT_MSG (gr != 0, "GlobalRouteManagerImpl needs an instance of Ipv4GlobalRouting to be installed on the node");
|
||||
// // walk through all available exit directions due to ECMP,
|
||||
// // and add host route for each of the exit direction toward
|
||||
// // the vertex 'v'
|
||||
// for (uint32_t i = 0; i < v->GetNRootExitDirections (); i++)
|
||||
// {
|
||||
// SPFVertex::NodeExit_t exit = v->GetRootExitDirection (i);
|
||||
// Ipv4Address nextHop = exit.first;
|
||||
// int32_t outIf = exit.second;
|
||||
// if (outIf >= 0)
|
||||
// {
|
||||
// gr->AddRouteTo (lr->GetLinkData (), Ipv4Mask::GetOnes (), nextHop,
|
||||
// outIf, v->GetDistanceFromRoot ());
|
||||
// NS_LOG_LOGIC ("(Route " << i << ") Node " << node->GetId () <<
|
||||
// " adding host route to " << lr->GetLinkData () <<
|
||||
// " using next hop " << nextHop <<
|
||||
// " and outgoing interface " << outIf);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// NS_LOG_LOGIC ("(Route " << i << ") Node " << node->GetId () <<
|
||||
// " NOT able to add host route to " << lr->GetLinkData () <<
|
||||
// " using next hop " << nextHop <<
|
||||
// " since outgoing interface id is negative " << outIf);
|
||||
// }
|
||||
// } // for all routes from the root the vertex 'v'
|
||||
}
|
||||
//
|
||||
// Done adding the routes for the selected node.
|
||||
@@ -2134,8 +2164,11 @@ GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Ptr<Ipv4GlobalRouting> gr = router->GetRoutingProtocol ();
|
||||
NS_ASSERT (gr);
|
||||
|
||||
Ptr<Ipv4GlobalRouting> gr = Ipv4RoutingHelper::
|
||||
GetRouting<Ipv4GlobalRouting> (ipv4->GetRoutingProtocol ());
|
||||
|
||||
NS_ASSERT_MSG (gr != 0, "GlobalRouteManagerImpl needs an instance of Ipv4GlobalRouting to be installed on the node");
|
||||
// walk through all available exit directions due to ECMP,
|
||||
// and add host route for each of the exit direction toward
|
||||
// the vertex 'v'
|
||||
@@ -2147,7 +2180,7 @@ GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v)
|
||||
|
||||
if (outIf >= 0)
|
||||
{
|
||||
gr->AddNetworkRouteTo (tempip, tempmask, nextHop, outIf);
|
||||
gr->AddRouteTo (tempip, tempmask, nextHop, outIf, v->GetDistanceFromRoot ());
|
||||
NS_LOG_LOGIC ("(Route " << i << ") Node " << node->GetId () <<
|
||||
" add network route to " << tempip <<
|
||||
" using next hop " << nextHop <<
|
||||
|
||||
@@ -715,6 +715,11 @@ public:
|
||||
*/
|
||||
virtual void DeleteGlobalRoutes ();
|
||||
|
||||
/**
|
||||
* @brief Reset LSDB without clearing routing entries
|
||||
*/
|
||||
virtual void ClearLSDB ();
|
||||
|
||||
/**
|
||||
* @brief Build the routing database by gathering Link State Advertisements
|
||||
* from each node exporting a GlobalRouter interface.
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "global-route-manager.h"
|
||||
#include "global-route-manager-impl.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("GlobalRouteManager1");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -35,13 +37,24 @@ namespace ns3 {
|
||||
void
|
||||
GlobalRouteManager::DeleteGlobalRoutes ()
|
||||
{
|
||||
NS_LOG_FUNCTION (0);
|
||||
SimulationSingleton<GlobalRouteManagerImpl>::Get ()->
|
||||
DeleteGlobalRoutes ();
|
||||
DeleteGlobalRoutes ();
|
||||
}
|
||||
|
||||
void
|
||||
GlobalRouteManager::ClearLSDB ()
|
||||
{
|
||||
NS_LOG_FUNCTION (0);
|
||||
SimulationSingleton<GlobalRouteManagerImpl>::Get ()->
|
||||
ClearLSDB ();
|
||||
}
|
||||
|
||||
void
|
||||
GlobalRouteManager::BuildGlobalRoutingDatabase (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (0);
|
||||
|
||||
SimulationSingleton<GlobalRouteManagerImpl>::Get ()->
|
||||
BuildGlobalRoutingDatabase ();
|
||||
}
|
||||
@@ -49,6 +62,8 @@ GlobalRouteManager::BuildGlobalRoutingDatabase (void)
|
||||
void
|
||||
GlobalRouteManager::InitializeRoutes (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (0);
|
||||
|
||||
SimulationSingleton<GlobalRouteManagerImpl>::Get ()->
|
||||
InitializeRoutes ();
|
||||
}
|
||||
@@ -56,6 +71,8 @@ GlobalRouteManager::InitializeRoutes (void)
|
||||
uint32_t
|
||||
GlobalRouteManager::AllocateRouterId (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (0);
|
||||
|
||||
static uint32_t routerId = 0;
|
||||
return routerId++;
|
||||
}
|
||||
|
||||
@@ -52,6 +52,11 @@ public:
|
||||
*/
|
||||
static void DeleteGlobalRoutes ();
|
||||
|
||||
/**
|
||||
* @breif Clear LSA database without removing any entry in global routing table
|
||||
*/
|
||||
static void ClearLSDB ();
|
||||
|
||||
/**
|
||||
* @brief Build the routing database by gathering Link State Advertisements
|
||||
* from each node exporting a GlobalRouter interface.
|
||||
|
||||
@@ -28,9 +28,11 @@
|
||||
#include "ns3/ipv4.h"
|
||||
#include "ns3/bridge-net-device.h"
|
||||
#include "ipv4-global-routing.h"
|
||||
#include "ns3/loopback-net-device.h"
|
||||
#include "global-router-interface.h"
|
||||
#include <vector>
|
||||
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("GlobalRouter");
|
||||
|
||||
namespace ns3 {
|
||||
@@ -526,28 +528,28 @@ GlobalRouter::~GlobalRouter ()
|
||||
ClearLSAs ();
|
||||
}
|
||||
|
||||
void
|
||||
GlobalRouter::SetRoutingProtocol (Ptr<Ipv4GlobalRouting> routing)
|
||||
{
|
||||
m_routingProtocol = routing;
|
||||
}
|
||||
Ptr<Ipv4GlobalRouting>
|
||||
GlobalRouter::GetRoutingProtocol (void)
|
||||
{
|
||||
return m_routingProtocol;
|
||||
}
|
||||
// void
|
||||
// GlobalRouter::SetRoutingProtocol (Ptr<Ipv4GlobalRouting> routing)
|
||||
// {
|
||||
// m_routingProtocol = routing;
|
||||
// }
|
||||
// Ptr<Ipv4GlobalRouting>
|
||||
// GlobalRouter::GetRoutingProtocol (void)
|
||||
// {
|
||||
// return m_routingProtocol;
|
||||
// }
|
||||
|
||||
void
|
||||
GlobalRouter::DoDispose ()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
m_routingProtocol = 0;
|
||||
for (InjectedRoutesI k = m_injectedRoutes.begin ();
|
||||
k != m_injectedRoutes.end ();
|
||||
k = m_injectedRoutes.erase (k))
|
||||
{
|
||||
delete (*k);
|
||||
}
|
||||
// m_routingProtocol = 0;
|
||||
// for (InjectedRoutesI k = m_injectedRoutes.begin ();
|
||||
// k != m_injectedRoutes.end ();
|
||||
// k = m_injectedRoutes.erase (k))
|
||||
// {
|
||||
// delete (*k);
|
||||
// }
|
||||
Object::DoDispose ();
|
||||
}
|
||||
|
||||
@@ -717,17 +719,17 @@ GlobalRouter::DiscoverLSAs ()
|
||||
// Build injected route LSAs as external routes
|
||||
// RFC 2328, section 12.4.4
|
||||
//
|
||||
for (InjectedRoutesCI i = m_injectedRoutes.begin ();
|
||||
for (RouteList::const_iterator i = m_injectedRoutes.begin ();
|
||||
i != m_injectedRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
GlobalRoutingLSA *pLSA = new GlobalRoutingLSA;
|
||||
pLSA->SetLSType (GlobalRoutingLSA::ASExternalLSAs);
|
||||
pLSA->SetLinkStateId ((*i)->GetDestNetwork ());
|
||||
pLSA->SetLinkStateId (i->GetDestNetwork ());
|
||||
pLSA->SetAdvertisingRouter (m_routerId);
|
||||
pLSA->SetNetworkLSANetworkMask ((*i)->GetDestNetworkMask ());
|
||||
pLSA->SetNetworkLSANetworkMask (i->GetDestNetworkMask ());
|
||||
pLSA->SetStatus (GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED);
|
||||
m_LSAs.push_back (pLSA);
|
||||
m_LSAs.push_back (pLSA);
|
||||
}
|
||||
return m_LSAs.size ();
|
||||
}
|
||||
@@ -752,6 +754,8 @@ GlobalRouter::ProcessSingleBroadcastLink (Ptr<NetDevice> nd, GlobalRoutingLSA *p
|
||||
{
|
||||
NS_LOG_FUNCTION (nd << pLSA << &c);
|
||||
|
||||
if (DynamicCast<LoopbackNetDevice> (nd)) return; //don't announce loopback addresses
|
||||
|
||||
GlobalRoutingLinkRecord *plr = new GlobalRoutingLinkRecord;
|
||||
NS_ABORT_MSG_IF (plr == 0, "GlobalRouter::ProcessSingleBroadcastLink(): Can't alloc link record");
|
||||
|
||||
@@ -1503,77 +1507,74 @@ GlobalRouter::GetLSA (uint32_t n, GlobalRoutingLSA &lsa) const
|
||||
}
|
||||
|
||||
void
|
||||
GlobalRouter::InjectRoute (Ipv4Address network, Ipv4Mask networkMask)
|
||||
GlobalRouter::InjectRoute (Ipv4Address network, Ipv4Mask networkMask, uint32_t metric/*=1*/)
|
||||
{
|
||||
NS_LOG_FUNCTION (network << networkMask);
|
||||
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
|
||||
//
|
||||
// Interface number does not matter here, using 1.
|
||||
//
|
||||
*route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
|
||||
networkMask,
|
||||
1);
|
||||
m_injectedRoutes.push_back (route);
|
||||
NS_LOG_FUNCTION (network << networkMask << metric);
|
||||
|
||||
WithdrawRoute (network, networkMask); //slight inefficiency to prevent duplicate routes
|
||||
m_injectedRoutes.push_back (Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
|
||||
networkMask,
|
||||
metric));
|
||||
}
|
||||
|
||||
Ipv4RoutingTableEntry *
|
||||
GlobalRouter::GetInjectedRoute (uint32_t index)
|
||||
{
|
||||
NS_LOG_FUNCTION (index);
|
||||
if (index < m_injectedRoutes.size ())
|
||||
{
|
||||
uint32_t tmp = 0;
|
||||
for (InjectedRoutesCI i = m_injectedRoutes.begin ();
|
||||
i != m_injectedRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
return *i;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
}
|
||||
NS_ASSERT (false);
|
||||
// quiet compiler.
|
||||
return 0;
|
||||
}
|
||||
// Ipv4RoutingTableEntry *
|
||||
// GlobalRouter::GetInjectedRoute (uint32_t index)
|
||||
// {
|
||||
// NS_LOG_FUNCTION (index);
|
||||
// if (index < m_injectedRoutes.size ())
|
||||
// {
|
||||
// uint32_t tmp = 0;
|
||||
// for (InjectedRoutesCI i = m_injectedRoutes.begin ();
|
||||
// i != m_injectedRoutes.end ();
|
||||
// i++)
|
||||
// {
|
||||
// if (tmp == index)
|
||||
// {
|
||||
// return *i;
|
||||
// }
|
||||
// tmp++;
|
||||
// }
|
||||
// }
|
||||
// NS_ASSERT (false);
|
||||
// // quiet compiler.
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
uint32_t
|
||||
GlobalRouter::GetNInjectedRoutes ()
|
||||
{
|
||||
return m_injectedRoutes.size ();
|
||||
}
|
||||
// uint32_t
|
||||
// GlobalRouter::GetNInjectedRoutes ()
|
||||
// {
|
||||
// return m_injectedRoutes.size ();
|
||||
// }
|
||||
|
||||
void
|
||||
GlobalRouter::RemoveInjectedRoute (uint32_t index)
|
||||
{
|
||||
NS_LOG_FUNCTION (index);
|
||||
NS_ASSERT (index < m_injectedRoutes.size ());
|
||||
uint32_t tmp = 0;
|
||||
for (InjectedRoutesI i = m_injectedRoutes.begin (); i != m_injectedRoutes.end (); i++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_injectedRoutes.size ());
|
||||
delete *i;
|
||||
m_injectedRoutes.erase (i);
|
||||
return;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
}
|
||||
// void
|
||||
// GlobalRouter::RemoveInjectedRoute (uint32_t index)
|
||||
// {
|
||||
// NS_LOG_FUNCTION (index);
|
||||
// NS_ASSERT (index < m_injectedRoutes.size ());
|
||||
// uint32_t tmp = 0;
|
||||
// for (InjectedRoutesI i = m_injectedRoutes.begin (); i != m_injectedRoutes.end (); i++)
|
||||
// {
|
||||
// if (tmp == index)
|
||||
// {
|
||||
// NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_injectedRoutes.size ());
|
||||
// delete *i;
|
||||
// m_injectedRoutes.erase (i);
|
||||
// return;
|
||||
// }
|
||||
// tmp++;
|
||||
// }
|
||||
// }
|
||||
|
||||
bool
|
||||
GlobalRouter::WithdrawRoute (Ipv4Address network, Ipv4Mask networkMask)
|
||||
{
|
||||
NS_LOG_FUNCTION (network << networkMask);
|
||||
for (InjectedRoutesI i = m_injectedRoutes.begin (); i != m_injectedRoutes.end (); i++)
|
||||
|
||||
for (RouteList::iterator i = m_injectedRoutes.begin (); i != m_injectedRoutes.end (); i++)
|
||||
{
|
||||
if ((*i)->GetDestNetwork () == network && (*i)->GetDestNetworkMask () == networkMask)
|
||||
if (i->GetDestNetwork () == network && i->GetDestNetworkMask () == networkMask)
|
||||
{
|
||||
NS_LOG_LOGIC ("Withdrawing route to network/mask " << network << "/" << networkMask);
|
||||
delete *i;
|
||||
m_injectedRoutes.erase (i);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
namespace ns3 {
|
||||
|
||||
class GlobalRouter;
|
||||
class Ipv4GlobalRouting;
|
||||
|
||||
/**
|
||||
* @brief A single link record for a link state advertisement.
|
||||
@@ -588,10 +587,6 @@ public:
|
||||
*/
|
||||
GlobalRouter ();
|
||||
|
||||
|
||||
void SetRoutingProtocol (Ptr<Ipv4GlobalRouting> routing);
|
||||
Ptr<Ipv4GlobalRouting> GetRoutingProtocol (void);
|
||||
|
||||
/**
|
||||
* @brief Get the Router ID associated with this Global Router.
|
||||
*
|
||||
@@ -666,35 +661,35 @@ public:
|
||||
* @param network The Network to inject
|
||||
* @param networkMask The Network Mask to inject
|
||||
*/
|
||||
void InjectRoute (Ipv4Address network, Ipv4Mask networkMask);
|
||||
void InjectRoute (Ipv4Address network, Ipv4Mask networkMask, uint32_t metric=1);
|
||||
|
||||
/**
|
||||
* @brief Get the number of injected routes that have been added
|
||||
* to the routing table.
|
||||
* @return number of injected routes
|
||||
*/
|
||||
uint32_t GetNInjectedRoutes (void);
|
||||
// /**
|
||||
// * @brief Get the number of injected routes that have been added
|
||||
// * to the routing table.
|
||||
// * @return number of injected routes
|
||||
// */
|
||||
// uint32_t GetNInjectedRoutes (void) const;
|
||||
|
||||
/**
|
||||
* @brief Return the injected route indexed by i
|
||||
* @param i the index of the route
|
||||
* @return a pointer to that Ipv4RoutingTableEntry is returned
|
||||
*
|
||||
*/
|
||||
Ipv4RoutingTableEntry *GetInjectedRoute (uint32_t i);
|
||||
// /**
|
||||
// * @brief Return the injected route indexed by i
|
||||
// * @param i the index of the route
|
||||
// * @return a pointer to that Ipv4RoutingTableEntry is returned
|
||||
// *
|
||||
// */
|
||||
// const Ipv4RoutingTableEntry& GetInjectedRoute (uint32_t i) const;
|
||||
|
||||
/**
|
||||
* @brief Withdraw a route from the global unicast routing table.
|
||||
*
|
||||
* Calling this function will cause all indexed routes numbered above
|
||||
* index i to have their index decremented. For instance, it is possible to
|
||||
* remove N injected routes by calling RemoveInjectedRoute (0) N times.
|
||||
*
|
||||
* @param i The index (into the injected routing list) of the route to remove.
|
||||
*
|
||||
* @see GlobalRouter::WithdrawRoute ()
|
||||
*/
|
||||
void RemoveInjectedRoute (uint32_t i);
|
||||
// /**
|
||||
// * @brief Withdraw a route from the global unicast routing table.
|
||||
// *
|
||||
// * Calling this function will cause all indexed routes numbered above
|
||||
// * index i to have their index decremented. For instance, it is possible to
|
||||
// * remove N injected routes by calling RemoveInjectedRoute (0) N times.
|
||||
// *
|
||||
// * @param i The index (into the injected routing list) of the route to remove.
|
||||
// *
|
||||
// * @see GlobalRouter::WithdrawRoute ()
|
||||
// */
|
||||
// void RemoveInjectedRoute (uint32_t i);
|
||||
|
||||
/**
|
||||
* @brief Withdraw a route from the global unicast routing table.
|
||||
@@ -728,12 +723,10 @@ private:
|
||||
ListOfLSAs_t m_LSAs;
|
||||
|
||||
Ipv4Address m_routerId;
|
||||
Ptr<Ipv4GlobalRouting> m_routingProtocol;
|
||||
// Ptr<Ipv4GlobalRouting> m_routingProtocol;
|
||||
|
||||
typedef std::list<Ipv4RoutingTableEntry *> InjectedRoutes;
|
||||
typedef std::list<Ipv4RoutingTableEntry *>::const_iterator InjectedRoutesCI;
|
||||
typedef std::list<Ipv4RoutingTableEntry *>::iterator InjectedRoutesI;
|
||||
InjectedRoutes m_injectedRoutes; // Routes we are exporting
|
||||
typedef std::list<Ipv4RoutingTableEntry> RouteList;
|
||||
RouteList m_injectedRoutes; // Routes we are exporting
|
||||
|
||||
// inherited from Object
|
||||
virtual void DoDispose (void);
|
||||
|
||||
@@ -846,10 +846,10 @@ void Icmpv6L4Protocol::SendMessage (Ptr<Packet> packet, Ipv6Address src, Ipv6Add
|
||||
{
|
||||
NS_LOG_FUNCTION (this << packet << src << dst << (uint32_t)ttl);
|
||||
Ptr<Ipv6L3Protocol> ipv6 = m_node->GetObject<Ipv6L3Protocol> ();
|
||||
SocketIpTtlTag tag;
|
||||
NS_ASSERT (ipv6 != 0);
|
||||
|
||||
tag.SetTtl (ttl);
|
||||
Ptr<SocketIpTtlTag> tag = CreateObject<SocketIpTtlTag> ();
|
||||
tag->SetTtl (ttl);
|
||||
packet->AddPacketTag (tag);
|
||||
m_downTarget (packet, src, dst, PROT_NUMBER, 0);
|
||||
}
|
||||
@@ -860,7 +860,6 @@ void Icmpv6L4Protocol::SendMessage (Ptr<Packet> packet, Ipv6Address dst, Icmpv6H
|
||||
Ptr<Ipv6L3Protocol> ipv6 = m_node->GetObject<Ipv6L3Protocol> ();
|
||||
NS_ASSERT (ipv6 != 0 && ipv6->GetRoutingProtocol () != 0);
|
||||
Ipv6Header header;
|
||||
SocketIpTtlTag tag;
|
||||
Socket::SocketErrno err;
|
||||
Ptr<Ipv6Route> route;
|
||||
Ptr<NetDevice> oif (0); //specify non-zero if bound to a source address
|
||||
@@ -871,7 +870,8 @@ void Icmpv6L4Protocol::SendMessage (Ptr<Packet> packet, Ipv6Address dst, Icmpv6H
|
||||
if (route != 0)
|
||||
{
|
||||
NS_LOG_LOGIC ("Route exists");
|
||||
tag.SetTtl (ttl);
|
||||
Ptr<SocketIpTtlTag> tag = CreateObject<SocketIpTtlTag> ();
|
||||
tag->SetTtl (ttl);
|
||||
packet->AddPacketTag (tag);
|
||||
Ipv6Address src = route->GetSource ();
|
||||
|
||||
|
||||
@@ -0,0 +1,317 @@
|
||||
// -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*-
|
||||
//
|
||||
// Copyright (c) 2008 University of Washington
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
// published by the Free Software Foundation;
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
|
||||
#include "ns3/names.h"
|
||||
#include "ns3/log.h"
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/object.h"
|
||||
#include "ns3/packet.h"
|
||||
#include "ns3/net-device.h"
|
||||
#include "ns3/ipv4-route.h"
|
||||
#include "ipv4-global-routing-one-nexthop.h"
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("Ipv4GlobalRoutingOneNexthop");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (Ipv4GlobalRoutingOneNexthop);
|
||||
|
||||
TypeId
|
||||
Ipv4GlobalRoutingOneNexthop::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::Ipv4GlobalRoutingOneNexthop")
|
||||
.SetParent<Ipv4GlobalRouting> ()
|
||||
.AddConstructor<Ipv4GlobalRoutingOneNexthop> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
Ipv4GlobalRoutingOneNexthop::Ipv4GlobalRoutingOneNexthop ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4GlobalRoutingOneNexthop::AddRouteTo (Ipv4Address dest,
|
||||
Ipv4Mask destMask,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface,
|
||||
uint32_t metric/*=0*/)
|
||||
{
|
||||
NS_LOG_FUNCTION (dest << nextHop << interface);
|
||||
|
||||
// First, make sure we don't try to add route to ourselves
|
||||
int32_t iface = m_ipv4->GetInterfaceForPrefix (dest, destMask);
|
||||
NS_LOG_LOGIC ("Iface " << iface << " for " << dest);
|
||||
if (iface >= 0)
|
||||
{
|
||||
NS_LOG_LOGIC ("Do not add route to ourselves");
|
||||
return;
|
||||
}
|
||||
|
||||
// Second, there is no reason to add p2p route that equals to the next hop
|
||||
if (destMask == Ipv4Mask::GetOnes () && dest == nextHop)
|
||||
{
|
||||
NS_LOG_LOGIC ("Ignore route to nexthop via nexhop");
|
||||
return;
|
||||
}
|
||||
|
||||
Ipv4AddressTrie<Ipv4RoutingTableEntry>::iterator route =
|
||||
m_routes.find (dest.CombineMask (destMask));
|
||||
if (route == m_routes.end ())
|
||||
{
|
||||
NS_LOG_LOGIC ("Adding new route");
|
||||
m_routes[dest.CombineMask (destMask)] =
|
||||
Ipv4RoutingTableEntry::CreateNetworkRouteTo (dest, destMask, nextHop, interface, metric);
|
||||
}
|
||||
else
|
||||
if (route->second.GetMetric () > metric)
|
||||
{
|
||||
NS_LOG_LOGIC ("Replacing larger-metric route");
|
||||
m_routes[dest.CombineMask (destMask)] =
|
||||
Ipv4RoutingTableEntry::CreateNetworkRouteTo (dest, destMask, nextHop, interface, metric);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_LOGIC ("Don't update lower-metric route");
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<Ipv4Route>
|
||||
Ipv4GlobalRoutingOneNexthop::LookupGlobal (Ipv4Address dest, Ptr<NetDevice> oif)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
NS_LOG_LOGIC ("Looking for route for destination " << dest);
|
||||
|
||||
// Cheating with lookups. Need to redesign Trie
|
||||
Ipv4AddressTrieMap::const_iterator longest_prefix_map;
|
||||
Ipv4Mask mask ("255.255.255.255");
|
||||
do {
|
||||
NS_LOG_DEBUG ("Try mask " << mask);
|
||||
longest_prefix_map = m_routes.longest_prefix_match (dest.CombineMask (mask));
|
||||
mask = Ipv4Mask (mask.Get () << 8);
|
||||
} while (longest_prefix_map == m_routes.end () && !mask.IsEqual (Ipv4Mask::GetZero ()));
|
||||
|
||||
if (longest_prefix_map == m_routes.end ())
|
||||
{
|
||||
NS_LOG_LOGIC ("Route not found...");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (oif != 0 && oif == m_ipv4->GetNetDevice (longest_prefix_map->second.GetInterface ()))
|
||||
{
|
||||
NS_LOG_LOGIC ("Route points to the incoming interface. Return empty route");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// create a Ipv4Route object from the selected routing table entry
|
||||
Ptr<Ipv4Route> rtentry = Create<Ipv4Route> ();
|
||||
rtentry->SetDestination (longest_prefix_map->second.GetDest ());
|
||||
rtentry->SetSource (m_ipv4->GetAddress (longest_prefix_map->second.GetInterface (), 0).GetLocal ());
|
||||
rtentry->SetGateway (longest_prefix_map->second.GetGateway ());
|
||||
rtentry->SetOutputDevice (m_ipv4->GetNetDevice (longest_prefix_map->second.GetInterface ()));
|
||||
return rtentry;
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4GlobalRoutingOneNexthop::DeleteRoutes ()
|
||||
{
|
||||
m_routes.clear ();
|
||||
}
|
||||
|
||||
// Formatted like output of "route -n" command
|
||||
void
|
||||
Ipv4GlobalRoutingOneNexthop::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
|
||||
{
|
||||
std::ostream* os = stream->GetStream ();
|
||||
if (m_routes.size () > 0)
|
||||
{
|
||||
*os << "Destination Gateway Genmask Flags Metric Ref Use Iface" << std::endl;
|
||||
for (Ipv4AddressTrieMap::const_iterator i=m_routes.begin (); i != m_routes.end (); i++)
|
||||
{
|
||||
std::ostringstream dest, gw, mask, flags;
|
||||
const Ipv4RoutingTableEntry &route = i->second;
|
||||
dest << route.GetDest ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (16) << dest.str ();
|
||||
gw << route.GetGateway ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (16) << gw.str ();
|
||||
mask << route.GetDestNetworkMask ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (16) << mask.str ();
|
||||
flags << "U";
|
||||
if (route.IsHost ())
|
||||
{
|
||||
flags << "H";
|
||||
}
|
||||
else if (route.IsGateway ())
|
||||
{
|
||||
flags << "G";
|
||||
}
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (6) << flags.str ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (6) << route.GetMetric ();
|
||||
// Ref ct not implemented
|
||||
*os << "-" << " ";
|
||||
// Use not implemented
|
||||
*os << "-" << " ";
|
||||
if (Names::FindName (m_ipv4->GetNetDevice (route.GetInterface ())) != "")
|
||||
{
|
||||
*os << Names::FindName (m_ipv4->GetNetDevice (route.GetInterface ()));
|
||||
}
|
||||
else
|
||||
{
|
||||
*os << route.GetInterface ();
|
||||
}
|
||||
*os << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<Ipv4Route>
|
||||
Ipv4GlobalRoutingOneNexthop::RouteOutput (Ptr<Packet> p, const Ipv4Header &header,
|
||||
Ptr<NetDevice> oif, Socket::SocketErrno &sockerr)
|
||||
{
|
||||
//
|
||||
// First, see if this is a multicast packet we have a route for. If we
|
||||
// have a route, then send the packet down each of the specified interfaces.
|
||||
//
|
||||
if (header.GetDestination ().IsMulticast ())
|
||||
{
|
||||
NS_LOG_LOGIC ("Multicast destination-- returning false");
|
||||
return 0; // Let other routing protocols try to handle this
|
||||
}
|
||||
//
|
||||
// See if this is a unicast packet we have a route for.
|
||||
//
|
||||
NS_LOG_LOGIC ("Unicast destination- looking up");
|
||||
Ptr<Ipv4Route> rtentry = LookupGlobal (header.GetDestination (), oif);
|
||||
if (rtentry)
|
||||
{
|
||||
sockerr = Socket::ERROR_NOTERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
sockerr = Socket::ERROR_NOROUTETOHOST;
|
||||
}
|
||||
return rtentry;
|
||||
}
|
||||
|
||||
bool
|
||||
Ipv4GlobalRoutingOneNexthop::RouteInput (Ptr<const Packet> p, const Ipv4Header &header,
|
||||
Ptr<const NetDevice> idev,
|
||||
UnicastForwardCallback ucb, MulticastForwardCallback mcb,
|
||||
LocalDeliverCallback lcb, ErrorCallback ecb)
|
||||
{
|
||||
|
||||
NS_LOG_FUNCTION (this << p << header << header.GetSource () << header.GetDestination () << idev);
|
||||
// Check if input device supports IP
|
||||
NS_ASSERT (m_ipv4->GetInterfaceForDevice (idev) >= 0);
|
||||
uint32_t iif = m_ipv4->GetInterfaceForDevice (idev);
|
||||
|
||||
if (header.GetDestination ().IsMulticast ())
|
||||
{
|
||||
NS_LOG_LOGIC ("Multicast destination-- returning false");
|
||||
return false; // Let other routing protocols try to handle this
|
||||
}
|
||||
|
||||
if (header.GetDestination ().IsBroadcast ())
|
||||
{
|
||||
NS_LOG_LOGIC ("For me (Ipv4Addr broadcast address)");
|
||||
// TODO: Local Deliver for broadcast
|
||||
// TODO: Forward broadcast
|
||||
}
|
||||
|
||||
// TODO: Configurable option to enable RFC 1222 Strong End System Model
|
||||
// Right now, we will be permissive and allow a source to send us
|
||||
// a packet to one of our other interface addresses; that is, the
|
||||
// destination unicast address does not match one of the iif addresses,
|
||||
// but we check our other interfaces. This could be an option
|
||||
// (to remove the outer loop immediately below and just check iif).
|
||||
for (uint32_t j = 0; j < m_ipv4->GetNInterfaces (); j++)
|
||||
{
|
||||
for (uint32_t i = 0; i < m_ipv4->GetNAddresses (j); i++)
|
||||
{
|
||||
Ipv4InterfaceAddress iaddr = m_ipv4->GetAddress (j, i);
|
||||
Ipv4Address addr = iaddr.GetLocal ();
|
||||
if (addr.IsEqual (header.GetDestination ()))
|
||||
{
|
||||
if (j == iif)
|
||||
{
|
||||
NS_LOG_LOGIC ("For me (destination " << addr << " match)");
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_LOGIC ("For me (destination " << addr << " match) on another interface " << header.GetDestination ());
|
||||
}
|
||||
lcb (p, header, iif);
|
||||
return true;
|
||||
}
|
||||
if (header.GetDestination ().IsEqual (iaddr.GetBroadcast ()))
|
||||
{
|
||||
NS_LOG_LOGIC ("For me (interface broadcast address)");
|
||||
lcb (p, header, iif);
|
||||
return true;
|
||||
}
|
||||
NS_LOG_LOGIC ("Address "<< addr << " not a match");
|
||||
}
|
||||
}
|
||||
// Check if input device supports IP forwarding
|
||||
if (m_ipv4->IsForwarding (iif) == false)
|
||||
{
|
||||
NS_LOG_LOGIC ("Forwarding disabled for this interface");
|
||||
ecb (p, header, Socket::ERROR_NOROUTETOHOST);
|
||||
return false;
|
||||
}
|
||||
// Next, try to find a route
|
||||
NS_LOG_LOGIC ("Unicast destination- looking up global route");
|
||||
Ptr<Ipv4Route> rtentry = LookupGlobal (header.GetDestination ());
|
||||
if (rtentry != 0)
|
||||
{
|
||||
NS_LOG_LOGIC ("Found unicast destination- calling unicast callback");
|
||||
ucb (rtentry, p, header);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_LOGIC ("Did not find unicast destination- returning false");
|
||||
return false; // Let other routing protocols try to handle this
|
||||
// route request.
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Ipv4GlobalRoutingOneNexthop::GetNRoutes () const
|
||||
{
|
||||
return m_routes.size ();
|
||||
}
|
||||
|
||||
Ipv4RoutingTableEntry
|
||||
Ipv4GlobalRoutingOneNexthop::GetRoute (uint32_t i) const
|
||||
{
|
||||
uint32_t index = 0;
|
||||
for (Ipv4AddressTrieMap::const_iterator it = m_routes.begin ();
|
||||
index <= i && it != m_routes.end ();
|
||||
it++, index++)
|
||||
{
|
||||
if (index == i) return it->second;
|
||||
}
|
||||
NS_ASSERT (false);
|
||||
return Ipv4RoutingTableEntry ();
|
||||
}
|
||||
|
||||
|
||||
} // namespace ns3
|
||||
@@ -0,0 +1,83 @@
|
||||
// -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*-
|
||||
//
|
||||
// Copyright (c) 2008 University of Washington
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
// published by the Free Software Foundation;
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef IPV4_GLOBAL_ROUTING_ONE_NEXTHOP_H
|
||||
#define IPV4_GLOBAL_ROUTING_ONE_NEXTHOP_H
|
||||
|
||||
#include "ns3/ipv4-global-routing.h"
|
||||
#include "ns3/trie.h"
|
||||
#include "ns3/ipv4-routing-table-entry.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* \brief Global routing protocol for IP version 4 stacks.
|
||||
*
|
||||
* Each prefix entry stores a list of ordered by metric next-hops
|
||||
*
|
||||
* This class deals with Ipv4 unicast routes only.
|
||||
*
|
||||
* \see Ipv4GlobalRouting
|
||||
* \see Ipv4RoutingProtocol
|
||||
* \see GlobalRouteManager
|
||||
*/
|
||||
class Ipv4GlobalRoutingOneNexthop : public Ipv4GlobalRouting
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
Ipv4GlobalRoutingOneNexthop ();
|
||||
|
||||
// These methods inherited from base class
|
||||
// from Ipv4RoutingProtocol
|
||||
virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header,
|
||||
Ptr<NetDevice> oif, Socket::SocketErrno &sockerr);
|
||||
|
||||
virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
|
||||
UnicastForwardCallback ucb, MulticastForwardCallback mcb,
|
||||
LocalDeliverCallback lcb, ErrorCallback ecb);
|
||||
|
||||
virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
|
||||
|
||||
// from Ipv4GlobalRouting
|
||||
virtual void AddRouteTo (Ipv4Address dest,
|
||||
Ipv4Mask destMask,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface,
|
||||
uint32_t metric=0);
|
||||
|
||||
virtual void DeleteRoutes ();
|
||||
|
||||
uint32_t
|
||||
GetNRoutes () const;
|
||||
|
||||
Ipv4RoutingTableEntry
|
||||
GetRoute (uint32_t i) const;
|
||||
|
||||
protected:
|
||||
virtual Ptr<Ipv4Route> LookupGlobal (Ipv4Address dest, Ptr<NetDevice> oif = 0);
|
||||
|
||||
private:
|
||||
typedef Ipv4AddressTrie<Ipv4RoutingTableEntry> Ipv4AddressTrieMap;
|
||||
Ipv4AddressTrieMap m_routes;
|
||||
};
|
||||
|
||||
} // Namespace ns3
|
||||
|
||||
#endif /* IPV4_GLOBAL_ROUTING_ONE_NEXTHOP_H */
|
||||
@@ -16,19 +16,13 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
|
||||
#include <vector>
|
||||
#include <iomanip>
|
||||
#include "ns3/names.h"
|
||||
#include "ns3/log.h"
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/object.h"
|
||||
#include "ns3/packet.h"
|
||||
#include "ns3/net-device.h"
|
||||
#include "ns3/ipv4-route.h"
|
||||
#include "ns3/ipv4-routing-table-entry.h"
|
||||
#include "ns3/global-route-manager.h"
|
||||
#include "ns3/boolean.h"
|
||||
#include "ipv4-global-routing.h"
|
||||
#include "global-route-manager.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("Ipv4GlobalRouting");
|
||||
|
||||
@@ -40,14 +34,10 @@ TypeId
|
||||
Ipv4GlobalRouting::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::Ipv4GlobalRouting")
|
||||
.SetParent<Object> ()
|
||||
.AddAttribute ("RandomEcmpRouting",
|
||||
"Set to true if packets are randomly routed among ECMP; set to false for using only one route consistently",
|
||||
BooleanValue (false),
|
||||
MakeBooleanAccessor (&Ipv4GlobalRouting::m_randomEcmpRouting),
|
||||
MakeBooleanChecker ())
|
||||
.SetParent<Ipv4RoutingProtocol> ()
|
||||
.AddAttribute ("RespondToInterfaceEvents",
|
||||
"Set to true if you want to dynamically recompute the global routes upon Interface notification events (up/down, or add/remove address)",
|
||||
"Set to true if you want to dynamically recompute the global routes "
|
||||
"upon Interface notification events (up/down, or add/remove address)",
|
||||
BooleanValue (false),
|
||||
MakeBooleanAccessor (&Ipv4GlobalRouting::m_respondToInterfaceEvents),
|
||||
MakeBooleanChecker ())
|
||||
@@ -55,491 +45,11 @@ Ipv4GlobalRouting::GetTypeId (void)
|
||||
return tid;
|
||||
}
|
||||
|
||||
Ipv4GlobalRouting::Ipv4GlobalRouting ()
|
||||
: m_randomEcmpRouting (false),
|
||||
m_respondToInterfaceEvents (false)
|
||||
Ipv4GlobalRouting::Ipv4GlobalRouting ()
|
||||
: m_respondToInterfaceEvents (false)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
}
|
||||
|
||||
Ipv4GlobalRouting::~Ipv4GlobalRouting ()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4GlobalRouting::AddHostRouteTo (Ipv4Address dest,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface)
|
||||
{
|
||||
NS_LOG_FUNCTION (dest << nextHop << interface);
|
||||
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
|
||||
*route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, nextHop, interface);
|
||||
m_hostRoutes.push_back (route);
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4GlobalRouting::AddHostRouteTo (Ipv4Address dest,
|
||||
uint32_t interface)
|
||||
{
|
||||
NS_LOG_FUNCTION (dest << interface);
|
||||
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
|
||||
*route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, interface);
|
||||
m_hostRoutes.push_back (route);
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4GlobalRouting::AddNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface)
|
||||
{
|
||||
NS_LOG_FUNCTION (network << networkMask << nextHop << interface);
|
||||
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
|
||||
*route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
|
||||
networkMask,
|
||||
nextHop,
|
||||
interface);
|
||||
m_networkRoutes.push_back (route);
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4GlobalRouting::AddNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
uint32_t interface)
|
||||
{
|
||||
NS_LOG_FUNCTION (network << networkMask << interface);
|
||||
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
|
||||
*route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
|
||||
networkMask,
|
||||
interface);
|
||||
m_networkRoutes.push_back (route);
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4GlobalRouting::AddASExternalRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface)
|
||||
{
|
||||
NS_LOG_FUNCTION (network << networkMask << nextHop);
|
||||
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
|
||||
*route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
|
||||
networkMask,
|
||||
nextHop,
|
||||
interface);
|
||||
m_ASexternalRoutes.push_back (route);
|
||||
}
|
||||
|
||||
|
||||
Ptr<Ipv4Route>
|
||||
Ipv4GlobalRouting::LookupGlobal (Ipv4Address dest, Ptr<NetDevice> oif)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
NS_LOG_LOGIC ("Looking for route for destination " << dest);
|
||||
Ptr<Ipv4Route> rtentry = 0;
|
||||
// store all available routes that bring packets to their destination
|
||||
typedef std::vector<Ipv4RoutingTableEntry*> RouteVec_t;
|
||||
RouteVec_t allRoutes;
|
||||
|
||||
NS_LOG_LOGIC ("Number of m_hostRoutes = " << m_hostRoutes.size ());
|
||||
for (HostRoutesCI i = m_hostRoutes.begin ();
|
||||
i != m_hostRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
NS_ASSERT ((*i)->IsHost ());
|
||||
if ((*i)->GetDest ().IsEqual (dest))
|
||||
{
|
||||
if (oif != 0)
|
||||
{
|
||||
if (oif != m_ipv4->GetNetDevice ((*i)->GetInterface ()))
|
||||
{
|
||||
NS_LOG_LOGIC ("Not on requested interface, skipping");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
allRoutes.push_back (*i);
|
||||
NS_LOG_LOGIC (allRoutes.size () << "Found global host route" << *i);
|
||||
}
|
||||
}
|
||||
if (allRoutes.size () == 0) // if no host route is found
|
||||
{
|
||||
NS_LOG_LOGIC ("Number of m_networkRoutes" << m_networkRoutes.size ());
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j++)
|
||||
{
|
||||
Ipv4Mask mask = (*j)->GetDestNetworkMask ();
|
||||
Ipv4Address entry = (*j)->GetDestNetwork ();
|
||||
if (mask.IsMatch (dest, entry))
|
||||
{
|
||||
if (oif != 0)
|
||||
{
|
||||
if (oif != m_ipv4->GetNetDevice ((*j)->GetInterface ()))
|
||||
{
|
||||
NS_LOG_LOGIC ("Not on requested interface, skipping");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
allRoutes.push_back (*j);
|
||||
NS_LOG_LOGIC (allRoutes.size () << "Found global network route" << *j);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (allRoutes.size () == 0) // consider external if no host/network found
|
||||
{
|
||||
for (ASExternalRoutesI k = m_ASexternalRoutes.begin ();
|
||||
k != m_ASexternalRoutes.end ();
|
||||
k++)
|
||||
{
|
||||
Ipv4Mask mask = (*k)->GetDestNetworkMask ();
|
||||
Ipv4Address entry = (*k)->GetDestNetwork ();
|
||||
if (mask.IsMatch (dest, entry))
|
||||
{
|
||||
NS_LOG_LOGIC ("Found external route" << *k);
|
||||
if (oif != 0)
|
||||
{
|
||||
if (oif != m_ipv4->GetNetDevice ((*k)->GetInterface ()))
|
||||
{
|
||||
NS_LOG_LOGIC ("Not on requested interface, skipping");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
allRoutes.push_back (*k);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (allRoutes.size () > 0 ) // if route(s) is found
|
||||
{
|
||||
// pick up one of the routes uniformly at random if random
|
||||
// ECMP routing is enabled, or always select the first route
|
||||
// consistently if random ECMP routing is disabled
|
||||
uint32_t selectIndex;
|
||||
if (m_randomEcmpRouting)
|
||||
{
|
||||
selectIndex = m_rand.GetInteger (0, allRoutes.size ()-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
selectIndex = 0;
|
||||
}
|
||||
Ipv4RoutingTableEntry* route = allRoutes.at (selectIndex);
|
||||
// create a Ipv4Route object from the selected routing table entry
|
||||
rtentry = Create<Ipv4Route> ();
|
||||
rtentry->SetDestination (route->GetDest ());
|
||||
// XXX handle multi-address case
|
||||
rtentry->SetSource (m_ipv4->GetAddress (route->GetInterface (), 0).GetLocal ());
|
||||
rtentry->SetGateway (route->GetGateway ());
|
||||
uint32_t interfaceIdx = route->GetInterface ();
|
||||
rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx));
|
||||
return rtentry;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Ipv4GlobalRouting::GetNRoutes (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
uint32_t n = 0;
|
||||
n += m_hostRoutes.size ();
|
||||
n += m_networkRoutes.size ();
|
||||
n += m_ASexternalRoutes.size ();
|
||||
return n;
|
||||
}
|
||||
|
||||
Ipv4RoutingTableEntry *
|
||||
Ipv4GlobalRouting::GetRoute (uint32_t index) const
|
||||
{
|
||||
NS_LOG_FUNCTION (index);
|
||||
if (index < m_hostRoutes.size ())
|
||||
{
|
||||
uint32_t tmp = 0;
|
||||
for (HostRoutesCI i = m_hostRoutes.begin ();
|
||||
i != m_hostRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
return *i;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
}
|
||||
index -= m_hostRoutes.size ();
|
||||
uint32_t tmp = 0;
|
||||
if (index < m_networkRoutes.size ())
|
||||
{
|
||||
for (NetworkRoutesCI j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
return *j;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
}
|
||||
index -= m_networkRoutes.size ();
|
||||
tmp = 0;
|
||||
for (ASExternalRoutesCI k = m_ASexternalRoutes.begin ();
|
||||
k != m_ASexternalRoutes.end ();
|
||||
k++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
return *k;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
NS_ASSERT (false);
|
||||
// quiet compiler.
|
||||
return 0;
|
||||
}
|
||||
void
|
||||
Ipv4GlobalRouting::RemoveRoute (uint32_t index)
|
||||
{
|
||||
NS_LOG_FUNCTION (index);
|
||||
if (index < m_hostRoutes.size ())
|
||||
{
|
||||
uint32_t tmp = 0;
|
||||
for (HostRoutesI i = m_hostRoutes.begin ();
|
||||
i != m_hostRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_hostRoutes.size ());
|
||||
delete *i;
|
||||
m_hostRoutes.erase (i);
|
||||
NS_LOG_LOGIC ("Done removing host route " << index << "; host route remaining size = " << m_hostRoutes.size ());
|
||||
return;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
}
|
||||
index -= m_hostRoutes.size ();
|
||||
uint32_t tmp = 0;
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_networkRoutes.size ());
|
||||
delete *j;
|
||||
m_networkRoutes.erase (j);
|
||||
NS_LOG_LOGIC ("Done removing network route " << index << "; network route remaining size = " << m_networkRoutes.size ());
|
||||
return;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
index -= m_networkRoutes.size ();
|
||||
tmp = 0;
|
||||
for (ASExternalRoutesI k = m_ASexternalRoutes.begin ();
|
||||
k != m_ASexternalRoutes.end ();
|
||||
k++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_ASexternalRoutes.size ());
|
||||
delete *k;
|
||||
m_ASexternalRoutes.erase (k);
|
||||
NS_LOG_LOGIC ("Done removing network route " << index << "; network route remaining size = " << m_networkRoutes.size ());
|
||||
return;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
NS_ASSERT (false);
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4GlobalRouting::DoDispose (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
for (HostRoutesI i = m_hostRoutes.begin ();
|
||||
i != m_hostRoutes.end ();
|
||||
i = m_hostRoutes.erase (i))
|
||||
{
|
||||
delete (*i);
|
||||
}
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j = m_networkRoutes.erase (j))
|
||||
{
|
||||
delete (*j);
|
||||
}
|
||||
for (ASExternalRoutesI l = m_ASexternalRoutes.begin ();
|
||||
l != m_ASexternalRoutes.end ();
|
||||
l = m_ASexternalRoutes.erase (l))
|
||||
{
|
||||
delete (*l);
|
||||
}
|
||||
|
||||
Ipv4RoutingProtocol::DoDispose ();
|
||||
}
|
||||
|
||||
// Formatted like output of "route -n" command
|
||||
void
|
||||
Ipv4GlobalRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
|
||||
{
|
||||
std::ostream* os = stream->GetStream ();
|
||||
if (GetNRoutes () > 0)
|
||||
{
|
||||
*os << "Destination Gateway Genmask Flags Metric Ref Use Iface" << std::endl;
|
||||
for (uint32_t j = 0; j < GetNRoutes (); j++)
|
||||
{
|
||||
std::ostringstream dest, gw, mask, flags;
|
||||
Ipv4RoutingTableEntry route = GetRoute (j);
|
||||
dest << route.GetDest ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (16) << dest.str ();
|
||||
gw << route.GetGateway ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (16) << gw.str ();
|
||||
mask << route.GetDestNetworkMask ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (16) << mask.str ();
|
||||
flags << "U";
|
||||
if (route.IsHost ())
|
||||
{
|
||||
flags << "H";
|
||||
}
|
||||
else if (route.IsGateway ())
|
||||
{
|
||||
flags << "G";
|
||||
}
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (6) << flags.str ();
|
||||
// Metric not implemented
|
||||
*os << "-" << " ";
|
||||
// Ref ct not implemented
|
||||
*os << "-" << " ";
|
||||
// Use not implemented
|
||||
*os << "-" << " ";
|
||||
if (Names::FindName (m_ipv4->GetNetDevice (route.GetInterface ())) != "")
|
||||
{
|
||||
*os << Names::FindName (m_ipv4->GetNetDevice (route.GetInterface ()));
|
||||
}
|
||||
else
|
||||
{
|
||||
*os << route.GetInterface ();
|
||||
}
|
||||
*os << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<Ipv4Route>
|
||||
Ipv4GlobalRouting::RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr)
|
||||
{
|
||||
|
||||
//
|
||||
// First, see if this is a multicast packet we have a route for. If we
|
||||
// have a route, then send the packet down each of the specified interfaces.
|
||||
//
|
||||
if (header.GetDestination ().IsMulticast ())
|
||||
{
|
||||
NS_LOG_LOGIC ("Multicast destination-- returning false");
|
||||
return 0; // Let other routing protocols try to handle this
|
||||
}
|
||||
//
|
||||
// See if this is a unicast packet we have a route for.
|
||||
//
|
||||
NS_LOG_LOGIC ("Unicast destination- looking up");
|
||||
Ptr<Ipv4Route> rtentry = LookupGlobal (header.GetDestination (), oif);
|
||||
if (rtentry)
|
||||
{
|
||||
sockerr = Socket::ERROR_NOTERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
sockerr = Socket::ERROR_NOROUTETOHOST;
|
||||
}
|
||||
return rtentry;
|
||||
}
|
||||
|
||||
bool
|
||||
Ipv4GlobalRouting::RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb,
|
||||
LocalDeliverCallback lcb, ErrorCallback ecb)
|
||||
{
|
||||
|
||||
NS_LOG_FUNCTION (this << p << header << header.GetSource () << header.GetDestination () << idev);
|
||||
// Check if input device supports IP
|
||||
NS_ASSERT (m_ipv4->GetInterfaceForDevice (idev) >= 0);
|
||||
uint32_t iif = m_ipv4->GetInterfaceForDevice (idev);
|
||||
|
||||
if (header.GetDestination ().IsMulticast ())
|
||||
{
|
||||
NS_LOG_LOGIC ("Multicast destination-- returning false");
|
||||
return false; // Let other routing protocols try to handle this
|
||||
}
|
||||
|
||||
if (header.GetDestination ().IsBroadcast ())
|
||||
{
|
||||
NS_LOG_LOGIC ("For me (Ipv4Addr broadcast address)");
|
||||
// TODO: Local Deliver for broadcast
|
||||
// TODO: Forward broadcast
|
||||
}
|
||||
|
||||
// TODO: Configurable option to enable RFC 1222 Strong End System Model
|
||||
// Right now, we will be permissive and allow a source to send us
|
||||
// a packet to one of our other interface addresses; that is, the
|
||||
// destination unicast address does not match one of the iif addresses,
|
||||
// but we check our other interfaces. This could be an option
|
||||
// (to remove the outer loop immediately below and just check iif).
|
||||
for (uint32_t j = 0; j < m_ipv4->GetNInterfaces (); j++)
|
||||
{
|
||||
for (uint32_t i = 0; i < m_ipv4->GetNAddresses (j); i++)
|
||||
{
|
||||
Ipv4InterfaceAddress iaddr = m_ipv4->GetAddress (j, i);
|
||||
Ipv4Address addr = iaddr.GetLocal ();
|
||||
if (addr.IsEqual (header.GetDestination ()))
|
||||
{
|
||||
if (j == iif)
|
||||
{
|
||||
NS_LOG_LOGIC ("For me (destination " << addr << " match)");
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_LOGIC ("For me (destination " << addr << " match) on another interface " << header.GetDestination ());
|
||||
}
|
||||
lcb (p, header, iif);
|
||||
return true;
|
||||
}
|
||||
if (header.GetDestination ().IsEqual (iaddr.GetBroadcast ()))
|
||||
{
|
||||
NS_LOG_LOGIC ("For me (interface broadcast address)");
|
||||
lcb (p, header, iif);
|
||||
return true;
|
||||
}
|
||||
NS_LOG_LOGIC ("Address "<< addr << " not a match");
|
||||
}
|
||||
}
|
||||
// Check if input device supports IP forwarding
|
||||
if (m_ipv4->IsForwarding (iif) == false)
|
||||
{
|
||||
NS_LOG_LOGIC ("Forwarding disabled for this interface");
|
||||
ecb (p, header, Socket::ERROR_NOROUTETOHOST);
|
||||
return false;
|
||||
}
|
||||
// Next, try to find a route
|
||||
NS_LOG_LOGIC ("Unicast destination- looking up global route");
|
||||
Ptr<Ipv4Route> rtentry = LookupGlobal (header.GetDestination ());
|
||||
if (rtentry != 0)
|
||||
{
|
||||
NS_LOG_LOGIC ("Found unicast destination- calling unicast callback");
|
||||
ucb (rtentry, p, header);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_LOGIC ("Did not find unicast destination- returning false");
|
||||
return false; // Let other routing protocols try to handle this
|
||||
// route request.
|
||||
}
|
||||
}
|
||||
void
|
||||
Ipv4GlobalRouting::NotifyInterfaceUp (uint32_t i)
|
||||
{
|
||||
|
||||
@@ -20,26 +20,16 @@
|
||||
#ifndef IPV4_GLOBAL_ROUTING_H
|
||||
#define IPV4_GLOBAL_ROUTING_H
|
||||
|
||||
#include <list>
|
||||
#include <stdint.h>
|
||||
#include "ns3/ipv4-address.h"
|
||||
#include "ns3/ipv4-header.h"
|
||||
#include "ns3/ptr.h"
|
||||
#include "ns3/ipv4.h"
|
||||
#include "ns3/ipv4-routing-protocol.h"
|
||||
#include "ns3/random-variable.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class Packet;
|
||||
class NetDevice;
|
||||
class Ipv4Interface;
|
||||
class Ipv4Address;
|
||||
class Ipv4Header;
|
||||
class Ipv4RoutingTableEntry;
|
||||
class Ipv4MulticastRoutingTableEntry;
|
||||
class Node;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Global routing protocol for IP version 4 stacks.
|
||||
@@ -70,175 +60,45 @@ class Ipv4GlobalRouting : public Ipv4RoutingProtocol
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
/**
|
||||
* \brief Construct an empty Ipv4GlobalRouting routing protocol,
|
||||
*
|
||||
* The Ipv4GlobalRouting class supports host and network unicast routes.
|
||||
* This method initializes the lists containing these routes to empty.
|
||||
*
|
||||
* \see Ipv4GlobalRouting
|
||||
*/
|
||||
|
||||
Ipv4GlobalRouting ();
|
||||
virtual ~Ipv4GlobalRouting ();
|
||||
|
||||
// These methods inherited from base class
|
||||
virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr);
|
||||
|
||||
virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
|
||||
UnicastForwardCallback ucb, MulticastForwardCallback mcb,
|
||||
LocalDeliverCallback lcb, ErrorCallback ecb);
|
||||
virtual void NotifyInterfaceUp (uint32_t interface);
|
||||
virtual void NotifyInterfaceDown (uint32_t interface);
|
||||
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
|
||||
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
|
||||
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
|
||||
virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
|
||||
|
||||
/**
|
||||
* \brief Add a host route to the global routing table.
|
||||
* \brief Add a route to the global routing table.
|
||||
*
|
||||
* \param dest The Ipv4Address destination for this route.
|
||||
* \param destMask The Ipv4Mask to extract the network.
|
||||
* \param nextHop The Ipv4Address of the next hop in the route.
|
||||
* \param interface The network interface index used to send packets to the
|
||||
* destination.
|
||||
*
|
||||
* \see Ipv4Address
|
||||
*/
|
||||
void AddHostRouteTo (Ipv4Address dest,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface);
|
||||
/**
|
||||
* \brief Add a host route to the global routing table.
|
||||
*
|
||||
* \param dest The Ipv4Address destination for this route.
|
||||
* \param interface The network interface index used to send packets to the
|
||||
* destination.
|
||||
*
|
||||
* \see Ipv4Address
|
||||
*/
|
||||
void AddHostRouteTo (Ipv4Address dest,
|
||||
uint32_t interface);
|
||||
virtual void AddRouteTo (Ipv4Address dest,
|
||||
Ipv4Mask destMask,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface,
|
||||
uint32_t metric=0) = 0;
|
||||
|
||||
/**
|
||||
* \brief Add a network route to the global routing table.
|
||||
*
|
||||
* \param network The Ipv4Address network for this route.
|
||||
* \param networkMask The Ipv4Mask to extract the network.
|
||||
* \param nextHop The next hop in the route to the destination network.
|
||||
* \param interface The network interface index used to send packets to the
|
||||
* destination.
|
||||
*
|
||||
* \see Ipv4Address
|
||||
*/
|
||||
void AddNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface);
|
||||
|
||||
/**
|
||||
* \brief Add a network route to the global routing table.
|
||||
*
|
||||
* \param network The Ipv4Address network for this route.
|
||||
* \param networkMask The Ipv4Mask to extract the network.
|
||||
* \param interface The network interface index used to send packets to the
|
||||
* destination.
|
||||
*
|
||||
* \see Ipv4Address
|
||||
*/
|
||||
void AddNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
uint32_t interface);
|
||||
|
||||
/**
|
||||
* \brief Add an external route to the global routing table.
|
||||
*
|
||||
* \param network The Ipv4Address network for this route.
|
||||
* \param networkMask The Ipv4Mask to extract the network.
|
||||
* \param nextHop The next hop Ipv4Address
|
||||
* \param interface The network interface index used to send packets to the
|
||||
* destination.
|
||||
*/
|
||||
void AddASExternalRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface);
|
||||
|
||||
/**
|
||||
* \brief Get the number of individual unicast routes that have been added
|
||||
* to the routing table.
|
||||
*
|
||||
* \warning The default route counts as one of the routes.
|
||||
*/
|
||||
uint32_t GetNRoutes (void) const;
|
||||
|
||||
/**
|
||||
* \brief Get a route from the global unicast routing table.
|
||||
*
|
||||
* Externally, the unicast global routing table appears simply as a table with
|
||||
* n entries. The one subtlety of note is that if a default route has been set
|
||||
* it will appear as the zeroth entry in the table. This means that if you
|
||||
* add only a default route, the table will have one entry that can be accessed
|
||||
* either by explicitly calling GetDefaultRoute () or by calling GetRoute (0).
|
||||
*
|
||||
* Similarly, if the default route has been set, calling RemoveRoute (0) will
|
||||
* remove the default route.
|
||||
*
|
||||
* \param i The index (into the routing table) of the route to retrieve. If
|
||||
* the default route has been set, it will occupy index zero.
|
||||
* \return If route is set, a pointer to that Ipv4RoutingTableEntry is returned, otherwise
|
||||
* a zero pointer is returned.
|
||||
*
|
||||
* \see Ipv4RoutingTableEntry
|
||||
* \see Ipv4GlobalRouting::RemoveRoute
|
||||
*/
|
||||
Ipv4RoutingTableEntry *GetRoute (uint32_t i) const;
|
||||
|
||||
/**
|
||||
* \brief Remove a route from the global unicast routing table.
|
||||
*
|
||||
* Externally, the unicast global routing table appears simply as a table with
|
||||
* n entries. The one subtlety of note is that if a default route has been set
|
||||
* it will appear as the zeroth entry in the table. This means that if the
|
||||
* default route has been set, calling RemoveRoute (0) will remove the
|
||||
* default route.
|
||||
*
|
||||
* \param i The index (into the routing table) of the route to remove. If
|
||||
* the default route has been set, it will occupy index zero.
|
||||
*
|
||||
* \see Ipv4RoutingTableEntry
|
||||
* \see Ipv4GlobalRouting::GetRoute
|
||||
* \see Ipv4GlobalRouting::AddRoute
|
||||
*/
|
||||
void RemoveRoute (uint32_t i);
|
||||
/**
|
||||
* \brief Function to remove all routes
|
||||
*/
|
||||
virtual void DeleteRoutes () = 0;
|
||||
|
||||
protected:
|
||||
void DoDispose (void);
|
||||
// virtual Ptr<Ipv4Route> LookupGlobal (Ipv4Address dest, Ptr<NetDevice> oif = 0) = 0;
|
||||
|
||||
Ptr<Ipv4> m_ipv4;
|
||||
|
||||
private:
|
||||
/// Set to true if packets are randomly routed among ECMP; set to false for using only one route consistently
|
||||
bool m_randomEcmpRouting;
|
||||
/// Set to true if this interface should respond to interface events by globallly recomputing routes
|
||||
bool m_respondToInterfaceEvents;
|
||||
/// A uniform random number generator for randomly routing packets among ECMP
|
||||
UniformVariable m_rand;
|
||||
|
||||
typedef std::list<Ipv4RoutingTableEntry *> HostRoutes;
|
||||
typedef std::list<Ipv4RoutingTableEntry *>::const_iterator HostRoutesCI;
|
||||
typedef std::list<Ipv4RoutingTableEntry *>::iterator HostRoutesI;
|
||||
typedef std::list<Ipv4RoutingTableEntry *> NetworkRoutes;
|
||||
typedef std::list<Ipv4RoutingTableEntry *>::const_iterator NetworkRoutesCI;
|
||||
typedef std::list<Ipv4RoutingTableEntry *>::iterator NetworkRoutesI;
|
||||
typedef std::list<Ipv4RoutingTableEntry *> ASExternalRoutes;
|
||||
typedef std::list<Ipv4RoutingTableEntry *>::const_iterator ASExternalRoutesCI;
|
||||
typedef std::list<Ipv4RoutingTableEntry *>::iterator ASExternalRoutesI;
|
||||
|
||||
Ptr<Ipv4Route> LookupGlobal (Ipv4Address dest, Ptr<NetDevice> oif = 0);
|
||||
|
||||
HostRoutes m_hostRoutes;
|
||||
NetworkRoutes m_networkRoutes;
|
||||
ASExternalRoutes m_ASexternalRoutes; // External routes imported
|
||||
|
||||
Ptr<Ipv4> m_ipv4;
|
||||
};
|
||||
|
||||
} // Namespace ns3
|
||||
|
||||
@@ -547,11 +547,10 @@ Ipv4L3Protocol::Send (Ptr<Packet> packet,
|
||||
Ipv4Header ipHeader;
|
||||
bool mayFragment = true;
|
||||
uint8_t ttl = m_defaultTtl;
|
||||
SocketIpTtlTag tag;
|
||||
bool found = packet->RemovePacketTag (tag);
|
||||
if (found)
|
||||
Ptr<const SocketIpTtlTag> tag = packet->RemovePacketTag<SocketIpTtlTag> ();
|
||||
if (tag != 0)
|
||||
{
|
||||
ttl = tag.GetTtl ();
|
||||
ttl = tag->GetTtl ();
|
||||
}
|
||||
|
||||
// Handle a few cases:
|
||||
|
||||
@@ -320,9 +320,10 @@ Ipv4RawSocketImpl::ForwardUp (Ptr<const Packet> p, Ipv4Header ipHeader, Ptr<Ipv4
|
||||
// Should check via getsockopt ()..
|
||||
if (IsRecvPktInfo ())
|
||||
{
|
||||
Ipv4PacketInfoTag tag;
|
||||
copy->RemovePacketTag (tag);
|
||||
tag.SetRecvIf (incomingInterface->GetDevice ()->GetIfIndex ());
|
||||
Ptr<const Ipv4PacketInfoTag> origTag = copy->RemovePacketTag<Ipv4PacketInfoTag> ();
|
||||
NS_ASSERT (origTag != 0);
|
||||
Ptr<Ipv4PacketInfoTag> tag = CreateObject<Ipv4PacketInfoTag> (*origTag);
|
||||
tag->SetRecvIf (incomingInterface->GetDevice ()->GetIfIndex ());
|
||||
copy->AddPacketTag (tag);
|
||||
}
|
||||
if (m_protocol == 1)
|
||||
|
||||
@@ -35,7 +35,8 @@ Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4RoutingTableEntry const &route
|
||||
: m_dest (route.m_dest),
|
||||
m_destNetworkMask (route.m_destNetworkMask),
|
||||
m_gateway (route.m_gateway),
|
||||
m_interface (route.m_interface)
|
||||
m_interface (route.m_interface),
|
||||
m_metric (route.m_metric)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -43,44 +44,53 @@ Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4RoutingTableEntry const *route
|
||||
: m_dest (route->m_dest),
|
||||
m_destNetworkMask (route->m_destNetworkMask),
|
||||
m_gateway (route->m_gateway),
|
||||
m_interface (route->m_interface)
|
||||
m_interface (route->m_interface),
|
||||
m_metric (route->m_metric)
|
||||
{
|
||||
}
|
||||
|
||||
Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address dest,
|
||||
Ipv4Address gateway,
|
||||
uint32_t interface)
|
||||
uint32_t interface,
|
||||
uint32_t metric/*=0*/)
|
||||
: m_dest (dest),
|
||||
m_destNetworkMask (Ipv4Mask::GetOnes ()),
|
||||
m_gateway (gateway),
|
||||
m_interface (interface)
|
||||
m_interface (interface),
|
||||
m_metric (metric)
|
||||
{
|
||||
}
|
||||
Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address dest,
|
||||
uint32_t interface)
|
||||
uint32_t interface,
|
||||
uint32_t metric/*=0*/)
|
||||
: m_dest (dest),
|
||||
m_destNetworkMask (Ipv4Mask::GetOnes ()),
|
||||
m_gateway (Ipv4Address::GetZero ()),
|
||||
m_interface (interface)
|
||||
m_interface (interface),
|
||||
m_metric (metric)
|
||||
{
|
||||
}
|
||||
Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
Ipv4Address gateway,
|
||||
uint32_t interface)
|
||||
uint32_t interface,
|
||||
uint32_t metric/*=0*/)
|
||||
: m_dest (network),
|
||||
m_destNetworkMask (networkMask),
|
||||
m_gateway (gateway),
|
||||
m_interface (interface)
|
||||
m_interface (interface),
|
||||
m_metric (metric)
|
||||
{
|
||||
}
|
||||
Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
uint32_t interface)
|
||||
uint32_t interface,
|
||||
uint32_t metric/*=0*/)
|
||||
: m_dest (network),
|
||||
m_destNetworkMask (networkMask),
|
||||
m_gateway (Ipv4Address::GetZero ()),
|
||||
m_interface (interface)
|
||||
m_interface (interface),
|
||||
m_metric (metric)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -151,41 +161,58 @@ Ipv4RoutingTableEntry::GetInterface (void) const
|
||||
return m_interface;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Ipv4RoutingTableEntry::GetMetric () const
|
||||
{
|
||||
return m_metric;
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4RoutingTableEntry::SetMetric (uint32_t metric)
|
||||
{
|
||||
m_metric = metric;
|
||||
}
|
||||
|
||||
Ipv4RoutingTableEntry
|
||||
Ipv4RoutingTableEntry::CreateHostRouteTo (Ipv4Address dest,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface)
|
||||
uint32_t interface,
|
||||
uint32_t metric/*=0*/)
|
||||
{
|
||||
return Ipv4RoutingTableEntry (dest, nextHop, interface);
|
||||
return Ipv4RoutingTableEntry (dest, nextHop, interface, metric);
|
||||
}
|
||||
Ipv4RoutingTableEntry
|
||||
Ipv4RoutingTableEntry::CreateHostRouteTo (Ipv4Address dest,
|
||||
uint32_t interface)
|
||||
uint32_t interface,
|
||||
uint32_t metric/*=0*/)
|
||||
{
|
||||
return Ipv4RoutingTableEntry (dest, interface);
|
||||
return Ipv4RoutingTableEntry (dest, interface, metric);
|
||||
}
|
||||
Ipv4RoutingTableEntry
|
||||
Ipv4RoutingTableEntry::CreateNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface)
|
||||
uint32_t interface,
|
||||
uint32_t metric/*=0*/)
|
||||
{
|
||||
return Ipv4RoutingTableEntry (network, networkMask,
|
||||
nextHop, interface);
|
||||
nextHop, interface, metric);
|
||||
}
|
||||
Ipv4RoutingTableEntry
|
||||
Ipv4RoutingTableEntry::CreateNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
uint32_t interface)
|
||||
uint32_t interface,
|
||||
uint32_t metric/*=0*/)
|
||||
{
|
||||
return Ipv4RoutingTableEntry (network, networkMask,
|
||||
interface);
|
||||
interface, metric);
|
||||
}
|
||||
Ipv4RoutingTableEntry
|
||||
Ipv4RoutingTableEntry::CreateDefaultRoute (Ipv4Address nextHop,
|
||||
uint32_t interface)
|
||||
uint32_t interface,
|
||||
uint32_t metric/*=0*/)
|
||||
{
|
||||
return Ipv4RoutingTableEntry (Ipv4Address::GetZero (), nextHop, interface);
|
||||
return Ipv4RoutingTableEntry (Ipv4Address::GetZero (), nextHop, interface, metric);
|
||||
}
|
||||
|
||||
|
||||
@@ -216,20 +243,21 @@ std::ostream& operator<< (std::ostream& os, Ipv4RoutingTableEntry const& route)
|
||||
{
|
||||
os << "network=" << route.GetDestNetwork () <<
|
||||
", mask=" << route.GetDestNetworkMask () <<
|
||||
",out=" << route.GetInterface () <<
|
||||
", out=" << route.GetInterface () <<
|
||||
", next hop=" << route.GetGateway ();
|
||||
}
|
||||
else
|
||||
{
|
||||
os << "network=" << route.GetDestNetwork () <<
|
||||
", mask=" << route.GetDestNetworkMask () <<
|
||||
",out=" << route.GetInterface ();
|
||||
", out=" << route.GetInterface ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_ASSERT (false);
|
||||
}
|
||||
os << ", metric=" << route.GetMetric ();
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,15 @@ public:
|
||||
* \return The Ipv4 interface number used for sending outgoing packets
|
||||
*/
|
||||
uint32_t GetInterface (void) const;
|
||||
/**
|
||||
* \return Routing metric
|
||||
*/
|
||||
uint32_t GetMetric () const;
|
||||
/**
|
||||
* Set/Updates metric of the routing table entry
|
||||
*/
|
||||
void SetMetric (uint32_t metric);
|
||||
|
||||
/**
|
||||
* \return An Ipv4RoutingTableEntry object corresponding to the input parameters.
|
||||
* \param dest Ipv4Address of the destination
|
||||
@@ -96,14 +105,16 @@ public:
|
||||
*/
|
||||
static Ipv4RoutingTableEntry CreateHostRouteTo (Ipv4Address dest,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface);
|
||||
uint32_t interface,
|
||||
uint32_t metric=0);
|
||||
/**
|
||||
* \return An Ipv4RoutingTableEntry object corresponding to the input parameters.
|
||||
* \param dest Ipv4Address of the destination
|
||||
* \param interface Outgoing interface
|
||||
*/
|
||||
static Ipv4RoutingTableEntry CreateHostRouteTo (Ipv4Address dest,
|
||||
uint32_t interface);
|
||||
uint32_t interface,
|
||||
uint32_t metric=0);
|
||||
/**
|
||||
* \return An Ipv4RoutingTableEntry object corresponding to the input parameters.
|
||||
* \param network Ipv4Address of the destination network
|
||||
@@ -114,7 +125,8 @@ public:
|
||||
static Ipv4RoutingTableEntry CreateNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface);
|
||||
uint32_t interface,
|
||||
uint32_t metric=0);
|
||||
/**
|
||||
* \return An Ipv4RoutingTableEntry object corresponding to the input parameters.
|
||||
* \param network Ipv4Address of the destination network
|
||||
@@ -123,7 +135,8 @@ public:
|
||||
*/
|
||||
static Ipv4RoutingTableEntry CreateNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
uint32_t interface);
|
||||
uint32_t interface,
|
||||
uint32_t metric=0);
|
||||
/**
|
||||
* \return An Ipv4RoutingTableEntry object corresponding to the input
|
||||
* parameters. This route is distinguished; it will match any
|
||||
@@ -132,26 +145,32 @@ public:
|
||||
* \param interface Outgoing interface
|
||||
*/
|
||||
static Ipv4RoutingTableEntry CreateDefaultRoute (Ipv4Address nextHop,
|
||||
uint32_t interface);
|
||||
uint32_t interface,
|
||||
uint32_t metric=0);
|
||||
|
||||
private:
|
||||
Ipv4RoutingTableEntry (Ipv4Address network,
|
||||
Ipv4Mask mask,
|
||||
Ipv4Address gateway,
|
||||
uint32_t interface);
|
||||
uint32_t interface,
|
||||
uint32_t metric=0);
|
||||
Ipv4RoutingTableEntry (Ipv4Address dest,
|
||||
Ipv4Mask mask,
|
||||
uint32_t interface);
|
||||
uint32_t interface,
|
||||
uint32_t metric=0);
|
||||
Ipv4RoutingTableEntry (Ipv4Address dest,
|
||||
Ipv4Address gateway,
|
||||
uint32_t interface);
|
||||
uint32_t interface,
|
||||
uint32_t metric=0);
|
||||
Ipv4RoutingTableEntry (Ipv4Address dest,
|
||||
uint32_t interface);
|
||||
uint32_t interface,
|
||||
uint32_t metric=0);
|
||||
|
||||
Ipv4Address m_dest;
|
||||
Ipv4Mask m_destNetworkMask;
|
||||
Ipv4Address m_gateway;
|
||||
uint32_t m_interface;
|
||||
uint32_t m_metric;
|
||||
};
|
||||
|
||||
std::ostream& operator<< (std::ostream& os, Ipv4RoutingTableEntry const& route);
|
||||
|
||||
@@ -36,8 +36,6 @@
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("Ipv4StaticRouting");
|
||||
|
||||
using std::make_pair;
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (Ipv4StaticRouting);
|
||||
@@ -70,8 +68,9 @@ Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network,
|
||||
*route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
|
||||
networkMask,
|
||||
nextHop,
|
||||
interface);
|
||||
m_networkRoutes.push_back (make_pair (route,metric));
|
||||
interface,
|
||||
metric);
|
||||
m_networkRoutes.push_back (route);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -84,8 +83,9 @@ Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
|
||||
*route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
|
||||
networkMask,
|
||||
interface);
|
||||
m_networkRoutes.push_back (make_pair (route,metric));
|
||||
interface,
|
||||
metric);
|
||||
m_networkRoutes.push_back (route);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -142,7 +142,7 @@ Ipv4StaticRouting::SetDefaultMulticastRoute (uint32_t outputInterface)
|
||||
*route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
|
||||
networkMask,
|
||||
outputInterface);
|
||||
m_networkRoutes.push_back (make_pair (route,0));
|
||||
m_networkRoutes.push_back (route);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
@@ -162,7 +162,7 @@ Ipv4StaticRouting::GetMulticastRoute (uint32_t index) const
|
||||
if (index < m_multicastRoutes.size ())
|
||||
{
|
||||
uint32_t tmp = 0;
|
||||
for (MulticastRoutesCI i = m_multicastRoutes.begin ();
|
||||
for (MulticastRoutes::const_iterator i = m_multicastRoutes.begin ();
|
||||
i != m_multicastRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
@@ -182,7 +182,7 @@ Ipv4StaticRouting::RemoveMulticastRoute (Ipv4Address origin,
|
||||
uint32_t inputInterface)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << origin << " " << group << " " << inputInterface);
|
||||
for (MulticastRoutesI i = m_multicastRoutes.begin ();
|
||||
for (MulticastRoutes::iterator i = m_multicastRoutes.begin ();
|
||||
i != m_multicastRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
@@ -204,7 +204,7 @@ Ipv4StaticRouting::RemoveMulticastRoute (uint32_t index)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << index);
|
||||
uint32_t tmp = 0;
|
||||
for (MulticastRoutesI i = m_multicastRoutes.begin ();
|
||||
for (MulticastRoutes::iterator i = m_multicastRoutes.begin ();
|
||||
i != m_multicastRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
@@ -239,12 +239,12 @@ Ipv4StaticRouting::LookupStatic (Ipv4Address dest, Ptr<NetDevice> oif)
|
||||
}
|
||||
|
||||
|
||||
for (NetworkRoutesI i = m_networkRoutes.begin ();
|
||||
for (NetworkRoutes::iterator i = m_networkRoutes.begin ();
|
||||
i != m_networkRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
Ipv4RoutingTableEntry *j=i->first;
|
||||
uint32_t metric =i->second;
|
||||
Ipv4RoutingTableEntry *j=*i;
|
||||
uint32_t metric =j->GetMetric ();
|
||||
Ipv4Mask mask = (j)->GetDestNetworkMask ();
|
||||
uint16_t masklen = mask.GetPrefixLength ();
|
||||
Ipv4Address entry = (j)->GetDestNetwork ();
|
||||
@@ -305,7 +305,7 @@ Ipv4StaticRouting::LookupStatic (
|
||||
NS_LOG_FUNCTION (this << origin << " " << group << " " << interface);
|
||||
Ptr<Ipv4MulticastRoute> mrtentry = 0;
|
||||
|
||||
for (MulticastRoutesI i = m_multicastRoutes.begin ();
|
||||
for (MulticastRoutes::iterator i = m_multicastRoutes.begin ();
|
||||
i != m_multicastRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
@@ -363,13 +363,13 @@ Ipv4StaticRouting::GetDefaultRoute ()
|
||||
Ipv4Address dest ("0.0.0.0");
|
||||
uint32_t shortest_metric = 0xffffffff;
|
||||
Ipv4RoutingTableEntry *result = 0;
|
||||
for (NetworkRoutesI i = m_networkRoutes.begin ();
|
||||
for (NetworkRoutes::iterator i = m_networkRoutes.begin ();
|
||||
i != m_networkRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
Ipv4RoutingTableEntry *j = i->first;
|
||||
uint32_t metric = i->second;
|
||||
Ipv4Mask mask = (j)->GetDestNetworkMask ();
|
||||
Ipv4RoutingTableEntry *j = *i;
|
||||
uint32_t metric = j->GetMetric ();
|
||||
Ipv4Mask mask = j->GetDestNetworkMask ();
|
||||
uint16_t masklen = mask.GetPrefixLength ();
|
||||
if (masklen != 0)
|
||||
{
|
||||
@@ -397,13 +397,13 @@ Ipv4StaticRouting::GetRoute (uint32_t index) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << index);
|
||||
uint32_t tmp = 0;
|
||||
for (NetworkRoutesCI j = m_networkRoutes.begin ();
|
||||
for (NetworkRoutes::const_iterator j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
return j->first;
|
||||
return *j;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
@@ -417,13 +417,13 @@ Ipv4StaticRouting::GetMetric (uint32_t index) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << index);
|
||||
uint32_t tmp = 0;
|
||||
for (NetworkRoutesCI j = m_networkRoutes.begin ();
|
||||
for (NetworkRoutes::const_iterator j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
return j->second;
|
||||
return (*j)->GetMetric ();
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
@@ -436,13 +436,13 @@ Ipv4StaticRouting::RemoveRoute (uint32_t index)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << index);
|
||||
uint32_t tmp = 0;
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin ();
|
||||
for (NetworkRoutes::iterator j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
delete j->first;
|
||||
delete *j;
|
||||
m_networkRoutes.erase (j);
|
||||
return;
|
||||
}
|
||||
@@ -584,13 +584,13 @@ Ipv4StaticRouting::~Ipv4StaticRouting ()
|
||||
void
|
||||
Ipv4StaticRouting::DoDispose (void)
|
||||
{
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin ();
|
||||
for (NetworkRoutes::iterator j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j = m_networkRoutes.erase (j))
|
||||
{
|
||||
delete (j->first);
|
||||
delete *j;
|
||||
}
|
||||
for (MulticastRoutesI i = m_multicastRoutes.begin ();
|
||||
for (MulticastRoutes::iterator i = m_multicastRoutes.begin ();
|
||||
i != m_multicastRoutes.end ();
|
||||
i = m_multicastRoutes.erase (i))
|
||||
{
|
||||
@@ -708,15 +708,18 @@ Ipv4StaticRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
|
||||
if (GetNRoutes () > 0)
|
||||
{
|
||||
*os << "Destination Gateway Genmask Flags Metric Ref Use Iface" << std::endl;
|
||||
for (uint32_t j = 0; j < GetNRoutes (); j++)
|
||||
for (NetworkRoutes::const_iterator j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j++)
|
||||
{
|
||||
std::ostringstream dest, gw, mask, flags;
|
||||
Ipv4RoutingTableEntry route = GetRoute (j);
|
||||
dest << route.GetDest ();
|
||||
Ipv4RoutingTableEntry &route = *(*j);
|
||||
|
||||
dest << route.GetDest ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (16) << dest.str ();
|
||||
gw << route.GetGateway ();
|
||||
gw << route.GetGateway ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (16) << gw.str ();
|
||||
mask << route.GetDestNetworkMask ();
|
||||
mask << route.GetDestNetworkMask ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (16) << mask.str ();
|
||||
flags << "U";
|
||||
if (route.IsHost ())
|
||||
@@ -728,7 +731,7 @@ Ipv4StaticRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
|
||||
flags << "GS";
|
||||
}
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (6) << flags.str ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (7) << GetMetric (j);
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (6) << route.GetMetric ();
|
||||
// Ref ct not implemented
|
||||
*os << "-" << " ";
|
||||
// Use not implemented
|
||||
|
||||
@@ -375,13 +375,13 @@ protected:
|
||||
virtual void DoDispose (void);
|
||||
|
||||
private:
|
||||
typedef std::list<std::pair <Ipv4RoutingTableEntry *, uint32_t> > NetworkRoutes;
|
||||
typedef std::list<std::pair <Ipv4RoutingTableEntry *, uint32_t> >::const_iterator NetworkRoutesCI;
|
||||
typedef std::list<std::pair <Ipv4RoutingTableEntry *, uint32_t> >::iterator NetworkRoutesI;
|
||||
typedef std::list<Ipv4RoutingTableEntry *> NetworkRoutes;
|
||||
// typedef std::list<Ipv4RoutingTableEntry *>::const_iterator NetworkRoutesCI;
|
||||
// typedef std::list<Ipv4RoutingTableEntry *>::iterator NetworkRoutesI;
|
||||
|
||||
typedef std::list<Ipv4MulticastRoutingTableEntry *> MulticastRoutes;
|
||||
typedef std::list<Ipv4MulticastRoutingTableEntry *>::const_iterator MulticastRoutesCI;
|
||||
typedef std::list<Ipv4MulticastRoutingTableEntry *>::iterator MulticastRoutesI;
|
||||
// typedef std::list<Ipv4MulticastRoutingTableEntry *>::const_iterator MulticastRoutesCI;
|
||||
// typedef std::list<Ipv4MulticastRoutingTableEntry *>::iterator MulticastRoutesI;
|
||||
|
||||
Ptr<Ipv4Route> LookupStatic (Ipv4Address dest, Ptr<NetDevice> oif = 0);
|
||||
Ptr<Ipv4MulticastRoute> LookupStatic (Ipv4Address origin, Ipv4Address group,
|
||||
|
||||
@@ -610,12 +610,11 @@ void Ipv6L3Protocol::Send (Ptr<Packet> packet, Ipv6Address source, Ipv6Address d
|
||||
NS_LOG_FUNCTION (this << packet << source << destination << (uint32_t)protocol << route);
|
||||
Ipv6Header hdr;
|
||||
uint8_t ttl = m_defaultTtl;
|
||||
SocketIpTtlTag tag;
|
||||
bool found = packet->RemovePacketTag (tag);
|
||||
Ptr<const SocketIpTtlTag> tag = packet->RemovePacketTag<SocketIpTtlTag> ();
|
||||
|
||||
if (found)
|
||||
if (tag != 0)
|
||||
{
|
||||
ttl = tag.GetTtl ();
|
||||
ttl = tag->GetTtl ();
|
||||
}
|
||||
|
||||
/* Handle 3 cases:
|
||||
|
||||
@@ -340,9 +340,9 @@ bool Ipv6RawSocketImpl::ForwardUp (Ptr<const Packet> p, Ipv6Header hdr, Ptr<NetD
|
||||
// Should check via getsockopt ()..
|
||||
if (IsRecvPktInfo ())
|
||||
{
|
||||
Ipv6PacketInfoTag tag;
|
||||
copy->RemovePacketTag (tag);
|
||||
tag.SetRecvIf (device->GetIfIndex ());
|
||||
Ptr<const Ipv6PacketInfoTag> origTag = copy->RemovePacketTag<Ipv6PacketInfoTag> ();
|
||||
Ptr<Ipv6PacketInfoTag> tag = CreateObject<Ipv6PacketInfoTag> (*origTag);
|
||||
tag->SetRecvIf (device->GetIfIndex ());
|
||||
copy->AddPacketTag (tag);
|
||||
}
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ TcpSocketBase::Bind6 (void)
|
||||
{
|
||||
m_errno = ERROR_ADDRNOTAVAIL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
m_tcp->m_sockets.push_back (this);
|
||||
return SetupCallback ();
|
||||
}
|
||||
@@ -281,30 +281,30 @@ TcpSocketBase::Bind (const Address &address)
|
||||
NS_LOG_FUNCTION (this << address);
|
||||
if (InetSocketAddress::IsMatchingType (address))
|
||||
{
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
Ipv4Address ipv4 = transport.GetIpv4 ();
|
||||
uint16_t port = transport.GetPort ();
|
||||
if (ipv4 == Ipv4Address::GetAny () && port == 0)
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate ();
|
||||
}
|
||||
else if (ipv4 == Ipv4Address::GetAny () && port != 0)
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate (port);
|
||||
}
|
||||
else if (ipv4 != Ipv4Address::GetAny () && port == 0)
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate (ipv4);
|
||||
}
|
||||
else if (ipv4 != Ipv4Address::GetAny () && port != 0)
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate (ipv4, port);
|
||||
}
|
||||
if (0 == m_endPoint)
|
||||
{
|
||||
m_errno = port ? ERROR_ADDRINUSE : ERROR_ADDRNOTAVAIL;
|
||||
return -1;
|
||||
}
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
Ipv4Address ipv4 = transport.GetIpv4 ();
|
||||
uint16_t port = transport.GetPort ();
|
||||
if (ipv4 == Ipv4Address::GetAny () && port == 0)
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate ();
|
||||
}
|
||||
else if (ipv4 == Ipv4Address::GetAny () && port != 0)
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate (port);
|
||||
}
|
||||
else if (ipv4 != Ipv4Address::GetAny () && port == 0)
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate (ipv4);
|
||||
}
|
||||
else if (ipv4 != Ipv4Address::GetAny () && port != 0)
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate (ipv4, port);
|
||||
}
|
||||
if (0 == m_endPoint)
|
||||
{
|
||||
m_errno = port ? ERROR_ADDRINUSE : ERROR_ADDRNOTAVAIL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (Inet6SocketAddress::IsMatchingType (address))
|
||||
{
|
||||
@@ -353,24 +353,24 @@ TcpSocketBase::Connect (const Address & address)
|
||||
// If haven't do so, Bind() this socket first
|
||||
if (InetSocketAddress::IsMatchingType (address) && m_endPoint6 == 0)
|
||||
{
|
||||
if (m_endPoint == 0)
|
||||
if (m_endPoint == 0)
|
||||
{
|
||||
if (Bind () == -1)
|
||||
{
|
||||
if (Bind () == -1)
|
||||
{
|
||||
NS_ASSERT (m_endPoint == 0);
|
||||
return -1; // Bind() failed
|
||||
}
|
||||
NS_ASSERT (m_endPoint != 0);
|
||||
NS_ASSERT (m_endPoint == 0);
|
||||
return -1; // Bind() failed
|
||||
}
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
m_endPoint->SetPeer (transport.GetIpv4 (), transport.GetPort ());
|
||||
NS_ASSERT (m_endPoint != 0);
|
||||
}
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
m_endPoint->SetPeer (transport.GetIpv4 (), transport.GetPort ());
|
||||
m_endPoint6 = 0;
|
||||
|
||||
// Get the appropriate local address and port number from the routing protocol and set up endpoint
|
||||
if (SetupEndpoint () != 0)
|
||||
{ // Route to destination does not exist
|
||||
return -1;
|
||||
}
|
||||
// Get the appropriate local address and port number from the routing protocol and set up endpoint
|
||||
if (SetupEndpoint () != 0)
|
||||
{ // Route to destination does not exist
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (Inet6SocketAddress::IsMatchingType (address) && m_endPoint == 0)
|
||||
{
|
||||
@@ -381,7 +381,7 @@ TcpSocketBase::Connect (const Address & address)
|
||||
if (v6Addr.IsIpv4MappedAddress () == true)
|
||||
{
|
||||
Ipv4Address v4Addr = v6Addr.GetIpv4MappedAddress ();
|
||||
return Connect (InetSocketAddress (v4Addr, transport.GetPort ()));
|
||||
return Connect(InetSocketAddress(v4Addr, transport.GetPort ()));
|
||||
}
|
||||
|
||||
if (m_endPoint6 == 0)
|
||||
@@ -526,15 +526,16 @@ TcpSocketBase::Recv (uint32_t maxSize, uint32_t flags)
|
||||
Ptr<Packet> outPacket = m_rxBuffer.Extract (maxSize);
|
||||
if (outPacket != 0 && outPacket->GetSize () != 0)
|
||||
{
|
||||
SocketAddressTag tag;
|
||||
Ptr<SocketAddressTag> tag = CreateObject<SocketAddressTag> ();
|
||||
if (m_endPoint != 0)
|
||||
{
|
||||
tag.SetAddress (InetSocketAddress (m_endPoint->GetPeerAddress (), m_endPoint->GetPeerPort ()));
|
||||
tag->SetAddress (InetSocketAddress (m_endPoint->GetPeerAddress (), m_endPoint->GetPeerPort ()));
|
||||
}
|
||||
else if (m_endPoint6 != 0)
|
||||
{
|
||||
tag.SetAddress (Inet6SocketAddress (m_endPoint6->GetPeerAddress (), m_endPoint6->GetPeerPort ()));
|
||||
tag->SetAddress (Inet6SocketAddress (m_endPoint6->GetPeerAddress (), m_endPoint6->GetPeerPort ()));
|
||||
}
|
||||
|
||||
outPacket->AddPacketTag (tag);
|
||||
}
|
||||
return outPacket;
|
||||
@@ -621,7 +622,7 @@ TcpSocketBase::BindToNetDevice (Ptr<NetDevice> netdevice)
|
||||
|
||||
if (m_endPoint != 0)
|
||||
{
|
||||
m_endPoint->BindToNetDevice (netdevice);
|
||||
m_endPoint->BindToNetDevice (netdevice);
|
||||
}
|
||||
// No BindToNetDevice() for Ipv6EndPoint
|
||||
return;
|
||||
@@ -639,8 +640,8 @@ TcpSocketBase::SetupCallback (void)
|
||||
}
|
||||
if (m_endPoint != 0)
|
||||
{
|
||||
m_endPoint->SetRxCallback (MakeCallback (&TcpSocketBase::ForwardUp, Ptr<TcpSocketBase> (this)));
|
||||
m_endPoint->SetDestroyCallback (MakeCallback (&TcpSocketBase::Destroy, Ptr<TcpSocketBase> (this)));
|
||||
m_endPoint->SetRxCallback (MakeCallback (&TcpSocketBase::ForwardUp, Ptr<TcpSocketBase> (this)));
|
||||
m_endPoint->SetDestroyCallback (MakeCallback (&TcpSocketBase::Destroy, Ptr<TcpSocketBase> (this)));
|
||||
}
|
||||
if (m_endPoint6 != 0)
|
||||
{
|
||||
@@ -791,7 +792,7 @@ TcpSocketBase::DoForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port
|
||||
TcpHeader tcpHeader;
|
||||
packet->RemoveHeader (tcpHeader);
|
||||
if (tcpHeader.GetFlags () & TcpHeader::ACK)
|
||||
{
|
||||
{
|
||||
EstimateRtt (tcpHeader);
|
||||
}
|
||||
ReadOptions (tcpHeader);
|
||||
@@ -810,7 +811,7 @@ TcpSocketBase::DoForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port
|
||||
{
|
||||
NS_LOG_LOGIC ("At state " << TcpStateName[m_state] <<
|
||||
" received packet of seq [" << tcpHeader.GetSequenceNumber () <<
|
||||
":" << tcpHeader.GetSequenceNumber () + packet->GetSize () <<
|
||||
":" << tcpHeader.GetSequenceNumber () + packet->GetSize() <<
|
||||
") out of range [" << m_rxBuffer.NextRxSequence () << ":" <<
|
||||
m_rxBuffer.MaxRxSequence () << ")");
|
||||
// Acknowledgement should be sent for all unacceptable packets (RFC793, p.69)
|
||||
@@ -905,7 +906,7 @@ TcpSocketBase::DoForwardUp (Ptr<Packet> packet, Ipv6Address saddr, Ipv6Address d
|
||||
{
|
||||
NS_LOG_LOGIC ("At state " << TcpStateName[m_state] <<
|
||||
" received packet of seq [" << tcpHeader.GetSequenceNumber () <<
|
||||
":" << tcpHeader.GetSequenceNumber () + packet->GetSize () <<
|
||||
":" << tcpHeader.GetSequenceNumber () + packet->GetSize() <<
|
||||
") out of range [" << m_rxBuffer.NextRxSequence () << ":" <<
|
||||
m_rxBuffer.MaxRxSequence () << ")");
|
||||
// Acknowledgement should be sent for all unacceptable packets (RFC793, p.69)
|
||||
@@ -1130,7 +1131,7 @@ TcpSocketBase::ProcessSynSent (Ptr<Packet> packet, const TcpHeader& tcpHeader)
|
||||
{ // Other in-sequence input
|
||||
if (tcpflags != TcpHeader::RST)
|
||||
{ // When (1) rx of FIN+ACK; (2) rx of FIN; (3) rx of bad flags
|
||||
NS_LOG_LOGIC ("Illegal flag " << std::hex << static_cast<uint32_t> (tcpflags) << std::dec << " received. Reset packet is sent.");
|
||||
NS_LOG_LOGIC ("Illegal flag " << std::hex << static_cast<uint32_t>(tcpflags) << std::dec << " received. Reset packet is sent.");
|
||||
SendRST ();
|
||||
}
|
||||
CloseAndNotify ();
|
||||
@@ -1149,7 +1150,7 @@ TcpSocketBase::ProcessSynRcvd (Ptr<Packet> packet, const TcpHeader& tcpHeader,
|
||||
|
||||
if (tcpflags == 0
|
||||
|| (tcpflags == TcpHeader::ACK
|
||||
&& m_nextTxSequence + SequenceNumber32 (1) == tcpHeader.GetAckNumber ()))
|
||||
&& m_nextTxSequence + SequenceNumber32 (1) == tcpHeader.GetAckNumber ()))
|
||||
{ // If it is bare data, accept it and move to ESTABLISHED state. This is
|
||||
// possibly due to ACK lost in 3WHS. If in-sequence ACK is received, the
|
||||
// handshake is completed nicely.
|
||||
@@ -1161,8 +1162,8 @@ TcpSocketBase::ProcessSynRcvd (Ptr<Packet> packet, const TcpHeader& tcpHeader,
|
||||
m_txBuffer.SetHeadSequence (m_nextTxSequence);
|
||||
if (m_endPoint)
|
||||
{
|
||||
m_endPoint->SetPeer (InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (),
|
||||
InetSocketAddress::ConvertFrom (fromAddress).GetPort ());
|
||||
m_endPoint->SetPeer (InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (),
|
||||
InetSocketAddress::ConvertFrom (fromAddress).GetPort ());
|
||||
}
|
||||
else if (m_endPoint6)
|
||||
{
|
||||
@@ -1195,8 +1196,8 @@ TcpSocketBase::ProcessSynRcvd (Ptr<Packet> packet, const TcpHeader& tcpHeader,
|
||||
m_txBuffer.SetHeadSequence (m_nextTxSequence);
|
||||
if (m_endPoint)
|
||||
{
|
||||
m_endPoint->SetPeer (InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (),
|
||||
InetSocketAddress::ConvertFrom (fromAddress).GetPort ());
|
||||
m_endPoint->SetPeer (InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (),
|
||||
InetSocketAddress::ConvertFrom (fromAddress).GetPort ());
|
||||
}
|
||||
else if (m_endPoint6)
|
||||
{
|
||||
@@ -1213,8 +1214,8 @@ TcpSocketBase::ProcessSynRcvd (Ptr<Packet> packet, const TcpHeader& tcpHeader,
|
||||
NS_LOG_LOGIC ("Illegal flag " << tcpflags << " received. Reset packet is sent.");
|
||||
if (m_endPoint)
|
||||
{
|
||||
m_endPoint->SetPeer (InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (),
|
||||
InetSocketAddress::ConvertFrom (fromAddress).GetPort ());
|
||||
m_endPoint->SetPeer (InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (),
|
||||
InetSocketAddress::ConvertFrom (fromAddress).GetPort ());
|
||||
}
|
||||
else if (m_endPoint6)
|
||||
{
|
||||
@@ -1294,9 +1295,9 @@ TcpSocketBase::ProcessWait (Ptr<Packet> packet, const TcpHeader& tcpHeader)
|
||||
if (!m_shutdownRecv)
|
||||
{
|
||||
NotifyDataRecv ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Received a packet upon CLOSING */
|
||||
void
|
||||
@@ -1450,12 +1451,12 @@ TcpSocketBase::Destroy (void)
|
||||
m_endPoint = 0;
|
||||
if (m_tcp != 0)
|
||||
{
|
||||
std::vector<Ptr<TcpSocketBase> >::iterator it
|
||||
= std::find (m_tcp->m_sockets.begin (), m_tcp->m_sockets.end (), this);
|
||||
if (it != m_tcp->m_sockets.end ())
|
||||
{
|
||||
m_tcp->m_sockets.erase (it);
|
||||
}
|
||||
std::vector<Ptr<TcpSocketBase> >::iterator it
|
||||
= std::find (m_tcp->m_sockets.begin (), m_tcp->m_sockets.end (), this);
|
||||
if (it != m_tcp->m_sockets.end ())
|
||||
{
|
||||
m_tcp->m_sockets.erase (it);
|
||||
}
|
||||
}
|
||||
NS_LOG_LOGIC (this << " Cancelled ReTxTimeout event which was set to expire at " <<
|
||||
(Simulator::Now () + Simulator::GetDelayLeft (m_retxEvent)).GetSeconds ());
|
||||
@@ -1511,8 +1512,8 @@ TcpSocketBase::SendEmptyPacket (uint8_t flags)
|
||||
header.SetAckNumber (m_rxBuffer.NextRxSequence ());
|
||||
if (m_endPoint != 0)
|
||||
{
|
||||
header.SetSourcePort (m_endPoint->GetLocalPort ());
|
||||
header.SetDestinationPort (m_endPoint->GetPeerPort ());
|
||||
header.SetSourcePort (m_endPoint->GetLocalPort ());
|
||||
header.SetDestinationPort (m_endPoint->GetPeerPort ());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1601,7 +1602,7 @@ TcpSocketBase::DeallocateEndPoint (void)
|
||||
if (it != m_tcp->m_sockets.end ())
|
||||
{
|
||||
m_tcp->m_sockets.erase (it);
|
||||
}
|
||||
}
|
||||
CancelAllTimers ();
|
||||
}
|
||||
}
|
||||
@@ -1677,10 +1678,10 @@ TcpSocketBase::CompleteFork (Ptr<Packet> p, const TcpHeader& h,
|
||||
// Get port and address from peer (connecting host)
|
||||
if (InetSocketAddress::IsMatchingType (toAddress))
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate (InetSocketAddress::ConvertFrom (toAddress).GetIpv4 (),
|
||||
InetSocketAddress::ConvertFrom (toAddress).GetPort (),
|
||||
InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (),
|
||||
InetSocketAddress::ConvertFrom (fromAddress).GetPort ());
|
||||
m_endPoint = m_tcp->Allocate (InetSocketAddress::ConvertFrom (toAddress).GetIpv4 (),
|
||||
InetSocketAddress::ConvertFrom (toAddress).GetPort (),
|
||||
InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (),
|
||||
InetSocketAddress::ConvertFrom (fromAddress).GetPort ());
|
||||
m_endPoint6 = 0;
|
||||
}
|
||||
else if (Inet6SocketAddress::IsMatchingType (toAddress))
|
||||
@@ -1748,8 +1749,8 @@ TcpSocketBase::SendDataPacket (SequenceNumber32 seq, uint32_t maxSize, bool with
|
||||
header.SetAckNumber (m_rxBuffer.NextRxSequence ());
|
||||
if (m_endPoint)
|
||||
{
|
||||
header.SetSourcePort (m_endPoint->GetLocalPort ());
|
||||
header.SetDestinationPort (m_endPoint->GetPeerPort ());
|
||||
header.SetSourcePort (m_endPoint->GetLocalPort ());
|
||||
header.SetDestinationPort (m_endPoint->GetPeerPort ());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1769,8 +1770,8 @@ TcpSocketBase::SendDataPacket (SequenceNumber32 seq, uint32_t maxSize, bool with
|
||||
NS_LOG_LOGIC ("Send packet via TcpL4Protocol with flags 0x" << std::hex << static_cast<uint32_t> (flags) << std::dec);
|
||||
if (m_endPoint)
|
||||
{
|
||||
m_tcp->SendPacket (p, header, m_endPoint->GetLocalAddress (),
|
||||
m_endPoint->GetPeerAddress (), m_boundnetdevice);
|
||||
m_tcp->SendPacket (p, header, m_endPoint->GetLocalAddress (),
|
||||
m_endPoint->GetPeerAddress (), m_boundnetdevice);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2061,8 +2062,8 @@ TcpSocketBase::PersistTimeout ()
|
||||
tcpHeader.SetWindowSize (AdvertisedWindowSize ());
|
||||
if (m_endPoint != 0)
|
||||
{
|
||||
tcpHeader.SetSourcePort (m_endPoint->GetLocalPort ());
|
||||
tcpHeader.SetDestinationPort (m_endPoint->GetPeerPort ());
|
||||
tcpHeader.SetSourcePort (m_endPoint->GetLocalPort ());
|
||||
tcpHeader.SetDestinationPort (m_endPoint->GetPeerPort ());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2073,8 +2074,8 @@ TcpSocketBase::PersistTimeout ()
|
||||
|
||||
if (m_endPoint != 0)
|
||||
{
|
||||
m_tcp->SendPacket (p, tcpHeader, m_endPoint->GetLocalAddress (),
|
||||
m_endPoint->GetPeerAddress (), m_boundnetdevice);
|
||||
m_tcp->SendPacket (p, tcpHeader, m_endPoint->GetLocalAddress (),
|
||||
m_endPoint->GetPeerAddress (), m_boundnetdevice);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2149,7 +2150,7 @@ TcpSocketBase::TimeWait ()
|
||||
CancelAllTimers ();
|
||||
// Move from TIME_WAIT to CLOSED after 2*MSL. Max segment lifetime is 2 min
|
||||
// according to RFC793, p.28
|
||||
m_timewaitEvent = Simulator::Schedule (Seconds (2 * m_msl),
|
||||
m_timewaitEvent = Simulator::Schedule (Seconds (2*m_msl),
|
||||
&TcpSocketBase::CloseAndNotify, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -182,9 +182,9 @@ UdpSocketImpl::FinishBind (void)
|
||||
bool done = false;
|
||||
if (m_endPoint != 0)
|
||||
{
|
||||
m_endPoint->SetRxCallback (MakeCallback (&UdpSocketImpl::ForwardUp, Ptr<UdpSocketImpl> (this)));
|
||||
m_endPoint->SetIcmpCallback (MakeCallback (&UdpSocketImpl::ForwardIcmp, Ptr<UdpSocketImpl> (this)));
|
||||
m_endPoint->SetDestroyCallback (MakeCallback (&UdpSocketImpl::Destroy, Ptr<UdpSocketImpl> (this)));
|
||||
m_endPoint->SetRxCallback (MakeCallback (&UdpSocketImpl::ForwardUp, Ptr<UdpSocketImpl> (this)));
|
||||
m_endPoint->SetIcmpCallback (MakeCallback (&UdpSocketImpl::ForwardIcmp, Ptr<UdpSocketImpl> (this)));
|
||||
m_endPoint->SetDestroyCallback (MakeCallback (&UdpSocketImpl::Destroy, Ptr<UdpSocketImpl> (this)));
|
||||
done = true;
|
||||
}
|
||||
if (m_endPoint6 != 0)
|
||||
@@ -196,8 +196,8 @@ UdpSocketImpl::FinishBind (void)
|
||||
}
|
||||
if (done)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ UdpSocketImpl::Bind (void)
|
||||
return FinishBind ();
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
UdpSocketImpl::Bind6 (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
@@ -224,25 +224,25 @@ UdpSocketImpl::Bind (const Address &address)
|
||||
|
||||
if (InetSocketAddress::IsMatchingType (address))
|
||||
{
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
Ipv4Address ipv4 = transport.GetIpv4 ();
|
||||
uint16_t port = transport.GetPort ();
|
||||
if (ipv4 == Ipv4Address::GetAny () && port == 0)
|
||||
{
|
||||
m_endPoint = m_udp->Allocate ();
|
||||
}
|
||||
else if (ipv4 == Ipv4Address::GetAny () && port != 0)
|
||||
{
|
||||
m_endPoint = m_udp->Allocate (port);
|
||||
}
|
||||
else if (ipv4 != Ipv4Address::GetAny () && port == 0)
|
||||
{
|
||||
m_endPoint = m_udp->Allocate (ipv4);
|
||||
}
|
||||
else if (ipv4 != Ipv4Address::GetAny () && port != 0)
|
||||
{
|
||||
m_endPoint = m_udp->Allocate (ipv4, port);
|
||||
}
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
Ipv4Address ipv4 = transport.GetIpv4 ();
|
||||
uint16_t port = transport.GetPort ();
|
||||
if (ipv4 == Ipv4Address::GetAny () && port == 0)
|
||||
{
|
||||
m_endPoint = m_udp->Allocate ();
|
||||
}
|
||||
else if (ipv4 == Ipv4Address::GetAny () && port != 0)
|
||||
{
|
||||
m_endPoint = m_udp->Allocate (port);
|
||||
}
|
||||
else if (ipv4 != Ipv4Address::GetAny () && port == 0)
|
||||
{
|
||||
m_endPoint = m_udp->Allocate (ipv4);
|
||||
}
|
||||
else if (ipv4 != Ipv4Address::GetAny () && port != 0)
|
||||
{
|
||||
m_endPoint = m_udp->Allocate (ipv4, port);
|
||||
}
|
||||
}
|
||||
else if (Inet6SocketAddress::IsMatchingType (address))
|
||||
{
|
||||
@@ -312,11 +312,11 @@ UdpSocketImpl::Connect (const Address & address)
|
||||
NS_LOG_FUNCTION (this << address);
|
||||
if (InetSocketAddress::IsMatchingType(address) == true)
|
||||
{
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
m_defaultAddress = Address(transport.GetIpv4 ());
|
||||
m_defaultPort = transport.GetPort ();
|
||||
m_connected = true;
|
||||
NotifyConnectionSucceeded ();
|
||||
m_defaultPort = transport.GetPort ();
|
||||
m_connected = true;
|
||||
NotifyConnectionSucceeded ();
|
||||
}
|
||||
else if (Inet6SocketAddress::IsMatchingType(address) == true)
|
||||
{
|
||||
@@ -395,11 +395,11 @@ UdpSocketImpl::DoSendTo (Ptr<Packet> p, const Address &address)
|
||||
NS_LOG_LOGIC ("Not connected");
|
||||
if (InetSocketAddress::IsMatchingType(address) == true)
|
||||
{
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
Ipv4Address ipv4 = transport.GetIpv4 ();
|
||||
uint16_t port = transport.GetPort ();
|
||||
return DoSendTo (p, ipv4, port);
|
||||
}
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
Ipv4Address ipv4 = transport.GetIpv4 ();
|
||||
uint16_t port = transport.GetPort ();
|
||||
return DoSendTo (p, ipv4, port);
|
||||
}
|
||||
else if (Inet6SocketAddress::IsMatchingType(address) == true)
|
||||
{
|
||||
Inet6SocketAddress transport = Inet6SocketAddress::ConvertFrom (address);
|
||||
@@ -407,8 +407,8 @@ UdpSocketImpl::DoSendTo (Ptr<Packet> p, const Address &address)
|
||||
uint16_t port = transport.GetPort ();
|
||||
return DoSendTo (p, ipv6, port);
|
||||
}
|
||||
else
|
||||
{
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -419,11 +419,11 @@ UdpSocketImpl::DoSendTo (Ptr<Packet> p, const Address &address)
|
||||
if (Ipv4Address::IsMatchingType(m_defaultAddress))
|
||||
{
|
||||
return DoSendTo (p, Ipv4Address::ConvertFrom(m_defaultAddress), m_defaultPort);
|
||||
}
|
||||
}
|
||||
else if (Ipv6Address::IsMatchingType(m_defaultAddress))
|
||||
{
|
||||
return DoSendTo (p, Ipv6Address::ConvertFrom(m_defaultAddress), m_defaultPort);
|
||||
}
|
||||
}
|
||||
}
|
||||
m_errno = ERROR_AFNOSUPPORT;
|
||||
return(-1);
|
||||
@@ -470,28 +470,29 @@ UdpSocketImpl::DoSendTo (Ptr<Packet> p, Ipv4Address dest, uint16_t port)
|
||||
// the same as a unicast, but it will be fixed further down the stack
|
||||
if (m_ipMulticastTtl != 0 && dest.IsMulticast ())
|
||||
{
|
||||
SocketIpTtlTag tag;
|
||||
tag.SetTtl (m_ipMulticastTtl);
|
||||
Ptr<SocketIpTtlTag> tag = CreateObject<SocketIpTtlTag> ();
|
||||
tag->SetTtl (m_ipMulticastTtl);
|
||||
p->AddPacketTag (tag);
|
||||
}
|
||||
else if (m_ipTtl != 0 && !dest.IsMulticast () && !dest.IsBroadcast ())
|
||||
{
|
||||
SocketIpTtlTag tag;
|
||||
tag.SetTtl (m_ipTtl);
|
||||
Ptr<SocketIpTtlTag> tag = CreateObject<SocketIpTtlTag> ();
|
||||
tag->SetTtl (m_ipTtl);
|
||||
p->AddPacketTag (tag);
|
||||
}
|
||||
{
|
||||
SocketSetDontFragmentTag tag;
|
||||
bool found = p->RemovePacketTag (tag);
|
||||
if (!found)
|
||||
|
||||
// !!! Previously, header was removed, checked, but never added back. Guess, this was wrong
|
||||
if (p->PeekPacketTag<SocketSetDontFragmentTag> () == 0)
|
||||
{
|
||||
Ptr<SocketSetDontFragmentTag> tag = CreateObject<SocketSetDontFragmentTag> ();
|
||||
if (m_mtuDiscover)
|
||||
{
|
||||
tag.Enable ();
|
||||
tag->Enable ();
|
||||
}
|
||||
else
|
||||
{
|
||||
tag.Disable ();
|
||||
tag->Disable ();
|
||||
}
|
||||
p->AddPacketTag (tag);
|
||||
}
|
||||
@@ -658,14 +659,14 @@ UdpSocketImpl::DoSendTo (Ptr<Packet> p, Ipv6Address dest, uint16_t port)
|
||||
// the same as a unicast, but it will be fixed further down the stack
|
||||
if (m_ipMulticastTtl != 0 && dest.IsMulticast ())
|
||||
{
|
||||
SocketIpTtlTag tag;
|
||||
tag.SetTtl (m_ipMulticastTtl);
|
||||
Ptr<SocketIpTtlTag> tag = CreateObject<SocketIpTtlTag> ();
|
||||
tag->SetTtl (m_ipMulticastTtl);
|
||||
p->AddPacketTag (tag);
|
||||
}
|
||||
else if (m_ipTtl != 0 && !dest.IsMulticast ())
|
||||
{
|
||||
SocketIpTtlTag tag;
|
||||
tag.SetTtl (m_ipTtl);
|
||||
Ptr<SocketIpTtlTag> tag = CreateObject<SocketIpTtlTag> ();
|
||||
tag->SetTtl (m_ipTtl);
|
||||
p->AddPacketTag (tag);
|
||||
}
|
||||
// There is no analgous to an IPv4 broadcast address in IPv6.
|
||||
@@ -736,11 +737,11 @@ UdpSocketImpl::SendTo (Ptr<Packet> p, uint32_t flags, const Address &address)
|
||||
NS_LOG_FUNCTION (this << p << flags << address);
|
||||
if (InetSocketAddress::IsMatchingType (address))
|
||||
{
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
Ipv4Address ipv4 = transport.GetIpv4 ();
|
||||
uint16_t port = transport.GetPort ();
|
||||
return DoSendTo (p, ipv4, port);
|
||||
}
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
Ipv4Address ipv4 = transport.GetIpv4 ();
|
||||
uint16_t port = transport.GetPort ();
|
||||
return DoSendTo (p, ipv4, port);
|
||||
}
|
||||
else if (Inet6SocketAddress::IsMatchingType (address))
|
||||
{
|
||||
Inet6SocketAddress transport = Inet6SocketAddress::ConvertFrom (address);
|
||||
@@ -790,11 +791,9 @@ UdpSocketImpl::RecvFrom (uint32_t maxSize, uint32_t flags,
|
||||
Ptr<Packet> packet = Recv (maxSize, flags);
|
||||
if (packet != 0)
|
||||
{
|
||||
SocketAddressTag tag;
|
||||
bool found;
|
||||
found = packet->PeekPacketTag (tag);
|
||||
NS_ASSERT (found);
|
||||
fromAddress = tag.GetAddress ();
|
||||
Ptr<const SocketAddressTag> tag = packet->PeekPacketTag<SocketAddressTag> ();
|
||||
NS_ASSERT (tag != 0);
|
||||
fromAddress = tag->GetAddress ();
|
||||
}
|
||||
return packet;
|
||||
}
|
||||
@@ -876,17 +875,17 @@ UdpSocketImpl::ForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port,
|
||||
// Should check via getsockopt ()..
|
||||
if (IsRecvPktInfo ())
|
||||
{
|
||||
Ipv4PacketInfoTag tag;
|
||||
packet->RemovePacketTag (tag);
|
||||
tag.SetRecvIf (incomingInterface->GetDevice ()->GetIfIndex ());
|
||||
Ptr<const Ipv4PacketInfoTag> origTag = packet->RemovePacketTag<Ipv4PacketInfoTag> ();
|
||||
Ptr<Ipv4PacketInfoTag> tag = CreateObject<Ipv4PacketInfoTag> (*origTag);
|
||||
tag->SetRecvIf (incomingInterface->GetDevice ()->GetIfIndex ());
|
||||
packet->AddPacketTag (tag);
|
||||
}
|
||||
|
||||
if ((m_rxAvailable + packet->GetSize ()) <= m_rcvBufSize)
|
||||
{
|
||||
Address address = InetSocketAddress (header.GetSource (), port);
|
||||
SocketAddressTag tag;
|
||||
tag.SetAddress (address);
|
||||
Ptr<SocketAddressTag> tag = CreateObject<SocketAddressTag> ();
|
||||
tag->SetAddress (address);
|
||||
packet->AddPacketTag (tag);
|
||||
m_deliveryQueue.push (packet);
|
||||
m_rxAvailable += packet->GetSize ();
|
||||
@@ -904,7 +903,7 @@ UdpSocketImpl::ForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
UdpSocketImpl::ForwardUp6 (Ptr<Packet> packet, Ipv6Address saddr, Ipv6Address daddr, uint16_t port)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << packet << saddr << port);
|
||||
@@ -917,8 +916,8 @@ UdpSocketImpl::ForwardUp6 (Ptr<Packet> packet, Ipv6Address saddr, Ipv6Address da
|
||||
if ((m_rxAvailable + packet->GetSize ()) <= m_rcvBufSize)
|
||||
{
|
||||
Address address = Inet6SocketAddress (saddr, port);
|
||||
SocketAddressTag tag;
|
||||
tag.SetAddress (address);
|
||||
Ptr<SocketAddressTag> tag = CreateObject<SocketAddressTag> ();
|
||||
tag->SetAddress (address);
|
||||
packet->AddPacketTag (tag);
|
||||
m_deliveryQueue.push (packet);
|
||||
m_rxAvailable += packet->GetSize ();
|
||||
|
||||
@@ -97,10 +97,8 @@ Ipv4PacketInfoTagTest::RxCb (Ptr<Socket> socket)
|
||||
m_receivedPacket = socket->Recv (std::numeric_limits<uint32_t>::max (), 0);
|
||||
NS_TEST_ASSERT_MSG_EQ (availableData, m_receivedPacket->GetSize (), "Did not read expected data");
|
||||
|
||||
Ipv4PacketInfoTag tag;
|
||||
bool found;
|
||||
found = m_receivedPacket->RemovePacketTag (tag);
|
||||
NS_TEST_ASSERT_MSG_EQ (found, true, "Could not find tag");
|
||||
Ptr<const Ipv4PacketInfoTag> tag = m_receivedPacket->RemovePacketTag<Ipv4PacketInfoTag> ();
|
||||
NS_TEST_ASSERT_MSG_NE (tag, 0, "Could not find tag");
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -93,10 +93,8 @@ Ipv6PacketInfoTagTest::RxCb (Ptr<Socket> socket)
|
||||
m_receivedPacket = socket->Recv (std::numeric_limits<uint32_t>::max (), 0);
|
||||
NS_TEST_ASSERT_MSG_EQ (availableData, m_receivedPacket->GetSize (), "Did not read expected data");
|
||||
|
||||
Ipv6PacketInfoTag tag;
|
||||
bool found;
|
||||
found = m_receivedPacket->RemovePacketTag (tag);
|
||||
NS_TEST_ASSERT_MSG_EQ (found, true, "Could not find tag");
|
||||
Ptr<const Ipv6PacketInfoTag> tag = m_receivedPacket->RemovePacketTag<Ipv6PacketInfoTag> ();
|
||||
NS_TEST_ASSERT_MSG_NE (tag, 0, "Could not find tag");
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -93,6 +93,7 @@ def configure(conf):
|
||||
def build(bld):
|
||||
# bridge and mpi dependencies are due to global routing
|
||||
obj = bld.create_ns3_module('internet', ['bridge', 'mpi', 'network', 'core'])
|
||||
|
||||
obj.source = [
|
||||
'model/ip-l4-protocol.cc',
|
||||
'model/udp-header.cc',
|
||||
@@ -173,6 +174,7 @@ def build(bld):
|
||||
'model/global-route-manager-impl.cc',
|
||||
'model/candidate-queue.cc',
|
||||
'model/ipv4-global-routing.cc',
|
||||
'model/ipv4-global-routing-one-nexthop.cc',
|
||||
'helper/ipv4-global-routing-helper.cc',
|
||||
'helper/internet-stack-helper.cc',
|
||||
'helper/internet-trace-helper.cc',
|
||||
@@ -270,6 +272,7 @@ def build(bld):
|
||||
'model/global-route-manager-impl.h',
|
||||
'model/candidate-queue.h',
|
||||
'model/ipv4-global-routing.h',
|
||||
'model/ipv4-global-routing-one-nexthop.h',
|
||||
'helper/ipv4-global-routing-helper.h',
|
||||
'helper/internet-stack-helper.h',
|
||||
'helper/internet-trace-helper.h',
|
||||
|
||||
@@ -55,8 +55,7 @@ HwmpProtocolMac::ReceiveData (Ptr<Packet> packet, const WifiMacHeader & header)
|
||||
NS_ASSERT (header.IsData ());
|
||||
|
||||
MeshHeader meshHdr;
|
||||
HwmpTag tag;
|
||||
if (packet->PeekPacketTag (tag))
|
||||
if (packet->PeekPacketTag<HwmpTag> () != 0)
|
||||
{
|
||||
NS_FATAL_ERROR ("HWMP tag is not supposed to be received by network");
|
||||
}
|
||||
@@ -78,8 +77,9 @@ HwmpProtocolMac::ReceiveData (Ptr<Packet> packet, const WifiMacHeader & header)
|
||||
NS_FATAL_ERROR (
|
||||
"6-address scheme is not yet supported and 4-address extension is not supposed to be used for data frames.");
|
||||
}
|
||||
tag.SetSeqno (meshHdr.GetMeshSeqno ());
|
||||
tag.SetTtl (meshHdr.GetMeshTtl ());
|
||||
Ptr<HwmpTag> tag = CreateObject<HwmpTag> ();
|
||||
tag->SetSeqno (meshHdr.GetMeshSeqno ());
|
||||
tag->SetTtl (meshHdr.GetMeshTtl ());
|
||||
packet->AddPacketTag (tag);
|
||||
|
||||
if ((destination == Mac48Address::GetBroadcast ()) && (m_protocol->DropDataFrame (meshHdr.GetMeshSeqno (),
|
||||
@@ -188,19 +188,18 @@ HwmpProtocolMac::UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & heade
|
||||
{
|
||||
return true;
|
||||
}
|
||||
HwmpTag tag;
|
||||
bool tagExists = packet->RemovePacketTag (tag);
|
||||
if (!tagExists)
|
||||
Ptr<const HwmpTag> tag = packet->RemovePacketTag<HwmpTag> ();
|
||||
if (tag == 0)
|
||||
{
|
||||
NS_FATAL_ERROR ("HWMP tag must exist at this point");
|
||||
}
|
||||
m_stats.txData++;
|
||||
m_stats.txDataBytes += packet->GetSize ();
|
||||
MeshHeader meshHdr;
|
||||
meshHdr.SetMeshSeqno (tag.GetSeqno ());
|
||||
meshHdr.SetMeshTtl (tag.GetTtl ());
|
||||
meshHdr.SetMeshSeqno (tag->GetSeqno ());
|
||||
meshHdr.SetMeshTtl (tag->GetTtl ());
|
||||
packet->AddHeader (meshHdr);
|
||||
header.SetAddr1 (tag.GetAddress ());
|
||||
header.SetAddr1 (tag->GetAddress ());
|
||||
return true;
|
||||
}
|
||||
WifiActionHeader
|
||||
|
||||
@@ -233,29 +233,32 @@ HwmpProtocol::RequestRoute (
|
||||
)
|
||||
{
|
||||
Ptr <Packet> packet = constPacket->Copy ();
|
||||
HwmpTag tag;
|
||||
Ptr<HwmpTag> tag = 0;
|
||||
if (sourceIface == GetMeshPoint ()->GetIfIndex ())
|
||||
{
|
||||
// packet from level 3
|
||||
if (packet->PeekPacketTag (tag))
|
||||
if (packet->PeekPacketTag<HwmpTag> () != 0)
|
||||
{
|
||||
NS_FATAL_ERROR ("HWMP tag has come with a packet from upper layer. This must not occur...");
|
||||
}
|
||||
tag = CreateObject<HwmpTag> ();
|
||||
//Filling TAG:
|
||||
if (destination == Mac48Address::GetBroadcast ())
|
||||
{
|
||||
tag.SetSeqno (m_dataSeqno++);
|
||||
tag->SetSeqno (m_dataSeqno++);
|
||||
}
|
||||
tag.SetTtl (m_maxTtl);
|
||||
tag->SetTtl (m_maxTtl);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!packet->RemovePacketTag (tag))
|
||||
Ptr<const HwmpTag> origTag = packet->RemovePacketTag<HwmpTag> ();
|
||||
if (!packet->RemovePacketTag<HwmpTag> ())
|
||||
{
|
||||
NS_FATAL_ERROR ("HWMP tag is supposed to be here at this point.");
|
||||
}
|
||||
tag.DecrementTtl ();
|
||||
if (tag.GetTtl () == 0)
|
||||
tag = CreateObject<HwmpTag> (*origTag);
|
||||
tag->DecrementTtl ();
|
||||
if (tag->GetTtl () == 0)
|
||||
{
|
||||
m_stats.droppedTtl++;
|
||||
return false;
|
||||
@@ -287,11 +290,11 @@ HwmpProtocol::RequestRoute (
|
||||
{
|
||||
Ptr<Packet> packetCopy = packet->Copy ();
|
||||
//
|
||||
// 64-bit Intel valgrind complains about tag.SetAddress (*i). It
|
||||
// 64-bit Intel valgrind complains about tag->SetAddress (*i). It
|
||||
// likes this just fine.
|
||||
//
|
||||
Mac48Address address = *i;
|
||||
tag.SetAddress (address);
|
||||
tag->SetAddress (address);
|
||||
packetCopy->AddPacketTag (tag);
|
||||
routeReply (true, packetCopy, source, destination, protocolType, plugin->first);
|
||||
}
|
||||
@@ -299,7 +302,7 @@ HwmpProtocol::RequestRoute (
|
||||
}
|
||||
else
|
||||
{
|
||||
return ForwardUnicast (sourceIface, source, destination, packet, protocolType, routeReply, tag.GetTtl ());
|
||||
return ForwardUnicast (sourceIface, source, destination, packet, protocolType, routeReply, tag->GetTtl ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -307,8 +310,8 @@ bool
|
||||
HwmpProtocol::RemoveRoutingStuff (uint32_t fromIface, const Mac48Address source,
|
||||
const Mac48Address destination, Ptr<Packet> packet, uint16_t& protocolType)
|
||||
{
|
||||
HwmpTag tag;
|
||||
if (!packet->RemovePacketTag (tag))
|
||||
Ptr<const HwmpTag> tag = packet->RemovePacketTag<HwmpTag> ();
|
||||
if (tag == 0)
|
||||
{
|
||||
NS_FATAL_ERROR ("HWMP tag must exist when packet received from the network");
|
||||
}
|
||||
@@ -325,9 +328,9 @@ HwmpProtocol::ForwardUnicast (uint32_t sourceIface, const Mac48Address source,
|
||||
{
|
||||
result = m_rtable->LookupProactive ();
|
||||
}
|
||||
HwmpTag tag;
|
||||
tag.SetAddress (result.retransmitter);
|
||||
tag.SetTtl (ttl);
|
||||
Ptr<HwmpTag> tag = CreateObject<HwmpTag> ();
|
||||
tag->SetAddress (result.retransmitter);
|
||||
tag->SetTtl (ttl);
|
||||
//seqno and metric is not used;
|
||||
packet->AddPacketTag (tag);
|
||||
if (result.retransmitter != Mac48Address::GetBroadcast ())
|
||||
@@ -921,9 +924,13 @@ HwmpProtocol::ReactivePathResolved (Mac48Address dst)
|
||||
while (packet.pkt != 0)
|
||||
{
|
||||
//set RA tag for retransmitter:
|
||||
HwmpTag tag;
|
||||
packet.pkt->RemovePacketTag (tag);
|
||||
tag.SetAddress (result.retransmitter);
|
||||
Ptr<const HwmpTag> origTag = packet.pkt->RemovePacketTag<HwmpTag> ();
|
||||
if (origTag == 0)
|
||||
{
|
||||
NS_FATAL_ERROR ("HWMP tag must be present at this point");
|
||||
}
|
||||
Ptr<HwmpTag> tag = CreateObject<HwmpTag> (*origTag);
|
||||
tag->SetAddress (result.retransmitter);
|
||||
packet.pkt->AddPacketTag (tag);
|
||||
m_stats.txUnicast++;
|
||||
m_stats.txBytes += packet.pkt->GetSize ();
|
||||
@@ -942,12 +949,13 @@ HwmpProtocol::ProactivePathResolved ()
|
||||
while (packet.pkt != 0)
|
||||
{
|
||||
//set RA tag for retransmitter:
|
||||
HwmpTag tag;
|
||||
if (!packet.pkt->RemovePacketTag (tag))
|
||||
Ptr<const HwmpTag> origTag = packet.pkt->RemovePacketTag<HwmpTag> ();
|
||||
if (origTag == 0)
|
||||
{
|
||||
NS_FATAL_ERROR ("HWMP tag must be present at this point");
|
||||
}
|
||||
tag.SetAddress (result.retransmitter);
|
||||
Ptr<HwmpTag> tag = CreateObject<HwmpTag> (*origTag);
|
||||
tag->SetAddress (result.retransmitter);
|
||||
packet.pkt->AddPacketTag (tag);
|
||||
m_stats.txUnicast++;
|
||||
m_stats.txBytes += packet.pkt->GetSize ();
|
||||
|
||||
@@ -41,7 +41,7 @@ HwmpTag::SetAddress (Mac48Address retransmitter)
|
||||
}
|
||||
|
||||
Mac48Address
|
||||
HwmpTag::GetAddress ()
|
||||
HwmpTag::GetAddress () const
|
||||
{
|
||||
return m_address;
|
||||
}
|
||||
@@ -53,7 +53,7 @@ HwmpTag::SetTtl (uint8_t ttl)
|
||||
}
|
||||
|
||||
uint8_t
|
||||
HwmpTag::GetTtl ()
|
||||
HwmpTag::GetTtl () const
|
||||
{
|
||||
return m_ttl;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ HwmpTag::SetMetric (uint32_t metric)
|
||||
}
|
||||
|
||||
uint32_t
|
||||
HwmpTag::GetMetric ()
|
||||
HwmpTag::GetMetric () const
|
||||
{
|
||||
return m_metric;
|
||||
}
|
||||
@@ -77,7 +77,7 @@ HwmpTag::SetSeqno (uint32_t seqno)
|
||||
}
|
||||
|
||||
uint32_t
|
||||
HwmpTag::GetSeqno ()
|
||||
HwmpTag::GetSeqno () const
|
||||
{
|
||||
return m_seqno;
|
||||
}
|
||||
|
||||
@@ -51,13 +51,13 @@ public:
|
||||
HwmpTag ();
|
||||
~HwmpTag ();
|
||||
void SetAddress (Mac48Address retransmitter);
|
||||
Mac48Address GetAddress ();
|
||||
Mac48Address GetAddress () const;
|
||||
void SetTtl (uint8_t ttl);
|
||||
uint8_t GetTtl ();
|
||||
uint8_t GetTtl () const;
|
||||
void SetMetric (uint32_t metric);
|
||||
uint32_t GetMetric ();
|
||||
uint32_t GetMetric () const;
|
||||
void SetSeqno (uint32_t seqno);
|
||||
uint32_t GetSeqno ();
|
||||
uint32_t GetSeqno () const;
|
||||
void DecrementTtl ();
|
||||
|
||||
static TypeId GetTypeId ();
|
||||
|
||||
@@ -47,14 +47,14 @@ FlameProtocolMac::Receive (Ptr<Packet> packet, const WifiMacHeader & header)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
FlameTag tag;
|
||||
if (packet->PeekPacketTag (tag))
|
||||
if (packet->PeekPacketTag<FlameTag> () != 0)
|
||||
{
|
||||
NS_FATAL_ERROR ("FLAME tag is not supposed to be received by network");
|
||||
}
|
||||
tag.receiver = header.GetAddr1 ();
|
||||
tag.transmitter = header.GetAddr2 ();
|
||||
if (tag.receiver == Mac48Address::GetBroadcast ())
|
||||
Ptr<FlameTag> tag = CreateObject<FlameTag> ();
|
||||
tag->receiver = header.GetAddr1 ();
|
||||
tag->transmitter = header.GetAddr2 ();
|
||||
if (tag->receiver == Mac48Address::GetBroadcast ())
|
||||
{
|
||||
m_stats.rxBroadcast++;
|
||||
}
|
||||
@@ -74,13 +74,13 @@ FlameProtocolMac::UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & head
|
||||
{
|
||||
return true;
|
||||
}
|
||||
FlameTag tag;
|
||||
if (!packet->RemovePacketTag (tag))
|
||||
Ptr<const FlameTag> tag = packet->RemovePacketTag<FlameTag> ();
|
||||
if (tag == 0)
|
||||
{
|
||||
NS_FATAL_ERROR ("FLAME tag must exist here");
|
||||
}
|
||||
header.SetAddr1 (tag.receiver);
|
||||
if (tag.receiver == Mac48Address::GetBroadcast ())
|
||||
header.SetAddr1 (tag->receiver);
|
||||
if (tag->receiver == Mac48Address::GetBroadcast ())
|
||||
{
|
||||
m_stats.txBroadcast++;
|
||||
}
|
||||
|
||||
@@ -150,8 +150,7 @@ FlameProtocol::RequestRoute (uint32_t sourceIface, const Mac48Address source, co
|
||||
if (sourceIface == m_mp->GetIfIndex ())
|
||||
{
|
||||
//Packet from upper layer!
|
||||
FlameTag tag;
|
||||
if (packet->PeekPacketTag (tag))
|
||||
if (packet->PeekPacketTag<FlameTag> () != 0)
|
||||
{
|
||||
NS_FATAL_ERROR ("FLAME tag is not supposed to be received from upper layers");
|
||||
}
|
||||
@@ -174,7 +173,8 @@ FlameProtocol::RequestRoute (uint32_t sourceIface, const Mac48Address source, co
|
||||
flameHdr.SetOrigSrc (source);
|
||||
m_stats.txBytes += packet->GetSize ();
|
||||
packet->AddHeader (flameHdr);
|
||||
tag.receiver = result.retransmitter;
|
||||
Ptr<FlameTag> tag = CreateObject<FlameTag> ();
|
||||
tag->receiver = result.retransmitter;
|
||||
if (result.retransmitter == Mac48Address::GetBroadcast ())
|
||||
{
|
||||
m_stats.txBroadcast++;
|
||||
@@ -183,7 +183,7 @@ FlameProtocol::RequestRoute (uint32_t sourceIface, const Mac48Address source, co
|
||||
{
|
||||
m_stats.txUnicast++;
|
||||
}
|
||||
NS_LOG_DEBUG ("Source: send packet with RA = " << tag.receiver);
|
||||
NS_LOG_DEBUG ("Source: send packet with RA = " << tag->receiver);
|
||||
packet->AddPacketTag (tag);
|
||||
routeReply (true, packet, source, destination, FLAME_PROTOCOL, result.ifIndex);
|
||||
}
|
||||
@@ -191,17 +191,18 @@ FlameProtocol::RequestRoute (uint32_t sourceIface, const Mac48Address source, co
|
||||
{
|
||||
FlameHeader flameHdr;
|
||||
packet->RemoveHeader (flameHdr);
|
||||
FlameTag tag;
|
||||
|
||||
if (!packet->RemovePacketTag (tag))
|
||||
Ptr<const FlameTag> origTag = packet->RemovePacketTag<FlameTag> ();
|
||||
if (origTag == 0)
|
||||
{
|
||||
NS_FATAL_ERROR ("FLAME tag must exist here");
|
||||
}
|
||||
|
||||
if (destination == Mac48Address::GetBroadcast ())
|
||||
{
|
||||
//Broadcast always is forwarded as broadcast!
|
||||
NS_ASSERT (HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, sourceIface));
|
||||
FlameTag tag (Mac48Address::GetBroadcast ());
|
||||
NS_ASSERT (HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, origTag->transmitter, sourceIface));
|
||||
Ptr<FlameTag> tag = CreateObject<FlameTag> (Mac48Address::GetBroadcast ());
|
||||
flameHdr.AddCost (1);
|
||||
m_stats.txBytes += packet->GetSize ();
|
||||
packet->AddHeader (flameHdr);
|
||||
@@ -212,27 +213,28 @@ FlameProtocol::RequestRoute (uint32_t sourceIface, const Mac48Address source, co
|
||||
}
|
||||
else
|
||||
{
|
||||
Ptr<FlameTag> tag = CreateObject<FlameTag> (*origTag);
|
||||
// We check sequence only when forward unicast, because broadcast-checks were done
|
||||
// inside remove routing stuff.
|
||||
if (HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, sourceIface))
|
||||
if (HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag->transmitter, sourceIface))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
FlameRtable::LookupResult result = m_rtable->Lookup (destination);
|
||||
if (tag.receiver != Mac48Address::GetBroadcast ())
|
||||
if (origTag->receiver != Mac48Address::GetBroadcast ())
|
||||
{
|
||||
if (result.retransmitter == Mac48Address::GetBroadcast ())
|
||||
{
|
||||
NS_LOG_DEBUG ("unicast packet dropped, because no route! I am " << GetAddress ()
|
||||
<< ", RA = " << tag.receiver << ", TA = " << tag.transmitter);
|
||||
<< ", RA = " << origTag->receiver << ", TA = " << origTag->transmitter);
|
||||
m_stats.totalDropped++;
|
||||
return false;
|
||||
}
|
||||
tag.receiver = result.retransmitter;
|
||||
tag->receiver = result.retransmitter;
|
||||
}
|
||||
else
|
||||
{
|
||||
tag.receiver = Mac48Address::GetBroadcast ();
|
||||
tag->receiver = Mac48Address::GetBroadcast ();
|
||||
}
|
||||
if (result.retransmitter == Mac48Address::GetBroadcast ())
|
||||
{
|
||||
@@ -263,14 +265,14 @@ FlameProtocol::RemoveRoutingStuff (uint32_t fromIface, const Mac48Address source
|
||||
NS_LOG_DEBUG ("Dropped my own frame!");
|
||||
return false;
|
||||
}
|
||||
FlameTag tag;
|
||||
if (!packet->RemovePacketTag (tag))
|
||||
Ptr<const FlameTag> tag = packet->RemovePacketTag <FlameTag> ();
|
||||
if (tag == 0)
|
||||
{
|
||||
NS_FATAL_ERROR ("FLAME tag must exist when packet is coming to protocol");
|
||||
}
|
||||
FlameHeader flameHdr;
|
||||
packet->RemoveHeader (flameHdr);
|
||||
if (HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, fromIface))
|
||||
if (HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag->transmitter, fromIface))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -222,15 +222,15 @@ MeshWifiInterfaceMac::ForwardDown (Ptr<const Packet> const_packet, Mac48Address
|
||||
//Classify: application sets a tag, which is removed here
|
||||
// Get Qos tag:
|
||||
AcIndex ac = AC_BE;
|
||||
QosTag tag;
|
||||
if (packet->RemovePacketTag (tag))
|
||||
Ptr<const QosTag> tag = packet->RemovePacketTag<QosTag> ();
|
||||
if (tag != 0)
|
||||
{
|
||||
hdr.SetType (WIFI_MAC_QOSDATA);
|
||||
hdr.SetQosTid (tag.GetTid ());
|
||||
hdr.SetQosTid (tag->GetTid ());
|
||||
//Aftre setting type DsFrom and DsTo fields are reset.
|
||||
hdr.SetDsFrom ();
|
||||
hdr.SetDsTo ();
|
||||
ac = QosUtilsMapTidToAc (tag.GetTid ());
|
||||
ac = QosUtilsMapTidToAc (tag->GetTid ());
|
||||
}
|
||||
m_stats.sentFrames++;
|
||||
m_stats.sentBytes += packet->GetSize ();
|
||||
@@ -446,7 +446,7 @@ MeshWifiInterfaceMac::Receive (Ptr<Packet> packet, WifiMacHeader const *hdr)
|
||||
// Check if QoS tag exists and add it:
|
||||
if (hdr->IsQosData ())
|
||||
{
|
||||
packet->AddPacketTag (QosTag (hdr->GetQosTid ()));
|
||||
packet->AddPacketTag (CreateObject<QosTag> (hdr->GetQosTid ()));
|
||||
}
|
||||
// Forward data up
|
||||
if (hdr->IsData ())
|
||||
|
||||
@@ -96,8 +96,8 @@ MyTag::GetSimpleValue (void) const
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
// create a tag.
|
||||
MyTag tag;
|
||||
tag.SetSimpleValue (0x56);
|
||||
Ptr<MyTag> tag = CreateObject<MyTag> ();
|
||||
tag->SetSimpleValue (0x56);
|
||||
|
||||
// store the tag in a packet.
|
||||
Ptr<Packet> p = Create<Packet> (100);
|
||||
@@ -107,11 +107,10 @@ int main (int argc, char *argv[])
|
||||
Ptr<Packet> aCopy = p->Copy ();
|
||||
|
||||
// read the tag from the packet copy
|
||||
MyTag tagCopy;
|
||||
p->PeekPacketTag (tagCopy);
|
||||
Ptr<const MyTag> tagCopy = p->PeekPacketTag<MyTag> ();
|
||||
|
||||
// the copy and the original are the same !
|
||||
NS_ASSERT (tagCopy.GetSimpleValue () == tag.GetSimpleValue ());
|
||||
NS_ASSERT (tagCopy->GetSimpleValue () == tag->GetSimpleValue ());
|
||||
|
||||
aCopy->PrintPacketTags (std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
@@ -28,150 +28,146 @@ NS_LOG_COMPONENT_DEFINE ("PacketTagList");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
#ifdef USE_FREE_LIST
|
||||
|
||||
struct PacketTagList::TagData *PacketTagList::g_free = 0;
|
||||
uint32_t PacketTagList::g_nfree = 0;
|
||||
|
||||
struct PacketTagList::TagData *
|
||||
PacketTagList::AllocData (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (g_nfree);
|
||||
struct PacketTagList::TagData *retval;
|
||||
if (g_free != 0)
|
||||
{
|
||||
retval = g_free;
|
||||
g_free = g_free->m_next;
|
||||
g_nfree--;
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = new struct PacketTagList::TagData ();
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
void
|
||||
PacketTagList::FreeData (struct TagData *data) const
|
||||
PacketTagList::Add (Ptr<const Tag> tag)
|
||||
{
|
||||
NS_LOG_FUNCTION (g_nfree << data);
|
||||
if (g_nfree > 1000)
|
||||
{
|
||||
delete data;
|
||||
return;
|
||||
}
|
||||
g_nfree++;
|
||||
data->next = g_free;
|
||||
data->tid = TypeId ();
|
||||
g_free = data;
|
||||
}
|
||||
#else
|
||||
struct PacketTagList::TagData *
|
||||
PacketTagList::AllocData (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
struct PacketTagList::TagData *retval;
|
||||
retval = new struct PacketTagList::TagData ();
|
||||
return retval;
|
||||
NS_LOG_FUNCTION (this << tag->GetInstanceTypeId ());
|
||||
|
||||
NS_ASSERT_MSG (Peek (tag->GetInstanceTypeId ()) == 0,
|
||||
"Only one tag type per packet is allowed");
|
||||
|
||||
push_back (tag);
|
||||
}
|
||||
|
||||
void
|
||||
PacketTagList::FreeData (struct TagData *data) const
|
||||
Ptr<const Tag>
|
||||
PacketTagList::Remove (TypeId tagType)
|
||||
{
|
||||
NS_LOG_FUNCTION (data);
|
||||
delete data;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
PacketTagList::Remove (Tag &tag)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ());
|
||||
TypeId tid = tag.GetInstanceTypeId ();
|
||||
bool found = false;
|
||||
for (struct TagData *cur = m_next; cur != 0; cur = cur->next)
|
||||
NS_LOG_FUNCTION (this << tagType);
|
||||
|
||||
for (iterator tag = begin (); tag != end (); tag++)
|
||||
{
|
||||
if (cur->tid == tid)
|
||||
if ((*tag)->GetInstanceTypeId () == tagType)
|
||||
{
|
||||
found = true;
|
||||
tag.Deserialize (TagBuffer (cur->data, cur->data+PACKET_TAG_MAX_SIZE));
|
||||
Ptr<const Tag> retval = *tag;
|
||||
erase (tag);
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
struct TagData *start = 0;
|
||||
struct TagData **prevNext = &start;
|
||||
for (struct TagData *cur = m_next; cur != 0; cur = cur->next)
|
||||
{
|
||||
if (cur->tid == tid)
|
||||
{
|
||||
/**
|
||||
* XXX
|
||||
* Note: I believe that we could optimize this to
|
||||
* avoid copying each TagData located after the target id
|
||||
* and just link the already-copied list to the next tag.
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
struct TagData *copy = AllocData ();
|
||||
copy->tid = cur->tid;
|
||||
copy->count = 1;
|
||||
copy->next = 0;
|
||||
memcpy (copy->data, cur->data, PACKET_TAG_MAX_SIZE);
|
||||
*prevNext = copy;
|
||||
prevNext = ©->next;
|
||||
}
|
||||
*prevNext = 0;
|
||||
RemoveAll ();
|
||||
m_next = start;
|
||||
return true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
PacketTagList::Add (const Tag &tag) const
|
||||
Ptr<const Tag>
|
||||
PacketTagList::Peek (TypeId tagType) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ());
|
||||
// ensure this id was not yet added
|
||||
for (struct TagData *cur = m_next; cur != 0; cur = cur->next)
|
||||
NS_LOG_FUNCTION (this << tagType);
|
||||
for (const_iterator tag = begin (); tag != end (); tag++)
|
||||
{
|
||||
NS_ASSERT (cur->tid != tag.GetInstanceTypeId ());
|
||||
if ((*tag)->GetInstanceTypeId () == tagType)
|
||||
return *tag;
|
||||
}
|
||||
struct TagData *head = AllocData ();
|
||||
head->count = 1;
|
||||
head->next = 0;
|
||||
head->tid = tag.GetInstanceTypeId ();
|
||||
head->next = m_next;
|
||||
NS_ASSERT (tag.GetSerializedSize () <= PACKET_TAG_MAX_SIZE);
|
||||
tag.Serialize (TagBuffer (head->data, head->data+tag.GetSerializedSize ()));
|
||||
|
||||
const_cast<PacketTagList *> (this)->m_next = head;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool
|
||||
PacketTagList::Peek (Tag &tag) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ());
|
||||
TypeId tid = tag.GetInstanceTypeId ();
|
||||
for (struct TagData *cur = m_next; cur != 0; cur = cur->next)
|
||||
{
|
||||
if (cur->tid == tid)
|
||||
{
|
||||
/* found tag */
|
||||
tag.Deserialize (TagBuffer (cur->data, cur->data+PACKET_TAG_MAX_SIZE));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/* no tag found */
|
||||
return false;
|
||||
}
|
||||
|
||||
const struct PacketTagList::TagData *
|
||||
PacketTagList::Head (void) const
|
||||
{
|
||||
return m_next;
|
||||
}
|
||||
// bool
|
||||
// PacketTagList::Remove (Tag &tag)
|
||||
// {
|
||||
// NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ());
|
||||
|
||||
// return false;
|
||||
|
||||
// // TypeId tid = tag.GetInstanceTypeId ();
|
||||
// // bool found = false;
|
||||
// // for (struct TagData *cur = m_next; cur != 0; cur = cur->next)
|
||||
// // {
|
||||
// // if (cur->tid == tid)
|
||||
// // {
|
||||
// // found = true;
|
||||
// // tag.Deserialize (TagBuffer (cur->data, cur->data+PACKET_TAG_MAX_SIZE));
|
||||
// // }
|
||||
// // }
|
||||
// // if (!found)
|
||||
// // {
|
||||
// // return false;
|
||||
// // }
|
||||
// // struct TagData *start = 0;
|
||||
// // struct TagData **prevNext = &start;
|
||||
// // for (struct TagData *cur = m_next; cur != 0; cur = cur->next)
|
||||
// // {
|
||||
// // if (cur->tid == tid)
|
||||
// // {
|
||||
// // /**
|
||||
// // * XXX
|
||||
// // * Note: I believe that we could optimize this to
|
||||
// // * avoid copying each TagData located after the target id
|
||||
// // * and just link the already-copied list to the next tag.
|
||||
// // */
|
||||
// // continue;
|
||||
// // }
|
||||
// // struct TagData *copy = AllocData ();
|
||||
// // copy->tid = cur->tid;
|
||||
// // copy->count = 1;
|
||||
// // copy->next = 0;
|
||||
// // memcpy (copy->data, cur->data, PACKET_TAG_MAX_SIZE);
|
||||
// // *prevNext = copy;
|
||||
// // prevNext = ©->next;
|
||||
// // }
|
||||
// // *prevNext = 0;
|
||||
// // RemoveAll ();
|
||||
// // m_next = start;
|
||||
// // return true;
|
||||
// }
|
||||
|
||||
// void
|
||||
// PacketTagList::Add (const Tag &tag) const
|
||||
// {
|
||||
// NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ());
|
||||
// // ensure this id was not yet added
|
||||
|
||||
// // for (struct TagData *cur = m_next; cur != 0; cur = cur->next)
|
||||
// // {
|
||||
// // NS_ASSERT (cur->tid != tag.GetInstanceTypeId ());
|
||||
// // }
|
||||
|
||||
// // struct TagData *head = AllocData ();
|
||||
// // head->count = 1;
|
||||
// // head->next = 0;
|
||||
// // head->tid = tag.GetInstanceTypeId ();
|
||||
// // head->next = m_next;
|
||||
// // NS_ASSERT (tag.GetSerializedSize () <= PACKET_TAG_MAX_SIZE);
|
||||
// // tag.Serialize (TagBuffer (head->data, head->data+tag.GetSerializedSize ()));
|
||||
|
||||
// // const_cast<PacketTagList *> (this)->m_next = head;
|
||||
|
||||
// // m_tags.
|
||||
// }
|
||||
|
||||
// bool
|
||||
// PacketTagList::Peek (Tag &tag) const
|
||||
// {
|
||||
// NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ());
|
||||
// // TypeId tid = tag.GetInstanceTypeId ();
|
||||
// // for (struct TagData *cur = m_next; cur != 0; cur = cur->next)
|
||||
// // {
|
||||
// // if (cur->tid == tid)
|
||||
// // {
|
||||
// // /* found tag */
|
||||
// // tag.Deserialize (TagBuffer (cur->data, cur->data+PACKET_TAG_MAX_SIZE));
|
||||
// // return true;
|
||||
// // }
|
||||
// // }
|
||||
|
||||
// /* no tag found */
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// // const struct PacketTagList::TagData *
|
||||
// // PacketTagList::Head (void) const
|
||||
// // {
|
||||
// // return m_next;
|
||||
// // }
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#define PACKET_TAG_LIST_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <ostream>
|
||||
#include <list>
|
||||
#include "ns3/type-id.h"
|
||||
|
||||
namespace ns3 {
|
||||
@@ -34,40 +34,30 @@ class Tag;
|
||||
* The maximum size (in bytes) of a Tag is stored
|
||||
* in this constant.
|
||||
*/
|
||||
#define PACKET_TAG_MAX_SIZE 20
|
||||
// #define PACKET_TAG_MAX_SIZE 20
|
||||
|
||||
class PacketTagList
|
||||
class PacketTagList : public std::list<Ptr<const Tag> >
|
||||
{
|
||||
public:
|
||||
struct TagData {
|
||||
uint8_t data[PACKET_TAG_MAX_SIZE];
|
||||
struct TagData *next;
|
||||
TypeId tid;
|
||||
uint32_t count;
|
||||
};
|
||||
// struct TagData {
|
||||
// std::vector<uint8_t> data;
|
||||
// TypeId tid;
|
||||
// uint32_t count;
|
||||
// };
|
||||
|
||||
inline PacketTagList ();
|
||||
inline PacketTagList (PacketTagList const &o);
|
||||
inline PacketTagList &operator = (PacketTagList const &o);
|
||||
inline ~PacketTagList ();
|
||||
// inline PacketTagList ();
|
||||
// inline PacketTagList (PacketTagList const &o);
|
||||
// inline PacketTagList &operator = (PacketTagList const &o);
|
||||
// inline ~PacketTagList ();
|
||||
|
||||
void Add (Tag const&tag) const;
|
||||
bool Remove (Tag &tag);
|
||||
bool Peek (Tag &tag) const;
|
||||
inline void RemoveAll (void);
|
||||
void
|
||||
Add (Ptr<const Tag> tag);
|
||||
|
||||
const struct PacketTagList::TagData *Head (void) const;
|
||||
Ptr<const Tag>
|
||||
Remove (TypeId tagType);
|
||||
|
||||
private:
|
||||
|
||||
bool Remove (TypeId tid);
|
||||
struct PacketTagList::TagData *AllocData (void) const;
|
||||
void FreeData (struct TagData *data) const;
|
||||
|
||||
static struct PacketTagList::TagData *g_free;
|
||||
static uint32_t g_nfree;
|
||||
|
||||
struct TagData *m_next;
|
||||
Ptr<const Tag>
|
||||
Peek (TypeId tagType) const;
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
@@ -78,65 +68,38 @@ private:
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
PacketTagList::PacketTagList ()
|
||||
: m_next ()
|
||||
{
|
||||
}
|
||||
// PacketTagList::PacketTagList ()
|
||||
// {
|
||||
// }
|
||||
|
||||
PacketTagList::PacketTagList (PacketTagList const &o)
|
||||
: m_next (o.m_next)
|
||||
{
|
||||
if (m_next != 0)
|
||||
{
|
||||
m_next->count++;
|
||||
}
|
||||
}
|
||||
// PacketTagList::PacketTagList (PacketTagList const &o)
|
||||
// : m_tags (o.m_tags)
|
||||
// {
|
||||
// }
|
||||
|
||||
PacketTagList &
|
||||
PacketTagList::operator = (PacketTagList const &o)
|
||||
{
|
||||
// self assignment
|
||||
if (m_next == o.m_next)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
RemoveAll ();
|
||||
m_next = o.m_next;
|
||||
if (m_next != 0)
|
||||
{
|
||||
m_next->count++;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
// PacketTagList &
|
||||
// PacketTagList::operator = (PacketTagList const &o)
|
||||
// {
|
||||
// // self assignment
|
||||
// if (&o == this)
|
||||
// {
|
||||
// return *this;
|
||||
// }
|
||||
// // RemoveAll (); // ???
|
||||
// m_tags = o.m_tags;
|
||||
// return *this;
|
||||
// }
|
||||
|
||||
PacketTagList::~PacketTagList ()
|
||||
{
|
||||
RemoveAll ();
|
||||
}
|
||||
// PacketTagList::~PacketTagList ()
|
||||
// {
|
||||
// RemoveAll ();
|
||||
// }
|
||||
|
||||
void
|
||||
PacketTagList::RemoveAll (void)
|
||||
{
|
||||
struct TagData *prev = 0;
|
||||
for (struct TagData *cur = m_next; cur != 0; cur = cur->next)
|
||||
{
|
||||
cur->count--;
|
||||
if (cur->count > 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (prev != 0)
|
||||
{
|
||||
FreeData (prev);
|
||||
}
|
||||
prev = cur;
|
||||
}
|
||||
if (prev != 0)
|
||||
{
|
||||
FreeData (prev);
|
||||
}
|
||||
m_next = 0;
|
||||
}
|
||||
// void
|
||||
// PacketTagList::RemoveAll (void)
|
||||
// {
|
||||
// m_tags.clear ();
|
||||
// }
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
|
||||
+93
-63
@@ -81,39 +81,39 @@ ByteTagIterator::ByteTagIterator (ByteTagList::Iterator i)
|
||||
}
|
||||
|
||||
|
||||
PacketTagIterator::PacketTagIterator (const struct PacketTagList::TagData *head)
|
||||
: m_current (head)
|
||||
{
|
||||
}
|
||||
bool
|
||||
PacketTagIterator::HasNext (void) const
|
||||
{
|
||||
return m_current != 0;
|
||||
}
|
||||
PacketTagIterator::Item
|
||||
PacketTagIterator::Next (void)
|
||||
{
|
||||
NS_ASSERT (HasNext ());
|
||||
const struct PacketTagList::TagData *prev = m_current;
|
||||
m_current = m_current->next;
|
||||
return PacketTagIterator::Item (prev);
|
||||
}
|
||||
// PacketTagIterator::PacketTagIterator (const struct PacketTagList::TagData *head)
|
||||
// : m_current (head)
|
||||
// {
|
||||
// }
|
||||
// bool
|
||||
// PacketTagIterator::HasNext (void) const
|
||||
// {
|
||||
// return m_current != 0;
|
||||
// }
|
||||
// PacketTagIterator::Item
|
||||
// PacketTagIterator::Next (void)
|
||||
// {
|
||||
// NS_ASSERT (HasNext ());
|
||||
// const struct PacketTagList::TagData *prev = m_current;
|
||||
// m_current = m_current->next;
|
||||
// return PacketTagIterator::Item (prev);
|
||||
// }
|
||||
|
||||
PacketTagIterator::Item::Item (const struct PacketTagList::TagData *data)
|
||||
: m_data (data)
|
||||
{
|
||||
}
|
||||
TypeId
|
||||
PacketTagIterator::Item::GetTypeId (void) const
|
||||
{
|
||||
return m_data->tid;
|
||||
}
|
||||
void
|
||||
PacketTagIterator::Item::GetTag (Tag &tag) const
|
||||
{
|
||||
NS_ASSERT (tag.GetInstanceTypeId () == m_data->tid);
|
||||
tag.Deserialize (TagBuffer ((uint8_t*)m_data->data, (uint8_t*)m_data->data+PACKET_TAG_MAX_SIZE));
|
||||
}
|
||||
// PacketTagIterator::Item::Item (const struct PacketTagList::TagData *data)
|
||||
// : m_data (data)
|
||||
// {
|
||||
// }
|
||||
// TypeId
|
||||
// PacketTagIterator::Item::GetTypeId (void) const
|
||||
// {
|
||||
// return m_data->tid;
|
||||
// }
|
||||
// void
|
||||
// PacketTagIterator::Item::GetTag (Tag &tag) const
|
||||
// {
|
||||
// NS_ASSERT (tag.GetInstanceTypeId () == m_data->tid);
|
||||
// tag.Deserialize (TagBuffer ((uint8_t*)m_data->data, (uint8_t*)m_data->data+PACKET_TAG_MAX_SIZE));
|
||||
// }
|
||||
|
||||
|
||||
Ptr<Packet>
|
||||
@@ -835,60 +835,90 @@ Packet::FindFirstMatchingByteTag (Tag &tag) const
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
Packet::AddPacketTag (const Tag &tag) const
|
||||
// void
|
||||
// Packet::AddPacketTag (const Tag &tag) const
|
||||
// {
|
||||
// NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ().GetName () << tag.GetSerializedSize ());
|
||||
// m_packetTagList.Add (tag);
|
||||
// }
|
||||
// bool
|
||||
// Packet::RemovePacketTag (Tag &tag)
|
||||
// {
|
||||
// NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ().GetName () << tag.GetSerializedSize ());
|
||||
// bool found = m_packetTagList.Remove (tag);
|
||||
// return found;
|
||||
// }
|
||||
// bool
|
||||
// Packet::PeekPacketTag (Tag &tag) const
|
||||
// {
|
||||
// bool found = m_packetTagList.Peek (tag);
|
||||
// return found;
|
||||
// }
|
||||
|
||||
void
|
||||
Packet::AddPacketTag (Ptr<const Tag> tag)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ().GetName () << tag.GetSerializedSize ());
|
||||
m_packetTagList.Add (tag);
|
||||
}
|
||||
bool
|
||||
Packet::RemovePacketTag (Tag &tag)
|
||||
|
||||
Ptr<const Tag>
|
||||
Packet::RemovePacketTag (TypeId tagType)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ().GetName () << tag.GetSerializedSize ());
|
||||
bool found = m_packetTagList.Remove (tag);
|
||||
return found;
|
||||
return m_packetTagList.Remove (tagType);
|
||||
}
|
||||
bool
|
||||
Packet::PeekPacketTag (Tag &tag) const
|
||||
|
||||
Ptr<const Tag>
|
||||
Packet::PeekPacketTag (TypeId tagType) const
|
||||
{
|
||||
bool found = m_packetTagList.Peek (tag);
|
||||
return found;
|
||||
return m_packetTagList.Peek (tagType);
|
||||
}
|
||||
|
||||
void
|
||||
Packet::RemoveAllPacketTags (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_packetTagList.RemoveAll ();
|
||||
m_packetTagList.clear ();
|
||||
}
|
||||
|
||||
void
|
||||
Packet::PrintPacketTags (std::ostream &os) const
|
||||
{
|
||||
PacketTagIterator i = GetPacketTagIterator ();
|
||||
while (i.HasNext ())
|
||||
for (PacketTagList::const_iterator tag = m_packetTagList.begin ();
|
||||
tag != m_packetTagList.end ();
|
||||
tag++)
|
||||
{
|
||||
PacketTagIterator::Item item = i.Next ();
|
||||
NS_ASSERT (item.GetTypeId ().HasConstructor ());
|
||||
Callback<ObjectBase *> constructor = item.GetTypeId ().GetConstructor ();
|
||||
NS_ASSERT (!constructor.IsNull ());
|
||||
ObjectBase *instance = constructor ();
|
||||
Tag *tag = dynamic_cast<Tag *> (instance);
|
||||
NS_ASSERT (tag != 0);
|
||||
item.GetTag (*tag);
|
||||
tag->Print (os);
|
||||
delete tag;
|
||||
if (i.HasNext ())
|
||||
if (tag != m_packetTagList.begin ())
|
||||
{
|
||||
os << " ";
|
||||
}
|
||||
|
||||
(*tag)->Print (os);
|
||||
}
|
||||
// PacketTagIterator i = GetPacketTagIterator ();
|
||||
// while (i.HasNext ())
|
||||
// {
|
||||
// PacketTagIterator::Item item = i.Next ();
|
||||
// NS_ASSERT (item.GetTypeId ().HasConstructor ());
|
||||
// Callback<ObjectBase *> constructor = item.GetTypeId ().GetConstructor ();
|
||||
// NS_ASSERT (!constructor.IsNull ());
|
||||
// ObjectBase *instance = constructor ();
|
||||
// Tag *tag = dynamic_cast<Tag *> (instance);
|
||||
// NS_ASSERT (tag != 0);
|
||||
// item.GetTag (*tag);
|
||||
// tag->Print (os);
|
||||
// delete tag;
|
||||
// if (i.HasNext ())
|
||||
// {
|
||||
// os << " ";
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
PacketTagIterator
|
||||
Packet::GetPacketTagIterator (void) const
|
||||
{
|
||||
return PacketTagIterator (m_packetTagList.Head ());
|
||||
}
|
||||
// PacketTagIterator
|
||||
// Packet::GetPacketTagIterator (void) const
|
||||
// {
|
||||
// return PacketTagIterator (m_packetTagList.Head ());
|
||||
// }
|
||||
|
||||
std::ostream& operator<< (std::ostream& os, const Packet &packet)
|
||||
{
|
||||
|
||||
+47
-62
@@ -104,53 +104,6 @@ private:
|
||||
ByteTagList::Iterator m_current;
|
||||
};
|
||||
|
||||
/**
|
||||
* \ingroup packet
|
||||
* \brief Iterator over the set of 'packet' tags in a packet
|
||||
*
|
||||
* This is a java-style iterator.
|
||||
*/
|
||||
class PacketTagIterator
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Identifies a tag within a packet.
|
||||
*/
|
||||
class Item
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \returns the ns3::TypeId associated to this tag.
|
||||
*/
|
||||
TypeId GetTypeId (void) const;
|
||||
/**
|
||||
* \param tag the user tag to which the data should be copied.
|
||||
*
|
||||
* Read the requested tag and store it in the user-provided
|
||||
* tag instance. This method will crash if the type of the
|
||||
* tag provided by the user does not match the type of
|
||||
* the underlying tag.
|
||||
*/
|
||||
void GetTag (Tag &tag) const;
|
||||
private:
|
||||
friend class PacketTagIterator;
|
||||
Item (const struct PacketTagList::TagData *data);
|
||||
const struct PacketTagList::TagData *m_data;
|
||||
};
|
||||
/**
|
||||
* \returns true if calling Next is safe, false otherwise.
|
||||
*/
|
||||
bool HasNext (void) const;
|
||||
/**
|
||||
* \returns the next item found and prepare for the next one.
|
||||
*/
|
||||
Item Next (void);
|
||||
private:
|
||||
friend class Packet;
|
||||
PacketTagIterator (const struct PacketTagList::TagData *head);
|
||||
const struct PacketTagList::TagData *m_current;
|
||||
};
|
||||
|
||||
/**
|
||||
* \ingroup packet
|
||||
* \brief network packets
|
||||
@@ -498,31 +451,63 @@ public:
|
||||
/**
|
||||
* \param tag the tag to store in this packet
|
||||
*
|
||||
* Add a tag to this packet. This method calls the
|
||||
* Tag::GetSerializedSize and, then, Tag::Serialize.
|
||||
*
|
||||
* Note that this method is const, that is, it does not
|
||||
* modify the state of this packet, which is fairly
|
||||
* un-intuitive.
|
||||
* Add a tag to this packet.
|
||||
*/
|
||||
void AddPacketTag (const Tag &tag) const;
|
||||
void
|
||||
AddPacketTag (Ptr<const Tag> tag);
|
||||
|
||||
/**
|
||||
* \param tag the tag to remove from this packet
|
||||
* \returns true if the requested tag is found, false
|
||||
* otherwise.
|
||||
* \returns smart pointer to a constant Tag object if the requested tag is found,
|
||||
* 0 otherwise.
|
||||
*
|
||||
* Remove a tag from this packet. This method calls
|
||||
* Tag::Deserialize if the tag is found.
|
||||
* Remove a tag from this packet.
|
||||
*/
|
||||
bool RemovePacketTag (Tag &tag);
|
||||
Ptr<const Tag>
|
||||
RemovePacketTag (TypeId tagType);
|
||||
|
||||
/**
|
||||
* \param tag the tag to remove from this packet
|
||||
* \returns smart pointer to a constant Tag object if the requested tag is found,
|
||||
* 0 otherwise.
|
||||
*
|
||||
* Templated version to remove a tag from this packet.
|
||||
* In addition to non-templated version, there is a DynamicCast to
|
||||
* the requested tag type
|
||||
*/
|
||||
template<class T>
|
||||
Ptr<const T>
|
||||
RemovePacketTag ()
|
||||
{
|
||||
return DynamicCast<const T> (RemovePacketTag (T::GetTypeId ()));
|
||||
}
|
||||
|
||||
/**
|
||||
* \param tag the tag to search in this packet
|
||||
* \returns true if the requested tag is found, false
|
||||
* otherwise.
|
||||
*
|
||||
* Search a matching tag and call Tag::Deserialize if it is found.
|
||||
* Search a matching tag and return it if found
|
||||
*/
|
||||
bool PeekPacketTag (Tag &tag) const;
|
||||
Ptr<const Tag>
|
||||
PeekPacketTag (TypeId tagType) const;
|
||||
|
||||
/**
|
||||
* \param tag the tag to search in this packet
|
||||
* \returns true if the requested tag is found, false
|
||||
* otherwise.
|
||||
*
|
||||
* Templated version of search for a matching tag and returning it if found
|
||||
* In addition to non-templated version, there is a DynamicCast to
|
||||
* the requested tag type
|
||||
*/
|
||||
template<class T>
|
||||
Ptr<const T>
|
||||
PeekPacketTag () const
|
||||
{
|
||||
return DynamicCast<const T> (PeekPacketTag (T::GetTypeId ()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all packet tags.
|
||||
*/
|
||||
@@ -542,7 +527,7 @@ public:
|
||||
* \returns an object which can be used to iterate over the list of
|
||||
* packet tags.
|
||||
*/
|
||||
PacketTagIterator GetPacketTagIterator (void) const;
|
||||
// PacketTagIterator GetPacketTagIterator (void) const;
|
||||
|
||||
/* Note: These functions support a temporary solution
|
||||
* to a specific problem in this generic class, i.e.
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef TAG_H
|
||||
#define TAG_H
|
||||
|
||||
#include "ns3/object-base.h"
|
||||
#include "ns3/object.h"
|
||||
#include "tag-buffer.h"
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace ns3 {
|
||||
*
|
||||
* New kinds of tags can be created by subclassing this base class.
|
||||
*/
|
||||
class Tag : public ObjectBase
|
||||
class Tag : public Object
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
@@ -71,6 +71,13 @@ public:
|
||||
virtual void Print (std::ostream &os) const = 0;
|
||||
};
|
||||
|
||||
inline std::ostream &
|
||||
operator << (std::ostream &os, const Tag &tag)
|
||||
{
|
||||
tag.Print (os);
|
||||
return os;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* TAG_H */
|
||||
@@ -391,33 +391,33 @@ PacketTest::DoRun (void)
|
||||
|
||||
{
|
||||
Packet p;
|
||||
ATestTag<10> a;
|
||||
Ptr< ATestTag<10> > a = CreateObject< ATestTag<10> > ();
|
||||
p.AddPacketTag (a);
|
||||
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag (a), true, "trivial");
|
||||
ATestTag<11> b;
|
||||
NS_TEST_EXPECT_MSG_NE (p.PeekPacketTag< ATestTag<10> > (), 0, "trivial");
|
||||
Ptr< ATestTag<11> > b = CreateObject< ATestTag<11> > ();
|
||||
p.AddPacketTag (b);
|
||||
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag (b), true, "trivial");
|
||||
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag (a), true, "trivial");
|
||||
NS_TEST_EXPECT_MSG_NE (p.PeekPacketTag< ATestTag<11> > (), 0, "trivial");
|
||||
NS_TEST_EXPECT_MSG_NE (p.PeekPacketTag< ATestTag<10> > (), 0, "trivial");
|
||||
Packet copy = p;
|
||||
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag (b), true, "trivial");
|
||||
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag (a), true, "trivial");
|
||||
ATestTag<12> c;
|
||||
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag (c), false, "trivial");
|
||||
NS_TEST_EXPECT_MSG_NE (copy.PeekPacketTag< ATestTag<11> > (), 0, "trivial");
|
||||
NS_TEST_EXPECT_MSG_NE (copy.PeekPacketTag< ATestTag<10> > (), 0, "trivial");
|
||||
Ptr< ATestTag<12> > c = CreateObject< ATestTag<12> > ();
|
||||
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag< ATestTag<12> > (), 0, "trivial");
|
||||
copy.AddPacketTag (c);
|
||||
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag (c), true, "trivial");
|
||||
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag (b), true, "trivial");
|
||||
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag (a), true, "trivial");
|
||||
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag (c), false, "trivial");
|
||||
copy.RemovePacketTag (b);
|
||||
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag (b), false, "trivial");
|
||||
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag (b), true, "trivial");
|
||||
p.RemovePacketTag (a);
|
||||
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag (a), false, "trivial");
|
||||
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag (a), true, "trivial");
|
||||
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag (c), false, "trivial");
|
||||
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag (c), true, "trivial");
|
||||
NS_TEST_EXPECT_MSG_NE (copy.PeekPacketTag< ATestTag<12> > (), 0, "trivial");
|
||||
NS_TEST_EXPECT_MSG_NE (copy.PeekPacketTag< ATestTag<11> > (), 0, "trivial");
|
||||
NS_TEST_EXPECT_MSG_NE (copy.PeekPacketTag< ATestTag<10> > (), 0, "trivial");
|
||||
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag< ATestTag<12> > (), 0, "trivial");
|
||||
copy.RemovePacketTag< ATestTag<11> > ();
|
||||
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag< ATestTag<11> > (), 0, "trivial");
|
||||
NS_TEST_EXPECT_MSG_NE (p.PeekPacketTag< ATestTag<11> > (), 0, "trivial");
|
||||
p.RemovePacketTag< ATestTag<10> > ();
|
||||
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag< ATestTag<10> > (), 0, "trivial");
|
||||
NS_TEST_EXPECT_MSG_NE (copy.PeekPacketTag< ATestTag<10> > (), 0, "trivial");
|
||||
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag< ATestTag<12> > (), 0, "trivial");
|
||||
NS_TEST_EXPECT_MSG_NE (copy.PeekPacketTag< ATestTag<12> > (), 0, "trivial");
|
||||
p.RemoveAllPacketTags ();
|
||||
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag (b), false, "trivial");
|
||||
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag< ATestTag<11> > (), 0, "trivial");
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -130,10 +130,10 @@ Ipv4Mask::GetInverse (void) const
|
||||
void
|
||||
Ipv4Mask::Print (std::ostream &os) const
|
||||
{
|
||||
os << ((m_mask >> 24) & 0xff) << "."
|
||||
<< ((m_mask >> 16) & 0xff) << "."
|
||||
<< ((m_mask >> 8) & 0xff) << "."
|
||||
<< ((m_mask >> 0) & 0xff);
|
||||
os << (int)((m_mask >> 24) & 0xff) << "."
|
||||
<< (int)((m_mask >> 16) & 0xff) << "."
|
||||
<< (int)((m_mask >> 8) & 0xff) << "."
|
||||
<< (int)((m_mask >> 0) & 0xff);
|
||||
}
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ Ipv4Address::Ipv4Address (char const *address)
|
||||
m_address = AsciiToIpv4Host (address);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
const uint32_t &
|
||||
Ipv4Address::Get (void) const
|
||||
{
|
||||
return m_address;
|
||||
|
||||
@@ -57,7 +57,8 @@ public:
|
||||
* Get the host-order 32-bit IP address
|
||||
* \return the host-order 32-bit IP address
|
||||
*/
|
||||
uint32_t Get (void) const;
|
||||
const uint32_t &
|
||||
Get (void) const;
|
||||
/**
|
||||
* input address is in host order.
|
||||
* \param address The host order 32-bit address
|
||||
|
||||
@@ -386,8 +386,8 @@ PacketSocket::ForwardUp (Ptr<NetDevice> device, Ptr<const Packet> packet,
|
||||
if ((m_rxAvailable + packet->GetSize ()) <= m_rcvBufSize)
|
||||
{
|
||||
Ptr<Packet> copy = packet->Copy ();
|
||||
SocketAddressTag tag;
|
||||
tag.SetAddress (address);
|
||||
Ptr<SocketAddressTag> tag = Create<SocketAddressTag> ();
|
||||
tag->SetAddress (address);
|
||||
copy->AddPacketTag (tag);
|
||||
m_deliveryQueue.push (copy);
|
||||
m_rxAvailable += packet->GetSize ();
|
||||
@@ -443,11 +443,9 @@ PacketSocket::RecvFrom (uint32_t maxSize, uint32_t flags, Address &fromAddress)
|
||||
Ptr<Packet> packet = Recv (maxSize, flags);
|
||||
if (packet != 0)
|
||||
{
|
||||
SocketAddressTag tag;
|
||||
bool found;
|
||||
found = packet->PeekPacketTag (tag);
|
||||
NS_ASSERT (found);
|
||||
fromAddress = tag.GetAddress ();
|
||||
Ptr<const SocketAddressTag> tag = packet->PeekPacketTag<SocketAddressTag> ();
|
||||
NS_ASSERT (tag != 0);
|
||||
fromAddress = tag->GetAddress ();
|
||||
}
|
||||
return packet;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2011 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,267 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2011 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#ifndef _TRIE_H_
|
||||
#define _TRIE_H_
|
||||
|
||||
#ifndef __GNUC__
|
||||
#error "gcc is required to compile this code"
|
||||
#else
|
||||
|
||||
#include <ext/pb_ds/assoc_container.hpp>
|
||||
#include <ext/pb_ds/trie_policy.hpp>
|
||||
#include <ext/pb_ds/tag_and_trait.hpp>
|
||||
|
||||
#if __GNUC__ < 4 || (__GNUC__==4 && __GNUC_MINOR__<=1)
|
||||
#error "gcc version at least 4.1 is required to compile this code"
|
||||
#elif (__GNUC__==4 && __GNUC_MINOR__<3)
|
||||
#define PB_DS pb_ds
|
||||
#else
|
||||
#define PB_DS __gnu_pbds
|
||||
#endif
|
||||
|
||||
#endif // __GNUC__
|
||||
|
||||
/**
|
||||
* At least for now, trie implementation is based on gcc policy-based data containers
|
||||
*
|
||||
* Important!!! This trie simplifies/optimizes work with IPv4 prefixes.
|
||||
* There is an assumption that nobody will use IP netmasks other than 255.255.255.0, 255.255.0.0, 255.0.0.0, or 0.0.0.0.
|
||||
* As a result, branching happens on a byte level, not on bit a level.
|
||||
*/
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* \brief IPv4 version of element-access traits for patricia trie
|
||||
*
|
||||
* Refer to http://gcc.gnu.org/onlinedocs/libstdc++/ext/pb_ds/trie_based_containers.html
|
||||
*/
|
||||
class Ipv4AddressTrieEAccessTraits
|
||||
{
|
||||
public:
|
||||
// Size type.
|
||||
typedef size_t size_type;
|
||||
|
||||
// Key type.
|
||||
typedef Ipv4Address key_type;
|
||||
|
||||
// Const key reference type.
|
||||
typedef const Ipv4Address & const_key_reference;
|
||||
|
||||
// Element const iterator type.
|
||||
typedef const uint8_t * const_iterator;
|
||||
|
||||
// Element type.
|
||||
typedef uint8_t e_type;
|
||||
|
||||
enum
|
||||
{
|
||||
min_e_val = 0,
|
||||
max_e_val = 255,
|
||||
max_size = max_e_val - min_e_val + 1
|
||||
};
|
||||
|
||||
public:
|
||||
// Returns a const_iterator to the first element of r_key.
|
||||
inline static const_iterator
|
||||
begin (const_key_reference r_key);
|
||||
|
||||
// Returns a const_iterator to the after-last element of r_key.
|
||||
inline static const_iterator
|
||||
end (const_key_reference r_key);
|
||||
|
||||
// Maps an element to a position.
|
||||
inline static size_type
|
||||
e_pos (e_type e);
|
||||
};
|
||||
|
||||
Ipv4AddressTrieEAccessTraits::const_iterator
|
||||
Ipv4AddressTrieEAccessTraits::begin (Ipv4AddressTrieEAccessTraits::const_key_reference r_key)
|
||||
{
|
||||
return reinterpret_cast<Ipv4AddressTrieEAccessTraits::const_iterator> (&r_key.Get ());
|
||||
}
|
||||
|
||||
Ipv4AddressTrieEAccessTraits::const_iterator
|
||||
Ipv4AddressTrieEAccessTraits::end (Ipv4AddressTrieEAccessTraits::const_key_reference r_key)
|
||||
{
|
||||
return sizeof (r_key.Get ()) + reinterpret_cast<Ipv4AddressTrieEAccessTraits::const_iterator> (&r_key.Get ());
|
||||
}
|
||||
|
||||
Ipv4AddressTrieEAccessTraits::size_type
|
||||
Ipv4AddressTrieEAccessTraits::e_pos (Ipv4AddressTrieEAccessTraits::e_type e)
|
||||
{
|
||||
return e;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#include <ext/pb_ds/detail/trie_policy/trie_policy_base.hpp>
|
||||
|
||||
#define PB_DS_BASE_C_DEC \
|
||||
PB_DS::detail::trie_policy_base<Const_Node_Iterator,Node_Iterator,E_Access_Traits,Allocator>
|
||||
|
||||
template<typename Const_Node_Iterator,
|
||||
class Node_Iterator,
|
||||
class E_Access_Traits,
|
||||
class Allocator>
|
||||
class TrieLongestPrefixMatch : private PB_DS_BASE_C_DEC
|
||||
{
|
||||
private:
|
||||
typedef PB_DS_BASE_C_DEC base_type;
|
||||
public:
|
||||
typedef typename base_type::key_type key_type;
|
||||
typedef typename base_type::const_key_reference const_key_reference;
|
||||
|
||||
// Element access traits.
|
||||
typedef E_Access_Traits e_access_traits;
|
||||
|
||||
// Const element iterator.
|
||||
typedef typename e_access_traits::const_iterator const_e_iterator;
|
||||
|
||||
// Allocator type.
|
||||
typedef Allocator allocator;
|
||||
|
||||
// Size type.
|
||||
typedef typename allocator::size_type size_type;
|
||||
typedef PB_DS::detail::null_node_metadata metadata_type;
|
||||
typedef Const_Node_Iterator const_node_iterator;
|
||||
typedef Node_Iterator node_iterator;
|
||||
typedef typename const_node_iterator::value_type const_iterator;
|
||||
typedef typename node_iterator::value_type iterator;
|
||||
|
||||
inline const_iterator
|
||||
longest_prefix_match (const_key_reference r_key)
|
||||
{
|
||||
return longest_prefix_match (
|
||||
get_e_access_traits().begin (r_key),
|
||||
get_e_access_traits().end (r_key));
|
||||
}
|
||||
|
||||
inline const_iterator
|
||||
longest_prefix_match (typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e)
|
||||
{
|
||||
if (empty())
|
||||
return (end());
|
||||
|
||||
node_iterator nd_it = node_begin ();
|
||||
node_iterator end_nd_it = node_end ();
|
||||
|
||||
const e_access_traits& r_traits = get_e_access_traits ();
|
||||
const size_type given_range_length = std::distance (b, e);
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (nd_it == end_nd_it) return end ();
|
||||
|
||||
const size_type common_range_length =
|
||||
base_type::common_prefix_len (nd_it, b, e, r_traits);
|
||||
|
||||
if (common_range_length >= given_range_length) // not sure what this condition is for...
|
||||
{
|
||||
return rightmost_it (nd_it);
|
||||
}
|
||||
|
||||
nd_it = next_child (nd_it, b, e, end_nd_it, r_traits);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
inline void
|
||||
operator()(node_iterator node_it, const_node_iterator end_nd_it) const
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
// Returns true if the container is empty.
|
||||
virtual bool
|
||||
empty() const = 0;
|
||||
|
||||
// Returns the const iterator associated with the just-after last element.
|
||||
virtual const_iterator
|
||||
end() const = 0;
|
||||
|
||||
// Returns the iterator associated with the just-after last element.
|
||||
virtual iterator
|
||||
end() = 0;
|
||||
|
||||
// Returns the const_node_iterator associated with the trie's root node.
|
||||
virtual const_node_iterator
|
||||
node_begin() const = 0;
|
||||
|
||||
// Returns the node_iterator associated with the trie's root node.
|
||||
virtual node_iterator
|
||||
node_begin() = 0;
|
||||
|
||||
// Returns the const_node_iterator associated with a just-after leaf node.
|
||||
virtual const_node_iterator
|
||||
node_end() const = 0;
|
||||
|
||||
// Returns the node_iterator associated with a just-after leaf node.
|
||||
virtual node_iterator
|
||||
node_end() = 0;
|
||||
|
||||
// Access to the cmp_fn object.
|
||||
virtual const e_access_traits&
|
||||
get_e_access_traits() const = 0;
|
||||
|
||||
node_iterator
|
||||
next_child(node_iterator nd_it, const_e_iterator b, const_e_iterator e,
|
||||
node_iterator end_nd_it, const e_access_traits &r_traits)
|
||||
{
|
||||
const size_type num_children = nd_it.num_children();
|
||||
|
||||
node_iterator ret = end_nd_it;
|
||||
size_type max_length = 0;
|
||||
|
||||
for (size_type i = 0; i < num_children; ++i)
|
||||
{
|
||||
node_iterator pot = nd_it.get_child (i);
|
||||
|
||||
const size_type common_range_length =
|
||||
PB_DS_BASE_C_DEC::common_prefix_len (pot, b, e, r_traits);
|
||||
|
||||
if (common_range_length > max_length)
|
||||
{
|
||||
ret = pot;
|
||||
|
||||
max_length = common_range_length;
|
||||
}
|
||||
}
|
||||
|
||||
return (ret);
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
template<class MappedValue>
|
||||
class Ipv4AddressTrie : public PB_DS::trie<Ipv4Address,MappedValue,Ipv4AddressTrieEAccessTraits,
|
||||
PB_DS::pat_trie_tag,TrieLongestPrefixMatch>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif // _TRIE_H_
|
||||
@@ -124,6 +124,7 @@ def build(bld):
|
||||
'utils/simple-channel.h',
|
||||
'utils/simple-net-device.h',
|
||||
'utils/pcap-test.h',
|
||||
'utils/trie.h',
|
||||
'helper/application-container.h',
|
||||
'helper/net-device-container.h',
|
||||
'helper/node-container.h',
|
||||
|
||||
@@ -76,11 +76,9 @@ DynamicGlobalRoutingTestCase::~DynamicGlobalRoutingTestCase ()
|
||||
void
|
||||
DynamicGlobalRoutingTestCase::SinkRx (std::string path, Ptr<const Packet> p, const Address& address)
|
||||
{
|
||||
Ipv4PacketInfoTag tag;
|
||||
bool found;
|
||||
found = p->PeekPacketTag (tag);
|
||||
Ptr<const Ipv4PacketInfoTag> tag = p->PeekPacketTag<Ipv4PacketInfoTag> ();
|
||||
uint8_t now = static_cast<uint8_t> (Simulator::Now ().GetSeconds ());
|
||||
if (found)
|
||||
if (tag != 0)
|
||||
{
|
||||
;
|
||||
}
|
||||
@@ -99,17 +97,15 @@ DynamicGlobalRoutingTestCase::HandleRead (Ptr<Socket> socket)
|
||||
{ //EOF
|
||||
break;
|
||||
}
|
||||
Ipv4PacketInfoTag tag;
|
||||
bool found;
|
||||
found = packet->PeekPacketTag (tag);
|
||||
Ptr<const Ipv4PacketInfoTag> tag = packet->PeekPacketTag<Ipv4PacketInfoTag> ();
|
||||
uint8_t now = static_cast<uint8_t> (Simulator::Now ().GetSeconds ());
|
||||
if (found)
|
||||
if (tag != 0)
|
||||
{
|
||||
if (tag.GetRecvIf () == 1)
|
||||
if (tag->GetRecvIf () == 1)
|
||||
{
|
||||
m_firstInterface[now]++;
|
||||
}
|
||||
if (tag.GetRecvIf () == 2)
|
||||
if (tag->GetRecvIf () == 2)
|
||||
{
|
||||
m_secondInterface[now]++;
|
||||
}
|
||||
|
||||
@@ -78,8 +78,6 @@ def register_types(module):
|
||||
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeValue', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeValue>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > [class]
|
||||
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::CallbackImplBase', 'ns3::empty', 'ns3::DefaultDeleter<ns3::CallbackImplBase>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> > [class]
|
||||
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::TopologyReader', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TopologyReader>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class]
|
||||
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
|
||||
## nstime.h (module 'core'): ns3::Time [class]
|
||||
@@ -89,7 +87,7 @@ def register_types(module):
|
||||
## nstime.h (module 'core'): ns3::Time [class]
|
||||
root_module['ns3::Time'].implicitly_converts_to(root_module['ns3::int64x64_t'])
|
||||
## topology-reader.h (module 'topology-read'): ns3::TopologyReader [class]
|
||||
module.add_class('TopologyReader', parent=root_module['ns3::SimpleRefCount< ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >'])
|
||||
module.add_class('TopologyReader', parent=root_module['ns3::Object'])
|
||||
## topology-reader.h (module 'topology-read'): ns3::TopologyReader::Link [class]
|
||||
module.add_class('Link', outer_class=root_module['ns3::TopologyReader'])
|
||||
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor [class]
|
||||
@@ -186,7 +184,6 @@ def register_methods(root_module):
|
||||
register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
|
||||
register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
|
||||
register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >'])
|
||||
register_Ns3SimpleRefCount__Ns3TopologyReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3TopologyReader__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >'])
|
||||
register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
|
||||
register_Ns3Time_methods(root_module, root_module['ns3::Time'])
|
||||
register_Ns3TopologyReader_methods(root_module, root_module['ns3::TopologyReader'])
|
||||
@@ -377,9 +374,9 @@ def register_Ns3Ipv4Address_methods(root_module, cls):
|
||||
'ns3::Ipv4Address',
|
||||
[param('uint8_t const *', 'buf')],
|
||||
is_static=True)
|
||||
## ipv4-address.h (module 'network'): uint32_t const & ns3::Ipv4Address::Get() const [member function]
|
||||
## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Address::Get() const [member function]
|
||||
cls.add_method('Get',
|
||||
'uint32_t const &',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetAny() [member function]
|
||||
@@ -1384,18 +1381,6 @@ def register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__
|
||||
is_static=True)
|
||||
return
|
||||
|
||||
def register_Ns3SimpleRefCount__Ns3TopologyReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3TopologyReader__gt___methods(root_module, cls):
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >::SimpleRefCount() [constructor]
|
||||
cls.add_constructor([])
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >::SimpleRefCount(ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> > const & o) [copy constructor]
|
||||
cls.add_constructor([param('ns3::SimpleRefCount< ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter< ns3::TopologyReader > > const &', 'o')])
|
||||
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >::Cleanup() [member function]
|
||||
cls.add_method('Cleanup',
|
||||
'void',
|
||||
[],
|
||||
is_static=True)
|
||||
return
|
||||
|
||||
def register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, cls):
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount() [constructor]
|
||||
cls.add_constructor([])
|
||||
@@ -1576,6 +1561,11 @@ def register_Ns3TopologyReader_methods(root_module, cls):
|
||||
'std::string',
|
||||
[],
|
||||
is_const=True)
|
||||
## topology-reader.h (module 'topology-read'): static ns3::TypeId ns3::TopologyReader::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## topology-reader.h (module 'topology-read'): std::_List_const_iterator<ns3::TopologyReader::Link> ns3::TopologyReader::LinksBegin() const [member function]
|
||||
cls.add_method('LinksBegin',
|
||||
'std::_List_const_iterator< ns3::TopologyReader::Link >',
|
||||
@@ -1610,8 +1600,6 @@ def register_Ns3TopologyReader_methods(root_module, cls):
|
||||
def register_Ns3TopologyReaderLink_methods(root_module, cls):
|
||||
## topology-reader.h (module 'topology-read'): ns3::TopologyReader::Link::Link(ns3::TopologyReader::Link const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::TopologyReader::Link const &', 'arg0')])
|
||||
## topology-reader.h (module 'topology-read'): ns3::TopologyReader::Link::Link() [constructor]
|
||||
cls.add_constructor([])
|
||||
## topology-reader.h (module 'topology-read'): ns3::TopologyReader::Link::Link(ns3::Ptr<ns3::Node> fromPtr, std::string const & fromName, ns3::Ptr<ns3::Node> toPtr, std::string const & toName) [constructor]
|
||||
cls.add_constructor([param('ns3::Ptr< ns3::Node >', 'fromPtr'), param('std::string const &', 'fromName'), param('ns3::Ptr< ns3::Node >', 'toPtr'), param('std::string const &', 'toName')])
|
||||
## topology-reader.h (module 'topology-read'): std::_Rb_tree_const_iterator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > ns3::TopologyReader::Link::AttributesBegin() [member function]
|
||||
@@ -1632,11 +1620,6 @@ def register_Ns3TopologyReaderLink_methods(root_module, cls):
|
||||
'bool',
|
||||
[param('std::string const &', 'name'), param('std::string &', 'value')],
|
||||
is_const=True)
|
||||
## topology-reader.h (module 'topology-read'): ns3::Ptr<ns3::NetDevice> ns3::TopologyReader::Link::GetFromNetDevice() const [member function]
|
||||
cls.add_method('GetFromNetDevice',
|
||||
'ns3::Ptr< ns3::NetDevice >',
|
||||
[],
|
||||
is_const=True)
|
||||
## topology-reader.h (module 'topology-read'): ns3::Ptr<ns3::Node> ns3::TopologyReader::Link::GetFromNode() const [member function]
|
||||
cls.add_method('GetFromNode',
|
||||
'ns3::Ptr< ns3::Node >',
|
||||
@@ -1647,11 +1630,6 @@ def register_Ns3TopologyReaderLink_methods(root_module, cls):
|
||||
'std::string',
|
||||
[],
|
||||
is_const=True)
|
||||
## topology-reader.h (module 'topology-read'): ns3::Ptr<ns3::NetDevice> ns3::TopologyReader::Link::GetToNetDevice() const [member function]
|
||||
cls.add_method('GetToNetDevice',
|
||||
'ns3::Ptr< ns3::NetDevice >',
|
||||
[],
|
||||
is_const=True)
|
||||
## topology-reader.h (module 'topology-read'): ns3::Ptr<ns3::Node> ns3::TopologyReader::Link::GetToNode() const [member function]
|
||||
cls.add_method('GetToNode',
|
||||
'ns3::Ptr< ns3::Node >',
|
||||
@@ -1666,10 +1644,6 @@ def register_Ns3TopologyReaderLink_methods(root_module, cls):
|
||||
cls.add_method('SetAttribute',
|
||||
'void',
|
||||
[param('std::string const &', 'name'), param('std::string const &', 'value')])
|
||||
## topology-reader.h (module 'topology-read'): void ns3::TopologyReader::Link::SetNetDevices(ns3::Ptr<ns3::NetDevice> from, ns3::Ptr<ns3::NetDevice> to) [member function]
|
||||
cls.add_method('SetNetDevices',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::NetDevice >', 'from'), param('ns3::Ptr< ns3::NetDevice >', 'to')])
|
||||
return
|
||||
|
||||
def register_Ns3TraceSourceAccessor_methods(root_module, cls):
|
||||
@@ -1860,6 +1834,11 @@ def register_Ns3EmptyAttributeValue_methods(root_module, cls):
|
||||
return
|
||||
|
||||
def register_Ns3InetTopologyReader_methods(root_module, cls):
|
||||
## inet-topology-reader.h (module 'topology-read'): static ns3::TypeId ns3::InetTopologyReader::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## inet-topology-reader.h (module 'topology-read'): ns3::InetTopologyReader::InetTopologyReader() [constructor]
|
||||
cls.add_constructor([])
|
||||
## inet-topology-reader.h (module 'topology-read'): ns3::NodeContainer ns3::InetTopologyReader::Read() [member function]
|
||||
@@ -2245,6 +2224,11 @@ def register_Ns3Node_methods(root_module, cls):
|
||||
return
|
||||
|
||||
def register_Ns3OrbisTopologyReader_methods(root_module, cls):
|
||||
## orbis-topology-reader.h (module 'topology-read'): static ns3::TypeId ns3::OrbisTopologyReader::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## orbis-topology-reader.h (module 'topology-read'): ns3::OrbisTopologyReader::OrbisTopologyReader() [constructor]
|
||||
cls.add_constructor([])
|
||||
## orbis-topology-reader.h (module 'topology-read'): ns3::NodeContainer ns3::OrbisTopologyReader::Read() [member function]
|
||||
@@ -2255,6 +2239,11 @@ def register_Ns3OrbisTopologyReader_methods(root_module, cls):
|
||||
return
|
||||
|
||||
def register_Ns3RocketfuelTopologyReader_methods(root_module, cls):
|
||||
## rocketfuel-topology-reader.h (module 'topology-read'): static ns3::TypeId ns3::RocketfuelTopologyReader::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## rocketfuel-topology-reader.h (module 'topology-read'): ns3::RocketfuelTopologyReader::RocketfuelTopologyReader() [constructor]
|
||||
cls.add_constructor([])
|
||||
## rocketfuel-topology-reader.h (module 'topology-read'): ns3::NodeContainer ns3::RocketfuelTopologyReader::Read() [member function]
|
||||
|
||||
@@ -78,8 +78,6 @@ def register_types(module):
|
||||
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeValue', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeValue>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > [class]
|
||||
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::CallbackImplBase', 'ns3::empty', 'ns3::DefaultDeleter<ns3::CallbackImplBase>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> > [class]
|
||||
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::TopologyReader', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TopologyReader>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class]
|
||||
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
|
||||
## nstime.h (module 'core'): ns3::Time [class]
|
||||
@@ -89,7 +87,7 @@ def register_types(module):
|
||||
## nstime.h (module 'core'): ns3::Time [class]
|
||||
root_module['ns3::Time'].implicitly_converts_to(root_module['ns3::int64x64_t'])
|
||||
## topology-reader.h (module 'topology-read'): ns3::TopologyReader [class]
|
||||
module.add_class('TopologyReader', parent=root_module['ns3::SimpleRefCount< ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >'])
|
||||
module.add_class('TopologyReader', parent=root_module['ns3::Object'])
|
||||
## topology-reader.h (module 'topology-read'): ns3::TopologyReader::Link [class]
|
||||
module.add_class('Link', outer_class=root_module['ns3::TopologyReader'])
|
||||
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor [class]
|
||||
@@ -186,7 +184,6 @@ def register_methods(root_module):
|
||||
register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
|
||||
register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
|
||||
register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >'])
|
||||
register_Ns3SimpleRefCount__Ns3TopologyReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3TopologyReader__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >'])
|
||||
register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
|
||||
register_Ns3Time_methods(root_module, root_module['ns3::Time'])
|
||||
register_Ns3TopologyReader_methods(root_module, root_module['ns3::TopologyReader'])
|
||||
@@ -377,9 +374,9 @@ def register_Ns3Ipv4Address_methods(root_module, cls):
|
||||
'ns3::Ipv4Address',
|
||||
[param('uint8_t const *', 'buf')],
|
||||
is_static=True)
|
||||
## ipv4-address.h (module 'network'): uint32_t const & ns3::Ipv4Address::Get() const [member function]
|
||||
## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Address::Get() const [member function]
|
||||
cls.add_method('Get',
|
||||
'uint32_t const &',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetAny() [member function]
|
||||
@@ -1384,18 +1381,6 @@ def register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__
|
||||
is_static=True)
|
||||
return
|
||||
|
||||
def register_Ns3SimpleRefCount__Ns3TopologyReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3TopologyReader__gt___methods(root_module, cls):
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >::SimpleRefCount() [constructor]
|
||||
cls.add_constructor([])
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >::SimpleRefCount(ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> > const & o) [copy constructor]
|
||||
cls.add_constructor([param('ns3::SimpleRefCount< ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter< ns3::TopologyReader > > const &', 'o')])
|
||||
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >::Cleanup() [member function]
|
||||
cls.add_method('Cleanup',
|
||||
'void',
|
||||
[],
|
||||
is_static=True)
|
||||
return
|
||||
|
||||
def register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, cls):
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount() [constructor]
|
||||
cls.add_constructor([])
|
||||
@@ -1576,6 +1561,11 @@ def register_Ns3TopologyReader_methods(root_module, cls):
|
||||
'std::string',
|
||||
[],
|
||||
is_const=True)
|
||||
## topology-reader.h (module 'topology-read'): static ns3::TypeId ns3::TopologyReader::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## topology-reader.h (module 'topology-read'): std::_List_const_iterator<ns3::TopologyReader::Link> ns3::TopologyReader::LinksBegin() const [member function]
|
||||
cls.add_method('LinksBegin',
|
||||
'std::_List_const_iterator< ns3::TopologyReader::Link >',
|
||||
@@ -1610,8 +1600,6 @@ def register_Ns3TopologyReader_methods(root_module, cls):
|
||||
def register_Ns3TopologyReaderLink_methods(root_module, cls):
|
||||
## topology-reader.h (module 'topology-read'): ns3::TopologyReader::Link::Link(ns3::TopologyReader::Link const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::TopologyReader::Link const &', 'arg0')])
|
||||
## topology-reader.h (module 'topology-read'): ns3::TopologyReader::Link::Link() [constructor]
|
||||
cls.add_constructor([])
|
||||
## topology-reader.h (module 'topology-read'): ns3::TopologyReader::Link::Link(ns3::Ptr<ns3::Node> fromPtr, std::string const & fromName, ns3::Ptr<ns3::Node> toPtr, std::string const & toName) [constructor]
|
||||
cls.add_constructor([param('ns3::Ptr< ns3::Node >', 'fromPtr'), param('std::string const &', 'fromName'), param('ns3::Ptr< ns3::Node >', 'toPtr'), param('std::string const &', 'toName')])
|
||||
## topology-reader.h (module 'topology-read'): std::_Rb_tree_const_iterator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > ns3::TopologyReader::Link::AttributesBegin() [member function]
|
||||
@@ -1632,11 +1620,6 @@ def register_Ns3TopologyReaderLink_methods(root_module, cls):
|
||||
'bool',
|
||||
[param('std::string const &', 'name'), param('std::string &', 'value')],
|
||||
is_const=True)
|
||||
## topology-reader.h (module 'topology-read'): ns3::Ptr<ns3::NetDevice> ns3::TopologyReader::Link::GetFromNetDevice() const [member function]
|
||||
cls.add_method('GetFromNetDevice',
|
||||
'ns3::Ptr< ns3::NetDevice >',
|
||||
[],
|
||||
is_const=True)
|
||||
## topology-reader.h (module 'topology-read'): ns3::Ptr<ns3::Node> ns3::TopologyReader::Link::GetFromNode() const [member function]
|
||||
cls.add_method('GetFromNode',
|
||||
'ns3::Ptr< ns3::Node >',
|
||||
@@ -1647,11 +1630,6 @@ def register_Ns3TopologyReaderLink_methods(root_module, cls):
|
||||
'std::string',
|
||||
[],
|
||||
is_const=True)
|
||||
## topology-reader.h (module 'topology-read'): ns3::Ptr<ns3::NetDevice> ns3::TopologyReader::Link::GetToNetDevice() const [member function]
|
||||
cls.add_method('GetToNetDevice',
|
||||
'ns3::Ptr< ns3::NetDevice >',
|
||||
[],
|
||||
is_const=True)
|
||||
## topology-reader.h (module 'topology-read'): ns3::Ptr<ns3::Node> ns3::TopologyReader::Link::GetToNode() const [member function]
|
||||
cls.add_method('GetToNode',
|
||||
'ns3::Ptr< ns3::Node >',
|
||||
@@ -1666,10 +1644,6 @@ def register_Ns3TopologyReaderLink_methods(root_module, cls):
|
||||
cls.add_method('SetAttribute',
|
||||
'void',
|
||||
[param('std::string const &', 'name'), param('std::string const &', 'value')])
|
||||
## topology-reader.h (module 'topology-read'): void ns3::TopologyReader::Link::SetNetDevices(ns3::Ptr<ns3::NetDevice> from, ns3::Ptr<ns3::NetDevice> to) [member function]
|
||||
cls.add_method('SetNetDevices',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::NetDevice >', 'from'), param('ns3::Ptr< ns3::NetDevice >', 'to')])
|
||||
return
|
||||
|
||||
def register_Ns3TraceSourceAccessor_methods(root_module, cls):
|
||||
@@ -1860,6 +1834,11 @@ def register_Ns3EmptyAttributeValue_methods(root_module, cls):
|
||||
return
|
||||
|
||||
def register_Ns3InetTopologyReader_methods(root_module, cls):
|
||||
## inet-topology-reader.h (module 'topology-read'): static ns3::TypeId ns3::InetTopologyReader::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## inet-topology-reader.h (module 'topology-read'): ns3::InetTopologyReader::InetTopologyReader() [constructor]
|
||||
cls.add_constructor([])
|
||||
## inet-topology-reader.h (module 'topology-read'): ns3::NodeContainer ns3::InetTopologyReader::Read() [member function]
|
||||
@@ -2245,6 +2224,11 @@ def register_Ns3Node_methods(root_module, cls):
|
||||
return
|
||||
|
||||
def register_Ns3OrbisTopologyReader_methods(root_module, cls):
|
||||
## orbis-topology-reader.h (module 'topology-read'): static ns3::TypeId ns3::OrbisTopologyReader::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## orbis-topology-reader.h (module 'topology-read'): ns3::OrbisTopologyReader::OrbisTopologyReader() [constructor]
|
||||
cls.add_constructor([])
|
||||
## orbis-topology-reader.h (module 'topology-read'): ns3::NodeContainer ns3::OrbisTopologyReader::Read() [member function]
|
||||
@@ -2255,6 +2239,11 @@ def register_Ns3OrbisTopologyReader_methods(root_module, cls):
|
||||
return
|
||||
|
||||
def register_Ns3RocketfuelTopologyReader_methods(root_module, cls):
|
||||
## rocketfuel-topology-reader.h (module 'topology-read'): static ns3::TypeId ns3::RocketfuelTopologyReader::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## rocketfuel-topology-reader.h (module 'topology-read'): ns3::RocketfuelTopologyReader::RocketfuelTopologyReader() [constructor]
|
||||
cls.add_constructor([])
|
||||
## rocketfuel-topology-reader.h (module 'topology-read'): ns3::NodeContainer ns3::RocketfuelTopologyReader::Read() [member function]
|
||||
|
||||
@@ -55,7 +55,7 @@ RocketfuelTopologyReaderTest::DoRun (void)
|
||||
|
||||
std::string input ("./src/topology-read/examples/RocketFuel_toposample_1239_weights.txt");
|
||||
|
||||
inFile = CreateObject<RocketfuelTopologyReader> ();
|
||||
inFile = Create<RocketfuelTopologyReader> ();
|
||||
inFile->SetFileName (input);
|
||||
|
||||
if (inFile != 0)
|
||||
|
||||
@@ -113,8 +113,7 @@ class Tunnel
|
||||
{
|
||||
Ptr<Packet> packet = socket->Recv (65535, 0);
|
||||
NS_LOG_DEBUG ("N3SocketRecv: " << *packet);
|
||||
SocketAddressTag socketAddressTag;
|
||||
packet->RemovePacketTag (socketAddressTag);
|
||||
packet->RemovePacketTag<SocketAddressTag> ();
|
||||
m_n3Tap->Receive (packet, 0x0800, m_n3Tap->GetAddress (), m_n3Tap->GetAddress (), NetDevice::PACKET_HOST);
|
||||
}
|
||||
|
||||
@@ -122,8 +121,7 @@ class Tunnel
|
||||
{
|
||||
Ptr<Packet> packet = socket->Recv (65535, 0);
|
||||
NS_LOG_DEBUG ("N0SocketRecv: " << *packet);
|
||||
SocketAddressTag socketAddressTag;
|
||||
packet->RemovePacketTag (socketAddressTag);
|
||||
packet->RemovePacketTag<SocketAddressTag> ();
|
||||
m_n0Tap->Receive (packet, 0x0800, m_n0Tap->GetAddress (), m_n0Tap->GetAddress (), NetDevice::PACKET_HOST);
|
||||
}
|
||||
|
||||
@@ -131,8 +129,7 @@ class Tunnel
|
||||
{
|
||||
Ptr<Packet> packet = socket->Recv (65535, 0);
|
||||
NS_LOG_DEBUG ("N1SocketRecv: " << *packet);
|
||||
SocketAddressTag socketAddressTag;
|
||||
packet->RemovePacketTag (socketAddressTag);
|
||||
packet->RemovePacketTag<SocketAddressTag> ();
|
||||
m_n1Tap->Receive (packet, 0x0800, m_n1Tap->GetAddress (), m_n1Tap->GetAddress (), NetDevice::PACKET_HOST);
|
||||
}
|
||||
|
||||
|
||||
@@ -709,12 +709,11 @@ MacLow::ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiMode txMode, WifiPreamb
|
||||
&& m_currentPacket != 0)
|
||||
{
|
||||
NS_LOG_DEBUG ("receive cts from=" << m_currentHdr.GetAddr1 ());
|
||||
SnrTag tag;
|
||||
packet->RemovePacketTag (tag);
|
||||
Ptr<const SnrTag> tag = packet->RemovePacketTag<SnrTag> ();
|
||||
m_stationManager->ReportRxOk (m_currentHdr.GetAddr1 (), &m_currentHdr,
|
||||
rxSnr, txMode);
|
||||
m_stationManager->ReportRtsOk (m_currentHdr.GetAddr1 (), &m_currentHdr,
|
||||
rxSnr, txMode, tag.Get ());
|
||||
rxSnr, txMode, tag->Get ());
|
||||
|
||||
m_ctsTimeoutEvent.Cancel ();
|
||||
NotifyCtsTimeoutResetNow ();
|
||||
@@ -734,12 +733,11 @@ MacLow::ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiMode txMode, WifiPreamb
|
||||
&& m_txParams.MustWaitAck ())
|
||||
{
|
||||
NS_LOG_DEBUG ("receive ack from=" << m_currentHdr.GetAddr1 ());
|
||||
SnrTag tag;
|
||||
packet->RemovePacketTag (tag);
|
||||
Ptr<const SnrTag> tag = packet->RemovePacketTag<SnrTag> ();
|
||||
m_stationManager->ReportRxOk (m_currentHdr.GetAddr1 (), &m_currentHdr,
|
||||
rxSnr, txMode);
|
||||
m_stationManager->ReportDataOk (m_currentHdr.GetAddr1 (), &m_currentHdr,
|
||||
rxSnr, txMode, tag.Get ());
|
||||
rxSnr, txMode, tag->Get ());
|
||||
bool gotAck = false;
|
||||
if (m_txParams.MustWaitNormalAck ()
|
||||
&& m_normalAckTimeoutEvent.IsRunning ())
|
||||
@@ -1446,8 +1444,8 @@ MacLow::SendCtsAfterRts (Mac48Address source, Time duration, WifiMode rtsTxMode,
|
||||
WifiMacTrailer fcs;
|
||||
packet->AddTrailer (fcs);
|
||||
|
||||
SnrTag tag;
|
||||
tag.Set (rtsSnr);
|
||||
Ptr<SnrTag> tag = CreateObject<SnrTag> ();
|
||||
tag->Set (rtsSnr);
|
||||
packet->AddPacketTag (tag);
|
||||
|
||||
ForwardDown (packet, &cts, ctsTxMode);
|
||||
@@ -1525,8 +1523,8 @@ MacLow::SendAckAfterData (Mac48Address source, Time duration, WifiMode dataTxMod
|
||||
WifiMacTrailer fcs;
|
||||
packet->AddTrailer (fcs);
|
||||
|
||||
SnrTag tag;
|
||||
tag.Set (dataSnr);
|
||||
Ptr<SnrTag> tag = CreateObject<SnrTag> ();
|
||||
tag->Set (dataSnr);
|
||||
packet->AddPacketTag (tag);
|
||||
|
||||
ForwardDown (packet, &ack, ackTxMode);
|
||||
|
||||
@@ -59,13 +59,13 @@ QosUtilsMapTidToAc (uint8_t tid)
|
||||
uint8_t
|
||||
QosUtilsGetTidForPacket (Ptr<const Packet> packet)
|
||||
{
|
||||
QosTag qos;
|
||||
Ptr<const QosTag> qos = packet->PeekPacketTag<QosTag> ();
|
||||
uint8_t tid = 8;
|
||||
if (packet->PeekPacketTag (qos))
|
||||
if (qos != 0)
|
||||
{
|
||||
if (qos.GetTid () < 8)
|
||||
if (qos->GetTid () < 8)
|
||||
{
|
||||
tid = qos.GetTid ();
|
||||
tid = qos->GetTid ();
|
||||
}
|
||||
}
|
||||
return tid;
|
||||
|
||||
@@ -347,12 +347,12 @@ WifiRemoteStationManager::PrepareForQueue (Mac48Address address, const WifiMacHe
|
||||
WifiRemoteStation *station = Lookup (address, header);
|
||||
WifiMode rts = DoGetRtsMode (station);
|
||||
WifiMode data = DoGetDataMode (station, fullPacketSize);
|
||||
TxModeTag tag;
|
||||
|
||||
// first, make sure that the tag is not here anymore.
|
||||
ConstCast<Packet> (packet)->RemovePacketTag (tag);
|
||||
tag = TxModeTag (rts, data);
|
||||
ConstCast<Packet> (packet)->RemovePacketTag<TxModeTag> ();
|
||||
Ptr<TxModeTag> tag = CreateObject<TxModeTag> (rts, data);
|
||||
// and then, add it back
|
||||
packet->AddPacketTag (tag);
|
||||
ConstCast<Packet> (packet)->AddPacketTag (tag);
|
||||
}
|
||||
WifiMode
|
||||
WifiRemoteStationManager::GetDataMode (Mac48Address address, const WifiMacHeader *header,
|
||||
@@ -364,11 +364,9 @@ WifiRemoteStationManager::GetDataMode (Mac48Address address, const WifiMacHeader
|
||||
}
|
||||
if (!IsLowLatency ())
|
||||
{
|
||||
TxModeTag tag;
|
||||
bool found;
|
||||
found = ConstCast<Packet> (packet)->PeekPacketTag (tag);
|
||||
NS_ASSERT (found);
|
||||
return tag.GetDataMode ();
|
||||
Ptr<const TxModeTag> tag = packet->PeekPacketTag<TxModeTag> ();
|
||||
NS_ASSERT (tag != 0);
|
||||
return tag->GetDataMode ();
|
||||
}
|
||||
return DoGetDataMode (Lookup (address, header), fullPacketSize);
|
||||
}
|
||||
@@ -379,11 +377,9 @@ WifiRemoteStationManager::GetRtsMode (Mac48Address address, const WifiMacHeader
|
||||
NS_ASSERT (!address.IsGroup ());
|
||||
if (!IsLowLatency ())
|
||||
{
|
||||
TxModeTag tag;
|
||||
bool found;
|
||||
found = ConstCast<Packet> (packet)->PeekPacketTag (tag);
|
||||
NS_ASSERT (found);
|
||||
return tag.GetRtsMode ();
|
||||
Ptr<const TxModeTag> tag = packet->PeekPacketTag<TxModeTag> ();
|
||||
NS_ASSERT (tag != 0);
|
||||
return tag->GetRtsMode ();
|
||||
}
|
||||
return DoGetRtsMode (Lookup (address, header));
|
||||
}
|
||||
|
||||
@@ -163,19 +163,19 @@ benchD (uint32_t n)
|
||||
{
|
||||
BenchHeader<25> ipv4;
|
||||
BenchHeader<8> udp;
|
||||
BenchTag<16> tag1;
|
||||
BenchTag<17> tag2;
|
||||
|
||||
for (uint32_t i = 0; i < n; i++) {
|
||||
Ptr<Packet> p = Create<Packet> (2000);
|
||||
p->AddPacketTag (tag1);
|
||||
p->AddPacketTag (CreateObject<BenchTag<16> > ());
|
||||
p->AddHeader (udp);
|
||||
p->RemovePacketTag (tag1);
|
||||
p->AddPacketTag (tag2);
|
||||
p->RemovePacketTag (BenchTag<16>::GetTypeId ());
|
||||
|
||||
p->AddPacketTag (CreateObject<BenchTag<17> > ());
|
||||
p->AddHeader (ipv4);
|
||||
|
||||
Ptr<Packet> o = p->Copy ();
|
||||
o->RemoveHeader (ipv4);
|
||||
p->RemovePacketTag (tag2);
|
||||
p->RemovePacketTag (BenchTag<17>::GetTypeId ());
|
||||
o->RemoveHeader (udp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,20 +313,17 @@ PrintHelp (const char *program_name)
|
||||
<< std::endl
|
||||
<< "Options:" << std::endl
|
||||
<< " --help : print these options" << std::endl
|
||||
<< " --output-text : format output as plain text" << std::endl
|
||||
<< " --group <group> : print information only for this group" << std::endl;
|
||||
<< " --output-text : format output as plain text" << std::endl;
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
bool outputText = false;
|
||||
char *programName = argv[0];
|
||||
std::string group = "";
|
||||
|
||||
argv++;
|
||||
argc--;
|
||||
|
||||
while (argc > 0 && *argv != 0)
|
||||
while (*argv != 0)
|
||||
{
|
||||
char *arg = *argv;
|
||||
|
||||
@@ -339,17 +336,6 @@ int main (int argc, char *argv[])
|
||||
{
|
||||
outputText = true;
|
||||
}
|
||||
else if (strcmp(arg, "--group") == 0)
|
||||
{
|
||||
argv ++;
|
||||
argc --;
|
||||
if (argc == 0 || argv == 0)
|
||||
{
|
||||
PrintHelp (programName);
|
||||
return 0;
|
||||
}
|
||||
group = *argv;
|
||||
}
|
||||
else
|
||||
{
|
||||
// un-recognized command-line argument
|
||||
@@ -357,7 +343,6 @@ int main (int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
argv++;
|
||||
argc--;
|
||||
}
|
||||
|
||||
if (outputText)
|
||||
@@ -447,11 +432,6 @@ int main (int argc, char *argv[])
|
||||
continue;
|
||||
}
|
||||
|
||||
if (group != "" && tid.GetGroupName () != group)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Capitalize all of letters in the name so that it sorts
|
||||
// correctly in the map.
|
||||
std::string name = tid.GetName ();
|
||||
@@ -550,12 +530,6 @@ int main (int argc, char *argv[])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (group != "" && tid.GetGroupName () != group)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
std::cout << boldStart << tid.GetName () << boldStop << breakHtmlOnly << std::endl
|
||||
<< listStart << std::endl;
|
||||
for (uint32_t j = 0; j < tid.GetTraceSourceN (); ++j)
|
||||
@@ -578,12 +552,6 @@ int main (int argc, char *argv[])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (group != "" && tid.GetGroupName () != group)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
std::cout << boldStart << tid.GetName () << boldStop << breakHtmlOnly << std::endl
|
||||
<< listStart << std::endl;
|
||||
for (uint32_t j = 0; j < tid.GetAttributeN (); ++j)
|
||||
|
||||
Reference in new issue
Block a user