merge with ns-3-dev
This commit is contained in:
commit
be1e0dea3f
88 files changed
+1844
-1070
No files matched your search
@@ -52,6 +52,21 @@ us a note on ns-developers mailing list. </p>
|
||||
|
||||
<h2>New API:</h2>
|
||||
<ul>
|
||||
<li><b>Longest prefix match, support for metrics, for Ipv4StaticRouting and Ipv6StaticRouting</b>
|
||||
<p>When performing route lookup, first match for longest prefix, and then
|
||||
based on metrics (default metric = 0). If metrics are equal, most recent
|
||||
addition is picked. Extends API for support of metrics but preserves
|
||||
backward compatibility. One small change is that the default route
|
||||
is no longer stored as index 0 route in the host route table so
|
||||
GetDefaultRoute () must be used.
|
||||
</p>
|
||||
</li>
|
||||
<li><b>Route injection for global routing</b>
|
||||
<p>Add ability to inject and withdraw routes to Ipv4GlobalRouting. This
|
||||
allows a user to insert a route and have it redistributed like an OSPF
|
||||
external LSA to the rest of the topology.
|
||||
</p>
|
||||
</li>
|
||||
<li><b>Athstats</b>
|
||||
<p>New classes AthstatsWifiTraceSink and AthstatsHelper.
|
||||
</p>
|
||||
@@ -94,6 +109,13 @@ router solicitation, DAD
|
||||
<li><b>WifiMode</b>
|
||||
<p>WifiMode now has a WifiPhyStandard attribute which identifies the standard the WifiMode belongs to. To properly set this attribute when creating a new WifiMode, it is now required to explicitly pass a WifiPhyStandard parameter to all WifiModeFactory::CreateXXXX() methods. The WifiPhyStandard value of an existing WifiMode can be retrieved using the new method WifiMode::GetStandard().</p>
|
||||
</li>
|
||||
<li><b>NetDevice</b>
|
||||
<p>In order to have multiple link change callback in NetDevice (i.e. to flush ARP and IPv6 neighbor discovery caches), the following member method has been renamed:</p>
|
||||
<pre>
|
||||
- virtual void SetLinkChangeCallback (Callback<void> callback);
|
||||
+ virtual void AddLinkChangeCallback (Callback<void> callback);</pre>
|
||||
Now each NetDevice subclasses have a TracedCallback<> object (list of callbacks) instead of Callback<void> ones.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
@@ -98,6 +98,11 @@ def register_Ns3BridgeNetDevice_methods(root_module, cls):
|
||||
cls.add_method('AddBridgePort',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::NetDevice >', 'bridgePort')])
|
||||
## bridge-net-device.h: void ns3::BridgeNetDevice::AddLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('AddLinkChangeCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
## bridge-net-device.h: ns3::Address ns3::BridgeNetDevice::GetAddress() const [member function]
|
||||
cls.add_method('GetAddress',
|
||||
'ns3::Address',
|
||||
@@ -203,11 +208,6 @@ def register_Ns3BridgeNetDevice_methods(root_module, cls):
|
||||
'void',
|
||||
[param('uint32_t const', 'index')],
|
||||
is_virtual=True)
|
||||
## bridge-net-device.h: void ns3::BridgeNetDevice::SetLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('SetLinkChangeCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
## bridge-net-device.h: bool ns3::BridgeNetDevice::SetMtu(uint16_t const mtu) [member function]
|
||||
cls.add_method('SetMtu',
|
||||
'bool',
|
||||
|
||||
@@ -317,8 +317,8 @@ def register_Ns3CsmaNetDevice_methods(root_module, cls):
|
||||
'bool',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## csma-net-device.h: void ns3::CsmaNetDevice::SetLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('SetLinkChangeCallback',
|
||||
## csma-net-device.h: void ns3::CsmaNetDevice::AddLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('AddLinkChangeCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
|
||||
@@ -65,6 +65,11 @@ def register_Ns3EmuNetDevice_methods(root_module, cls):
|
||||
cls.add_constructor([param('ns3::EmuNetDevice const &', 'arg0')])
|
||||
## emu-net-device.h: ns3::EmuNetDevice::EmuNetDevice() [constructor]
|
||||
cls.add_constructor([])
|
||||
## emu-net-device.h: void ns3::EmuNetDevice::AddLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('AddLinkChangeCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
## emu-net-device.h: ns3::Address ns3::EmuNetDevice::GetAddress() const [member function]
|
||||
cls.add_method('GetAddress',
|
||||
'ns3::Address',
|
||||
@@ -164,11 +169,6 @@ def register_Ns3EmuNetDevice_methods(root_module, cls):
|
||||
'void',
|
||||
[param('uint32_t const', 'index')],
|
||||
is_virtual=True)
|
||||
## emu-net-device.h: void ns3::EmuNetDevice::SetLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('SetLinkChangeCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
## emu-net-device.h: bool ns3::EmuNetDevice::SetMtu(uint16_t const mtu) [member function]
|
||||
cls.add_method('SetMtu',
|
||||
'bool',
|
||||
|
||||
@@ -301,6 +301,26 @@ def register_Ns3GlobalRouter_methods(root_module, cls):
|
||||
'bool',
|
||||
[param('uint32_t', 'n'), param('ns3::GlobalRoutingLSA &', 'lsa')],
|
||||
is_const=True)
|
||||
## global-router-interface.h: void ns3::GlobalRouter::InjectRoute(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask) [member function]
|
||||
cls.add_method('InjectRoute',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask')])
|
||||
## global-router-interface.h: uint32_t ns3::GlobalRouter::GetNInjectedRoutes() [member function]
|
||||
cls.add_method('GetNInjectedRoutes',
|
||||
'uint32_t',
|
||||
[])
|
||||
## global-router-interface.h: ns3::Ipv4RoutingTableEntry * ns3::GlobalRouter::GetInjectedRoute(uint32_t i) [member function]
|
||||
cls.add_method('GetInjectedRoute',
|
||||
'ns3::Ipv4RoutingTableEntry *',
|
||||
[param('uint32_t', 'i')])
|
||||
## global-router-interface.h: void ns3::GlobalRouter::RemoveInjectedRoute(uint32_t i) [member function]
|
||||
cls.add_method('RemoveInjectedRoute',
|
||||
'void',
|
||||
[param('uint32_t', 'i')])
|
||||
## global-router-interface.h: bool ns3::GlobalRouter::WithdrawRoute(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask) [member function]
|
||||
cls.add_method('WithdrawRoute',
|
||||
'bool',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask')])
|
||||
## global-router-interface.h: void ns3::GlobalRouter::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
@@ -313,6 +333,10 @@ def register_Ns3Ipv4GlobalRouting_methods(root_module, cls):
|
||||
cls.add_constructor([param('ns3::Ipv4GlobalRouting const &', 'arg0')])
|
||||
## ipv4-global-routing.h: ns3::Ipv4GlobalRouting::Ipv4GlobalRouting() [constructor]
|
||||
cls.add_constructor([])
|
||||
## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::AddASExternalRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
cls.add_method('AddASExternalRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::AddHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
cls.add_method('AddHostRouteTo',
|
||||
'void',
|
||||
|
||||
@@ -79,8 +79,6 @@ def register_types(module):
|
||||
module.add_class('Ipv4L4Protocol', parent=root_module['ns3::Object'])
|
||||
## ipv4-l4-protocol.h: ns3::Ipv4L4Protocol::RxStatus [enumeration]
|
||||
module.add_enum('RxStatus', ['RX_OK', 'RX_CSUM_FAILED', 'RX_ENDPOINT_UNREACH'], outer_class=root_module['ns3::Ipv4L4Protocol'])
|
||||
## nsc-tcp-l4-protocol.h: ns3::NscTcpL4Protocol [class]
|
||||
module.add_class('NscTcpL4Protocol', parent=root_module['ns3::Ipv4L4Protocol'])
|
||||
## tcp-l4-protocol.h: ns3::TcpL4Protocol [class]
|
||||
module.add_class('TcpL4Protocol', parent=root_module['ns3::Ipv4L4Protocol'])
|
||||
## udp-l4-protocol.h: ns3::UdpL4Protocol [class]
|
||||
@@ -166,7 +164,6 @@ def register_methods(root_module):
|
||||
register_Ns3Icmpv6Echo_methods(root_module, root_module['ns3::Icmpv6Echo'])
|
||||
register_Ns3Ipv4L3Protocol_methods(root_module, root_module['ns3::Ipv4L3Protocol'])
|
||||
register_Ns3Ipv4L4Protocol_methods(root_module, root_module['ns3::Ipv4L4Protocol'])
|
||||
register_Ns3NscTcpL4Protocol_methods(root_module, root_module['ns3::NscTcpL4Protocol'])
|
||||
register_Ns3TcpL4Protocol_methods(root_module, root_module['ns3::TcpL4Protocol'])
|
||||
register_Ns3UdpL4Protocol_methods(root_module, root_module['ns3::UdpL4Protocol'])
|
||||
register_Ns3Icmpv4L4Protocol_methods(root_module, root_module['ns3::Icmpv4L4Protocol'])
|
||||
@@ -1981,84 +1978,6 @@ def register_Ns3Ipv4L4Protocol_methods(root_module, cls):
|
||||
is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3NscTcpL4Protocol_methods(root_module, cls):
|
||||
## nsc-tcp-l4-protocol.h: ns3::NscTcpL4Protocol::PROT_NUMBER [variable]
|
||||
cls.add_static_attribute('PROT_NUMBER', 'uint8_t const', is_const=True)
|
||||
## nsc-tcp-l4-protocol.h: static ns3::TypeId ns3::NscTcpL4Protocol::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## nsc-tcp-l4-protocol.h: ns3::NscTcpL4Protocol::NscTcpL4Protocol() [constructor]
|
||||
cls.add_constructor([])
|
||||
## nsc-tcp-l4-protocol.h: void ns3::NscTcpL4Protocol::SetNode(ns3::Ptr<ns3::Node> node) [member function]
|
||||
cls.add_method('SetNode',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Node >', 'node')])
|
||||
## nsc-tcp-l4-protocol.h: void ns3::NscTcpL4Protocol::SetNscLibrary(std::string const & lib) [member function]
|
||||
cls.add_method('SetNscLibrary',
|
||||
'void',
|
||||
[param('std::string const &', 'lib')])
|
||||
## nsc-tcp-l4-protocol.h: std::string ns3::NscTcpL4Protocol::GetNscLibrary() const [member function]
|
||||
cls.add_method('GetNscLibrary',
|
||||
'std::string',
|
||||
[],
|
||||
is_const=True)
|
||||
## nsc-tcp-l4-protocol.h: int ns3::NscTcpL4Protocol::GetProtocolNumber() const [member function]
|
||||
cls.add_method('GetProtocolNumber',
|
||||
'int',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## nsc-tcp-l4-protocol.h: int ns3::NscTcpL4Protocol::GetVersion() const [member function]
|
||||
cls.add_method('GetVersion',
|
||||
'int',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## nsc-tcp-l4-protocol.h: ns3::Ptr<ns3::Socket> ns3::NscTcpL4Protocol::CreateSocket() [member function]
|
||||
cls.add_method('CreateSocket',
|
||||
'ns3::Ptr< ns3::Socket >',
|
||||
[])
|
||||
## nsc-tcp-l4-protocol.h: ns3::Ipv4EndPoint * ns3::NscTcpL4Protocol::Allocate() [member function]
|
||||
cls.add_method('Allocate',
|
||||
'ns3::Ipv4EndPoint *',
|
||||
[])
|
||||
## nsc-tcp-l4-protocol.h: ns3::Ipv4EndPoint * ns3::NscTcpL4Protocol::Allocate(ns3::Ipv4Address address) [member function]
|
||||
cls.add_method('Allocate',
|
||||
'ns3::Ipv4EndPoint *',
|
||||
[param('ns3::Ipv4Address', 'address')])
|
||||
## nsc-tcp-l4-protocol.h: ns3::Ipv4EndPoint * ns3::NscTcpL4Protocol::Allocate(uint16_t port) [member function]
|
||||
cls.add_method('Allocate',
|
||||
'ns3::Ipv4EndPoint *',
|
||||
[param('uint16_t', 'port')])
|
||||
## nsc-tcp-l4-protocol.h: ns3::Ipv4EndPoint * ns3::NscTcpL4Protocol::Allocate(ns3::Ipv4Address address, uint16_t port) [member function]
|
||||
cls.add_method('Allocate',
|
||||
'ns3::Ipv4EndPoint *',
|
||||
[param('ns3::Ipv4Address', 'address'), param('uint16_t', 'port')])
|
||||
## nsc-tcp-l4-protocol.h: ns3::Ipv4EndPoint * ns3::NscTcpL4Protocol::Allocate(ns3::Ipv4Address localAddress, uint16_t localPort, ns3::Ipv4Address peerAddress, uint16_t peerPort) [member function]
|
||||
cls.add_method('Allocate',
|
||||
'ns3::Ipv4EndPoint *',
|
||||
[param('ns3::Ipv4Address', 'localAddress'), param('uint16_t', 'localPort'), param('ns3::Ipv4Address', 'peerAddress'), param('uint16_t', 'peerPort')])
|
||||
## nsc-tcp-l4-protocol.h: void ns3::NscTcpL4Protocol::DeAllocate(ns3::Ipv4EndPoint * endPoint) [member function]
|
||||
cls.add_method('DeAllocate',
|
||||
'void',
|
||||
[param('ns3::Ipv4EndPoint *', 'endPoint')])
|
||||
## nsc-tcp-l4-protocol.h: ns3::Ipv4L4Protocol::RxStatus ns3::NscTcpL4Protocol::Receive(ns3::Ptr<ns3::Packet> p, ns3::Ipv4Address const & source, ns3::Ipv4Address const & destination, ns3::Ptr<ns3::Ipv4Interface> incomingInterface) [member function]
|
||||
cls.add_method('Receive',
|
||||
'ns3::Ipv4L4Protocol::RxStatus',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Address const &', 'source'), param('ns3::Ipv4Address const &', 'destination'), param('ns3::Ptr< ns3::Ipv4Interface >', 'incomingInterface')],
|
||||
is_virtual=True)
|
||||
## nsc-tcp-l4-protocol.h: void ns3::NscTcpL4Protocol::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='protected', is_virtual=True)
|
||||
## nsc-tcp-l4-protocol.h: void ns3::NscTcpL4Protocol::NotifyNewAggregate() [member function]
|
||||
cls.add_method('NotifyNewAggregate',
|
||||
'void',
|
||||
[],
|
||||
visibility='protected', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3TcpL4Protocol_methods(root_module, cls):
|
||||
## tcp-l4-protocol.h: ns3::TcpL4Protocol::PROT_NUMBER [variable]
|
||||
cls.add_static_attribute('PROT_NUMBER', 'uint8_t const', is_const=True)
|
||||
|
||||
@@ -180,10 +180,10 @@ def register_Ns3Ipv6ListRouting_methods(root_module, cls):
|
||||
'void',
|
||||
[param('uint32_t', 'interface'), param('ns3::Ipv6InterfaceAddress', 'address')],
|
||||
is_virtual=True)
|
||||
## ipv6-list-routing.h: void ns3::Ipv6ListRouting::NotifyRemoveRoute(ns3::Ipv6Address dst, ns3::Ipv6Prefix mask, ns3::Ipv6Address nextHop, uint32_t interface) [member function]
|
||||
## ipv6-list-routing.h: void ns3::Ipv6ListRouting::NotifyRemoveRoute(ns3::Ipv6Address dst, ns3::Ipv6Prefix mask, ns3::Ipv6Address nextHop, uint32_t interface, ns3::Ipv6Address prefixToUse=ns3::Ipv6Address::GetZero( )) [member function]
|
||||
cls.add_method('NotifyRemoveRoute',
|
||||
'void',
|
||||
[param('ns3::Ipv6Address', 'dst'), param('ns3::Ipv6Prefix', 'mask'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv6Address', 'dst'), param('ns3::Ipv6Prefix', 'mask'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'prefixToUse', default_value='ns3::Ipv6Address::GetZero( )')],
|
||||
is_virtual=True)
|
||||
## ipv6-list-routing.h: bool ns3::Ipv6ListRouting::RouteInput(ns3::Ptr<ns3::Packet const> p, ns3::Ipv6Header const & header, ns3::Ptr<const ns3::NetDevice> idev, ns3::Callback<void,ns3::Ptr<ns3::Ipv6Route>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv6Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback<void,ns3::Ptr<ns3::Ipv6MulticastRoute>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv6Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv6Header&,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::Ipv6Header&,ns3::Socket::SocketErrno,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
|
||||
cls.add_method('RouteInput',
|
||||
|
||||
@@ -762,6 +762,11 @@ def register_Ns3Ipv6Address_methods(root_module, cls):
|
||||
'ns3::Ipv6Address',
|
||||
[],
|
||||
is_static=True)
|
||||
## ipv6-address.h: static ns3::Ipv6Address ns3::Ipv6Address::GetOnes() [member function]
|
||||
cls.add_method('GetOnes',
|
||||
'ns3::Ipv6Address',
|
||||
[],
|
||||
is_static=True)
|
||||
## ipv6-address.h: static ns3::Ipv6Address ns3::Ipv6Address::GetZero() [member function]
|
||||
cls.add_method('GetZero',
|
||||
'ns3::Ipv6Address',
|
||||
@@ -933,6 +938,16 @@ def register_Ns3Ipv6Prefix_methods(root_module, cls):
|
||||
'ns3::Ipv6Prefix',
|
||||
[],
|
||||
is_static=True)
|
||||
## ipv6-address.h: static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetOnes() [member function]
|
||||
cls.add_method('GetOnes',
|
||||
'ns3::Ipv6Prefix',
|
||||
[],
|
||||
is_static=True)
|
||||
## ipv6-address.h: uint8_t ns3::Ipv6Prefix::GetPrefixLength() const [member function]
|
||||
cls.add_method('GetPrefixLength',
|
||||
'uint8_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv6-address.h: static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetZero() [member function]
|
||||
cls.add_method('GetZero',
|
||||
'ns3::Ipv6Prefix',
|
||||
@@ -3107,10 +3122,10 @@ def register_Ns3Ipv6RoutingProtocol_methods(root_module, cls):
|
||||
'void',
|
||||
[param('uint32_t', 'interface'), param('ns3::Ipv6InterfaceAddress', 'address')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## ipv6-routing-protocol.h: void ns3::Ipv6RoutingProtocol::NotifyRemoveRoute(ns3::Ipv6Address dst, ns3::Ipv6Prefix mask, ns3::Ipv6Address nextHop, uint32_t interface) [member function]
|
||||
## ipv6-routing-protocol.h: void ns3::Ipv6RoutingProtocol::NotifyRemoveRoute(ns3::Ipv6Address dst, ns3::Ipv6Prefix mask, ns3::Ipv6Address nextHop, uint32_t interface, ns3::Ipv6Address prefixToUse=ns3::Ipv6Address::GetZero( )) [member function]
|
||||
cls.add_method('NotifyRemoveRoute',
|
||||
'void',
|
||||
[param('ns3::Ipv6Address', 'dst'), param('ns3::Ipv6Prefix', 'mask'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv6Address', 'dst'), param('ns3::Ipv6Prefix', 'mask'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'prefixToUse', default_value='ns3::Ipv6Address::GetZero( )')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## ipv6-routing-protocol.h: bool ns3::Ipv6RoutingProtocol::RouteInput(ns3::Ptr<ns3::Packet const> p, ns3::Ipv6Header const & header, ns3::Ptr<const ns3::NetDevice> idev, ns3::Callback<void,ns3::Ptr<ns3::Ipv6Route>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv6Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback<void,ns3::Ptr<ns3::Ipv6MulticastRoute>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv6Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv6Header&,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::Ipv6Header&,ns3::Socket::SocketErrno,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
|
||||
cls.add_method('RouteInput',
|
||||
@@ -3134,6 +3149,11 @@ def register_Ns3NetDevice_methods(root_module, cls):
|
||||
cls.add_constructor([])
|
||||
## net-device.h: ns3::NetDevice::NetDevice(ns3::NetDevice const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::NetDevice const &', 'arg0')])
|
||||
## net-device.h: void ns3::NetDevice::AddLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('AddLinkChangeCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## net-device.h: ns3::Address ns3::NetDevice::GetAddress() const [member function]
|
||||
cls.add_method('GetAddress',
|
||||
'ns3::Address',
|
||||
@@ -3229,11 +3249,6 @@ def register_Ns3NetDevice_methods(root_module, cls):
|
||||
'void',
|
||||
[param('uint32_t const', 'index')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## net-device.h: void ns3::NetDevice::SetLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('SetLinkChangeCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## net-device.h: bool ns3::NetDevice::SetMtu(uint16_t const mtu) [member function]
|
||||
cls.add_method('SetMtu',
|
||||
'bool',
|
||||
@@ -3388,6 +3403,11 @@ def register_Ns3SimpleNetDevice_methods(root_module, cls):
|
||||
cls.add_constructor([param('ns3::SimpleNetDevice const &', 'arg0')])
|
||||
## simple-net-device.h: ns3::SimpleNetDevice::SimpleNetDevice() [constructor]
|
||||
cls.add_constructor([])
|
||||
## simple-net-device.h: void ns3::SimpleNetDevice::AddLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('AddLinkChangeCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
## simple-net-device.h: ns3::Address ns3::SimpleNetDevice::GetAddress() const [member function]
|
||||
cls.add_method('GetAddress',
|
||||
'ns3::Address',
|
||||
@@ -3491,11 +3511,6 @@ def register_Ns3SimpleNetDevice_methods(root_module, cls):
|
||||
'void',
|
||||
[param('uint32_t const', 'index')],
|
||||
is_virtual=True)
|
||||
## simple-net-device.h: void ns3::SimpleNetDevice::SetLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('SetLinkChangeCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
## simple-net-device.h: bool ns3::SimpleNetDevice::SetMtu(uint16_t const mtu) [member function]
|
||||
cls.add_method('SetMtu',
|
||||
'bool',
|
||||
|
||||
@@ -143,6 +143,11 @@ def register_Ns3PointToPointNetDevice_methods(root_module, cls):
|
||||
cls.add_constructor([param('ns3::PointToPointNetDevice const &', 'arg0')])
|
||||
## point-to-point-net-device.h: ns3::PointToPointNetDevice::PointToPointNetDevice() [constructor]
|
||||
cls.add_constructor([])
|
||||
## point-to-point-net-device.h: void ns3::PointToPointNetDevice::AddLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('AddLinkChangeCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
## point-to-point-net-device.h: bool ns3::PointToPointNetDevice::Attach(ns3::Ptr<ns3::PointToPointChannel> ch) [member function]
|
||||
cls.add_method('Attach',
|
||||
'bool',
|
||||
@@ -263,11 +268,6 @@ def register_Ns3PointToPointNetDevice_methods(root_module, cls):
|
||||
cls.add_method('SetInterframeGap',
|
||||
'void',
|
||||
[param('ns3::Time', 't')])
|
||||
## point-to-point-net-device.h: void ns3::PointToPointNetDevice::SetLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('SetLinkChangeCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
## point-to-point-net-device.h: bool ns3::PointToPointNetDevice::SetMtu(uint16_t const mtu) [member function]
|
||||
cls.add_method('SetMtu',
|
||||
'bool',
|
||||
|
||||
@@ -344,30 +344,34 @@ def register_Ns3Ipv4StaticRouting_methods(root_module, cls):
|
||||
cls.add_constructor([param('ns3::Ipv4StaticRouting const &', 'arg0')])
|
||||
## ipv4-static-routing.h: ns3::Ipv4StaticRouting::Ipv4StaticRouting() [constructor]
|
||||
cls.add_constructor([])
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('AddHostRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')])
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddHostRouteTo(ns3::Ipv4Address dest, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('AddHostRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')])
|
||||
[param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')])
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface, std::vector<unsigned int, std::allocator<unsigned int> > outputInterfaces) [member function]
|
||||
cls.add_method('AddMulticastRoute',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group'), param('uint32_t', 'inputInterface'), param('std::vector< unsigned int >', 'outputInterfaces')])
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('AddNetworkRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function]
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')])
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('AddNetworkRouteTo',
|
||||
'void',
|
||||
[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')])
|
||||
## ipv4-static-routing.h: ns3::Ipv4RoutingTableEntry ns3::Ipv4StaticRouting::GetDefaultRoute() [member function]
|
||||
cls.add_method('GetDefaultRoute',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[])
|
||||
## ipv4-static-routing.h: uint32_t ns3::Ipv4StaticRouting::GetMetric(uint32_t index) [member function]
|
||||
cls.add_method('GetMetric',
|
||||
'uint32_t',
|
||||
[param('uint32_t', 'index')])
|
||||
## ipv4-static-routing.h: ns3::Ipv4MulticastRoutingTableEntry ns3::Ipv4StaticRouting::GetMulticastRoute(uint32_t i) const [member function]
|
||||
cls.add_method('GetMulticastRoute',
|
||||
'ns3::Ipv4MulticastRoutingTableEntry',
|
||||
@@ -437,10 +441,10 @@ def register_Ns3Ipv4StaticRouting_methods(root_module, cls):
|
||||
cls.add_method('SetDefaultMulticastRoute',
|
||||
'void',
|
||||
[param('uint32_t', 'outputInterface')])
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::SetDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::SetDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('SetDefaultRoute',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
[param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')])
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::SetIpv4(ns3::Ptr<ns3::Ipv4> ipv4) [member function]
|
||||
cls.add_method('SetIpv4',
|
||||
'void',
|
||||
@@ -458,34 +462,38 @@ def register_Ns3Ipv6StaticRouting_methods(root_module, cls):
|
||||
cls.add_constructor([param('ns3::Ipv6StaticRouting const &', 'arg0')])
|
||||
## ipv6-static-routing.h: ns3::Ipv6StaticRouting::Ipv6StaticRouting() [constructor]
|
||||
cls.add_constructor([])
|
||||
## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddHostRouteTo(ns3::Ipv6Address dest, ns3::Ipv6Address nextHop, uint32_t interface, ns3::Ipv6Address prefixToUse=ns3::Ipv6Address(((const char*)"::"))) [member function]
|
||||
## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddHostRouteTo(ns3::Ipv6Address dest, ns3::Ipv6Address nextHop, uint32_t interface, ns3::Ipv6Address prefixToUse=ns3::Ipv6Address(((const char*)"::")), uint32_t metric=0) [member function]
|
||||
cls.add_method('AddHostRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv6Address', 'dest'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'prefixToUse', default_value='ns3::Ipv6Address(((const char*)"::"))')])
|
||||
## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddHostRouteTo(ns3::Ipv6Address dest, uint32_t interface) [member function]
|
||||
[param('ns3::Ipv6Address', 'dest'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'prefixToUse', default_value='ns3::Ipv6Address(((const char*)"::"))'), param('uint32_t', 'metric', default_value='0')])
|
||||
## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddHostRouteTo(ns3::Ipv6Address dest, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('AddHostRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv6Address', 'dest'), param('uint32_t', 'interface')])
|
||||
[param('ns3::Ipv6Address', 'dest'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')])
|
||||
## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddMulticastRoute(ns3::Ipv6Address origin, ns3::Ipv6Address group, uint32_t inputInterface, std::vector<unsigned int, std::allocator<unsigned int> > outputInterfaces) [member function]
|
||||
cls.add_method('AddMulticastRoute',
|
||||
'void',
|
||||
[param('ns3::Ipv6Address', 'origin'), param('ns3::Ipv6Address', 'group'), param('uint32_t', 'inputInterface'), param('std::vector< unsigned int >', 'outputInterfaces')])
|
||||
## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddNetworkRouteTo(ns3::Ipv6Address network, ns3::Ipv6Prefix networkPrefix, ns3::Ipv6Address nextHop, uint32_t interface) [member function]
|
||||
## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddNetworkRouteTo(ns3::Ipv6Address network, ns3::Ipv6Prefix networkPrefix, ns3::Ipv6Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('AddNetworkRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'networkPrefix'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddNetworkRouteTo(ns3::Ipv6Address network, ns3::Ipv6Prefix networkPrefix, ns3::Ipv6Address nextHop, uint32_t interface, ns3::Ipv6Address prefixToUse) [member function]
|
||||
[param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'networkPrefix'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')])
|
||||
## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddNetworkRouteTo(ns3::Ipv6Address network, ns3::Ipv6Prefix networkPrefix, ns3::Ipv6Address nextHop, uint32_t interface, ns3::Ipv6Address prefixToUse, uint32_t metric=0) [member function]
|
||||
cls.add_method('AddNetworkRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'networkPrefix'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'prefixToUse')])
|
||||
## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddNetworkRouteTo(ns3::Ipv6Address network, ns3::Ipv6Prefix networkPrefix, uint32_t interface) [member function]
|
||||
[param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'networkPrefix'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'prefixToUse'), param('uint32_t', 'metric', default_value='0')])
|
||||
## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddNetworkRouteTo(ns3::Ipv6Address network, ns3::Ipv6Prefix networkPrefix, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('AddNetworkRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'networkPrefix'), param('uint32_t', 'interface')])
|
||||
[param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'networkPrefix'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')])
|
||||
## ipv6-static-routing.h: ns3::Ipv6RoutingTableEntry ns3::Ipv6StaticRouting::GetDefaultRoute() [member function]
|
||||
cls.add_method('GetDefaultRoute',
|
||||
'ns3::Ipv6RoutingTableEntry',
|
||||
[])
|
||||
## ipv6-static-routing.h: uint32_t ns3::Ipv6StaticRouting::GetMetric(uint32_t index) [member function]
|
||||
cls.add_method('GetMetric',
|
||||
'uint32_t',
|
||||
[param('uint32_t', 'index')])
|
||||
## ipv6-static-routing.h: ns3::Ipv6MulticastRoutingTableEntry ns3::Ipv6StaticRouting::GetMulticastRoute(uint32_t i) const [member function]
|
||||
cls.add_method('GetMulticastRoute',
|
||||
'ns3::Ipv6MulticastRoutingTableEntry',
|
||||
@@ -538,15 +546,11 @@ def register_Ns3Ipv6StaticRouting_methods(root_module, cls):
|
||||
'void',
|
||||
[param('uint32_t', 'interface'), param('ns3::Ipv6InterfaceAddress', 'address')],
|
||||
is_virtual=True)
|
||||
## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::NotifyRemoveRoute(ns3::Ipv6Address dst, ns3::Ipv6Prefix mask, ns3::Ipv6Address nextHop, uint32_t interface) [member function]
|
||||
## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::NotifyRemoveRoute(ns3::Ipv6Address dst, ns3::Ipv6Prefix mask, ns3::Ipv6Address nextHop, uint32_t interface, ns3::Ipv6Address prefixToUse=ns3::Ipv6Address::GetZero( )) [member function]
|
||||
cls.add_method('NotifyRemoveRoute',
|
||||
'void',
|
||||
[param('ns3::Ipv6Address', 'dst'), param('ns3::Ipv6Prefix', 'mask'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv6Address', 'dst'), param('ns3::Ipv6Prefix', 'mask'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'prefixToUse', default_value='ns3::Ipv6Address::GetZero( )')],
|
||||
is_virtual=True)
|
||||
## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::RemoveDefaultRoute() [member function]
|
||||
cls.add_method('RemoveDefaultRoute',
|
||||
'void',
|
||||
[])
|
||||
## ipv6-static-routing.h: bool ns3::Ipv6StaticRouting::RemoveMulticastRoute(ns3::Ipv6Address origin, ns3::Ipv6Address group, uint32_t inputInterface) [member function]
|
||||
cls.add_method('RemoveMulticastRoute',
|
||||
'bool',
|
||||
@@ -559,10 +563,10 @@ def register_Ns3Ipv6StaticRouting_methods(root_module, cls):
|
||||
cls.add_method('RemoveRoute',
|
||||
'void',
|
||||
[param('uint32_t', 'i')])
|
||||
## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::RemoveRoute(ns3::Ipv6Address network, ns3::Ipv6Prefix prefix, uint32_t ifIndex) [member function]
|
||||
## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::RemoveRoute(ns3::Ipv6Address network, ns3::Ipv6Prefix prefix, uint32_t ifIndex, ns3::Ipv6Address prefixToUse) [member function]
|
||||
cls.add_method('RemoveRoute',
|
||||
'void',
|
||||
[param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'prefix'), param('uint32_t', 'ifIndex')])
|
||||
[param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'prefix'), param('uint32_t', 'ifIndex'), param('ns3::Ipv6Address', 'prefixToUse')])
|
||||
## ipv6-static-routing.h: bool ns3::Ipv6StaticRouting::RouteInput(ns3::Ptr<ns3::Packet const> p, ns3::Ipv6Header const & header, ns3::Ptr<const ns3::NetDevice> idev, ns3::Callback<void,ns3::Ptr<ns3::Ipv6Route>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv6Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback<void,ns3::Ptr<ns3::Ipv6MulticastRoute>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv6Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv6Header&,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::Ipv6Header&,ns3::Socket::SocketErrno,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
|
||||
cls.add_method('RouteInput',
|
||||
'bool',
|
||||
@@ -577,10 +581,10 @@ def register_Ns3Ipv6StaticRouting_methods(root_module, cls):
|
||||
cls.add_method('SetDefaultMulticastRoute',
|
||||
'void',
|
||||
[param('uint32_t', 'outputInterface')])
|
||||
## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::SetDefaultRoute(ns3::Ipv6Address nextHop, uint32_t interface, ns3::Ipv6Address prefixToUse=ns3::Ipv6Address(((const char*)"::"))) [member function]
|
||||
## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::SetDefaultRoute(ns3::Ipv6Address nextHop, uint32_t interface, ns3::Ipv6Address prefixToUse=ns3::Ipv6Address(((const char*)"::")), uint32_t metric=0) [member function]
|
||||
cls.add_method('SetDefaultRoute',
|
||||
'void',
|
||||
[param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'prefixToUse', default_value='ns3::Ipv6Address(((const char*)"::"))')])
|
||||
[param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'prefixToUse', default_value='ns3::Ipv6Address(((const char*)"::"))'), param('uint32_t', 'metric', default_value='0')])
|
||||
## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::SetIpv6(ns3::Ptr<ns3::Ipv6> ipv6) [member function]
|
||||
cls.add_method('SetIpv6',
|
||||
'void',
|
||||
|
||||
@@ -67,6 +67,11 @@ def register_Ns3TapBridge_methods(root_module, cls):
|
||||
cls.add_constructor([param('ns3::TapBridge const &', 'arg0')])
|
||||
## tap-bridge.h: ns3::TapBridge::TapBridge() [constructor]
|
||||
cls.add_constructor([])
|
||||
## tap-bridge.h: void ns3::TapBridge::AddLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('AddLinkChangeCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
## tap-bridge.h: ns3::Address ns3::TapBridge::GetAddress() const [member function]
|
||||
cls.add_method('GetAddress',
|
||||
'ns3::Address',
|
||||
@@ -174,11 +179,6 @@ def register_Ns3TapBridge_methods(root_module, cls):
|
||||
'void',
|
||||
[param('uint32_t const', 'index')],
|
||||
is_virtual=True)
|
||||
## tap-bridge.h: void ns3::TapBridge::SetLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('SetLinkChangeCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
## tap-bridge.h: void ns3::TapBridge::SetMode(ns3::TapBridge::Mode mode) [member function]
|
||||
cls.add_method('SetMode',
|
||||
'void',
|
||||
|
||||
@@ -65,6 +65,11 @@ def register_Ns3VirtualNetDevice_methods(root_module, cls):
|
||||
cls.add_constructor([param('ns3::VirtualNetDevice const &', 'arg0')])
|
||||
## virtual-net-device.h: ns3::VirtualNetDevice::VirtualNetDevice() [constructor]
|
||||
cls.add_constructor([])
|
||||
## virtual-net-device.h: void ns3::VirtualNetDevice::AddLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('AddLinkChangeCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
## virtual-net-device.h: ns3::Address ns3::VirtualNetDevice::GetAddress() const [member function]
|
||||
cls.add_method('GetAddress',
|
||||
'ns3::Address',
|
||||
@@ -168,11 +173,6 @@ def register_Ns3VirtualNetDevice_methods(root_module, cls):
|
||||
cls.add_method('SetIsPointToPoint',
|
||||
'void',
|
||||
[param('bool', 'isPointToPoint')])
|
||||
## virtual-net-device.h: void ns3::VirtualNetDevice::SetLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('SetLinkChangeCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
## virtual-net-device.h: bool ns3::VirtualNetDevice::SetMtu(uint16_t const mtu) [member function]
|
||||
cls.add_method('SetMtu',
|
||||
'bool',
|
||||
|
||||
+159
-159
@@ -3162,31 +3162,25 @@ def register_Ns3WifiRemoteStationManager_methods(root_module, cls):
|
||||
return
|
||||
|
||||
def register_Ns3YansWifiPhy_methods(root_module, cls):
|
||||
## yans-wifi-phy.h: static ns3::TypeId ns3::YansWifiPhy::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## yans-wifi-phy.h: ns3::YansWifiPhy::YansWifiPhy() [constructor]
|
||||
cls.add_constructor([])
|
||||
## yans-wifi-phy.h: double ns3::YansWifiPhy::CalculateSnr(ns3::WifiMode txMode, double ber) const [member function]
|
||||
cls.add_method('CalculateSnr',
|
||||
'double',
|
||||
[param('ns3::WifiMode', 'txMode'), param('double', 'ber')],
|
||||
is_const=True, is_virtual=True)
|
||||
## yans-wifi-phy.h: ns3::Time ns3::YansWifiPhy::CalculateTxDuration(uint32_t size, ns3::WifiMode payloadMode, ns3::WifiPreamble preamble) const [member function]
|
||||
cls.add_method('CalculateTxDuration',
|
||||
'ns3::Time',
|
||||
[param('uint32_t', 'size'), param('ns3::WifiMode', 'payloadMode'), param('ns3::WifiPreamble', 'preamble')],
|
||||
is_const=True, is_virtual=True)
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::ConfigureStandard(ns3::WifiPhyStandard standard) [member function]
|
||||
cls.add_method('ConfigureStandard',
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetChannel(ns3::Ptr<ns3::YansWifiChannel> channel) [member function]
|
||||
cls.add_method('SetChannel',
|
||||
'void',
|
||||
[param('ns3::WifiPhyStandard', 'standard')],
|
||||
[param('ns3::Ptr< ns3::YansWifiChannel >', 'channel')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetChannelNumber(uint16_t id) [member function]
|
||||
cls.add_method('SetChannelNumber',
|
||||
'void',
|
||||
[param('uint16_t', 'id')],
|
||||
is_virtual=True)
|
||||
## yans-wifi-phy.h: double ns3::YansWifiPhy::GetCcaMode1Threshold() const [member function]
|
||||
cls.add_method('GetCcaMode1Threshold',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## yans-wifi-phy.h: ns3::Ptr<ns3::WifiChannel> ns3::YansWifiPhy::GetChannel() const [member function]
|
||||
cls.add_method('GetChannel',
|
||||
'ns3::Ptr< ns3::WifiChannel >',
|
||||
## yans-wifi-phy.h: uint16_t ns3::YansWifiPhy::GetChannelNumber() const [member function]
|
||||
cls.add_method('GetChannelNumber',
|
||||
'uint16_t',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## yans-wifi-phy.h: double ns3::YansWifiPhy::GetChannelFrequencyMhz() const [member function]
|
||||
@@ -3194,19 +3188,67 @@ def register_Ns3YansWifiPhy_methods(root_module, cls):
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## yans-wifi-phy.h: uint16_t ns3::YansWifiPhy::GetChannelNumber() const [member function]
|
||||
cls.add_method('GetChannelNumber',
|
||||
'uint16_t',
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::StartReceivePacket(ns3::Ptr<ns3::Packet> packet, double rxPowerDbm, ns3::WifiMode mode, ns3::WifiPreamble preamble) [member function]
|
||||
cls.add_method('StartReceivePacket',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('double', 'rxPowerDbm'), param('ns3::WifiMode', 'mode'), param('ns3::WifiPreamble', 'preamble')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetRxNoiseFigure(double noiseFigureDb) [member function]
|
||||
cls.add_method('SetRxNoiseFigure',
|
||||
'void',
|
||||
[param('double', 'noiseFigureDb')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetTxPowerStart(double start) [member function]
|
||||
cls.add_method('SetTxPowerStart',
|
||||
'void',
|
||||
[param('double', 'start')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetTxPowerEnd(double end) [member function]
|
||||
cls.add_method('SetTxPowerEnd',
|
||||
'void',
|
||||
[param('double', 'end')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetNTxPower(uint32_t n) [member function]
|
||||
cls.add_method('SetNTxPower',
|
||||
'void',
|
||||
[param('uint32_t', 'n')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetTxGain(double gain) [member function]
|
||||
cls.add_method('SetTxGain',
|
||||
'void',
|
||||
[param('double', 'gain')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetRxGain(double gain) [member function]
|
||||
cls.add_method('SetRxGain',
|
||||
'void',
|
||||
[param('double', 'gain')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetEdThreshold(double threshold) [member function]
|
||||
cls.add_method('SetEdThreshold',
|
||||
'void',
|
||||
[param('double', 'threshold')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetCcaMode1Threshold(double threshold) [member function]
|
||||
cls.add_method('SetCcaMode1Threshold',
|
||||
'void',
|
||||
[param('double', 'threshold')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetErrorRateModel(ns3::Ptr<ns3::ErrorRateModel> rate) [member function]
|
||||
cls.add_method('SetErrorRateModel',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::ErrorRateModel >', 'rate')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetDevice(ns3::Ptr<ns3::Object> device) [member function]
|
||||
cls.add_method('SetDevice',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Object >', 'device')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetMobility(ns3::Ptr<ns3::Object> mobility) [member function]
|
||||
cls.add_method('SetMobility',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Object >', 'mobility')])
|
||||
## yans-wifi-phy.h: double ns3::YansWifiPhy::GetRxNoiseFigure() const [member function]
|
||||
cls.add_method('GetRxNoiseFigure',
|
||||
'double',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## yans-wifi-phy.h: ns3::Time ns3::YansWifiPhy::GetDelayUntilIdle() [member function]
|
||||
cls.add_method('GetDelayUntilIdle',
|
||||
'ns3::Time',
|
||||
is_const=True)
|
||||
## yans-wifi-phy.h: double ns3::YansWifiPhy::GetTxGain() const [member function]
|
||||
cls.add_method('GetTxGain',
|
||||
'double',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## yans-wifi-phy.h: ns3::Ptr<ns3::Object> ns3::YansWifiPhy::GetDevice() const [member function]
|
||||
cls.add_method('GetDevice',
|
||||
'ns3::Ptr< ns3::Object >',
|
||||
is_const=True)
|
||||
## yans-wifi-phy.h: double ns3::YansWifiPhy::GetRxGain() const [member function]
|
||||
cls.add_method('GetRxGain',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## yans-wifi-phy.h: double ns3::YansWifiPhy::GetEdThreshold() const [member function]
|
||||
@@ -3214,28 +3256,33 @@ def register_Ns3YansWifiPhy_methods(root_module, cls):
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## yans-wifi-phy.h: double ns3::YansWifiPhy::GetCcaMode1Threshold() const [member function]
|
||||
cls.add_method('GetCcaMode1Threshold',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## yans-wifi-phy.h: ns3::Ptr<ns3::ErrorRateModel> ns3::YansWifiPhy::GetErrorRateModel() const [member function]
|
||||
cls.add_method('GetErrorRateModel',
|
||||
'ns3::Ptr< ns3::ErrorRateModel >',
|
||||
[],
|
||||
is_const=True)
|
||||
## yans-wifi-phy.h: ns3::Time ns3::YansWifiPhy::GetLastRxStartTime() const [member function]
|
||||
cls.add_method('GetLastRxStartTime',
|
||||
'ns3::Time',
|
||||
## yans-wifi-phy.h: ns3::Ptr<ns3::Object> ns3::YansWifiPhy::GetDevice() const [member function]
|
||||
cls.add_method('GetDevice',
|
||||
'ns3::Ptr< ns3::Object >',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
is_const=True)
|
||||
## yans-wifi-phy.h: ns3::Ptr<ns3::Object> ns3::YansWifiPhy::GetMobility() [member function]
|
||||
cls.add_method('GetMobility',
|
||||
'ns3::Ptr< ns3::Object >',
|
||||
[])
|
||||
## yans-wifi-phy.h: ns3::WifiMode ns3::YansWifiPhy::GetMode(uint32_t mode) const [member function]
|
||||
cls.add_method('GetMode',
|
||||
'ns3::WifiMode',
|
||||
[param('uint32_t', 'mode')],
|
||||
## yans-wifi-phy.h: double ns3::YansWifiPhy::GetTxPowerStart() const [member function]
|
||||
cls.add_method('GetTxPowerStart',
|
||||
'double',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## yans-wifi-phy.h: uint32_t ns3::YansWifiPhy::GetNModes() const [member function]
|
||||
cls.add_method('GetNModes',
|
||||
'uint32_t',
|
||||
## yans-wifi-phy.h: double ns3::YansWifiPhy::GetTxPowerEnd() const [member function]
|
||||
cls.add_method('GetTxPowerEnd',
|
||||
'double',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## yans-wifi-phy.h: uint32_t ns3::YansWifiPhy::GetNTxPower() const [member function]
|
||||
@@ -3243,45 +3290,25 @@ def register_Ns3YansWifiPhy_methods(root_module, cls):
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## yans-wifi-phy.h: double ns3::YansWifiPhy::GetRxGain() const [member function]
|
||||
cls.add_method('GetRxGain',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## yans-wifi-phy.h: double ns3::YansWifiPhy::GetRxNoiseFigure() const [member function]
|
||||
cls.add_method('GetRxNoiseFigure',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## yans-wifi-phy.h: ns3::Time ns3::YansWifiPhy::GetStateDuration() [member function]
|
||||
cls.add_method('GetStateDuration',
|
||||
'ns3::Time',
|
||||
[],
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetReceiveOkCallback(ns3::Callback<void,ns3::Ptr<ns3::Packet>,double,ns3::WifiMode,ns3::WifiPreamble,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
|
||||
cls.add_method('SetReceiveOkCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, double, ns3::WifiMode, ns3::WifiPreamble, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
## yans-wifi-phy.h: double ns3::YansWifiPhy::GetTxGain() const [member function]
|
||||
cls.add_method('GetTxGain',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## yans-wifi-phy.h: double ns3::YansWifiPhy::GetTxPowerEnd() const [member function]
|
||||
cls.add_method('GetTxPowerEnd',
|
||||
'double',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## yans-wifi-phy.h: double ns3::YansWifiPhy::GetTxPowerStart() const [member function]
|
||||
cls.add_method('GetTxPowerStart',
|
||||
'double',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## yans-wifi-phy.h: static ns3::TypeId ns3::YansWifiPhy::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## yans-wifi-phy.h: bool ns3::YansWifiPhy::IsStateBusy() [member function]
|
||||
cls.add_method('IsStateBusy',
|
||||
'bool',
|
||||
[],
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetReceiveErrorCallback(ns3::Callback<void,ns3::Ptr<const ns3::Packet>,double,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
|
||||
cls.add_method('SetReceiveErrorCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, double, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SendPacket(ns3::Ptr<ns3::Packet const> packet, ns3::WifiMode mode, ns3::WifiPreamble preamble, uint8_t txPowerLevel) [member function]
|
||||
cls.add_method('SendPacket',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::WifiMode', 'mode'), param('ns3::WifiPreamble', 'preamble'), param('uint8_t', 'txPowerLevel')],
|
||||
is_virtual=True)
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::RegisterListener(ns3::WifiPhyListener * listener) [member function]
|
||||
cls.add_method('RegisterListener',
|
||||
'void',
|
||||
[param('ns3::WifiPhyListener *', 'listener')],
|
||||
is_virtual=True)
|
||||
## yans-wifi-phy.h: bool ns3::YansWifiPhy::IsStateCcaBusy() [member function]
|
||||
cls.add_method('IsStateCcaBusy',
|
||||
@@ -3293,6 +3320,11 @@ def register_Ns3YansWifiPhy_methods(root_module, cls):
|
||||
'bool',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## yans-wifi-phy.h: bool ns3::YansWifiPhy::IsStateBusy() [member function]
|
||||
cls.add_method('IsStateBusy',
|
||||
'bool',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## yans-wifi-phy.h: bool ns3::YansWifiPhy::IsStateSync() [member function]
|
||||
cls.add_method('IsStateSync',
|
||||
'bool',
|
||||
@@ -3303,83 +3335,51 @@ def register_Ns3YansWifiPhy_methods(root_module, cls):
|
||||
'bool',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::RegisterListener(ns3::WifiPhyListener * listener) [member function]
|
||||
cls.add_method('RegisterListener',
|
||||
'void',
|
||||
[param('ns3::WifiPhyListener *', 'listener')],
|
||||
## yans-wifi-phy.h: ns3::Time ns3::YansWifiPhy::GetStateDuration() [member function]
|
||||
cls.add_method('GetStateDuration',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SendPacket(ns3::Ptr<ns3::Packet const> packet, ns3::WifiMode mode, ns3::WifiPreamble preamble, uint8_t txPowerLevel) [member function]
|
||||
cls.add_method('SendPacket',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::WifiMode', 'mode'), param('ns3::WifiPreamble', 'preamble'), param('uint8_t', 'txPowerLevel')],
|
||||
## yans-wifi-phy.h: ns3::Time ns3::YansWifiPhy::GetDelayUntilIdle() [member function]
|
||||
cls.add_method('GetDelayUntilIdle',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetCcaMode1Threshold(double threshold) [member function]
|
||||
cls.add_method('SetCcaMode1Threshold',
|
||||
## yans-wifi-phy.h: ns3::Time ns3::YansWifiPhy::GetLastRxStartTime() const [member function]
|
||||
cls.add_method('GetLastRxStartTime',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## yans-wifi-phy.h: ns3::Time ns3::YansWifiPhy::CalculateTxDuration(uint32_t size, ns3::WifiMode payloadMode, ns3::WifiPreamble preamble) const [member function]
|
||||
cls.add_method('CalculateTxDuration',
|
||||
'ns3::Time',
|
||||
[param('uint32_t', 'size'), param('ns3::WifiMode', 'payloadMode'), param('ns3::WifiPreamble', 'preamble')],
|
||||
is_const=True, is_virtual=True)
|
||||
## yans-wifi-phy.h: uint32_t ns3::YansWifiPhy::GetNModes() const [member function]
|
||||
cls.add_method('GetNModes',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## yans-wifi-phy.h: ns3::WifiMode ns3::YansWifiPhy::GetMode(uint32_t mode) const [member function]
|
||||
cls.add_method('GetMode',
|
||||
'ns3::WifiMode',
|
||||
[param('uint32_t', 'mode')],
|
||||
is_const=True, is_virtual=True)
|
||||
## yans-wifi-phy.h: double ns3::YansWifiPhy::CalculateSnr(ns3::WifiMode txMode, double ber) const [member function]
|
||||
cls.add_method('CalculateSnr',
|
||||
'double',
|
||||
[param('ns3::WifiMode', 'txMode'), param('double', 'ber')],
|
||||
is_const=True, is_virtual=True)
|
||||
## yans-wifi-phy.h: ns3::Ptr<ns3::WifiChannel> ns3::YansWifiPhy::GetChannel() const [member function]
|
||||
cls.add_method('GetChannel',
|
||||
'ns3::Ptr< ns3::WifiChannel >',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::ConfigureStandard(ns3::WifiPhyStandard standard) [member function]
|
||||
cls.add_method('ConfigureStandard',
|
||||
'void',
|
||||
[param('double', 'threshold')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetChannel(ns3::Ptr<ns3::YansWifiChannel> channel) [member function]
|
||||
cls.add_method('SetChannel',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::YansWifiChannel >', 'channel')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetChannelNumber(uint16_t id) [member function]
|
||||
cls.add_method('SetChannelNumber',
|
||||
'void',
|
||||
[param('uint16_t', 'id')],
|
||||
[param('ns3::WifiPhyStandard', 'standard')],
|
||||
is_virtual=True)
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetDevice(ns3::Ptr<ns3::Object> device) [member function]
|
||||
cls.add_method('SetDevice',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Object >', 'device')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetEdThreshold(double threshold) [member function]
|
||||
cls.add_method('SetEdThreshold',
|
||||
'void',
|
||||
[param('double', 'threshold')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetErrorRateModel(ns3::Ptr<ns3::ErrorRateModel> rate) [member function]
|
||||
cls.add_method('SetErrorRateModel',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::ErrorRateModel >', 'rate')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetMobility(ns3::Ptr<ns3::Object> mobility) [member function]
|
||||
cls.add_method('SetMobility',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Object >', 'mobility')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetNTxPower(uint32_t n) [member function]
|
||||
cls.add_method('SetNTxPower',
|
||||
'void',
|
||||
[param('uint32_t', 'n')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetReceiveErrorCallback(ns3::Callback<void,ns3::Ptr<const ns3::Packet>,double,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
|
||||
cls.add_method('SetReceiveErrorCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, double, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetReceiveOkCallback(ns3::Callback<void,ns3::Ptr<ns3::Packet>,double,ns3::WifiMode,ns3::WifiPreamble,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
|
||||
cls.add_method('SetReceiveOkCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, double, ns3::WifiMode, ns3::WifiPreamble, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetRxGain(double gain) [member function]
|
||||
cls.add_method('SetRxGain',
|
||||
'void',
|
||||
[param('double', 'gain')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetRxNoiseFigure(double noiseFigureDb) [member function]
|
||||
cls.add_method('SetRxNoiseFigure',
|
||||
'void',
|
||||
[param('double', 'noiseFigureDb')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetTxGain(double gain) [member function]
|
||||
cls.add_method('SetTxGain',
|
||||
'void',
|
||||
[param('double', 'gain')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetTxPowerEnd(double end) [member function]
|
||||
cls.add_method('SetTxPowerEnd',
|
||||
'void',
|
||||
[param('double', 'end')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::SetTxPowerStart(double start) [member function]
|
||||
cls.add_method('SetTxPowerStart',
|
||||
'void',
|
||||
[param('double', 'start')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::StartReceivePacket(ns3::Ptr<ns3::Packet> packet, double rxPowerDbm, ns3::WifiMode mode, ns3::WifiPreamble preamble) [member function]
|
||||
cls.add_method('StartReceivePacket',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('double', 'rxPowerDbm'), param('ns3::WifiMode', 'mode'), param('ns3::WifiPreamble', 'preamble')])
|
||||
## yans-wifi-phy.h: void ns3::YansWifiPhy::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
@@ -5156,6 +5156,11 @@ def register_Ns3WifiNetDevice_methods(root_module, cls):
|
||||
cls.add_constructor([param('ns3::WifiNetDevice const &', 'arg0')])
|
||||
## wifi-net-device.h: ns3::WifiNetDevice::WifiNetDevice() [constructor]
|
||||
cls.add_constructor([])
|
||||
## wifi-net-device.h: void ns3::WifiNetDevice::AddLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('AddLinkChangeCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
## wifi-net-device.h: ns3::Address ns3::WifiNetDevice::GetAddress() const [member function]
|
||||
cls.add_method('GetAddress',
|
||||
'ns3::Address',
|
||||
@@ -5266,11 +5271,6 @@ def register_Ns3WifiNetDevice_methods(root_module, cls):
|
||||
'void',
|
||||
[param('uint32_t const', 'index')],
|
||||
is_virtual=True)
|
||||
## wifi-net-device.h: void ns3::WifiNetDevice::SetLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('SetLinkChangeCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
## wifi-net-device.h: void ns3::WifiNetDevice::SetMac(ns3::Ptr<ns3::WifiMac> mac) [member function]
|
||||
cls.add_method('SetMac',
|
||||
'void',
|
||||
|
||||
@@ -61,6 +61,11 @@ type_annotations = {
|
||||
'allow_subclassing': 'true', # needed so that AddValue is able to set attributes on the object
|
||||
},
|
||||
|
||||
'::ns3::NscTcpL4Protocol': {
|
||||
'ignore': 'true', # this class is implementation detail
|
||||
},
|
||||
|
||||
|
||||
'ns3::RandomVariable::RandomVariable(ns3::RandomVariableBase const & variable) [constructor]': {
|
||||
'ignore': None,
|
||||
},
|
||||
|
||||
@@ -297,7 +297,7 @@ may manipulate these values.
|
||||
Note that initialization of the attribute relies on the macro
|
||||
NS_OBJECT_ENSURE_REGISTERED (DropTailQueue) being called; if you leave
|
||||
this out of your new class implementation, your attributes will not be
|
||||
initialized corretly.
|
||||
initialized correctly.
|
||||
|
||||
@subsection Basic usage
|
||||
|
||||
@@ -521,7 +521,7 @@ Consider this variable in class TcpSocket:
|
||||
uint32_t m_cWnd; // Congestion window
|
||||
@end verbatim
|
||||
|
||||
Suppose that someone working with Tcp wanted to get or set the
|
||||
Suppose that someone working with TCP wanted to get or set the
|
||||
value of that variable using the metadata system. If it were not
|
||||
already provided by ns-3, the user could declare the following addition
|
||||
in the runtime metadata system (to the TypeId declaration for TcpSocket):
|
||||
@@ -597,7 +597,7 @@ wants to hook it in to the attribute system, there is mainly the matter
|
||||
of writing
|
||||
the conversions to/from strings and attribute values. Most of this can be
|
||||
copy/pasted with macro-ized code. For instance, consider class
|
||||
delcaration for Rectangle in the @code{src/mobility/} directory:
|
||||
declaration for Rectangle in the @code{src/mobility/} directory:
|
||||
|
||||
@verbatim
|
||||
/**
|
||||
@@ -663,7 +663,7 @@ of an instance of the new class.
|
||||
found in @code{src/contrib} and not in the main tree. If you like this feature
|
||||
and would like to provide feedback on it, please email us.
|
||||
|
||||
Values for ns-3 attributes can be stored in an ascii or XML text file and
|
||||
Values for ns-3 attributes can be stored in an ASCII or XML text file and
|
||||
loaded into a future simulation. This feature is known as the
|
||||
ns-3 ConfigStore.
|
||||
The ConfigStore code is in @code{src/contrib/}. It is not yet main-tree
|
||||
|
||||
@@ -19,7 +19,7 @@ it, and details on its implementation.
|
||||
Consider that you have two simulation models A and B, and you wish
|
||||
to have them pass information between them during the simulation. One
|
||||
way that you can do that is that you can make A and B each explicitly
|
||||
knowledgable about the other, so that they can invoke methods on each
|
||||
knowledgeable about the other, so that they can invoke methods on each
|
||||
other.
|
||||
|
||||
@verbatim
|
||||
@@ -141,7 +141,7 @@ CbOne (double a, double b)
|
||||
}
|
||||
@end verbatim
|
||||
|
||||
Consider also the following main program snippett:
|
||||
Consider also the following main program snippet:
|
||||
@verbatim
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
|
||||
@@ -139,7 +139,7 @@ corresponding to a single speed-of-light delay. This delay applies to all
|
||||
net devices on the channel identically. You can think of a symmetrical hub
|
||||
in which the packet bits propagate to a central location and then back out
|
||||
equal length cables to the other devices on the channel. The single ``speed
|
||||
of light'' delay then corresponds to the time it takes for: 1) a singal to
|
||||
of light'' delay then corresponds to the time it takes for: 1) a signal to
|
||||
propagate from one CsmaNetDevice through its cable to the hub; plus 2) the
|
||||
time it takes for the hub to forward the packet out a port; plus 3) the time
|
||||
it takes for the signal in question to propagate to the destination net
|
||||
@@ -168,7 +168,7 @@ The CsmaChannel provides following Attributes:
|
||||
@item ReceiveEnable: Enable packet reception if true;
|
||||
@item EncapsulationMode: Type of link layer encapsulation to use;
|
||||
@item RxErrorModel: The receive error model;
|
||||
@item TxQueue: The trasmit queue used by the device;
|
||||
@item TxQueue: The transmit queue used by the device;
|
||||
@item InterframeGap: The optional time to wait between "frames";
|
||||
@item Rx: A trace source for received packets;
|
||||
@item Drop: A trace source for dropped packets.
|
||||
@@ -181,7 +181,7 @@ on the link.
|
||||
Packets sent over the CsmaNetDevice are always routed through the
|
||||
transmit queue to provide a trace hook for packets sent out over the
|
||||
network. This transmit queue can be set (via attribute) to model different
|
||||
queueing strategies.
|
||||
queuing strategies.
|
||||
|
||||
Also configurable by attribute is the encapsulation method used by the
|
||||
device. Every packet gets an EthernetHeader that includes the
|
||||
@@ -219,7 +219,7 @@ attempted. The default maximum number of retries is 1000.
|
||||
|
||||
The CSMA net devices and channels are typically created and configured using
|
||||
the associated @code{CsmaHelper} object. The various ns3 device dhelpers
|
||||
generatlly work in a simlar way, and their use is seen in many of our example
|
||||
generally work in a similar way, and their use is seen in many of our example
|
||||
programs.
|
||||
|
||||
The conceptual model of interest is that of a bare computer ``husk'' into which
|
||||
@@ -302,13 +302,13 @@ like a transmit complete interrupt service routine; or 3) from
|
||||
the random exponential backoff handler if a timeout is detected.
|
||||
|
||||
Case (3) implies that a packet is dequeued from the transmit queue if it is
|
||||
unable to be transmittted according to the backoff rules. It is important
|
||||
unable to be transmitted according to the backoff rules. It is important
|
||||
to understand that this will appear as a Dequeued packet and it is easy to
|
||||
incorrectly assume that the packet was transmitted since it passed through
|
||||
the transmit queue. In fact, a packet is actually dropped by the net device
|
||||
in this case. The reason for this behavior is due to the definition of the
|
||||
Queue Drop event. The m_traceDrop event is, by defintion, fired when a
|
||||
packet cannot be enqueued on the transmit queue becasue it is full. This
|
||||
Queue Drop event. The m_traceDrop event is, by definition, fired when a
|
||||
packet cannot be enqueued on the transmit queue because it is full. This
|
||||
event only fires if the queue is full and we do not overload this event
|
||||
to indicate that the CsmaChannel is "full."
|
||||
|
||||
|
||||
+8
-8
@@ -78,9 +78,9 @@ trace hooks. The EmuNetDevice provides following Attributes:
|
||||
@itemize @bullet
|
||||
@item Address: The Mac48Address of the device;
|
||||
@item DeviceName: The name of the underlying real device (e.g., ``eth1'');
|
||||
@item Start: The simualtion time at which to enable the underlying socket;
|
||||
@item Stop: The simualtion time at which to stop receiving from the underlying socket;
|
||||
@item TxQueue: The trasmit queue used by the device;
|
||||
@item Start: The simulation time at which to enable the underlying socket;
|
||||
@item Stop: The simulation time at which to stop receiving from the underlying socket;
|
||||
@item TxQueue: The transmit queue used by the device;
|
||||
@item InterframeGap: The optional time to wait between "frames";
|
||||
@item Rx: A trace source for received packets;
|
||||
@end itemize
|
||||
@@ -88,7 +88,7 @@ trace hooks. The EmuNetDevice provides following Attributes:
|
||||
Packets sent over the EmuNetDevice are always routed through the
|
||||
transmit queue to provide a trace hook for packets sent out over the
|
||||
network. This transmit queue can be set (via attribute) to model different
|
||||
queueing strategies.
|
||||
queuing strategies.
|
||||
|
||||
@node Using the EmuNetDevice
|
||||
@section Using the EmuNetDevice
|
||||
@@ -102,8 +102,8 @@ attempts to walk the channels looking for adjacent networks. Since there
|
||||
is no channel, the global router will be unable to do this.
|
||||
|
||||
The Emu net devices are typically created and configured using the associated
|
||||
@code{EmuHelper} object. The various ns3 device helpers generatlly work in a
|
||||
simlar way, and their use is seen in many of our example programs.
|
||||
@code{EmuHelper} object. The various ns3 device helpers generally work in a
|
||||
similar way, and their use is seen in many of our example programs.
|
||||
|
||||
The conceptual model of interest is that of a bare computer ``husk'' into which
|
||||
you plug net devices. The bare computers are created using a @code{NodeContainer}
|
||||
@@ -173,8 +173,8 @@ The m_traceDequeue event is triggered when a packet is removed from the
|
||||
transmit queue. Dequeues from the transmit queue happen immediately after
|
||||
the Enqueue event and just prior to the packet being sent to the underlying
|
||||
socket. This means that the transmit queue really only exists to fire on
|
||||
enqueue and dequeue operations so the Emu device bhaves like other ns-3
|
||||
devices in this repect.
|
||||
enqueue and dequeue operations so the Emu device behaves like other ns-3
|
||||
devices in this respect.
|
||||
|
||||
@subsection Lower-Level (PHY) Hooks
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ stacks attached to a simulation node to communicate over real hardware.
|
||||
|
||||
We expect the primary use for this configuration will be to generate repeatable
|
||||
experimental results in a real-world network environment that includes all of
|
||||
the ns-3 tracing, loging, visualization and statistics gathering tools.
|
||||
the ns-3 tracing, logging, visualization and statistics gathering tools.
|
||||
|
||||
In what can be viewed as essentially an inverse configuration, we allow ``real''
|
||||
machines running native applications and protocol stacks to integrate with
|
||||
@@ -188,7 +188,7 @@ here for one side).
|
||||
ed->SetAddress ("00:00:00:00:00:02");
|
||||
@end verbatim
|
||||
|
||||
And then the IP address of the client or serveris set in the usual way using
|
||||
And then the IP address of the client or server is set in the usual way using
|
||||
helpers.
|
||||
|
||||
@verbatim
|
||||
|
||||
@@ -100,7 +100,7 @@ function can be registered with the protocol handler by calling:
|
||||
MakeCallback (&Ipv4L3Protocol::Receive, ipv4),
|
||||
Ipv4L3Protocol::PROT_NUMBER, 0);
|
||||
@end verbatim
|
||||
and likewise for Ipv6, Arp, etc.
|
||||
and likewise for Ipv6, ARP, etc.
|
||||
|
||||
@section NodeList
|
||||
|
||||
@@ -115,7 +115,7 @@ The above @code{class Node} is not very useful as-is; other objects
|
||||
must be aggregated to it to provide useful node functionality.
|
||||
|
||||
The ns-3 source code directory @code{src/internet-stack} provides
|
||||
implmentation of TCP/IPv4-related components. These include IPv4,
|
||||
implementation of TCP/IPv4-related components. These include IPv4,
|
||||
ARP, UDP, TCP, and other related protocols.
|
||||
|
||||
Internet Nodes are not subclasses of class Node; they are simply Nodes
|
||||
@@ -289,7 +289,7 @@ usage is in @code{class PacketSink}:
|
||||
|
||||
To summarize, internally, the UDP implementation is organized as follows:
|
||||
@itemize @bullet
|
||||
@item a @code{UdpImpl} class that implements the Udp socket factory
|
||||
@item a @code{UdpImpl} class that implements the UDP socket factory
|
||||
functionality
|
||||
@item a @code{UdpL4Protocol} class that implements the protocol logic
|
||||
that is socket-independent
|
||||
|
||||
+24
-24
@@ -515,7 +515,7 @@ The file is called @code{tutorial-linear-dumbbell.cc} and is located in the
|
||||
create this network, so we will just quickly go over the main sections of the
|
||||
script.
|
||||
|
||||
The first section creates a CSMA lan that will become the left side of the
|
||||
The first section creates a CSMA LAN that will become the left side of the
|
||||
dumbbell network. This code should be very familiar since we used the same
|
||||
process to create our first example.
|
||||
|
||||
@@ -549,7 +549,7 @@ process to create our first example.
|
||||
CsmaIpv4Topology::AddIpv4Address (n3, nd3, "10.1.1.4", "255.255.255.0");
|
||||
@end verbatim
|
||||
|
||||
The code to generate the CSMA lan on the right side is similar; only the names
|
||||
The code to generate the CSMA LAN on the right side is similar; only the names
|
||||
have been changed.
|
||||
|
||||
@verbatim
|
||||
@@ -582,9 +582,9 @@ have been changed.
|
||||
CsmaIpv4Topology::AddIpv4Address (n7, nd7, "10.1.2.4", "255.255.255.0");
|
||||
@end verbatim
|
||||
|
||||
Next, we create a point to point link to connect the two lans. We connect
|
||||
the point-to-point channel between nodes three (on the left lan) and four
|
||||
(on the right lan). You should recoginze this as substantially similar to
|
||||
Next, we create a point to point link to connect the two LANs. We connect
|
||||
the point-to-point channel between nodes three (on the left LAN) and four
|
||||
(on the right LAN). You should recognize this as substantially similar to
|
||||
the link setup from the @code{point-to-point} example.
|
||||
|
||||
@verbatim
|
||||
@@ -599,7 +599,7 @@ the link setup from the @code{point-to-point} example.
|
||||
@end verbatim
|
||||
|
||||
Then we configure data flows. We create four echo clients that send UDP
|
||||
packets from the left side lan to servers created on the right side lan.
|
||||
packets from the left side LAN to servers created on the right side LAN.
|
||||
Notice that we send 100 packets with an inter-packet gap of ten milliseconds
|
||||
instead of the single packet we have previously used. This data rate is
|
||||
sufficient to saturate the point-to-point link and will cause packets to be
|
||||
@@ -710,7 +710,7 @@ object-oriented way. Since object-oriented design is somewhat of a black art
|
||||
to some people, we'll take some time here and outline a simple methodology
|
||||
you can follow.
|
||||
|
||||
@section Object Design 101 --- Class Ipv4BusNetwork
|
||||
@section Object Design 101 --- Class IPv4BusNetwork
|
||||
If you are a master of object oriented design, feel free to skip or skim this
|
||||
section, in which we derive a simplistic but fully operational bus network
|
||||
class.
|
||||
@@ -735,7 +735,7 @@ give you a starting point for required classes and member variables.
|
||||
Immediately we can notice that at the highest level we are talking about the
|
||||
noun @emph{network}. This probably won't surprise you. We also have an
|
||||
adjective that modifies the noun --- @emph{bus}. This should lead us to our
|
||||
first class defintion. Usually class names are constructed in the same way
|
||||
first class definition. Usually class names are constructed in the same way
|
||||
as an English language sentence would be spoken. For example, one would speak
|
||||
of a @emph{bus network} in conversation, so we would normally create a
|
||||
@code{class BusNetwork} to represent it.
|
||||
@@ -1005,7 +1005,7 @@ For your convenience, we reproduce the entire bus network implementation below:
|
||||
|
||||
@section Using Ipv4BusNetwork
|
||||
If all you ever want to do with a bus network can be captured in a topology
|
||||
with four nodes on the bus, the preceeding section may seem like a colossal
|
||||
with four nodes on the bus, the preceding section may seem like a colossal
|
||||
waste of time. This is probably not the case, though. Now that we have a
|
||||
relatively abstract bus class, we can create bus networks with 4, 40 or 4000
|
||||
nodes with no additional effort.
|
||||
@@ -1044,7 +1044,7 @@ by all of the nodes in the simulation, so this can add up quickly.
|
||||
|
||||
This concludes the first part of the tutorial. We have focused on
|
||||
using the @command{ns-3} system to construct various network topologies and to
|
||||
simulate sendng data across the networks; and we've shown you how to use the
|
||||
simulate sending data across the networks; and we've shown you how to use the
|
||||
trace facility to get access to simulation results.
|
||||
|
||||
We now encourage you to play with the system a little. Experiment with what
|
||||
@@ -1058,7 +1058,7 @@ In the next part of the tutorial we are going to drop down a level and begin
|
||||
examining the lower levels of the system in more detail. We are going to
|
||||
explain how to change the behavior of the system and eventually how to write
|
||||
new models and applications. This is a good time to make sure that you
|
||||
thorougly understand what we've gone over so far.
|
||||
thoroughly understand what we've gone over so far.
|
||||
|
||||
@c ========================================================================
|
||||
@c Object Model
|
||||
@@ -1365,7 +1365,7 @@ its aggregation via the method @code{GetObject}.
|
||||
Technically, the class named @code{Object} is simply a base class that you
|
||||
will inherit from if you want your @code{Objects} to support aggregation and
|
||||
discovery. Many systems have a base class that implements common
|
||||
functionality and these base classes are typically called somthing like
|
||||
functionality and these base classes are typically called something like
|
||||
Object. The @command{ns-3} version of this base class relates primarily to
|
||||
@code{Object} aggregation and discovery, although it does also provide methods
|
||||
to help with intrusive reference counting and tracing as well.
|
||||
@@ -1383,7 +1383,7 @@ rather than with the form of the class declaration.
|
||||
For those of you unfamiliar with Microsoft COM, CORBA or ORBit, this might
|
||||
sound obvious. For those of with such a background, the point we are making
|
||||
is that there is no such thing in @command{ns-3} as a separate Interface
|
||||
declaration, no such thing as an Interface Definiition Language, no such thing
|
||||
declaration, no such thing as an Interface Definition Language, no such thing
|
||||
as a UUID or GUID, etc. In @command{ns-3} we just work with C++ objects that
|
||||
may be given some very useful abilities by inheriting from the @command{ns-3}
|
||||
base class @code{Object}. @command{Ns-3} @code{Objects} are not required to
|
||||
@@ -1422,7 +1422,7 @@ mentioned that the @code{Node} class acts as a container. In fact, the
|
||||
@code{Object}. So, when the @code{Node} object is created it is really an
|
||||
aggregation of one @code{Object} and you can call @code{AggregateObject} or
|
||||
@code{GetObject} on the resulting @code{Node} object. Along with being an
|
||||
aggregation, the @code{Node} class also describes a public interface. THis
|
||||
aggregation, the @code{Node} class also describes a public interface. This
|
||||
public interface (API) is declared just as any C++ object is declared, via its
|
||||
class methods as specified in the inheritance tree. For those steeped in
|
||||
COM or CORBA, this is where the concept of Interface works in @command{ns-3}.
|
||||
@@ -1435,7 +1435,7 @@ The figure below shows how an @code{Object} could be illustrated in detail.
|
||||
The line with the circle at the top of the diagram represents the appearance
|
||||
of the @code{Object} API to the external world. This circle and line are
|
||||
together called a lollipop because of its superficial similarity to a kind of
|
||||
childs candy.
|
||||
child's candy.
|
||||
|
||||
@sp 1
|
||||
@center @image{oneobj,,,,png}
|
||||
@@ -1514,7 +1514,7 @@ the @code{Object} (and container/aggregation) @code{A}.
|
||||
a->AggregateObject (c);
|
||||
@end verbatim
|
||||
|
||||
Thats all there is to it. Now that you have those connectors snapped
|
||||
That's all there is to it. Now that you have those connectors snapped
|
||||
together, you can ask each of the @code{Objects} in the aggregation for any of
|
||||
the other @code{Objects} in the aggregation. Lets look at a simple example:
|
||||
|
||||
@@ -1527,11 +1527,11 @@ The left hand side of this assignment declares a smart pointer to the class
|
||||
@code{B} to help with memory management of the returned @code{Object} pointer.
|
||||
You should be very familiar with smart pointers at this stage of the tutorial.
|
||||
|
||||
The right hand side illustrates how @code{GetObject} is acutally used.
|
||||
The method @code{GetObject} is templated. The assocated template parameter
|
||||
The right hand side illustrates how @code{GetObject} is actually used.
|
||||
The method @code{GetObject} is templated. The associated template parameter
|
||||
(between the brackets) specifies the @emph{class} that is being requested.
|
||||
This is important. Since it is the class type that specifies the search
|
||||
criteron, there can be only one instance of a particular class present in an
|
||||
criterion, there can be only one instance of a particular class present in an
|
||||
aggregation. Looking back a little, although the parameter to
|
||||
@code{AggregateObject} appears to be a vanilla C++ object (@code{b} or @code{c}
|
||||
above), it actually represents (is an instance of) a class that has an
|
||||
@@ -1648,7 +1648,7 @@ If you can get to @code{Object B} from @code{Object A}, and you can get to
|
||||
@cindex TypeId
|
||||
@cindex GetTypeId
|
||||
The final piece of this puzzle is the @code{TypeId}. Recall that the
|
||||
declaration our eample object above included the following code
|
||||
declaration our example object above included the following code
|
||||
|
||||
@verbatim
|
||||
static ns3::TypeId GetTypeId (void)
|
||||
@@ -1724,7 +1724,7 @@ named @code{A::tid} since it is inside the class declaration for
|
||||
@code{class A}, and is initialized by a call to the constructor for the class
|
||||
@code{TypeId}. The constructor for @code{TypeId} takes a @code{std::string}
|
||||
that can be used to locate the type information for your class. We usually
|
||||
privide the class name as the string.
|
||||
provide the class name as the string.
|
||||
|
||||
Hopefully, this much of the declaration is now clear:
|
||||
|
||||
@@ -1787,7 +1787,7 @@ constructor to be used when an instance of your class is created using
|
||||
AddConstructor<A> ();
|
||||
@end verbatim
|
||||
|
||||
You can interpret this as explaining to the @command{ns-3} object ssytem that
|
||||
You can interpret this as explaining to the @command{ns-3} object system that
|
||||
you have a constructor named @code{A::A} which takes no parameters. You are
|
||||
saying that this constructor should be used when @code{CreateObject} is called
|
||||
with no parameters.
|
||||
@@ -2077,10 +2077,10 @@ associated with it.
|
||||
|
||||
@emph{Remember: Object types do not identify objects.}
|
||||
|
||||
@subsection Dont use GetObject to Check Your Own Type.
|
||||
@subsection Don't use GetObject to Check Your Own Type.
|
||||
@cindex GetObject
|
||||
It is tempting to use @code{GetObject} as a form of runtime type
|
||||
information. Dont do it. You have no control over what @emph{other}
|
||||
information. Don't do it. You have no control over what @emph{other}
|
||||
object may be added to your aggregation. Someone else may have
|
||||
appropriated (reimplemented) your type and aggregated themselves onto the
|
||||
aggregation.
|
||||
|
||||
+10
-10
@@ -72,7 +72,7 @@ For Internet nodes, the ASCII trace wrapper is a wrapper around
|
||||
the @command{ns-3} low-level
|
||||
tracing system that lets you get access to underlying trace events easily.
|
||||
The output of a trace of a simulation run is an ASCII file --- thus the name.
|
||||
In the spririt of keeping things simple, you won't be able to control or
|
||||
In the spirit of keeping things simple, you won't be able to control or
|
||||
configure the output at this stage.
|
||||
|
||||
For those familiar with @command{ns-2} output, this type of trace is
|
||||
@@ -121,10 +121,10 @@ directory, it is created at the top-level directory of the repository. So,
|
||||
change into the top level directory and take a look at the file
|
||||
@code{tutorial.tr} in your favorite editor.
|
||||
|
||||
@subsubsection Parsing Ascii Traces
|
||||
@cindex parsing ascii traces
|
||||
@subsubsection Parsing ASCII Traces
|
||||
@cindex parsing ASCII traces
|
||||
|
||||
This section parses in detail the structure of the ascii tracing
|
||||
This section parses in detail the structure of the ASCII tracing
|
||||
output. If you find this output format self explanatory (it
|
||||
resembles tcpdump output), you may skip to the next
|
||||
section on pcap tracing.
|
||||
@@ -191,7 +191,7 @@ is created it is given an identifying number that monotonically increases from
|
||||
zero. Therefore, @code{nodeid=0} means that the node in which the given trace
|
||||
event originated is the first node we created. In the case of our script,
|
||||
this first node is is the node pointed to by the smart pointer @code{n0}. Not
|
||||
too surpsisingly, this is also the node to which we attached the
|
||||
too surprisingly, this is also the node to which we attached the
|
||||
@code{UdpEchoClient}. The device number is local to each node, and so the
|
||||
device given by @code{device=0} is the first net device that we added to the
|
||||
node in question. In our simulation, this corresponds to the
|
||||
@@ -269,10 +269,10 @@ on node one (reference 02) at simulation time 2.00207 seconds (reference 01).
|
||||
Looking at the packet payload (references 10-14) we see that this is an ARP
|
||||
reply to the request sent by node one. Note that the simulation time
|
||||
(reference 01) is now 2.00207 seconds. This is direct result of the data rate
|
||||
(5 mb/s) and latency (2 ms) parameters that we passed to the
|
||||
(5 MB/s) and latency (2 ms) parameters that we passed to the
|
||||
@code{CsmaChannel} when we created it. Clearly the ARP request packet was
|
||||
sent over the channel and received approximately 2 ms later by node one. A
|
||||
corresponding ARP response packet was created and enqueued on node one's net
|
||||
corresponding ARP response packet was created and enqueued on node ones net
|
||||
device. It is this enqueue trace event that has being logged.
|
||||
|
||||
@cindex queue
|
||||
@@ -339,7 +339,7 @@ one has received the UDP echo packet and the @code{UdpEchoServer Application}
|
||||
on that node has turned the packet around. Just as node zero needed to ARP
|
||||
for the MAC address of node one, now node one must ARP for the MAC address of
|
||||
node zero. We see the ARP request enqueued on the transmit queue of node one;
|
||||
then we see the ARP request dequeued from the tranmit queue of node one (and
|
||||
then we see the ARP request dequeued from the transmit queue of node one (and
|
||||
implicitly transmitted to node zero). Then we see an ARP response enqueued
|
||||
on the transmit queue of node zero; and finally the ARP response dequeued (and
|
||||
implicitly transmitted back to node one).
|
||||
@@ -396,7 +396,7 @@ tcpdump and Wireshark can be used..
|
||||
The code used to enable pcap tracing is similar to that for ASCII tracing.
|
||||
We have provided another file, @code{tutorial-csma-echo-pcap-trace.cc} that
|
||||
uses the pcap trace wrapper. We have added the code to include the pcap
|
||||
trace wrapper defintions:
|
||||
trace wrapper definitions:
|
||||
|
||||
@verbatim
|
||||
#include "ns3/pcap-trace.h"
|
||||
@@ -447,7 +447,7 @@ those nodes.
|
||||
|
||||
@subsubsection Reading output with Wireshark
|
||||
@cindex Wireshark
|
||||
If you are unfamilar with Wireshark, there is a web site available from which
|
||||
If you are unfamiliar with Wireshark, there is a web site available from which
|
||||
you can download programs and documentation: @uref{http://www.wireshark.org/}.
|
||||
|
||||
If you have Wireshark available, you can open each of the trace files and
|
||||
|
||||
@@ -59,7 +59,7 @@ QoS class id set by an application and processed by a lower-level MAC
|
||||
layer.
|
||||
|
||||
Memory management of Packet objects is entirely automatic and extremely
|
||||
efficient: memory for the application-level payload can be modelized by
|
||||
efficient: memory for the application-level payload can be modeled by
|
||||
a virtual buffer of zero-filled bytes for which memory is never allocated
|
||||
unless explicitly requested by the user or unless the packet is fragmented
|
||||
or serialized out to a real network device.
|
||||
@@ -458,7 +458,7 @@ code in @code{src/internet-stack/udp-socket-impl.cc}:
|
||||
@verbatim
|
||||
Ptr<Packet> p; // pointer to a pre-existing packet
|
||||
SocketIpTtlTag tag
|
||||
tag.SetTtl (m_ipMulticastTtl); // Convey the TTL from Udp layer to IP layer
|
||||
tag.SetTtl (m_ipMulticastTtl); // Convey the TTL from UDP layer to IP layer
|
||||
p->AddPacketTag (tag);
|
||||
@end verbatim
|
||||
|
||||
@@ -636,7 +636,7 @@ requires a deep copy of the linked list before performing this operation.
|
||||
On the other hand, copying a Packet and its tags is a matter of
|
||||
copying the TagData head pointer and incrementing its reference count.
|
||||
|
||||
Tags are found by the unique mapping betweent the Tag type and
|
||||
Tags are found by the unique mapping between the Tag type and
|
||||
its underlying id. This is why at most one instance of any Tag
|
||||
can be stored in a packet. The mapping between Tag type and
|
||||
underlying id is performed by a registration as follows:
|
||||
|
||||
@@ -35,7 +35,7 @@ The PointToPointNetDevice provides following Attributes:
|
||||
@itemize @bullet
|
||||
@item Address: The ns3::Mac48Address of the device (if desired);
|
||||
@item DataRate: The data rate (ns3::DataRate) of the device;
|
||||
@item TxQueue: The trasmit queue (ns3::Queue) used by the device;
|
||||
@item TxQueue: The transmit queue (ns3::Queue) used by the device;
|
||||
@item InterframeGap: The optional ns3::Time to wait between "frames";
|
||||
@item Rx: A trace source for received packets;
|
||||
@item Drop: A trace source for dropped packets.
|
||||
@@ -78,7 +78,7 @@ the channel.
|
||||
|
||||
The PointToPoint net devices and channels are typically created and configured using
|
||||
the associated @code{PointToPointHelper} object. The various ns3 device helpers
|
||||
generally work in a simlar way, and their use is seen in many of our example
|
||||
generally work in a similar way, and their use is seen in many of our example
|
||||
programs and is also covered in the ns-3 tutorial.
|
||||
|
||||
The conceptual model of interest is that of a bare computer ``husk'' into which
|
||||
@@ -93,7 +93,7 @@ helper. You just ask this helper to create as many computers (we call them
|
||||
|
||||
Once you have your nodes, you need to instantiate a @code{PointToPointHelper} and set
|
||||
any attributes you may want to change. Note that since this is a point-to-point
|
||||
(as compared to a point-to-mulipoint) there may only be two nodes with associated
|
||||
(as compared to a point-to-multipoint) there may only be two nodes with associated
|
||||
net devices connected by a PointToPointChannel.
|
||||
|
||||
@verbatim
|
||||
|
||||
@@ -28,7 +28,7 @@ ns-3 random numbers are provided via instances of @code{class RandomVariable}.
|
||||
@itemize @bullet
|
||||
@item @strong{by default, ns-3 simulations use a fixed seed}; if there is any
|
||||
randomness in the simulation, each run of the program will yield identical
|
||||
results uniess the seed and/or run number is changed.
|
||||
results unless the seed and/or run number is changed.
|
||||
@itemize @bullet
|
||||
@item @strong{in ns-3.3 and earlier, ns-3 simulations used a random seed by
|
||||
default; this marks a change in policy starting with ns-3.4}
|
||||
@@ -81,7 +81,7 @@ RNG, then
|
||||
the first stream might use the first N/2 values and the second
|
||||
stream might produce the second N/2 values. An important property
|
||||
here is that the two streams are uncorrelated. Likewise, each
|
||||
stream can be partitioned disjointly to a number of
|
||||
stream can be partitioned disjointedly to a number of
|
||||
uncorrelated @emph{substreams}. The underlying RNG hopefully
|
||||
produces a pseudo-random sequence of numbers with a very long
|
||||
cycle length, and partitions this into streams and substreams in an
|
||||
|
||||
@@ -225,7 +225,7 @@ will query each one of these routing protocols (in some order determined
|
||||
by the simulation author) until a route is found.
|
||||
|
||||
We chose this approach because it may better
|
||||
faciliate the integration of disparate routing approaches that may
|
||||
facilitate the integration of disparate routing approaches that may
|
||||
be difficult to coordinate the writing to a single table, approaches
|
||||
where more information than destination IP address (e.g., source
|
||||
routing) is used to determine the next hop, and on-demand
|
||||
@@ -300,7 +300,7 @@ are sent.
|
||||
|
||||
Typically there are two main types of multicast routes: routes of the
|
||||
first kind are used during forwarding. All of the conditions must be
|
||||
exlicitly provided. The second kind of routes are used to get packets off
|
||||
explicitly provided. The second kind of routes are used to get packets off
|
||||
of a local node. The difference is in the input interface. Routes for
|
||||
forwarding will always have an explicit input interface specified. Routes
|
||||
off of a node will always set the input interface to a wildcard specified
|
||||
|
||||
@@ -177,7 +177,7 @@ straightforward to support in ns-3; have applications call
|
||||
Similarly, passing in a zero to the pointer argument in the raw buffer
|
||||
variants has the same effect. Note that, if some subsequent code tries
|
||||
to read the Packet data buffer, the fake buffer will be converted to
|
||||
a real (zero'ed) buffer on the spot, and the efficiency will be lost there.
|
||||
a real (zeroed) buffer on the spot, and the efficiency will be lost there.
|
||||
|
||||
@subsection Socket options
|
||||
|
||||
|
||||
+3
-3
@@ -28,7 +28,7 @@ create TCP sockets. A typical usage can be seen in this snippet:
|
||||
...
|
||||
}
|
||||
@end verbatim
|
||||
The parameter @code{m_tid} controls the TypeId of the actual Tcp Socket
|
||||
The parameter @code{m_tid} controls the TypeId of the actual TCP Socket
|
||||
implementation that is instantiated. This way, the application can be
|
||||
written generically and different socket implementations can be swapped out
|
||||
by specifying the TypeId.
|
||||
@@ -138,7 +138,7 @@ NSC requires the packages mercurial, flex, and bison.
|
||||
|
||||
@subsection Configuring and Downloading
|
||||
|
||||
NSC is disbled by default and must be explicitly configured in. To try
|
||||
NSC is disabled by default and must be explicitly configured in. To try
|
||||
this, type
|
||||
@verbatim
|
||||
./waf configure --enable-nsc
|
||||
@@ -210,7 +210,7 @@ to be set:
|
||||
The key line is the @code{SetNscStack}. This tells the InternetStack
|
||||
helper to aggregate instances of NSC TCP instead of native ns-3 TCP
|
||||
to the remaining nodes. It is important that this function be called
|
||||
@strong{before} callling the @code{Install()} function, as shown above.
|
||||
@strong{before} calling the @code{Install()} function, as shown above.
|
||||
|
||||
Which stacks are available to use? Presently, the focus has been on
|
||||
Linux 2.6.18 and Linux 2.6.26 stacks for ns-3. To see which stacks
|
||||
|
||||
@@ -128,11 +128,11 @@ The modularity provided by the implementation makes low-level
|
||||
configuration of the WifiNetDevice powerful but complex. For this reason,
|
||||
we provide some helper classes to perform common operations in a simple
|
||||
matter, and leverage the ns-3 attribute system to allow users to control
|
||||
the parameterization of the underlying models.
|
||||
the parametrization of the underlying models.
|
||||
|
||||
Users who use the low-level ns-3 API and who wish to add a WifiNetDevice
|
||||
to their node must create an instance of a WifiNetDevice, plus
|
||||
a number of consitutent objects, and bind them together appropriately
|
||||
a number of constituent objects, and bind them together appropriately
|
||||
(the WifiNetDevice is very modular in this regard, for future
|
||||
extensibility). At the low-level API, this can be done
|
||||
with about 20 lines of code (see @code{ns3::WifiHelper::Install}, and
|
||||
|
||||
@@ -104,7 +104,7 @@ def main(argv):
|
||||
sink = ns3.PacketSinkHelper("ns3::UdpSocketFactory",
|
||||
ns3.Address(ns3.InetSocketAddress(ns3.Ipv4Address.GetAny(), port)))
|
||||
app = sink.Install(ns3.NodeContainer(terminals.Get(1)))
|
||||
app.Start (ns3.Seconds (0.0))
|
||||
app.Start(ns3.Seconds(0.0))
|
||||
|
||||
#
|
||||
# Create a similar flow from n3 to n0, starting at time 1.1 seconds
|
||||
@@ -116,7 +116,7 @@ def main(argv):
|
||||
app.Stop(ns3.Seconds(10.0))
|
||||
|
||||
app = sink.Install(ns3.NodeContainer(terminals.Get(0)))
|
||||
app.Start (ns3.Seconds (0.0))
|
||||
app.Start(ns3.Seconds(0.0))
|
||||
|
||||
#
|
||||
# Configure tracing of all enqueue, dequeue, and NetDevice receive events.
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
// Test program for this 3-router scenario, using global routing
|
||||
//
|
||||
// (a.a.a.a/32)A<--x.x.x.0/30-->B<--y.y.y.0/30-->C(c.c.c.c/32)
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
#include "ns3/csma-net-device.h"
|
||||
#include "ns3/core-module.h"
|
||||
#include "ns3/simulator-module.h"
|
||||
#include "ns3/node-module.h"
|
||||
#include "ns3/helper-module.h"
|
||||
#include "ns3/ipv4-static-routing.h"
|
||||
#include "ns3/ipv4-global-routing.h"
|
||||
#include "ns3/ipv4-list-routing.h"
|
||||
#include "ns3/ipv4-routing-table-entry.h"
|
||||
#include "ns3/global-router-interface.h"
|
||||
|
||||
using namespace ns3;
|
||||
using std::cout;
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("GlobalRouterInjectionTest");
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
|
||||
// Allow the user to override any of the defaults and the above
|
||||
// DefaultValue::Bind ()s at run-time, via command-line arguments
|
||||
CommandLine cmd;
|
||||
cmd.Parse (argc, argv);
|
||||
|
||||
Ptr<Node> nA = CreateObject<Node> ();
|
||||
Ptr<Node> nB = CreateObject<Node> ();
|
||||
Ptr<Node> nC = CreateObject<Node> ();
|
||||
|
||||
NodeContainer c = NodeContainer (nA, nB, nC);
|
||||
|
||||
InternetStackHelper internet;
|
||||
|
||||
// Point-to-point links
|
||||
NodeContainer nAnB = NodeContainer (nA, nB);
|
||||
NodeContainer nBnC = NodeContainer (nB, nC);
|
||||
|
||||
internet.Install (nAnB);
|
||||
Ipv4ListRoutingHelper staticonly;
|
||||
Ipv4ListRoutingHelper staticRouting;
|
||||
staticonly.Add(staticRouting, 0);
|
||||
internet.SetRoutingHelper(staticonly);
|
||||
internet.Install(NodeContainer(nC));
|
||||
|
||||
// We create the channels first without any IP addressing information
|
||||
PointToPointHelper p2p;
|
||||
p2p.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
|
||||
p2p.SetChannelAttribute ("Delay", StringValue ("2ms"));
|
||||
NetDeviceContainer dAdB = p2p.Install (nAnB);
|
||||
|
||||
NetDeviceContainer dBdC = p2p.Install (nBnC);;
|
||||
|
||||
Ptr<CsmaNetDevice> deviceA = CreateObject<CsmaNetDevice> ();
|
||||
deviceA->SetAddress (Mac48Address::Allocate ());
|
||||
nA->AddDevice (deviceA);
|
||||
|
||||
Ptr<CsmaNetDevice> deviceC = CreateObject<CsmaNetDevice> ();
|
||||
deviceC->SetAddress (Mac48Address::Allocate ());
|
||||
nC->AddDevice (deviceC);
|
||||
|
||||
// Later, we add IP addresses.
|
||||
Ipv4AddressHelper ipv4;
|
||||
ipv4.SetBase ("10.1.1.0", "255.255.255.252");
|
||||
Ipv4InterfaceContainer iAiB = ipv4.Assign (dAdB);
|
||||
|
||||
ipv4.SetBase ("10.1.1.4", "255.255.255.252");
|
||||
Ipv4InterfaceContainer iBiC = ipv4.Assign (dBdC);
|
||||
|
||||
Ptr<Ipv4> ipv4A = nA->GetObject<Ipv4> ();
|
||||
Ptr<Ipv4> ipv4B = nB->GetObject<Ipv4> ();
|
||||
Ptr<Ipv4> ipv4C = nC->GetObject<Ipv4> ();
|
||||
|
||||
int32_t ifIndexA = ipv4A->AddInterface (deviceA);
|
||||
int32_t ifIndexC = ipv4C->AddInterface (deviceC);
|
||||
|
||||
Ipv4InterfaceAddress ifInAddrA = Ipv4InterfaceAddress (Ipv4Address ("172.16.1.1"), Ipv4Mask ("255.255.255.255"));
|
||||
ipv4A->AddAddress (ifIndexA, ifInAddrA);
|
||||
ipv4A->SetMetric (ifIndexA, 1);
|
||||
ipv4A->SetUp (ifIndexA);
|
||||
|
||||
Ipv4InterfaceAddress ifInAddrC = Ipv4InterfaceAddress (Ipv4Address ("192.168.1.1"), Ipv4Mask ("255.255.255.255"));
|
||||
ipv4C->AddAddress (ifIndexC, ifInAddrC);
|
||||
ipv4C->SetMetric (ifIndexC, 1);
|
||||
ipv4C->SetUp (ifIndexC);
|
||||
|
||||
// Create router nodes, initialize routing database and set up the routing
|
||||
// tables in the nodes.
|
||||
|
||||
// Populate routing tables for nodes nA and nB
|
||||
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
|
||||
// Inject global routes from Node B, including transit network...
|
||||
Ptr<GlobalRouter> globalRouterB = nB->GetObject<GlobalRouter> ();
|
||||
globalRouterB->InjectRoute ("10.1.1.4", "255.255.255.252");
|
||||
// ...and the host in network "C"
|
||||
globalRouterB->InjectRoute ("192.168.1.1", "255.255.255.255");
|
||||
|
||||
Ipv4GlobalRoutingHelper::RecomputeRoutingTables();
|
||||
// In addition, nB needs a static route to nC so it knows what to do with stuff
|
||||
// going to 192.168.1.1
|
||||
Ipv4StaticRoutingHelper ipv4RoutingHelper;
|
||||
Ptr<Ipv4StaticRouting> staticRoutingB = ipv4RoutingHelper.GetStaticRouting(ipv4B);
|
||||
staticRoutingB->AddHostRouteTo (Ipv4Address ("192.168.1.1"), Ipv4Address ("10.1.1.6"),2);
|
||||
|
||||
// Create the OnOff application to send UDP datagrams of size
|
||||
// 210 bytes at a rate of 448 Kb/s
|
||||
uint16_t port = 9; // Discard port (RFC 863)
|
||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||
Address (InetSocketAddress (ifInAddrC.GetLocal(), port)));
|
||||
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
|
||||
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
|
||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000)));
|
||||
ApplicationContainer apps = onoff.Install (nA);
|
||||
apps.Start (Seconds (1.0));
|
||||
apps.Stop (Seconds (10.0));
|
||||
|
||||
// Create a packet sink to receive these packets
|
||||
PacketSinkHelper sink ("ns3::UdpSocketFactory",
|
||||
Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
|
||||
apps = sink.Install (nC);
|
||||
apps.Start (Seconds (1.0));
|
||||
apps.Stop (Seconds (10.0));
|
||||
|
||||
std::ofstream ascii;
|
||||
ascii.open ("global-routing-injection32.tr", std::ios_base::binary | std::ios_base::out);
|
||||
PointToPointHelper::EnablePcapAll ("global-routing-injection32");
|
||||
PointToPointHelper::EnableAsciiAll (ascii);
|
||||
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
+30
-34
@@ -114,18 +114,22 @@ def main(argv):
|
||||
# our container
|
||||
#
|
||||
wifi = ns3.WifiHelper()
|
||||
wifi.SetMac("ns3::AdhocWifiMac")
|
||||
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
|
||||
"DataMode", ns3.StringValue ("wifia-54mbs"))
|
||||
wifiPhy = ns3.YansWifiPhyHelper.Default ()
|
||||
wifiChannel = ns3.YansWifiChannelHelper.Default ()
|
||||
wifiPhy.SetChannel (wifiChannel.Create ())
|
||||
backboneDevices = wifi.Install(wifiPhy, backbone)
|
||||
mac = ns3.NqosWifiMacHelper.Default()
|
||||
mac.SetType("ns3::AdhocWifiMac")
|
||||
wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
|
||||
"DataMode", ns3.StringValue("wifia-54mbs"))
|
||||
wifiPhy = ns3.YansWifiPhyHelper.Default()
|
||||
wifiChannel = ns3.YansWifiChannelHelper.Default()
|
||||
wifiPhy.SetChannel(wifiChannel.Create())
|
||||
backboneDevices = wifi.Install(wifiPhy, mac, backbone)
|
||||
#
|
||||
# Add the IPv4 protocol stack to the nodes in our container
|
||||
#
|
||||
print "Enabling OLSR routing on all backbone nodes"
|
||||
internet = ns3.InternetStackHelper()
|
||||
internet.Install(backbone)
|
||||
olsr = ns3.OlsrHelper()
|
||||
internet.SetRoutingHelper(olsr);
|
||||
internet.Install(backbone);
|
||||
#
|
||||
# Assign IPv4 addresses to the device drivers(actually to the associated
|
||||
# IPv4 interfaces) we just created.
|
||||
@@ -219,22 +223,24 @@ def main(argv):
|
||||
#
|
||||
# Create another ad hoc network and devices
|
||||
#
|
||||
ssid = ns3.Ssid ('wifi-infra' + str(i))
|
||||
wifiInfra = ns3.WifiHelper.Default ()
|
||||
wifiPhy.SetChannel (wifiChannel.Create ())
|
||||
wifiInfra.SetRemoteStationManager ('ns3::ArfWifiManager')
|
||||
ssid = ns3.Ssid('wifi-infra' + str(i))
|
||||
wifiInfra = ns3.WifiHelper.Default()
|
||||
wifiPhy.SetChannel(wifiChannel.Create())
|
||||
wifiInfra.SetRemoteStationManager('ns3::ArfWifiManager')
|
||||
macInfra = ns3.NqosWifiMacHelper.Default();
|
||||
macInfra.SetType("ns3::NqstaWifiMac",
|
||||
"Ssid", ns3.SsidValue(ssid),
|
||||
"ActiveProbing", ns3.BooleanValue(False))
|
||||
|
||||
# setup stas
|
||||
wifiInfra.SetMac ("ns3::NqstaWifiMac",
|
||||
"Ssid", ns3.SsidValue (ssid),
|
||||
"ActiveProbing", ns3.BooleanValue (False))
|
||||
staDevices = wifiInfra.Install (wifiPhy, stas)
|
||||
staDevices = wifiInfra.Install(wifiPhy, macInfra, stas)
|
||||
# setup ap.
|
||||
wifiInfra.SetMac ("ns3::NqapWifiMac", "Ssid", ns3.SsidValue (ssid),
|
||||
"BeaconGeneration", ns3.BooleanValue (True),
|
||||
"BeaconInterval", ns3.TimeValue (ns3.Seconds (2.5)))
|
||||
apDevices = wifiInfra.Install (wifiPhy, backbone.Get (i))
|
||||
macInfra.SetType("ns3::NqapWifiMac", "Ssid", ns3.SsidValue(ssid),
|
||||
"BeaconGeneration", ns3.BooleanValue(True),
|
||||
"BeaconInterval", ns3.TimeValue(ns3.Seconds(2.5)))
|
||||
apDevices = wifiInfra.Install(wifiPhy, macInfra, backbone.Get(i))
|
||||
# Collect all of these new devices
|
||||
infraDevices = ns3.NetDeviceContainer (apDevices, staDevices)
|
||||
infraDevices = ns3.NetDeviceContainer(apDevices, staDevices)
|
||||
|
||||
# Add the IPv4 protocol stack to the nodes in our container
|
||||
#
|
||||
@@ -265,16 +271,6 @@ def main(argv):
|
||||
"Pause", ns3.RandomVariableValue(ns3.ConstantVariable(0.4)))
|
||||
mobility.Install(infra)
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # /
|
||||
# #
|
||||
# Routing configuration #
|
||||
# #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # /
|
||||
|
||||
print "Enabling OLSR routing on all backbone nodes"
|
||||
olsr = ns3.OlsrHelper()
|
||||
olsr.Install(backbone)
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # /
|
||||
# #
|
||||
# Application configuration #
|
||||
@@ -288,7 +284,7 @@ def main(argv):
|
||||
|
||||
# Let's make sure that the user does not define too few LAN nodes
|
||||
# to make this example work. We need lanNodes >= 5
|
||||
assert (lanNodes >= 5)
|
||||
assert(lanNodes >= 5)
|
||||
appSource = ns3.NodeList.GetNode(11)
|
||||
appSink = ns3.NodeList.GetNode(13)
|
||||
remoteAddr = ns3.Ipv4Address("172.16.0.5")
|
||||
@@ -327,9 +323,9 @@ def main(argv):
|
||||
# WifiHelper.EnableAscii(ascii, 13, 0);
|
||||
|
||||
# Let's do a pcap trace on the backbone devices
|
||||
ns3.YansWifiPhyHelper.EnablePcap("mixed-wireless", backboneDevices)
|
||||
wifiPhy.EnablePcap("mixed-wireless", backboneDevices)
|
||||
# Let's additionally trace the application Sink, ifIndex 0
|
||||
ns3.CsmaHelper.EnablePcap("mixed-wireless", appSink.GetId(), 0)
|
||||
ns3.CsmaHelper.EnablePcap("mixed-wireless", appSink.GetId(), 0, False)
|
||||
|
||||
# #ifdef ENABLE_FOR_TRACING_EXAMPLE
|
||||
# Config.Connect("/NodeList/*/$MobilityModel/CourseChange",
|
||||
|
||||
@@ -77,7 +77,7 @@ class StackHelper
|
||||
routing = routingHelper.GetStaticRouting (ipv6);
|
||||
|
||||
std::cout << "Routing table of " << n << " : " << std::endl;
|
||||
std::cout << "Destination\t\t\t\t" << "Gateway\t\t\t\t\t" << "Interface\t" << std::endl;
|
||||
std::cout << "Destination\t\t\t\t" << "Gateway\t\t\t\t\t" << "Interface\t" << "Prefix to use" << std::endl;
|
||||
|
||||
nbRoutes = routing->GetNRoutes ();
|
||||
for (uint32_t i = 0 ; i < nbRoutes ; i++)
|
||||
@@ -85,7 +85,9 @@ class StackHelper
|
||||
route = routing->GetRoute (i);
|
||||
std::cout << route.GetDest () << "\t"
|
||||
<< route.GetGateway () << "\t"
|
||||
<< route.GetInterface () << "\t" << std::endl;
|
||||
<< route.GetInterface () << "\t"
|
||||
<< route.GetPrefixToUse () << "\t"
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -157,8 +159,8 @@ int main (int argc, char** argv)
|
||||
iic2.Add (iicr2);
|
||||
|
||||
/* radvd configuration */
|
||||
Ipv6Address prefix ("2001:1::0"); /* create the prefix */
|
||||
Ipv6Address prefixBis ("2001:ABCD::0"); /* create the prefix */
|
||||
Ipv6Address prefix ("2001:ABCD::0"); /* create the prefix */
|
||||
Ipv6Address prefixBis ("2001:1::0"); /* create the prefix */
|
||||
Ipv6Address prefix2 ("2001:2::0"); /* create the prefix */
|
||||
uint32_t indexRouter = iic1.GetInterfaceIndex (1); /* R interface (n0 - R) */
|
||||
uint32_t indexRouter2 = iic2.GetInterfaceIndex (1); /* R interface (R - n1) */
|
||||
|
||||
@@ -33,12 +33,59 @@
|
||||
#include "ns3/simulator-module.h"
|
||||
#include "ns3/helper-module.h"
|
||||
|
||||
#include "ns3/ipv6-routing-table-entry.h"
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("SimpleRoutingUdp6Example");
|
||||
NS_LOG_COMPONENT_DEFINE ("SimpleRoutingPing6Example");
|
||||
|
||||
int
|
||||
main (int argc, char** argv)
|
||||
class StackHelper
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* \brief Add an address to a IPv6 node.
|
||||
* \param n node
|
||||
* \param interface interface index
|
||||
* \param address IPv6 address to add
|
||||
*/
|
||||
inline void AddAddress (Ptr<Node>& n, uint32_t interface, Ipv6Address address)
|
||||
{
|
||||
Ptr<Ipv6> ipv6 = n->GetObject<Ipv6> ();
|
||||
ipv6->AddAddress (interface, address);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Print the routing table.
|
||||
* \param n the node
|
||||
*/
|
||||
inline void PrintRoutingTable (Ptr<Node>& n)
|
||||
{
|
||||
Ptr<Ipv6StaticRouting> routing = 0;
|
||||
Ipv6StaticRoutingHelper routingHelper;
|
||||
Ptr<Ipv6> ipv6 = n->GetObject<Ipv6> ();
|
||||
uint32_t nbRoutes = 0;
|
||||
Ipv6RoutingTableEntry route;
|
||||
|
||||
routing = routingHelper.GetStaticRouting (ipv6);
|
||||
|
||||
std::cout << "Routing table of " << n << " : " << std::endl;
|
||||
std::cout << "Destination\t\t\t\t" << "Gateway\t\t\t\t\t" << "Interface\t" << "Prefix to use" << std::endl;
|
||||
|
||||
nbRoutes = routing->GetNRoutes ();
|
||||
for (uint32_t i = 0 ; i < nbRoutes ; i++)
|
||||
{
|
||||
route = routing->GetRoute (i);
|
||||
std::cout << route.GetDest () << "\t"
|
||||
<< route.GetGateway () << "\t"
|
||||
<< route.GetInterface () << "\t"
|
||||
<< route.GetPrefixToUse () << "\t"
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
#if 0
|
||||
LogComponentEnable ("Ipv6L3Protocol", LOG_LEVEL_ALL);
|
||||
@@ -50,6 +97,8 @@ main (int argc, char** argv)
|
||||
|
||||
CommandLine cmd;
|
||||
cmd.Parse (argc, argv);
|
||||
|
||||
StackHelper stackHelper;
|
||||
|
||||
NS_LOG_INFO ("Create nodes.");
|
||||
Ptr<Node> n0 = CreateObject<Node> ();
|
||||
@@ -80,6 +129,8 @@ main (int argc, char** argv)
|
||||
Ipv6InterfaceContainer i2 = ipv6.Assign (d2);
|
||||
i2.SetRouter (0, true);
|
||||
|
||||
stackHelper.PrintRoutingTable(n0);
|
||||
|
||||
/* Create a Ping6 application to send ICMPv6 echo request from n0 to n1 via r */
|
||||
uint32_t packetSize = 1024;
|
||||
uint32_t maxPacketCount = 5;
|
||||
@@ -88,7 +139,6 @@ main (int argc, char** argv)
|
||||
|
||||
ping6.SetLocal (i1.GetAddress (0, 1));
|
||||
ping6.SetRemote (i2.GetAddress (1, 1));
|
||||
/* ping6.SetRemote (Ipv6Address::GetAllNodesMulticast ()); */
|
||||
|
||||
ping6.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount));
|
||||
ping6.SetAttribute ("Interval", TimeValue (interPacketInterval));
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
#
|
||||
# Copyright (c) 2008-2009 Strasbourg University
|
||||
#
|
||||
# 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: David Gross <david.gross@eturs.u-strasbg.fr>
|
||||
# Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
|
||||
#
|
||||
|
||||
#
|
||||
# Network topology:
|
||||
#
|
||||
# n0 r n1
|
||||
# | _ |
|
||||
# ====|_|====
|
||||
# router
|
||||
#
|
||||
|
||||
import ns3;
|
||||
|
||||
def main(argv):
|
||||
|
||||
cmd = ns3.CommandLine();
|
||||
|
||||
cmd.Parse(argv);
|
||||
|
||||
# Create nodes
|
||||
print "Create nodes"
|
||||
n0 = ns3.Node();
|
||||
r = ns3.Node();
|
||||
n1 = ns3.Node();
|
||||
|
||||
net1 = ns3.NodeContainer();
|
||||
net1.Add(n0);
|
||||
net1.Add(r);
|
||||
net2 = ns3.NodeContainer();
|
||||
net2.Add(r);
|
||||
net2.Add(n1);
|
||||
all = ns3.NodeContainer();
|
||||
all.Add(n0);
|
||||
all.Add(r);
|
||||
all.Add(n1);
|
||||
|
||||
# Create IPv6 Internet Stack
|
||||
internetv6 = ns3.InternetStackHelper();
|
||||
internetv6.Install(all);
|
||||
|
||||
# Create channels
|
||||
csma = ns3.CsmaHelper();
|
||||
csma.SetChannelAttribute("DataRate", ns3.DataRateValue(ns3.DataRate(5000000)));
|
||||
csma.SetChannelAttribute("Delay", ns3.TimeValue(ns3.MilliSeconds(2)));
|
||||
d1 = csma.Install(net1);
|
||||
d2 = csma.Install(net2);
|
||||
|
||||
# Create networks and assign IPv6 Addresses
|
||||
print "Addressing"
|
||||
ipv6 = ns3.Ipv6AddressHelper();
|
||||
ipv6.NewNetwork(ns3.Ipv6Address("2001:1::"), ns3.Ipv6Prefix(64));
|
||||
i1 = ipv6.Assign(d1);
|
||||
i1.SetRouter(1, True);
|
||||
ipv6.NewNetwork(ns3.Ipv6Address("2001:2::"), ns3.Ipv6Prefix(64));
|
||||
i2 = ipv6.Assign(d2);
|
||||
i2.SetRouter(0, True);
|
||||
|
||||
# Create a Ping6 application to send ICMPv6 echo request from n0 to n1 via r
|
||||
print "Application"
|
||||
packetSize = 1024;
|
||||
maxPacketCount = 5;
|
||||
interPacketInterval = ns3.Seconds(1.);
|
||||
ping6 = ns3.Ping6Helper();
|
||||
|
||||
ping6.SetLocal(i1.GetAddress(0, 1));
|
||||
ping6.SetRemote(i2.GetAddress(1, 1));
|
||||
|
||||
ping6.SetAttribute("MaxPackets", ns3.UintegerValue(maxPacketCount));
|
||||
ping6.SetAttribute("Interval", ns3.TimeValue(interPacketInterval));
|
||||
ping6.SetAttribute("PacketSize", ns3.UintegerValue(packetSize));
|
||||
|
||||
apps = ping6.Install(ns3.NodeContainer(net1.Get(0)));
|
||||
apps.Start(ns3.Seconds(2.0));
|
||||
apps.Stop(ns3.Seconds(20.0));
|
||||
|
||||
print "Tracing"
|
||||
ascii = ns3.ofstream("simple-routing-ping6.tr");
|
||||
ns3.CsmaHelper.EnableAsciiAll(ascii);
|
||||
ns3.CsmaHelper.EnablePcapAll("simple-routing-ping6", True);
|
||||
|
||||
# Run Simulation
|
||||
ns3.Simulator.Run();
|
||||
ns3.Simulator.Destroy();
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
main(sys.argv)
|
||||
|
||||
+21
-19
@@ -29,30 +29,30 @@ import ns3
|
||||
# std::cout << " TX to=" << address << " p: " << *p << std::endl;
|
||||
# }
|
||||
# void
|
||||
# DevRxTrace (std::string context, Ptr<const Packet> p, Mac48Address address)
|
||||
# DevRxTrace(std::string context, Ptr<const Packet> p, Mac48Address address)
|
||||
# {
|
||||
# std::cout << " RX from=" << address << " p: " << *p << std::endl;
|
||||
# }
|
||||
# void
|
||||
# PhyRxOkTrace (std::string context, Ptr<const Packet> packet, double snr, WifiMode mode, enum WifiPreamble preamble)
|
||||
# PhyRxOkTrace(std::string context, Ptr<const Packet> packet, double snr, WifiMode mode, enum WifiPreamble preamble)
|
||||
# {
|
||||
# std::cout << "PHYRXOK mode=" << mode << " snr=" << snr << " " << *packet << std::endl;
|
||||
# }
|
||||
# void
|
||||
# PhyRxErrorTrace (std::string context, Ptr<const Packet> packet, double snr)
|
||||
# PhyRxErrorTrace(std::string context, Ptr<const Packet> packet, double snr)
|
||||
# {
|
||||
# std::cout << "PHYRXERROR snr=" << snr << " " << *packet << std::endl;
|
||||
# }
|
||||
# void
|
||||
# PhyTxTrace (std::string context, Ptr<const Packet> packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower)
|
||||
# PhyTxTrace(std::string context, Ptr<const Packet> packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower)
|
||||
# {
|
||||
# std::cout << "PHYTX mode=" << mode << " " << *packet << std::endl;
|
||||
# }
|
||||
# void
|
||||
# PhyStateTrace (std::string context, Time start, Time duration, enum WifiPhy::State state)
|
||||
# PhyStateTrace(std::string context, Time start, Time duration, enum WifiPhy::State state)
|
||||
# {
|
||||
# std::cout << " state=";
|
||||
# switch (state) {
|
||||
# switch(state) {
|
||||
# case WifiPhy::TX:
|
||||
# std::cout << "tx ";
|
||||
# break;
|
||||
@@ -79,7 +79,7 @@ def GetPosition(node):
|
||||
return mobility.GetPosition()
|
||||
|
||||
def AdvancePosition(node):
|
||||
pos = GetPosition (node);
|
||||
pos = GetPosition(node);
|
||||
pos.x += 5.0
|
||||
if pos.x >= 210.0:
|
||||
return
|
||||
@@ -88,12 +88,12 @@ def AdvancePosition(node):
|
||||
|
||||
|
||||
def main(argv):
|
||||
ns3.Packet.EnablePrinting ();
|
||||
ns3.Packet.EnablePrinting();
|
||||
|
||||
# enable rts cts all the time.
|
||||
ns3.Config.SetDefault("ns3::WifiRemoteStationManager::RtsCtsThreshold", ns3.StringValue("0"))
|
||||
# disable fragmentation
|
||||
ns3.Config.SetDefault("ns3::WifiRemoteStationManager::FragmentationThreshold", ns3.StringValue ("2200"))
|
||||
ns3.Config.SetDefault("ns3::WifiRemoteStationManager::FragmentationThreshold", ns3.StringValue("2200"))
|
||||
|
||||
wifi = ns3.WifiHelper.Default()
|
||||
mobility = ns3.MobilityHelper()
|
||||
@@ -115,16 +115,18 @@ def main(argv):
|
||||
|
||||
ssid = ns3.Ssid("wifi-default")
|
||||
wifi.SetRemoteStationManager("ns3::ArfWifiManager")
|
||||
wifiMac = ns3.NqosWifiMacHelper.Default()
|
||||
|
||||
# setup stas.
|
||||
wifi.SetMac("ns3::NqstaWifiMac",
|
||||
wifiMac.SetType("ns3::NqstaWifiMac",
|
||||
"Ssid", ns3.SsidValue(ssid),
|
||||
"ActiveProbing", ns3.BooleanValue(False))
|
||||
staDevs = wifi.Install(wifiPhy, stas)
|
||||
staDevs = wifi.Install(wifiPhy, wifiMac, stas)
|
||||
# setup ap.
|
||||
wifi.SetMac("ns3::NqapWifiMac", "Ssid", ns3.SsidValue(ssid),
|
||||
wifiMac.SetType("ns3::NqapWifiMac", "Ssid", ns3.SsidValue(ssid),
|
||||
"BeaconGeneration", ns3.BooleanValue(True),
|
||||
"BeaconInterval", ns3.TimeValue(ns3.Seconds(2.5)))
|
||||
wifi.Install(wifiPhy, ap)
|
||||
wifi.Install(wifiPhy, wifiMac, ap)
|
||||
|
||||
# mobility.
|
||||
mobility.Install(stas)
|
||||
@@ -147,12 +149,12 @@ def main(argv):
|
||||
|
||||
ns3.Simulator.Stop(ns3.Seconds(44.0))
|
||||
|
||||
# Config::Connect ("/NodeList/*/DeviceList/*/Tx", MakeCallback (&DevTxTrace));
|
||||
# Config::Connect ("/NodeList/*/DeviceList/*/Rx", MakeCallback (&DevRxTrace));
|
||||
# Config::Connect ("/NodeList/*/DeviceList/*/Phy/RxOk", MakeCallback (&PhyRxOkTrace));
|
||||
# Config::Connect ("/NodeList/*/DeviceList/*/Phy/RxError", MakeCallback (&PhyRxErrorTrace));
|
||||
# Config::Connect ("/NodeList/*/DeviceList/*/Phy/Tx", MakeCallback (&PhyTxTrace));
|
||||
# Config::Connect ("/NodeList/*/DeviceList/*/Phy/State", MakeCallback (&PhyStateTrace));
|
||||
# Config::Connect("/NodeList/*/DeviceList/*/Tx", MakeCallback(&DevTxTrace));
|
||||
# Config::Connect("/NodeList/*/DeviceList/*/Rx", MakeCallback(&DevRxTrace));
|
||||
# Config::Connect("/NodeList/*/DeviceList/*/Phy/RxOk", MakeCallback(&PhyRxOkTrace));
|
||||
# Config::Connect("/NodeList/*/DeviceList/*/Phy/RxError", MakeCallback(&PhyRxErrorTrace));
|
||||
# Config::Connect("/NodeList/*/DeviceList/*/Phy/Tx", MakeCallback(&PhyTxTrace));
|
||||
# Config::Connect("/NodeList/*/DeviceList/*/Phy/State", MakeCallback(&PhyStateTrace));
|
||||
|
||||
ascii = ns3.ofstream("wifi-ap.tr")
|
||||
ns3.YansWifiPhyHelper.EnableAsciiAll(ascii)
|
||||
|
||||
@@ -36,6 +36,10 @@ def build(bld):
|
||||
['point-to-point', 'internet-stack', 'global-routing'])
|
||||
obj.source = 'global-routing-slash32.cc'
|
||||
|
||||
obj = bld.create_ns3_program('global-injection-slash32',
|
||||
['point-to-point', 'internet-stack', 'global-routing'])
|
||||
obj.source = 'global-injection-slash32.cc'
|
||||
|
||||
obj = bld.create_ns3_program('simple-global-routing',
|
||||
['point-to-point', 'internet-stack', 'global-routing'])
|
||||
obj.source = 'simple-global-routing.cc'
|
||||
|
||||
+23
-7
@@ -91,10 +91,32 @@ class regression_test_task(Task.TaskBase):
|
||||
self.env = env
|
||||
super(regression_test_task, self).__init__(generator=self, env=env)
|
||||
self.test_name = test_name
|
||||
|
||||
assert self.test_name.startswith('test-')
|
||||
short_name = self.test_name[len('test-'):]
|
||||
|
||||
self.test_scripts_dir = test_scripts_dir
|
||||
self.build_traces_dir = build_traces_dir
|
||||
self.reference_traces_dir = reference_traces
|
||||
|
||||
sys.path.insert(0, self.test_scripts_dir)
|
||||
try:
|
||||
mod = __import__(self.test_name, globals(), locals(), [])
|
||||
finally:
|
||||
sys.path.remove(self.test_scripts_dir)
|
||||
self.mod = mod
|
||||
if hasattr(mod, 'may_run'):
|
||||
reason_cannot_run = mod.may_run(self.env, Options.options)
|
||||
else:
|
||||
reason_cannot_run = None
|
||||
if not reason_cannot_run:
|
||||
pyscript = getattr(mod, "pyscript", None)
|
||||
if pyscript:
|
||||
Options.options.compile_targets += ',ns3module'
|
||||
else:
|
||||
program = getattr(mod, "program", short_name)
|
||||
Options.options.compile_targets += ',' + program
|
||||
|
||||
def __str__(self):
|
||||
return 'regression-test (%s)\n' % self.test_name
|
||||
|
||||
@@ -103,15 +125,9 @@ class regression_test_task(Task.TaskBase):
|
||||
|
||||
def run(self):
|
||||
"""Run a single test"""
|
||||
sys.path.insert(0, self.test_scripts_dir)
|
||||
try:
|
||||
mod = __import__(self.test_name, globals(), locals(), [])
|
||||
finally:
|
||||
sys.path.remove(self.test_scripts_dir)
|
||||
|
||||
assert self.test_name.startswith('test-')
|
||||
short_name = self.test_name[len('test-'):]
|
||||
|
||||
mod = self.mod
|
||||
trace_dir_name = getattr(mod, "trace_dir_name", None)
|
||||
if trace_dir_name is None:
|
||||
trace_dir_name = "%s.ref" % short_name
|
||||
|
||||
@@ -33,6 +33,12 @@ class Packet;
|
||||
class Socket;
|
||||
|
||||
/**
|
||||
* \ingroup applications
|
||||
* \defgroup ping6 Ping6
|
||||
*/
|
||||
|
||||
/**
|
||||
* \ingroup ping6
|
||||
* \class Ping6
|
||||
* \brief A ping6 application.
|
||||
*/
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace ns3
|
||||
{
|
||||
|
||||
/**
|
||||
* \ingroup radvd
|
||||
* \class RadvdInterface
|
||||
* \brief Radvd interface configuration.
|
||||
*/
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace ns3
|
||||
{
|
||||
|
||||
/**
|
||||
* \ingroup radvd
|
||||
* \class RadvdPrefix
|
||||
* \brief Router prefix for radvd application.
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,12 @@ namespace ns3
|
||||
{
|
||||
|
||||
/**
|
||||
* \ingroup applications
|
||||
* \defgroup radvd Radvd
|
||||
*/
|
||||
|
||||
/**
|
||||
* \ingroup radvd
|
||||
* \class Radvd
|
||||
* \brief Router advertisement daemon.
|
||||
*/
|
||||
|
||||
@@ -317,7 +317,7 @@ BridgeNetDevice::IsLinkUp (void) const
|
||||
|
||||
|
||||
void
|
||||
BridgeNetDevice::SetLinkChangeCallback (Callback<void> callback)
|
||||
BridgeNetDevice::AddLinkChangeCallback (Callback<void> callback)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
virtual bool SetMtu (const uint16_t mtu);
|
||||
virtual uint16_t GetMtu (void) const;
|
||||
virtual bool IsLinkUp (void) const;
|
||||
virtual void SetLinkChangeCallback (Callback<void> callback);
|
||||
virtual void AddLinkChangeCallback (Callback<void> callback);
|
||||
virtual bool IsBroadcast (void) const;
|
||||
virtual Address GetBroadcast (void) const;
|
||||
virtual bool IsMulticast (void) const;
|
||||
|
||||
@@ -839,12 +839,8 @@ CsmaNetDevice::GetQueue (void) const
|
||||
CsmaNetDevice::NotifyLinkUp (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
|
||||
m_linkUp = true;
|
||||
if (m_linkChangeCallback.IsNull () == false)
|
||||
{
|
||||
m_linkChangeCallback ();
|
||||
}
|
||||
m_linkChangeCallbacks ();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -890,10 +886,10 @@ CsmaNetDevice::IsLinkUp (void) const
|
||||
}
|
||||
|
||||
void
|
||||
CsmaNetDevice::SetLinkChangeCallback (Callback<void> callback)
|
||||
CsmaNetDevice::AddLinkChangeCallback (Callback<void> callback)
|
||||
{
|
||||
NS_LOG_FUNCTION (&callback);
|
||||
m_linkChangeCallback = callback;
|
||||
m_linkChangeCallbacks.ConnectWithoutContext (callback);
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -306,7 +306,7 @@ public:
|
||||
virtual void SetAddress (Address address);
|
||||
virtual Address GetAddress (void) const;
|
||||
virtual bool IsLinkUp (void) const;
|
||||
virtual void SetLinkChangeCallback (Callback<void> callback);
|
||||
virtual void AddLinkChangeCallback (Callback<void> callback);
|
||||
virtual bool IsBroadcast (void) const;
|
||||
virtual Address GetBroadcast (void) const;
|
||||
virtual bool IsMulticast (void) const;
|
||||
@@ -806,9 +806,9 @@ private:
|
||||
bool m_linkUp;
|
||||
|
||||
/**
|
||||
* Callback to fire if the link changes state (up or down).
|
||||
* List of callbacks to fire if the link changes state (up or down).
|
||||
*/
|
||||
Callback<void> m_linkChangeCallback;
|
||||
TracedCallback<> m_linkChangeCallbacks;
|
||||
|
||||
static const uint16_t DEFAULT_FRAME_SIZE = 1518;
|
||||
static const uint16_t ETHERNET_OVERHEAD = 18;
|
||||
|
||||
@@ -869,10 +869,7 @@ void
|
||||
EmuNetDevice::NotifyLinkUp (void)
|
||||
{
|
||||
m_linkUp = true;
|
||||
if (!m_linkChangeCallback.IsNull ())
|
||||
{
|
||||
m_linkChangeCallback ();
|
||||
}
|
||||
m_linkChangeCallbacks ();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -943,9 +940,9 @@ EmuNetDevice::IsLinkUp (void) const
|
||||
}
|
||||
|
||||
void
|
||||
EmuNetDevice::SetLinkChangeCallback (Callback<void> callback)
|
||||
EmuNetDevice::AddLinkChangeCallback (Callback<void> callback)
|
||||
{
|
||||
m_linkChangeCallback = callback;
|
||||
m_linkChangeCallbacks.ConnectWithoutContext (callback);
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
|
||||
virtual bool IsLinkUp (void) const;
|
||||
|
||||
virtual void SetLinkChangeCallback (Callback<void> callback);
|
||||
virtual void AddLinkChangeCallback (Callback<void> callback);
|
||||
|
||||
virtual bool IsBroadcast (void) const;
|
||||
virtual Address GetBroadcast (void) const;
|
||||
@@ -459,9 +459,9 @@ private:
|
||||
bool m_isMulticast;
|
||||
|
||||
/**
|
||||
* Callback to fire if the link changes state (up or down).
|
||||
* Callbacks to fire if the link changes state (up or down).
|
||||
*/
|
||||
Callback<void> m_linkChangeCallback;
|
||||
TracedCallback<> m_linkChangeCallbacks;
|
||||
|
||||
/**
|
||||
* The unix/linux name of the underlying device (e.g., eth0)
|
||||
|
||||
@@ -366,10 +366,7 @@ PointToPointNetDevice::GetQueue(void) const
|
||||
PointToPointNetDevice::NotifyLinkUp (void)
|
||||
{
|
||||
m_linkUp = true;
|
||||
if (!m_linkChangeCallback.IsNull ())
|
||||
{
|
||||
m_linkChangeCallback ();
|
||||
}
|
||||
m_linkChangeCallbacks ();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -415,9 +412,9 @@ PointToPointNetDevice::IsLinkUp (void) const
|
||||
}
|
||||
|
||||
void
|
||||
PointToPointNetDevice::SetLinkChangeCallback (Callback<void> callback)
|
||||
PointToPointNetDevice::AddLinkChangeCallback (Callback<void> callback)
|
||||
{
|
||||
m_linkChangeCallback = callback;
|
||||
m_linkChangeCallbacks.ConnectWithoutContext (callback);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -231,7 +231,7 @@ public:
|
||||
|
||||
virtual bool IsLinkUp (void) const;
|
||||
|
||||
virtual void SetLinkChangeCallback (Callback<void> callback);
|
||||
virtual void AddLinkChangeCallback (Callback<void> callback);
|
||||
|
||||
virtual bool IsBroadcast (void) const;
|
||||
virtual Address GetBroadcast (void) const;
|
||||
@@ -520,7 +520,7 @@ private:
|
||||
NetDevice::PromiscReceiveCallback m_promiscCallback;
|
||||
uint32_t m_ifIndex;
|
||||
bool m_linkUp;
|
||||
Callback<void> m_linkChangeCallback;
|
||||
TracedCallback<> m_linkChangeCallbacks;
|
||||
|
||||
static const uint16_t DEFAULT_MTU = 1500;
|
||||
static const uint16_t PPP_OVERHEAD = 2;
|
||||
|
||||
@@ -1026,7 +1026,7 @@ TapBridge::IsLinkUp (void) const
|
||||
}
|
||||
|
||||
void
|
||||
TapBridge::SetLinkChangeCallback (Callback<void> callback)
|
||||
TapBridge::AddLinkChangeCallback (Callback<void> callback)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ public:
|
||||
virtual bool SetMtu (const uint16_t mtu);
|
||||
virtual uint16_t GetMtu (void) const;
|
||||
virtual bool IsLinkUp (void) const;
|
||||
virtual void SetLinkChangeCallback (Callback<void> callback);
|
||||
virtual void AddLinkChangeCallback (Callback<void> callback);
|
||||
virtual bool IsBroadcast (void) const;
|
||||
virtual Address GetBroadcast (void) const;
|
||||
virtual bool IsMulticast (void) const;
|
||||
|
||||
@@ -194,7 +194,7 @@ VirtualNetDevice::IsLinkUp (void) const
|
||||
}
|
||||
|
||||
void
|
||||
VirtualNetDevice::SetLinkChangeCallback (Callback<void> callback)
|
||||
VirtualNetDevice::AddLinkChangeCallback (Callback<void> callback)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
virtual Address GetAddress (void) const;
|
||||
virtual uint16_t GetMtu (void) const;
|
||||
virtual bool IsLinkUp (void) const;
|
||||
virtual void SetLinkChangeCallback (Callback<void> callback);
|
||||
virtual void AddLinkChangeCallback (Callback<void> callback);
|
||||
virtual bool IsBroadcast (void) const;
|
||||
virtual Address GetBroadcast (void) const;
|
||||
virtual bool IsMulticast (void) const;
|
||||
|
||||
@@ -151,6 +151,7 @@ public:
|
||||
* associated WifiMode is used.
|
||||
* \param dataRate the rate (bits/second) at which the user data is transmitted
|
||||
* \param phyRate the rate (bits/second) at which the encoded user data is transmitted
|
||||
* \param standard the Wifi Phy standard to apply
|
||||
* The phyRate includes FEC so, is typically higher than the dataRate.
|
||||
*
|
||||
* Create a BPSK WifiMode.
|
||||
@@ -171,6 +172,7 @@ public:
|
||||
* \param phyRate the rate (bits/second) at which the encoded user data is transmitted
|
||||
* The phyRate includes FEC so, is typically higher than the dataRate.
|
||||
* \param constellationSize the number of elements included in the QAM constellation.
|
||||
* \param standard the Wifi Phy standard to apply
|
||||
*
|
||||
* Create a QAM WifiMode.
|
||||
*/
|
||||
@@ -190,6 +192,7 @@ public:
|
||||
* associated WifiMode is used.
|
||||
* \param dataRate the rate (bits/second) at which the user data is transmitted
|
||||
* \param phyRate the rate (bits/second) at which the encoded user data is transmitted
|
||||
* \param standard the Wifi Phy standard to apply
|
||||
* The phyRate includes FEC so, is typically higher than the dataRate.
|
||||
*
|
||||
* Create a DBPSK WifiMode.
|
||||
@@ -208,6 +211,7 @@ public:
|
||||
* associated WifiMode is used.
|
||||
* \param dataRate the rate (bits/second) at which the user data is transmitted
|
||||
* \param phyRate the rate (bits/second) at which the encoded user data is transmitted
|
||||
* \param standard the Wifi Phy standard to apply
|
||||
* The phyRate includes FEC so, is typically higher than the dataRate.
|
||||
*
|
||||
* Create a DQPSK WifiMode.
|
||||
|
||||
@@ -196,9 +196,9 @@ WifiNetDevice::IsLinkUp (void) const
|
||||
return m_phy != 0 && m_linkUp;
|
||||
}
|
||||
void
|
||||
WifiNetDevice::SetLinkChangeCallback (Callback<void> callback)
|
||||
WifiNetDevice::AddLinkChangeCallback (Callback<void> callback)
|
||||
{
|
||||
m_linkChange = callback;
|
||||
m_linkChanges.ConnectWithoutContext (callback);
|
||||
}
|
||||
bool
|
||||
WifiNetDevice::IsBroadcast (void) const
|
||||
@@ -312,19 +312,13 @@ void
|
||||
WifiNetDevice::LinkUp (void)
|
||||
{
|
||||
m_linkUp = true;
|
||||
if (!m_linkChange.IsNull ())
|
||||
{
|
||||
m_linkChange ();
|
||||
}
|
||||
m_linkChanges ();
|
||||
}
|
||||
void
|
||||
WifiNetDevice::LinkDown (void)
|
||||
{
|
||||
m_linkUp = false;
|
||||
if (!m_linkChange.IsNull ())
|
||||
{
|
||||
m_linkChange ();
|
||||
}
|
||||
m_linkChanges ();
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
virtual bool SetMtu (const uint16_t mtu);
|
||||
virtual uint16_t GetMtu (void) const;
|
||||
virtual bool IsLinkUp (void) const;
|
||||
virtual void SetLinkChangeCallback (Callback<void> callback);
|
||||
virtual void AddLinkChangeCallback (Callback<void> callback);
|
||||
virtual bool IsBroadcast (void) const;
|
||||
virtual Address GetBroadcast (void) const;
|
||||
virtual bool IsMulticast (void) const;
|
||||
@@ -123,7 +123,7 @@ private:
|
||||
|
||||
uint32_t m_ifIndex;
|
||||
bool m_linkUp;
|
||||
Callback<void> m_linkChange;
|
||||
TracedCallback<> m_linkChanges;
|
||||
mutable uint16_t m_mtu;
|
||||
bool m_configComplete;
|
||||
};
|
||||
|
||||
@@ -337,6 +337,7 @@ public:
|
||||
* transmitted. This is because it is possible to have the receiver
|
||||
* tuned on a given channel and still to be able to receive packets
|
||||
* on a nearby channel.
|
||||
* @param channelNumber the channel on which the packet is received
|
||||
* @param rate the PHY data rate in units of 500kbps (i.e., the same
|
||||
* units used both for the radiotap and for the prism header)
|
||||
* @param isShortPreamble true if short preamble is used, false otherwise
|
||||
@@ -351,14 +352,10 @@ public:
|
||||
* Public method used to fire a PromiscSniffer trace for a wifi packet being transmitted. Implemented for encapsulation
|
||||
* purposes.
|
||||
*
|
||||
* @param packet the packet being received
|
||||
* @param packet the packet being transmitted
|
||||
* @param channelFreqMhz the frequency in MHz at which the packet is
|
||||
* received. Note that in real devices this is normally the
|
||||
* frequency to which the receiver is tuned, and this can be
|
||||
* different than the frequency at which the packet was originally
|
||||
* transmitted. This is because it is possible to have the receiver
|
||||
* tuned on a given channel and still to be able to receive packets
|
||||
* on a nearby channel.
|
||||
* transmitted.
|
||||
* @param channelNumber the channel on which the packet is transmitted
|
||||
* @param rate the PHY data rate in units of 500kbps (i.e., the same
|
||||
* units used both for the radiotap and for the prism header)
|
||||
* @param isShortPreamble true if short preamble is used, false otherwise
|
||||
|
||||
@@ -278,17 +278,17 @@ AthstatsWifiTraceSink::WriteStats ()
|
||||
// I know C strings are ugly but that's the quickest way to use exactly the same format as in madwifi
|
||||
char str[200];
|
||||
snprintf (str, 200, "%8u %8u %7u %7u %7u %6u %6u %6u %7u %4u %3uM\n",
|
||||
m_txCount, // /proc/net/dev transmitted packets to which we should subract mgmt frames
|
||||
m_rxCount, // /proc/net/dev received packets but subracts mgmt frames from it
|
||||
0, // ast_tx_altrate,
|
||||
m_shortRetryCount, // ast_tx_shortretry,
|
||||
m_longRetryCount, // ast_tx_longretry,
|
||||
m_exceededRetryCount, // ast_tx_xretries,
|
||||
m_phyRxErrorCount, // ast_rx_crcerr,
|
||||
0, // ast_rx_badcrypt,
|
||||
0, // ast_rx_phyerr,
|
||||
0, // ast_rx_rssi,
|
||||
0 // rate
|
||||
(unsigned int) m_txCount, // /proc/net/dev transmitted packets to which we should subract mgmt frames
|
||||
(unsigned int) m_rxCount, // /proc/net/dev received packets but subracts mgmt frames from it
|
||||
(unsigned int) 0, // ast_tx_altrate,
|
||||
(unsigned int) m_shortRetryCount, // ast_tx_shortretry,
|
||||
(unsigned int) m_longRetryCount, // ast_tx_longretry,
|
||||
(unsigned int) m_exceededRetryCount, // ast_tx_xretries,
|
||||
(unsigned int) m_phyRxErrorCount, // ast_rx_crcerr,
|
||||
(unsigned int) 0, // ast_rx_badcrypt,
|
||||
(unsigned int) 0, // ast_rx_phyerr,
|
||||
(unsigned int) 0, // ast_rx_rssi,
|
||||
(unsigned int) 0 // rate
|
||||
);
|
||||
|
||||
if (m_writer)
|
||||
|
||||
@@ -116,7 +116,7 @@ ArpL3Protocol::CreateCache (Ptr<NetDevice> device, Ptr<Ipv4Interface> interface)
|
||||
Ptr<ArpCache> cache = CreateObject<ArpCache> ();
|
||||
cache->SetDevice (device, interface);
|
||||
NS_ASSERT (device->IsBroadcast ());
|
||||
device->SetLinkChangeCallback (MakeCallback (&ArpCache::Flush, cache));
|
||||
device->AddLinkChangeCallback (MakeCallback (&ArpCache::Flush, cache));
|
||||
cache->SetArpRequestCallback (MakeCallback (&ArpL3Protocol::SendArpRequest, this));
|
||||
m_cacheList.push_back (cache);
|
||||
return cache;
|
||||
|
||||
@@ -1076,16 +1076,26 @@ Ptr<NdiscCache> Icmpv6L4Protocol::CreateCache (Ptr<NetDevice> device, Ptr<Ipv6In
|
||||
{
|
||||
Ptr<Ipv6L3Protocol> ipv6 = m_node->GetObject<Ipv6L3Protocol> ();
|
||||
Ptr<NdiscCache> cache = CreateObject<NdiscCache> ();
|
||||
|
||||
cache->SetDevice (device, interface);
|
||||
|
||||
/* XXX : make a list of callback in net-device.cc
|
||||
* else we override IPv4 flushing ARP table...
|
||||
*/
|
||||
/* device->SetLinkChangeCallback (MakeCallback (&NdiscCache::Flush, cache)); */
|
||||
device->AddLinkChangeCallback (MakeCallback (&NdiscCache::Flush, cache));
|
||||
m_cacheList.push_back (cache);
|
||||
return cache;
|
||||
}
|
||||
|
||||
bool Icmpv6L4Protocol::Lookup (Ipv6Address dst, Ptr<NetDevice> device, Ptr<NdiscCache> cache, Address* hardwareDestination)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << dst << device << hardwareDestination);
|
||||
|
||||
if (!cache)
|
||||
{
|
||||
/* try to find the cache */
|
||||
cache = FindCache (device);
|
||||
}
|
||||
|
||||
return cache->Lookup (dst);
|
||||
}
|
||||
|
||||
bool Icmpv6L4Protocol::Lookup (Ptr<Packet> p, Ipv6Address dst, Ptr<NetDevice> device, Ptr<NdiscCache> cache, Address* hardwareDestination)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << p << dst << device << hardwareDestination);
|
||||
|
||||
@@ -226,7 +226,6 @@ class Icmpv6L4Protocol : public Ipv6L4Protocol
|
||||
* \param id id of the packet
|
||||
* \param seq sequence number
|
||||
* \param data auxiliary data
|
||||
* \todo Change data to be a char[], change it too in icmpv6-header.
|
||||
*/
|
||||
void SendEchoReply (Ipv6Address src, Ipv6Address dst, uint16_t id, uint16_t seq, Ptr<Packet> data);
|
||||
|
||||
@@ -349,8 +348,20 @@ class Icmpv6L4Protocol : public Ipv6L4Protocol
|
||||
*/
|
||||
static void FunctionDadTimeout (Ptr<Icmpv6L4Protocol> icmpv6, Ipv6Interface* interface, Ipv6Address addr);
|
||||
|
||||
/**
|
||||
* \brief Lookup in the ND cache for the IPv6 address
|
||||
* \param dst destination address
|
||||
* \param device device
|
||||
* \param cache the neighbor cache
|
||||
* \param hardwareDestination hardware address
|
||||
* \note Unlike other Lookup method, it does not send NS request!
|
||||
*/
|
||||
bool Lookup (Ipv6Address dst, Ptr<NetDevice> device, Ptr<NdiscCache> cache, Address* hardwareDestination);
|
||||
|
||||
/**
|
||||
* \brief Lookup in the ND cache for the IPv6 address (similar as ARP protocol).
|
||||
*
|
||||
* It also send NS request to target and store the waiting packet.
|
||||
* \param p the packet
|
||||
* \param dst destination address
|
||||
* \param device device
|
||||
|
||||
@@ -269,12 +269,6 @@ void Ipv6L3Protocol::AddAutoconfiguredAddress (uint32_t interface, Ipv6Address n
|
||||
(*it)->StopPreferredTimer ();
|
||||
(*it)->StopValidTimer ();
|
||||
(*it)->StartPreferredTimer ();
|
||||
|
||||
/* Suppose a link with two prefixes advertised,
|
||||
* when first prefix (which is the default route) expires,
|
||||
* the second ones router has to be default router
|
||||
*/
|
||||
GetRoutingProtocol ()->NotifyAddRoute (Ipv6Address::GetAny (), Ipv6Prefix ((uint8_t)0), defaultRouter, interface, network);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -284,10 +278,7 @@ void Ipv6L3Protocol::AddAutoconfiguredAddress (uint32_t interface, Ipv6Address n
|
||||
AddAddress (interface, address);
|
||||
|
||||
/* add default router
|
||||
* check to know if default route already exists is done
|
||||
* in Ipv6StaticRouting class
|
||||
*
|
||||
* If default route is already set, this function does nothing.
|
||||
* if a previous default route exists, the new ones is simply added
|
||||
*/
|
||||
GetRoutingProtocol ()->NotifyAddRoute (Ipv6Address::GetAny (), Ipv6Prefix ((uint8_t)0), defaultRouter, interface, network);
|
||||
|
||||
@@ -327,7 +318,7 @@ void Ipv6L3Protocol::RemoveAutoconfiguredAddress (uint32_t interface, Ipv6Addres
|
||||
}
|
||||
}
|
||||
|
||||
GetRoutingProtocol ()->NotifyRemoveRoute (Ipv6Address::GetAny (), Ipv6Prefix ((uint8_t)0), defaultRouter, interface);
|
||||
GetRoutingProtocol ()->NotifyRemoveRoute (Ipv6Address::GetAny (), Ipv6Prefix ((uint8_t)0), defaultRouter, interface, network);
|
||||
}
|
||||
|
||||
bool Ipv6L3Protocol::AddAddress (uint32_t i, Ipv6InterfaceAddress address)
|
||||
@@ -811,7 +802,7 @@ void Ipv6L3Protocol::IpForward (Ptr<Ipv6Route> rtentry, Ptr<const Packet> p, con
|
||||
|
||||
copy->AddHeader (header);
|
||||
|
||||
if (icmpv6->Lookup (copy, target, rtentry->GetOutputDevice (), 0, &hardwareTarget))
|
||||
if (icmpv6->Lookup (target, rtentry->GetOutputDevice (), 0, &hardwareTarget))
|
||||
{
|
||||
icmpv6->SendRedirection (copy, src, target, dst, hardwareTarget);
|
||||
}
|
||||
@@ -820,7 +811,7 @@ void Ipv6L3Protocol::IpForward (Ptr<Ipv6Route> rtentry, Ptr<const Packet> p, con
|
||||
icmpv6->SendRedirection (copy, src, target, dst, Address ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SendRealOut (rtentry, packet, ipHeader);
|
||||
}
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ LoopbackNetDevice::IsLinkUp (void) const
|
||||
}
|
||||
|
||||
void
|
||||
LoopbackNetDevice::SetLinkChangeCallback (Callback<void> callback)
|
||||
LoopbackNetDevice::AddLinkChangeCallback (Callback<void> callback)
|
||||
{}
|
||||
|
||||
bool
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
virtual bool SetMtu (const uint16_t mtu);
|
||||
virtual uint16_t GetMtu (void) const;
|
||||
virtual bool IsLinkUp (void) const;
|
||||
virtual void SetLinkChangeCallback (Callback<void> callback);
|
||||
virtual void AddLinkChangeCallback (Callback<void> callback);
|
||||
virtual bool IsBroadcast (void) const;
|
||||
virtual Address GetBroadcast (void) const;
|
||||
virtual bool IsMulticast (void) const;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* \ingroup address
|
||||
* \class Inet6SocketAddress
|
||||
* \brief An Inet6 address class.
|
||||
*/
|
||||
|
||||
@@ -483,6 +483,12 @@ Ipv6Address Ipv6Address::GetLoopback ()
|
||||
return loopback;
|
||||
}
|
||||
|
||||
Ipv6Address Ipv6Address::GetOnes ()
|
||||
{
|
||||
static Ipv6Address ones ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff");
|
||||
return ones;
|
||||
}
|
||||
|
||||
void Ipv6Address::GetBytes (uint8_t buf[16]) const
|
||||
{
|
||||
memcpy (buf, m_address, 16);
|
||||
@@ -491,7 +497,7 @@ void Ipv6Address::GetBytes (uint8_t buf[16]) const
|
||||
bool Ipv6Address::IsLinkLocal () const
|
||||
{
|
||||
Ipv6Address linkLocal ("fe80::0");
|
||||
if (!IsMulticast () && ((Ipv6Address*)this)->CombinePrefix (Ipv6Prefix (64))==linkLocal)
|
||||
if (!IsMulticast () && ((Ipv6Address*)this)->CombinePrefix (Ipv6Prefix (64)) == linkLocal)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -627,6 +633,12 @@ Ipv6Prefix Ipv6Prefix::GetLoopback ()
|
||||
return prefix;
|
||||
}
|
||||
|
||||
Ipv6Prefix Ipv6Prefix::GetOnes ()
|
||||
{
|
||||
static Ipv6Prefix ones ((uint8_t)128);
|
||||
return ones;
|
||||
}
|
||||
|
||||
Ipv6Prefix Ipv6Prefix::GetZero ()
|
||||
{
|
||||
Ipv6Prefix prefix ((uint8_t)0);
|
||||
@@ -638,6 +650,25 @@ void Ipv6Prefix::GetBytes (uint8_t buf[16]) const
|
||||
memcpy (buf, m_prefix, 16);
|
||||
}
|
||||
|
||||
uint8_t Ipv6Prefix::GetPrefixLength () const
|
||||
{
|
||||
uint8_t i = 0;
|
||||
uint8_t prefixLength = 0;
|
||||
|
||||
for(i = 0 ; i < 16 ; i++)
|
||||
{
|
||||
uint8_t mask = m_prefix[i];
|
||||
|
||||
while(mask != 0)
|
||||
{
|
||||
mask = mask << 1;
|
||||
prefixLength++;
|
||||
}
|
||||
}
|
||||
|
||||
return prefixLength;
|
||||
}
|
||||
|
||||
bool Ipv6Prefix::IsEqual (const Ipv6Prefix& other) const
|
||||
{
|
||||
if (!memcmp (m_prefix, other.m_prefix, 16))
|
||||
|
||||
@@ -35,6 +35,7 @@ class Ipv6Prefix;
|
||||
class Mac48Address;
|
||||
|
||||
/**
|
||||
* \ingroup address
|
||||
* \class Ipv6Address
|
||||
* \brief Describes an IPv6 address.
|
||||
* \see Ipv6Prefix
|
||||
@@ -253,6 +254,12 @@ class Ipv6Address
|
||||
*/
|
||||
static Ipv6Address GetLoopback ();
|
||||
|
||||
/**
|
||||
* \brief Get the "all-1" IPv6 address (ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff).
|
||||
* \return all-1 Ipv6Address representation
|
||||
*/
|
||||
static Ipv6Address GetOnes ();
|
||||
|
||||
/**
|
||||
* \brief Get the bytes corresponding to the address.
|
||||
* \param buf buffer to store the data
|
||||
@@ -284,6 +291,7 @@ class Ipv6Address
|
||||
};
|
||||
|
||||
/**
|
||||
* \ingroup address
|
||||
* \class Ipv6Prefix
|
||||
* \brief Describes an IPv6 prefix. It is just a bitmask like Ipv4Mask.
|
||||
* \see Ipv6Address
|
||||
@@ -346,6 +354,12 @@ class Ipv6Prefix
|
||||
*/
|
||||
void GetBytes (uint8_t buf[16]) const;
|
||||
|
||||
/**
|
||||
* \brief Get prefix length.
|
||||
* \return prefix length
|
||||
*/
|
||||
uint8_t GetPrefixLength () const;
|
||||
|
||||
/**
|
||||
* \brief Comparison operation between two Ipv6Prefix.
|
||||
* \param other the IPv6 prefix to which to compare this prefix
|
||||
@@ -367,6 +381,12 @@ class Ipv6Prefix
|
||||
*/
|
||||
static Ipv6Prefix GetLoopback ();
|
||||
|
||||
/**
|
||||
* \brief Get the "all-1" IPv6 mask (ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff).
|
||||
* \return /128 Ipv6Prefix representation
|
||||
*/
|
||||
static Ipv6Prefix GetOnes ();
|
||||
|
||||
/**
|
||||
* \brief Get the zero prefix ( /0).
|
||||
* \return an Ipv6Prefix
|
||||
|
||||
@@ -37,14 +37,16 @@ class NetDevice;
|
||||
|
||||
/**
|
||||
* \ingroup node
|
||||
* \defgroup ipv6Routing Ipv6 Routing
|
||||
*
|
||||
* Abstract base class for Ipv6 routing protocols. Defines two
|
||||
* virtual functions for packet routing and forwarding. The first,
|
||||
* \defgroup ipv6Routing Ipv6RoutingProtocol
|
||||
*/
|
||||
/**
|
||||
* \ingroup ipv6Routing
|
||||
* \brief Abstract base class for Ipv6 routing protocols.
|
||||
*
|
||||
* Defines two virtual functions for packet routing and forwarding. The first,
|
||||
* RouteOutput (), is used for locally originated packets, and the second,
|
||||
* RouteInput (), is used for forwarding and/or delivering received packets.
|
||||
* Also defines the signatures of four callbacks used in RouteInput ().
|
||||
*
|
||||
*/
|
||||
class Ipv6RoutingProtocol : public Object
|
||||
{
|
||||
@@ -153,8 +155,9 @@ public:
|
||||
* \param mask destination mask
|
||||
* \param nextHop nextHop for this destination
|
||||
* \param interface output interface
|
||||
* \param prefixToUse prefix to use as source with this route
|
||||
*/
|
||||
virtual void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface) = 0;
|
||||
virtual void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address::GetZero ()) = 0;
|
||||
|
||||
/**
|
||||
* \param ipv6 the ipv6 object this routing protocol is being associated with
|
||||
|
||||
@@ -128,12 +128,12 @@ public:
|
||||
/**
|
||||
* \param callback the callback to invoke
|
||||
*
|
||||
* Register a callback invoked whenever the link
|
||||
* Add a callback invoked whenever the link
|
||||
* status changes to UP. This callback is typically used
|
||||
* by the IP/ARP layer to flush the ARP cache
|
||||
* whenever the link goes up.
|
||||
* by the IP/ARP layer to flush the ARP cache and by IPv6 stack
|
||||
* to flush NDISC cache whenever the link goes up.
|
||||
*/
|
||||
virtual void SetLinkChangeCallback (Callback<void> callback) = 0;
|
||||
virtual void AddLinkChangeCallback (Callback<void> callback) = 0;
|
||||
/**
|
||||
* \return true if this interface supports a broadcast address,
|
||||
* false otherwise.
|
||||
|
||||
@@ -121,7 +121,7 @@ SimpleNetDevice::IsLinkUp (void) const
|
||||
return true;
|
||||
}
|
||||
void
|
||||
SimpleNetDevice::SetLinkChangeCallback (Callback<void> callback)
|
||||
SimpleNetDevice::AddLinkChangeCallback (Callback<void> callback)
|
||||
{}
|
||||
bool
|
||||
SimpleNetDevice::IsBroadcast (void) const
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
virtual bool SetMtu (const uint16_t mtu);
|
||||
virtual uint16_t GetMtu (void) const;
|
||||
virtual bool IsLinkUp (void) const;
|
||||
virtual void SetLinkChangeCallback (Callback<void> callback);
|
||||
virtual void AddLinkChangeCallback (Callback<void> callback);
|
||||
virtual bool IsBroadcast (void) const;
|
||||
virtual Address GetBroadcast (void) const;
|
||||
virtual bool IsMulticast (void) const;
|
||||
|
||||
@@ -243,6 +243,15 @@ SPFVertex::IsVertexProcessed (void) const
|
||||
return m_vertexProcessed;
|
||||
}
|
||||
|
||||
void
|
||||
SPFVertex::ClearVertexProcessed (void)
|
||||
{
|
||||
for (uint32_t i = 0; i < this->GetNChildren (); i++)
|
||||
{
|
||||
this->GetChild (i)->ClearVertexProcessed ();
|
||||
}
|
||||
this->SetVertexProcessed (false);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
@@ -252,7 +261,8 @@ SPFVertex::IsVertexProcessed (void) const
|
||||
|
||||
GlobalRouteManagerLSDB::GlobalRouteManagerLSDB ()
|
||||
:
|
||||
m_database ()
|
||||
m_database (),
|
||||
m_extdatabase ()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
}
|
||||
@@ -267,6 +277,12 @@ GlobalRouteManagerLSDB::~GlobalRouteManagerLSDB ()
|
||||
GlobalRoutingLSA* temp = i->second;
|
||||
delete temp;
|
||||
}
|
||||
for (uint32_t j = 0; j < m_extdatabase.size (); j++)
|
||||
{
|
||||
NS_LOG_LOGIC ("free ASexternalLSA");
|
||||
GlobalRoutingLSA* temp = m_extdatabase.at (j);
|
||||
delete temp;
|
||||
}
|
||||
NS_LOG_LOGIC ("clear map");
|
||||
m_database.clear ();
|
||||
}
|
||||
@@ -287,7 +303,26 @@ GlobalRouteManagerLSDB::Initialize ()
|
||||
GlobalRouteManagerLSDB::Insert (Ipv4Address addr, GlobalRoutingLSA* lsa)
|
||||
{
|
||||
NS_LOG_FUNCTION (addr << lsa);
|
||||
m_database.insert (LSDBPair_t (addr, lsa));
|
||||
if (lsa->GetLSType () == GlobalRoutingLSA::ASExternalLSAs)
|
||||
{
|
||||
m_extdatabase.push_back (lsa);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_database.insert (LSDBPair_t (addr, lsa));
|
||||
}
|
||||
}
|
||||
|
||||
GlobalRoutingLSA*
|
||||
GlobalRouteManagerLSDB::GetExtLSA (uint32_t index) const
|
||||
{
|
||||
return m_extdatabase.at (index);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
GlobalRouteManagerLSDB::GetNumExtLSAs () const
|
||||
{
|
||||
return m_extdatabase.size ();
|
||||
}
|
||||
|
||||
GlobalRoutingLSA*
|
||||
@@ -371,7 +406,8 @@ GlobalRouteManagerImpl::DebugUseLsdb (GlobalRouteManagerLSDB* lsdb)
|
||||
GlobalRouteManagerImpl::DeleteGlobalRoutes ()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); i++)
|
||||
NodeList::Iterator listEnd = NodeList::End ();
|
||||
for (NodeList::Iterator i = NodeList::Begin (); i != listEnd; i++)
|
||||
{
|
||||
Ptr<Node> node = *i;
|
||||
Ptr<GlobalRouter> router = node->GetObject<GlobalRouter> ();
|
||||
@@ -418,7 +454,8 @@ GlobalRouteManagerImpl::BuildGlobalRoutingDatabase ()
|
||||
// Walk the list of nodes looking for the GlobalRouter Interface. Nodes with
|
||||
// global router interfaces are, not too surprisingly, our routers.
|
||||
//
|
||||
for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); i++)
|
||||
NodeList::Iterator listEnd = NodeList::End ();
|
||||
for (NodeList::Iterator i = NodeList::Begin (); i != listEnd; i++)
|
||||
{
|
||||
Ptr<Node> node = *i;
|
||||
|
||||
@@ -438,6 +475,7 @@ GlobalRouteManagerImpl::BuildGlobalRoutingDatabase ()
|
||||
// DiscoverLSAs () will get zero as the number since no routes have been
|
||||
// found.
|
||||
//
|
||||
Ptr<Ipv4GlobalRouting> grouting = rtr->GetRoutingProtocol ();
|
||||
uint32_t numLSAs = rtr->DiscoverLSAs ();
|
||||
NS_LOG_LOGIC ("Found " << numLSAs << " LSAs");
|
||||
|
||||
@@ -498,7 +536,8 @@ GlobalRouteManagerImpl::InitializeRoutes ()
|
||||
//
|
||||
// Walk the list of nodes in the system.
|
||||
//
|
||||
for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); i++)
|
||||
NodeList::Iterator listEnd = NodeList::End ();
|
||||
for (NodeList::Iterator i = NodeList::Begin (); i != listEnd; i++)
|
||||
{
|
||||
Ptr<Node> node = *i;
|
||||
//
|
||||
@@ -1237,6 +1276,14 @@ GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root)
|
||||
|
||||
// Second stage of SPF calculation procedure
|
||||
SPFProcessStubs (m_spfroot);
|
||||
for (uint32_t i = 0; i < m_lsdb->GetNumExtLSAs (); i++)
|
||||
{
|
||||
m_spfroot->ClearVertexProcessed ();
|
||||
GlobalRoutingLSA *extlsa = m_lsdb->GetExtLSA (i);
|
||||
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
|
||||
@@ -1246,6 +1293,161 @@ GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root)
|
||||
m_spfroot = 0;
|
||||
}
|
||||
|
||||
void
|
||||
GlobalRouteManagerImpl::ProcessASExternals (SPFVertex* v, GlobalRoutingLSA* extlsa)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
NS_LOG_LOGIC ("Processing external for destination " <<
|
||||
extlsa->GetLinkStateId () <<
|
||||
", for router " << v->GetVertexId () <<
|
||||
", advertised by " << extlsa->GetAdvertisingRouter ());
|
||||
if (v->GetVertexType () == SPFVertex::VertexRouter)
|
||||
{
|
||||
GlobalRoutingLSA *rlsa = v->GetLSA ();
|
||||
NS_LOG_LOGIC ("Processing router LSA with id " << rlsa->GetLinkStateId ());
|
||||
if ((rlsa->GetLinkStateId ()) == (extlsa->GetAdvertisingRouter ()))
|
||||
{
|
||||
NS_LOG_LOGIC ("Found advertising router to destination");
|
||||
SPFAddASExternal(extlsa,v);
|
||||
}
|
||||
}
|
||||
for (uint32_t i = 0; i < v->GetNChildren (); i++)
|
||||
{
|
||||
if (!v->GetChild (i)->IsVertexProcessed ())
|
||||
{
|
||||
NS_LOG_LOGIC ("Vertex's child " << i << " not yet processed, processing...");
|
||||
ProcessASExternals (v->GetChild (i), extlsa);
|
||||
v->GetChild (i)->SetVertexProcessed (true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Adding external routes to routing table - modeled after
|
||||
// SPFAddIntraAddStub()
|
||||
//
|
||||
|
||||
void
|
||||
GlobalRouteManagerImpl::SPFAddASExternal (GlobalRoutingLSA *extlsa, SPFVertex *v)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
|
||||
NS_ASSERT_MSG (m_spfroot, "GlobalRouteManagerImpl::SPFAddASExternal (): Root pointer not set");
|
||||
// Two cases to consider: We are advertising the external ourselves
|
||||
// => No need to add anything
|
||||
// OR find best path to the advertising router
|
||||
if (v->GetVertexId () == m_spfroot->GetVertexId ())
|
||||
{
|
||||
NS_LOG_LOGIC ("External is on local host: "
|
||||
<< v->GetVertexId () << "; returning");
|
||||
return;
|
||||
}
|
||||
NS_LOG_LOGIC ("External is on remote host: "
|
||||
<< extlsa->GetAdvertisingRouter () << "; installing");
|
||||
|
||||
Ipv4Address routerId = m_spfroot->GetVertexId ();
|
||||
|
||||
NS_LOG_LOGIC ("Vertex ID = " << routerId);
|
||||
//
|
||||
// We need to walk the list of nodes looking for the one that has the router
|
||||
// ID corresponding to the root vertex. This is the one we're going to write
|
||||
// the routing information to.
|
||||
//
|
||||
NodeList::Iterator i = NodeList::Begin ();
|
||||
NodeList::Iterator listEnd = NodeList::End ();
|
||||
for (; i != listEnd; i++)
|
||||
{
|
||||
Ptr<Node> node = *i;
|
||||
//
|
||||
// The router ID is accessible through the GlobalRouter interface, so we need
|
||||
// to QI for that interface. If there's no GlobalRouter interface, the node
|
||||
// in question cannot be the router we want, so we continue.
|
||||
//
|
||||
Ptr<GlobalRouter> rtr = node->GetObject<GlobalRouter> ();
|
||||
|
||||
if (rtr == 0)
|
||||
{
|
||||
NS_LOG_LOGIC ("No GlobalRouter interface on node " << node->GetId ());
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// If the router ID of the current node is equal to the router ID of the
|
||||
// root of the SPF tree, then this node is the one for which we need to
|
||||
// write the routing tables.
|
||||
//
|
||||
NS_LOG_LOGIC ("Considering router " << rtr->GetRouterId ());
|
||||
|
||||
if (rtr->GetRouterId () == routerId)
|
||||
{
|
||||
NS_LOG_LOGIC ("Setting routes for node " << node->GetId ());
|
||||
//
|
||||
// Routing information is updated using the Ipv4 interface. We need to QI
|
||||
// for that interface. If the node is acting as an IP version 4 router, it
|
||||
// should absolutely have an Ipv4 interface.
|
||||
//
|
||||
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
|
||||
NS_ASSERT_MSG (ipv4,
|
||||
"GlobalRouteManagerImpl::SPFIntraAddRouter (): "
|
||||
"QI for <Ipv4> interface failed");
|
||||
//
|
||||
// Get the Global Router Link State Advertisement from the vertex we're
|
||||
// adding the routes to. The LSA will have a number of attached Global Router
|
||||
// Link Records corresponding to links off of that vertex / node. We're going
|
||||
// to be interested in the records corresponding to point-to-point links.
|
||||
//
|
||||
NS_ASSERT_MSG (v->GetLSA (),
|
||||
"GlobalRouteManagerImpl::SPFIntraAddRouter (): "
|
||||
"Expected valid LSA in SPFVertex* v");
|
||||
Ipv4Mask tempmask = extlsa->GetNetworkLSANetworkMask ();
|
||||
Ipv4Address tempip = extlsa->GetLinkStateId ();
|
||||
tempip = tempip.CombineMask (tempmask);
|
||||
|
||||
NS_LOG_LOGIC (" Node " << node->GetId () <<
|
||||
" add route to " << tempip <<
|
||||
" with mask " << tempmask <<
|
||||
" using next hop " << v->GetNextHop () <<
|
||||
" via interface " << v->GetOutgoingInterfaceId ());
|
||||
//
|
||||
// Here's why we did all of that work. We're going to add a host route to the
|
||||
// host address found in the m_linkData field of the point-to-point link
|
||||
// record. In the case of a point-to-point link, this is the local IP address
|
||||
// of the node connected to the link. Each of these point-to-point links
|
||||
// will correspond to a local interface that has an IP address to which
|
||||
// the node at the root of the SPF tree can send packets. The vertex <v>
|
||||
// (corresponding to the node that has these links and interfaces) has
|
||||
// an m_nextHop address precalculated for us that is the address to which the
|
||||
// root node should send packets to be forwarded to these IP addresses.
|
||||
// Similarly, the vertex <v> has an m_rootOif (outbound interface index) to
|
||||
// which the packets should be send for forwarding.
|
||||
//
|
||||
Ptr<GlobalRouter> router = node->GetObject<GlobalRouter> ();
|
||||
if (router == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Ptr<Ipv4GlobalRouting> gr = router->GetRoutingProtocol ();
|
||||
NS_ASSERT (gr);
|
||||
if (v->GetOutgoingInterfaceId () >= 0)
|
||||
{
|
||||
gr->AddASExternalRouteTo (tempip, tempmask, v->GetNextHop (), v->GetOutgoingInterfaceId ());
|
||||
NS_LOG_LOGIC ("Node " << node->GetId () <<
|
||||
" add network route to " << tempip <<
|
||||
" using next hop " << v->GetNextHop () <<
|
||||
" via interface " << v->GetOutgoingInterfaceId ());
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_LOGIC ("Node " << node->GetId () <<
|
||||
" NOT able to add network route to " << tempip <<
|
||||
" using next hop " << v->GetNextHop () <<
|
||||
" since outgoing interface id is negative");
|
||||
}
|
||||
return;
|
||||
} // if
|
||||
} // for
|
||||
}
|
||||
|
||||
|
||||
// Processing logic from RFC 2328, page 166 and quagga ospf_spf_process_stubs ()
|
||||
// stub link records will exist for point-to-point interfaces and for
|
||||
// broadcast interfaces for which no neighboring router can be found
|
||||
@@ -1318,7 +1520,8 @@ GlobalRouteManagerImpl::SPFIntraAddStub (GlobalRoutingLinkRecord *l, SPFVertex*
|
||||
// the routing information to.
|
||||
//
|
||||
NodeList::Iterator i = NodeList::Begin ();
|
||||
for (; i != NodeList::End (); i++)
|
||||
NodeList::Iterator listEnd = NodeList::End ();
|
||||
for (; i != listEnd; i++)
|
||||
{
|
||||
Ptr<Node> node = *i;
|
||||
//
|
||||
@@ -1439,7 +1642,8 @@ GlobalRouteManagerImpl::FindOutgoingInterfaceId (Ipv4Address a, Ipv4Mask amask)
|
||||
// building the routing table.
|
||||
//
|
||||
NodeList::Iterator i = NodeList::Begin ();
|
||||
for (; i != NodeList::End (); i++)
|
||||
NodeList::Iterator listEnd = NodeList::End ();
|
||||
for (; i != listEnd; i++)
|
||||
{
|
||||
Ptr<Node> node = *i;
|
||||
|
||||
@@ -1529,7 +1733,8 @@ GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v)
|
||||
// the routing information to.
|
||||
//
|
||||
NodeList::Iterator i = NodeList::Begin ();
|
||||
for (; i != NodeList::End (); i++)
|
||||
NodeList::Iterator listEnd = NodeList::End ();
|
||||
for (; i != listEnd; i++)
|
||||
{
|
||||
Ptr<Node> node = *i;
|
||||
//
|
||||
@@ -1669,7 +1874,8 @@ GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v)
|
||||
// the routing information to.
|
||||
//
|
||||
NodeList::Iterator i = NodeList::Begin ();
|
||||
for (; i != NodeList::End (); i++)
|
||||
NodeList::Iterator listEnd = NodeList::End ();
|
||||
for (; i != listEnd; i++)
|
||||
{
|
||||
Ptr<Node> node = *i;
|
||||
//
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <list>
|
||||
#include <queue>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include "ns3/object.h"
|
||||
#include "ns3/ptr.h"
|
||||
#include "ns3/ipv4-address.h"
|
||||
@@ -563,6 +564,9 @@ public:
|
||||
* @returns value of underlying flag
|
||||
*/
|
||||
bool IsVertexProcessed (void) const;
|
||||
|
||||
void ClearVertexProcessed (void);
|
||||
|
||||
private:
|
||||
VertexType m_vertexType;
|
||||
Ipv4Address m_vertexId;
|
||||
@@ -683,12 +687,18 @@ public:
|
||||
* @see SPFVertex
|
||||
*/
|
||||
void Initialize ();
|
||||
|
||||
GlobalRoutingLSA* GetExtLSA (uint32_t index) const;
|
||||
uint32_t GetNumExtLSAs () const;
|
||||
|
||||
|
||||
private:
|
||||
typedef std::map<Ipv4Address, GlobalRoutingLSA*> LSDBMap_t;
|
||||
typedef std::pair<Ipv4Address, GlobalRoutingLSA*> LSDBPair_t;
|
||||
|
||||
LSDBMap_t m_database;
|
||||
std::vector<GlobalRoutingLSA*> m_extdatabase;
|
||||
|
||||
/**
|
||||
* @brief GlobalRouteManagerLSDB copy construction is disallowed. There's no
|
||||
* need for it and a compiler provided shallow copy would be wrong.
|
||||
@@ -775,6 +785,7 @@ private:
|
||||
bool CheckForStubNode (Ipv4Address root);
|
||||
void SPFCalculate (Ipv4Address root);
|
||||
void SPFProcessStubs (SPFVertex* v);
|
||||
void ProcessASExternals (SPFVertex* v, GlobalRoutingLSA* extlsa);
|
||||
void SPFNext (SPFVertex*, CandidateQueue&);
|
||||
int SPFNexthopCalculation (SPFVertex* v, SPFVertex* w,
|
||||
GlobalRoutingLinkRecord* l, uint32_t distance);
|
||||
@@ -784,6 +795,7 @@ private:
|
||||
void SPFIntraAddRouter (SPFVertex* v);
|
||||
void SPFIntraAddTransit (SPFVertex* v);
|
||||
void SPFIntraAddStub (GlobalRoutingLinkRecord *l, SPFVertex* v);
|
||||
void SPFAddASExternal (GlobalRoutingLSA *extlsa, SPFVertex *v);
|
||||
int32_t FindOutgoingInterfaceId (Ipv4Address a,
|
||||
Ipv4Mask amask = Ipv4Mask("255.255.255.255"));
|
||||
};
|
||||
|
||||
@@ -413,6 +413,10 @@ GlobalRoutingLSA::Print (std::ostream &os) const
|
||||
{
|
||||
os << " (GlobalRoutingLSA::NetworkLSA)";
|
||||
}
|
||||
else if (m_lsType == GlobalRoutingLSA::ASExternalLSAs)
|
||||
{
|
||||
os << " (GlobalRoutingLSA::ASExternalLSA)";
|
||||
}
|
||||
else
|
||||
{
|
||||
os << "(Unknown LSType)";
|
||||
@@ -474,6 +478,12 @@ GlobalRoutingLSA::Print (std::ostream &os) const
|
||||
}
|
||||
os << "---------- End NetworkLSA Link Record ----------" << std::endl;
|
||||
}
|
||||
else if (m_lsType == GlobalRoutingLSA::ASExternalLSAs)
|
||||
{
|
||||
os << "---------- ASExternalLSA Link Record --------" << std::endl;
|
||||
os << "m_linkStateId = " << m_linkStateId << std::endl;
|
||||
os << "m_networkLSANetworkMask = " << m_networkLSANetworkMask << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_ASSERT_MSG(0, "Illegal LSA LSType: " << m_lsType);
|
||||
@@ -532,6 +542,12 @@ 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);
|
||||
}
|
||||
Object::DoDispose ();
|
||||
}
|
||||
|
||||
@@ -568,8 +584,8 @@ GlobalRouter::GetRouterId (void) const
|
||||
// and build the Link State Advertisements that reflect them and their associated
|
||||
// networks.
|
||||
//
|
||||
uint32_t
|
||||
GlobalRouter::DiscoverLSAs (void)
|
||||
uint32_t
|
||||
GlobalRouter::DiscoverLSAs ()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
Ptr<Node> node = GetObject<Node> ();
|
||||
@@ -696,6 +712,22 @@ GlobalRouter::DiscoverLSAs (void)
|
||||
BuildNetworkLSAs (c);
|
||||
}
|
||||
|
||||
//
|
||||
// Build injected route LSAs as external routes
|
||||
// RFC 2328, section 12.4.4
|
||||
//
|
||||
for (InjectedRoutesCI i = m_injectedRoutes.begin();
|
||||
i != m_injectedRoutes.end();
|
||||
i++)
|
||||
{
|
||||
GlobalRoutingLSA *pLSA = new GlobalRoutingLSA;
|
||||
pLSA->SetLSType (GlobalRoutingLSA::ASExternalLSAs);
|
||||
pLSA->SetLinkStateId ((*i)->GetDestNetwork ());
|
||||
pLSA->SetAdvertisingRouter (m_routerId);
|
||||
pLSA->SetNetworkLSANetworkMask ((*i)->GetDestNetworkMask ());
|
||||
pLSA->SetStatus (GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED);
|
||||
m_LSAs.push_back (pLSA);
|
||||
}
|
||||
return m_LSAs.size ();
|
||||
}
|
||||
|
||||
@@ -1467,6 +1499,86 @@ GlobalRouter::GetLSA (uint32_t n, GlobalRoutingLSA &lsa) const
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
GlobalRouter::InjectRoute (Ipv4Address network, Ipv4Mask networkMask)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
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 ();
|
||||
}
|
||||
|
||||
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++)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Link through the given channel and find the net device that's on the
|
||||
// other end. This only makes sense with a point-to-point channel.
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "ns3/net-device-container.h"
|
||||
#include "ns3/bridge-net-device.h"
|
||||
#include "ns3/global-route-manager.h"
|
||||
#include "ns3/ipv4-routing-table-entry.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -657,6 +658,54 @@ public:
|
||||
*/
|
||||
bool GetLSA (uint32_t n, GlobalRoutingLSA &lsa) const;
|
||||
|
||||
/**
|
||||
* @brief Inject a route to be circulated to other routers as an external
|
||||
* route
|
||||
*
|
||||
* @param network The Network to inject
|
||||
* @param networkMask The Network Mask to inject
|
||||
*/
|
||||
void InjectRoute (Ipv4Address network, Ipv4Mask networkMask);
|
||||
|
||||
/**
|
||||
* @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 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 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.
|
||||
*
|
||||
* @param network The Network to withdraw
|
||||
* @param networkMask The Network Mask to withdraw
|
||||
* @return whether the operation succeeded (will return false if no such route)
|
||||
*
|
||||
* @see GlobalRouter::RemoveInjectedRoute ()
|
||||
*/
|
||||
bool WithdrawRoute (Ipv4Address network, Ipv4Mask networkMask);
|
||||
|
||||
private:
|
||||
virtual ~GlobalRouter ();
|
||||
void ClearLSAs (void);
|
||||
@@ -680,6 +729,11 @@ private:
|
||||
Ipv4Address m_routerId;
|
||||
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
|
||||
|
||||
// inherited from Object
|
||||
virtual void DoDispose (void);
|
||||
|
||||
|
||||
@@ -98,10 +98,27 @@ Ipv4GlobalRouting::AddNetworkRouteTo (Ipv4Address network,
|
||||
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)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
NS_LOG_LOGIC ("Looking for route for destination " << dest);
|
||||
Ptr<Ipv4Route> rtentry = 0;
|
||||
bool found = false;
|
||||
Ipv4RoutingTableEntry* route = 0;
|
||||
@@ -137,6 +154,23 @@ Ipv4GlobalRouting::LookupGlobal (Ipv4Address dest)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found == false)
|
||||
{
|
||||
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);
|
||||
route = (*k);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found == true)
|
||||
{
|
||||
rtentry = Create<Ipv4Route> ();
|
||||
@@ -161,6 +195,7 @@ Ipv4GlobalRouting::GetNRoutes (void)
|
||||
uint32_t n = 0;
|
||||
n += m_hostRoutes.size ();
|
||||
n += m_networkRoutes.size ();
|
||||
n += m_ASexternalRoutes.size ();
|
||||
return n;
|
||||
}
|
||||
|
||||
@@ -184,16 +219,31 @@ Ipv4GlobalRouting::GetRoute (uint32_t index)
|
||||
}
|
||||
index -= m_hostRoutes.size ();
|
||||
uint32_t tmp = 0;
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j++)
|
||||
if (index < m_networkRoutes.size())
|
||||
{
|
||||
if (tmp == index)
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j++)
|
||||
{
|
||||
return *j;
|
||||
if (tmp == index)
|
||||
{
|
||||
return *j;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
index -= m_networkRoutes.size();
|
||||
tmp = 0;
|
||||
for (ASExternalRoutesI k = m_ASexternalRoutes.begin ();
|
||||
k != m_ASexternalRoutes.end ();
|
||||
k++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
return *k;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
NS_ASSERT (false);
|
||||
// quiet compiler.
|
||||
return 0;
|
||||
@@ -236,6 +286,22 @@ Ipv4GlobalRouting::RemoveRoute (uint32_t index)
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -255,6 +321,13 @@ Ipv4GlobalRouting::DoDispose (void)
|
||||
{
|
||||
delete (*j);
|
||||
}
|
||||
for (ASExternalRoutesI l = m_ASexternalRoutes.begin ();
|
||||
l != m_ASexternalRoutes.end ();
|
||||
l = m_ASexternalRoutes.erase (l))
|
||||
{
|
||||
delete (*l);
|
||||
}
|
||||
|
||||
Ipv4RoutingProtocol::DoDispose ();
|
||||
}
|
||||
|
||||
|
||||
@@ -146,6 +146,20 @@ public:
|
||||
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.
|
||||
@@ -204,12 +218,16 @@ private:
|
||||
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);
|
||||
|
||||
HostRoutes m_hostRoutes;
|
||||
NetworkRoutes m_networkRoutes;
|
||||
|
||||
ASExternalRoutes m_ASexternalRoutes; // External routes imported
|
||||
|
||||
Ptr<Ipv4> m_ipv4;
|
||||
};
|
||||
|
||||
|
||||
@@ -257,7 +257,7 @@ void Ipv6ListRouting::NotifyAddRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Addr
|
||||
}
|
||||
}
|
||||
|
||||
void Ipv6ListRouting::NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface)
|
||||
void Ipv6ListRouting::NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << dst << mask << nextHop << interface);
|
||||
for (Ipv6RoutingProtocolList::const_iterator rprotoIter =
|
||||
@@ -265,7 +265,7 @@ void Ipv6ListRouting::NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6A
|
||||
rprotoIter != m_routingProtocols.end ();
|
||||
rprotoIter++)
|
||||
{
|
||||
(*rprotoIter).second->NotifyRemoveRoute (dst, mask, nextHop, interface);
|
||||
(*rprotoIter).second->NotifyRemoveRoute (dst, mask, nextHop, interface, prefixToUse);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ public:
|
||||
void NotifyAddAddress (uint32_t interface, Ipv6InterfaceAddress address) {}
|
||||
void NotifyRemoveAddress (uint32_t interface, Ipv6InterfaceAddress address) {}
|
||||
void NotifyAddRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address::GetZero ()) {}
|
||||
void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface) {}
|
||||
void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse) {}
|
||||
void SetIpv6 (Ptr<Ipv6> ipv6) {}
|
||||
};
|
||||
|
||||
@@ -367,7 +367,7 @@ public:
|
||||
void NotifyAddAddress (uint32_t interface, Ipv6InterfaceAddress address) {}
|
||||
void NotifyRemoveAddress (uint32_t interface, Ipv6InterfaceAddress address) {}
|
||||
void NotifyAddRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address::GetZero ()) {}
|
||||
void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface) {}
|
||||
void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse) {}
|
||||
void SetIpv6 (Ptr<Ipv6> ipv6) {}
|
||||
};
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
virtual void NotifyAddAddress (uint32_t interface, Ipv6InterfaceAddress address);
|
||||
virtual void NotifyRemoveAddress (uint32_t interface, Ipv6InterfaceAddress address);
|
||||
virtual void NotifyAddRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address::GetZero ());
|
||||
virtual void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface);
|
||||
virtual void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address::GetZero ());
|
||||
virtual void SetIpv6 (Ptr<Ipv6> ipv6);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -48,14 +48,14 @@ Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address dest,
|
||||
Ipv4Address gateway,
|
||||
uint32_t interface)
|
||||
: m_dest (dest),
|
||||
m_destNetworkMask (Ipv4Mask::GetZero ()),
|
||||
m_destNetworkMask (Ipv4Mask::GetOnes ()),
|
||||
m_gateway (gateway),
|
||||
m_interface (interface)
|
||||
{}
|
||||
Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address dest,
|
||||
uint32_t interface)
|
||||
: m_dest (dest),
|
||||
m_destNetworkMask (Ipv4Mask::GetZero ()),
|
||||
m_destNetworkMask (Ipv4Mask::GetOnes ()),
|
||||
m_gateway (Ipv4Address::GetZero ()),
|
||||
m_interface (interface)
|
||||
{}
|
||||
@@ -80,7 +80,7 @@ Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address network,
|
||||
bool
|
||||
Ipv4RoutingTableEntry::IsHost (void) const
|
||||
{
|
||||
if (m_destNetworkMask.IsEqual (Ipv4Mask::GetZero ()))
|
||||
if (m_destNetworkMask.IsEqual (Ipv4Mask::GetOnes ()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("Ipv4StaticRouting");
|
||||
|
||||
using std::make_pair;
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (Ipv4StaticRouting);
|
||||
@@ -42,37 +44,17 @@ Ipv4StaticRouting::GetTypeId (void)
|
||||
}
|
||||
|
||||
Ipv4StaticRouting::Ipv4StaticRouting ()
|
||||
: m_defaultRoute (0), m_ipv4 (0)
|
||||
: m_ipv4 (0)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4StaticRouting::AddHostRouteTo (Ipv4Address dest,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
|
||||
*route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, nextHop, interface);
|
||||
m_hostRoutes.push_back (route);
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4StaticRouting::AddHostRouteTo (Ipv4Address dest,
|
||||
uint32_t interface)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
|
||||
*route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, interface);
|
||||
m_hostRoutes.push_back (route);
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface)
|
||||
uint32_t interface,
|
||||
uint32_t metric)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
|
||||
@@ -80,31 +62,49 @@ Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network,
|
||||
networkMask,
|
||||
nextHop,
|
||||
interface);
|
||||
m_networkRoutes.push_back (route);
|
||||
m_networkRoutes.push_back (make_pair(route,metric));
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
uint32_t interface)
|
||||
uint32_t interface,
|
||||
uint32_t metric)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
|
||||
*route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
|
||||
networkMask,
|
||||
interface);
|
||||
m_networkRoutes.push_back (route);
|
||||
m_networkRoutes.push_back (make_pair (route,metric));
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4StaticRouting::AddHostRouteTo (Ipv4Address dest,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface,
|
||||
uint32_t metric)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
AddNetworkRouteTo (dest, Ipv4Mask::GetOnes (), nextHop, interface, metric);
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4StaticRouting::AddHostRouteTo (Ipv4Address dest,
|
||||
uint32_t interface,
|
||||
uint32_t metric)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
AddNetworkRouteTo (dest, Ipv4Mask::GetOnes (), interface, metric);
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4StaticRouting::SetDefaultRoute (Ipv4Address nextHop,
|
||||
uint32_t interface)
|
||||
uint32_t interface,
|
||||
uint32_t metric)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
|
||||
*route = Ipv4RoutingTableEntry::CreateDefaultRoute (nextHop, interface);
|
||||
delete m_defaultRoute;
|
||||
m_defaultRoute = route;
|
||||
AddNetworkRouteTo (Ipv4Address ("0.0.0.0"), Ipv4Mask::GetZero (), nextHop, interface, metric);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -133,7 +133,7 @@ Ipv4StaticRouting::SetDefaultMulticastRoute(uint32_t outputInterface)
|
||||
*route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
|
||||
networkMask,
|
||||
outputInterface);
|
||||
m_networkRoutes.push_back (route);
|
||||
m_networkRoutes.push_back (make_pair(route,0));
|
||||
}
|
||||
|
||||
uint32_t
|
||||
@@ -214,58 +214,48 @@ Ipv4StaticRouting::LookupStatic (Ipv4Address dest)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
Ptr<Ipv4Route> rtentry = 0;
|
||||
for (HostRoutesCI i = m_hostRoutes.begin ();
|
||||
i != m_hostRoutes.end ();
|
||||
uint16_t longest_mask = 0;
|
||||
uint32_t shortest_metric = 0xffffffff;
|
||||
for (NetworkRoutesI i = m_networkRoutes.begin ();
|
||||
i != m_networkRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
NS_ASSERT ((*i)->IsHost ());
|
||||
if ((*i)->GetDest ().IsEqual (dest))
|
||||
{
|
||||
NS_LOG_LOGIC ("Found global host route" << *i);
|
||||
Ipv4RoutingTableEntry* route = (*i);
|
||||
rtentry = Create<Ipv4Route> ();
|
||||
uint32_t interfaceIdx = route->GetInterface ();
|
||||
rtentry->SetDestination (route->GetDest ());
|
||||
rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetDest ()));
|
||||
rtentry->SetGateway (route->GetGateway ());
|
||||
rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx));
|
||||
return rtentry;
|
||||
}
|
||||
}
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j++)
|
||||
{
|
||||
NS_ASSERT ((*j)->IsNetwork ());
|
||||
Ipv4Mask mask = (*j)->GetDestNetworkMask ();
|
||||
Ipv4Address entry = (*j)->GetDestNetwork ();
|
||||
Ipv4RoutingTableEntry *j=i->first;
|
||||
uint32_t metric =i->second;
|
||||
Ipv4Mask mask = (j)->GetDestNetworkMask ();
|
||||
uint16_t masklen = mask.GetPrefixLength ();
|
||||
Ipv4Address entry = (j)->GetDestNetwork ();
|
||||
NS_LOG_LOGIC ("Searching for route to " << dest << ", checking against route to " << entry << "/" << masklen);
|
||||
if (mask.IsMatch (dest, entry))
|
||||
{
|
||||
NS_LOG_LOGIC ("Found global network route" << *j);
|
||||
Ipv4RoutingTableEntry* route = (*j);
|
||||
rtentry = Create<Ipv4Route> ();
|
||||
NS_LOG_LOGIC ("Found global network route " << j << ", mask length " << masklen << ", metric " << metric);
|
||||
if (masklen < longest_mask) // Not interested if got shorter mask
|
||||
{
|
||||
NS_LOG_LOGIC ("Previous match longer, skipping");
|
||||
continue;
|
||||
}
|
||||
if (masklen > longest_mask) // Reset metric if longer masklen
|
||||
{
|
||||
shortest_metric = 0xffffffff;
|
||||
}
|
||||
longest_mask = masklen;
|
||||
if (metric > shortest_metric)
|
||||
{
|
||||
NS_LOG_LOGIC ("Equal mask length, but previous metric shorter, skipping");
|
||||
continue;
|
||||
}
|
||||
shortest_metric = metric;
|
||||
Ipv4RoutingTableEntry* route = (j);
|
||||
uint32_t interfaceIdx = route->GetInterface ();
|
||||
rtentry = Create<Ipv4Route> ();
|
||||
rtentry->SetDestination (route->GetDest ());
|
||||
rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetDest ()));
|
||||
rtentry->SetGateway (route->GetGateway ());
|
||||
rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx));
|
||||
return rtentry;
|
||||
}
|
||||
}
|
||||
if (m_defaultRoute != 0)
|
||||
{
|
||||
NS_ASSERT (m_defaultRoute->IsDefault ());
|
||||
NS_LOG_LOGIC ("Found global network route" << m_defaultRoute);
|
||||
Ipv4RoutingTableEntry* route = m_defaultRoute;
|
||||
rtentry = Create<Ipv4Route> ();
|
||||
uint32_t interfaceIdx = route->GetInterface ();
|
||||
rtentry->SetDestination (route->GetDest ());
|
||||
rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetDest ()));
|
||||
rtentry->SetGateway (route->GetGateway ());
|
||||
rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx));
|
||||
return rtentry;
|
||||
}
|
||||
return 0;
|
||||
NS_LOG_LOGIC ("Matching route via " << rtentry << " at the end");
|
||||
return rtentry;
|
||||
}
|
||||
|
||||
Ptr<Ipv4MulticastRoute>
|
||||
@@ -324,23 +314,40 @@ uint32_t
|
||||
Ipv4StaticRouting::GetNRoutes (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
uint32_t n = 0;
|
||||
if (m_defaultRoute != 0)
|
||||
{
|
||||
n++;
|
||||
}
|
||||
n += m_hostRoutes.size ();
|
||||
n += m_networkRoutes.size ();
|
||||
return n;
|
||||
return m_networkRoutes.size ();;
|
||||
}
|
||||
|
||||
Ipv4RoutingTableEntry
|
||||
Ipv4StaticRouting::GetDefaultRoute ()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
if (m_defaultRoute != 0)
|
||||
// Basically a repeat of LookupStatic, retained for backward compatibility
|
||||
Ipv4Address dest ("0.0.0.0");
|
||||
uint32_t shortest_metric = 0xffffffff;
|
||||
Ipv4RoutingTableEntry *result = 0;
|
||||
for (NetworkRoutesI i = m_networkRoutes.begin ();
|
||||
i != m_networkRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
return *m_defaultRoute;
|
||||
Ipv4RoutingTableEntry *j = i->first;
|
||||
uint32_t metric = i->second;
|
||||
Ipv4Mask mask = (j)->GetDestNetworkMask ();
|
||||
uint16_t masklen = mask.GetPrefixLength ();
|
||||
Ipv4Address entry = (j)->GetDestNetwork ();
|
||||
if (masklen != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (metric > shortest_metric)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
shortest_metric = metric;
|
||||
result = j;
|
||||
}
|
||||
if (result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -352,29 +359,26 @@ Ipv4RoutingTableEntry
|
||||
Ipv4StaticRouting::GetRoute (uint32_t index)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
if (index == 0 && m_defaultRoute != 0)
|
||||
{
|
||||
return *m_defaultRoute;
|
||||
}
|
||||
if (index > 0 && m_defaultRoute != 0)
|
||||
{
|
||||
index--;
|
||||
}
|
||||
if (index < m_hostRoutes.size ())
|
||||
{
|
||||
uint32_t tmp = 0;
|
||||
for (HostRoutesCI i = m_hostRoutes.begin ();
|
||||
i != m_hostRoutes.end ();
|
||||
i++)
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
return *i;
|
||||
return j->first;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
}
|
||||
index -= m_hostRoutes.size ();
|
||||
NS_ASSERT (false);
|
||||
// quiet compiler.
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Ipv4StaticRouting::GetMetric (uint32_t index)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
uint32_t tmp = 0;
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
@@ -382,7 +386,7 @@ Ipv4StaticRouting::GetRoute (uint32_t index)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
return *j;
|
||||
return j->second;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
@@ -394,32 +398,6 @@ void
|
||||
Ipv4StaticRouting::RemoveRoute (uint32_t index)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
if (index == 0 && m_defaultRoute != 0)
|
||||
{
|
||||
delete m_defaultRoute;
|
||||
m_defaultRoute = 0;
|
||||
}
|
||||
if (index > 0 && m_defaultRoute != 0)
|
||||
{
|
||||
index--;
|
||||
}
|
||||
if (index < m_hostRoutes.size ())
|
||||
{
|
||||
uint32_t tmp = 0;
|
||||
for (HostRoutesI i = m_hostRoutes.begin ();
|
||||
i != m_hostRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
delete *i;
|
||||
m_hostRoutes.erase (i);
|
||||
return;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
}
|
||||
index -= m_hostRoutes.size ();
|
||||
uint32_t tmp = 0;
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
@@ -427,7 +405,7 @@ Ipv4StaticRouting::RemoveRoute (uint32_t index)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
delete *j;
|
||||
delete j->first;
|
||||
m_networkRoutes.erase (j);
|
||||
return;
|
||||
}
|
||||
@@ -520,22 +498,11 @@ void
|
||||
Ipv4StaticRouting::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);
|
||||
}
|
||||
if (m_defaultRoute != 0)
|
||||
{
|
||||
delete m_defaultRoute;
|
||||
m_defaultRoute = 0;
|
||||
delete (j->first);
|
||||
}
|
||||
for (MulticastRoutesI i = m_multicastRoutes.begin ();
|
||||
i != m_multicastRoutes.end ();
|
||||
@@ -568,13 +535,18 @@ void
|
||||
Ipv4StaticRouting::NotifyInterfaceDown (uint32_t i)
|
||||
{
|
||||
// Remove all static routes that are going through this interface
|
||||
for (uint32_t j = 0; j < GetNRoutes (); j++)
|
||||
uint32_t j = 0;
|
||||
while (j < GetNRoutes())
|
||||
{
|
||||
Ipv4RoutingTableEntry route = GetRoute (j);
|
||||
if (route.GetInterface () == i)
|
||||
{
|
||||
RemoveRoute (j);
|
||||
}
|
||||
else
|
||||
{
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#define IPV4_STATIC_ROUTING_H
|
||||
|
||||
#include <list>
|
||||
#include <utility>
|
||||
#include <stdint.h>
|
||||
#include "ns3/ipv4-address.h"
|
||||
#include "ns3/ipv4-header.h"
|
||||
@@ -86,31 +87,6 @@ public:
|
||||
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
|
||||
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
|
||||
|
||||
/**
|
||||
* \brief Add a host route to the static routing table.
|
||||
*
|
||||
* \param dest The Ipv4Address destination for this route.
|
||||
* \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 static 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);
|
||||
|
||||
/**
|
||||
* \brief Add a network route to the static routing table.
|
||||
*
|
||||
@@ -119,13 +95,15 @@ public:
|
||||
* \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.
|
||||
* \param metric Metric of route in case of multiple routes to same destination
|
||||
*
|
||||
* \see Ipv4Address
|
||||
*/
|
||||
void AddNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface);
|
||||
uint32_t interface,
|
||||
uint32_t metric = 0);
|
||||
|
||||
/**
|
||||
* \brief Add a network route to the static routing table.
|
||||
@@ -134,13 +112,43 @@ public:
|
||||
* \param networkMask The Ipv4Mask to extract the network.
|
||||
* \param interface The network interface index used to send packets to the
|
||||
* destination.
|
||||
* \param metric Metric of route in case of multiple routes to same destination
|
||||
*
|
||||
* \see Ipv4Address
|
||||
*/
|
||||
void AddNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
uint32_t interface);
|
||||
uint32_t interface,
|
||||
uint32_t metric = 0);
|
||||
|
||||
/**
|
||||
* \brief Add a host route to the static routing table.
|
||||
*
|
||||
* \param dest The Ipv4Address destination for this route.
|
||||
* \param nextHop The Ipv4Address of the next hop in the route.
|
||||
* \param interface The network interface index used to send packets to the
|
||||
* destination.
|
||||
* \param metric Metric of route in case of multiple routes to same destination
|
||||
*
|
||||
* \see Ipv4Address
|
||||
*/
|
||||
void AddHostRouteTo (Ipv4Address dest,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface,
|
||||
uint32_t metric = 0);
|
||||
/**
|
||||
* \brief Add a host route to the static routing table.
|
||||
*
|
||||
* \param dest The Ipv4Address destination for this route.
|
||||
* \param interface The network interface index used to send packets to the
|
||||
* destination.
|
||||
* \param metric Metric of route in case of multiple routes to same destination
|
||||
*
|
||||
* \see Ipv4Address
|
||||
*/
|
||||
void AddHostRouteTo (Ipv4Address dest,
|
||||
uint32_t interface,
|
||||
uint32_t metric = 0);
|
||||
/**
|
||||
* \brief Add a default route to the static routing table.
|
||||
*
|
||||
@@ -155,12 +163,14 @@ public:
|
||||
* \param nextHop The Ipv4Address to send packets to in the hope that they
|
||||
* will be forwarded correctly.
|
||||
* \param interface The network interface index used to send packets.
|
||||
* \param metric Metric of route in case of multiple routes to same destination
|
||||
*
|
||||
* \see Ipv4Address
|
||||
* \see Ipv4StaticRouting::Lookup
|
||||
*/
|
||||
void SetDefaultRoute (Ipv4Address nextHop,
|
||||
uint32_t interface);
|
||||
uint32_t interface,
|
||||
uint32_t metric = 0);
|
||||
|
||||
/**
|
||||
* \brief Get the number of individual unicast routes that have been added
|
||||
@@ -171,10 +181,11 @@ public:
|
||||
uint32_t GetNRoutes (void);
|
||||
|
||||
/**
|
||||
* \brief Get the default route from the static routing table.
|
||||
* \brief Get the default route with lowest metric from the static routing table.
|
||||
*
|
||||
* \return If the default route is set, a pointer to that Ipv4RoutingTableEntry is
|
||||
* returned, otherwise a zero pointer is returned.
|
||||
* returned, otherwise an empty routing table entry is returned.
|
||||
* If multiple default routes exist, the one with lowest metric is returned.
|
||||
*
|
||||
* \see Ipv4RoutingTableEntry
|
||||
*/
|
||||
@@ -184,16 +195,9 @@ public:
|
||||
* \brief Get a route from the static unicast routing table.
|
||||
*
|
||||
* Externally, the unicast static routing table appears simply as a table with
|
||||
* n entries. The one sublety 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 explicity calling GetDefaultRoute () or by calling GetRoute (0).
|
||||
*
|
||||
* Similarly, if the default route has been set, calling RemoveRoute (0) will
|
||||
* remove the default route.
|
||||
* n entries.
|
||||
*
|
||||
* \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.
|
||||
* \param i The index (into the routing table) of the route to retrieve.
|
||||
* \return If route is set, a pointer to that Ipv4RoutingTableEntry is returned, otherwise
|
||||
* a zero pointer is returned.
|
||||
*
|
||||
@@ -202,17 +206,22 @@ public:
|
||||
*/
|
||||
Ipv4RoutingTableEntry GetRoute (uint32_t i);
|
||||
|
||||
/**
|
||||
* \brief Get a metric for route from the static unicast routing table.
|
||||
*
|
||||
* \param index The index (into the routing table) of the route to retrieve.
|
||||
* \return If route is set, the metric is returned. If not, an infinity metric (0xffffffff) is returned
|
||||
*
|
||||
*/
|
||||
uint32_t GetMetric (uint32_t index);
|
||||
|
||||
/**
|
||||
* \brief Remove a route from the static unicast routing table.
|
||||
*
|
||||
* Externally, the unicast static routing table appears simply as a table with
|
||||
* n entries. The one sublety 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.
|
||||
* n entries.
|
||||
*
|
||||
* \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.
|
||||
* \param i The index (into the routing table) of the route to remove.
|
||||
*
|
||||
* \see Ipv4RoutingTableEntry
|
||||
* \see Ipv4StaticRouting::GetRoute
|
||||
@@ -366,12 +375,9 @@ protected:
|
||||
virtual void DoDispose (void);
|
||||
|
||||
private:
|
||||
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<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<Ipv4MulticastRoutingTableEntry *> MulticastRoutes;
|
||||
typedef std::list<Ipv4MulticastRoutingTableEntry *>::const_iterator MulticastRoutesCI;
|
||||
@@ -383,9 +389,7 @@ private:
|
||||
|
||||
Ipv4Address SourceAddressSelection (uint32_t interface, Ipv4Address dest);
|
||||
|
||||
HostRoutes m_hostRoutes;
|
||||
NetworkRoutes m_networkRoutes;
|
||||
Ipv4RoutingTableEntry *m_defaultRoute;
|
||||
MulticastRoutes m_multicastRoutes;
|
||||
|
||||
Ptr<Ipv4> m_ipv4;
|
||||
|
||||
@@ -57,7 +57,7 @@ Ipv6RoutingTableEntry::Ipv6RoutingTableEntry (Ipv6Address dest, Ipv6Address gate
|
||||
|
||||
Ipv6RoutingTableEntry::Ipv6RoutingTableEntry (Ipv6Address dest, uint32_t interface)
|
||||
: m_dest (dest),
|
||||
m_destNetworkPrefix (Ipv6Prefix (128)),
|
||||
m_destNetworkPrefix (Ipv6Prefix::GetOnes ()),
|
||||
m_gateway (Ipv6Address::GetZero ()),
|
||||
m_interface (interface),
|
||||
m_prefixToUse (Ipv6Address ("::"))
|
||||
@@ -107,8 +107,7 @@ Ipv6RoutingTableEntry::~Ipv6RoutingTableEntry ()
|
||||
|
||||
bool Ipv6RoutingTableEntry::IsHost () const
|
||||
{
|
||||
static Ipv6Prefix prefix (128);
|
||||
if (m_destNetworkPrefix.IsEqual (prefix))
|
||||
if (m_destNetworkPrefix.IsEqual (Ipv6Prefix::GetOnes ()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -170,7 +169,7 @@ Ipv6Address Ipv6RoutingTableEntry::GetGateway () const
|
||||
|
||||
Ipv6RoutingTableEntry Ipv6RoutingTableEntry::CreateHostRouteTo (Ipv6Address dest, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse)
|
||||
{
|
||||
return Ipv6RoutingTableEntry (dest, Ipv6Prefix (128), nextHop, interface, prefixToUse);
|
||||
return Ipv6RoutingTableEntry (dest, Ipv6Prefix::GetOnes (), nextHop, interface, prefixToUse);
|
||||
}
|
||||
|
||||
Ipv6RoutingTableEntry Ipv6RoutingTableEntry::CreateHostRouteTo (Ipv6Address dest, uint32_t interface)
|
||||
|
||||
@@ -40,9 +40,8 @@ TypeId Ipv6StaticRouting::GetTypeId ()
|
||||
return tid;
|
||||
}
|
||||
|
||||
Ipv6StaticRouting::Ipv6StaticRouting ()
|
||||
: m_defaultRoute (0),
|
||||
m_ipv6 (0)
|
||||
Ipv6StaticRouting::Ipv6StaticRouting ()
|
||||
: m_ipv6 (0)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
}
|
||||
@@ -58,7 +57,7 @@ void Ipv6StaticRouting::SetIpv6 (Ptr<Ipv6> ipv6)
|
||||
NS_ASSERT (m_ipv6 == 0 && ipv6 != 0);
|
||||
uint32_t i = 0;
|
||||
m_ipv6 = ipv6;
|
||||
|
||||
|
||||
for (i = 0 ; i < m_ipv6->GetNInterfaces () ; i++)
|
||||
{
|
||||
if (m_ipv6->IsUp (i))
|
||||
@@ -72,65 +71,47 @@ void Ipv6StaticRouting::SetIpv6 (Ptr<Ipv6> ipv6)
|
||||
}
|
||||
}
|
||||
|
||||
void Ipv6StaticRouting::AddHostRouteTo (Ipv6Address dst, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse)
|
||||
void Ipv6StaticRouting::AddHostRouteTo (Ipv6Address dst, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse, uint32_t metric)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << dst << nextHop << interface << prefixToUse);
|
||||
Ipv6RoutingTableEntry* route = new Ipv6RoutingTableEntry ();
|
||||
*route = Ipv6RoutingTableEntry::CreateHostRouteTo (dst, nextHop, interface, prefixToUse);
|
||||
m_hostRoutes.push_back (route);
|
||||
NS_LOG_FUNCTION (this << dst << nextHop << interface << prefixToUse << metric);
|
||||
AddNetworkRouteTo (dst, Ipv6Prefix::GetOnes (), nextHop, interface, prefixToUse, metric);
|
||||
}
|
||||
|
||||
void Ipv6StaticRouting::AddHostRouteTo (Ipv6Address dst, uint32_t interface)
|
||||
void Ipv6StaticRouting::AddHostRouteTo (Ipv6Address dst, uint32_t interface, uint32_t metric)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << dst << interface);
|
||||
Ipv6RoutingTableEntry* route = new Ipv6RoutingTableEntry ();
|
||||
*route = Ipv6RoutingTableEntry::CreateHostRouteTo (dst, interface);
|
||||
m_hostRoutes.push_back (route);
|
||||
NS_LOG_FUNCTION (this << dst << interface << metric);
|
||||
AddNetworkRouteTo (dst, Ipv6Prefix::GetOnes (), interface, metric);
|
||||
}
|
||||
|
||||
void Ipv6StaticRouting::AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface)
|
||||
void Ipv6StaticRouting::AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface, uint32_t metric)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << network << networkPrefix << nextHop << interface);
|
||||
NS_LOG_FUNCTION (this << network << networkPrefix << nextHop << interface << metric);
|
||||
Ipv6RoutingTableEntry* route = new Ipv6RoutingTableEntry ();
|
||||
*route = Ipv6RoutingTableEntry::CreateNetworkRouteTo (network, networkPrefix, nextHop, interface);
|
||||
m_networkRoutes.push_back (route);
|
||||
m_networkRoutes.push_back (std::make_pair (route, metric));
|
||||
}
|
||||
|
||||
void Ipv6StaticRouting::AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse)
|
||||
void Ipv6StaticRouting::AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse, uint32_t metric)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << network << networkPrefix << nextHop << interface << prefixToUse);
|
||||
NS_LOG_FUNCTION (this << network << networkPrefix << nextHop << interface << prefixToUse << metric);
|
||||
Ipv6RoutingTableEntry* route = new Ipv6RoutingTableEntry ();
|
||||
*route = Ipv6RoutingTableEntry::CreateNetworkRouteTo (network, networkPrefix, nextHop, interface, prefixToUse);
|
||||
m_networkRoutes.push_back (route);
|
||||
m_networkRoutes.push_back (std::make_pair (route, metric));
|
||||
}
|
||||
|
||||
|
||||
void Ipv6StaticRouting::AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, uint32_t interface)
|
||||
void Ipv6StaticRouting::AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, uint32_t interface, uint32_t metric)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << network << networkPrefix << interface);
|
||||
Ipv6RoutingTableEntry* route = new Ipv6RoutingTableEntry ();
|
||||
*route = Ipv6RoutingTableEntry::CreateNetworkRouteTo (network, networkPrefix, interface);
|
||||
m_networkRoutes.push_back (route);
|
||||
m_networkRoutes.push_back (std::make_pair (route, metric));
|
||||
}
|
||||
|
||||
void Ipv6StaticRouting::SetDefaultRoute (Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse)
|
||||
void Ipv6StaticRouting::SetDefaultRoute (Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse, uint32_t metric)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << nextHop << interface << prefixToUse);
|
||||
Ipv6RoutingTableEntry* route = new Ipv6RoutingTableEntry ();
|
||||
*route = Ipv6RoutingTableEntry::CreateDefaultRoute (nextHop, interface);
|
||||
route->SetPrefixToUse (prefixToUse);
|
||||
delete m_defaultRoute;
|
||||
m_defaultRoute = route;
|
||||
}
|
||||
|
||||
void Ipv6StaticRouting::RemoveDefaultRoute ()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
if (m_defaultRoute)
|
||||
{
|
||||
delete m_defaultRoute;
|
||||
m_defaultRoute = 0;
|
||||
}
|
||||
AddNetworkRouteTo (Ipv6Address ("::"), Ipv6Prefix::GetZero (), nextHop, interface, prefixToUse, metric);
|
||||
}
|
||||
|
||||
void Ipv6StaticRouting::AddMulticastRoute (Ipv6Address origin, Ipv6Address group, uint32_t inputInterface, std::vector<uint32_t> outputInterfaces)
|
||||
@@ -148,7 +129,7 @@ void Ipv6StaticRouting::SetDefaultMulticastRoute (uint32_t outputInterface)
|
||||
Ipv6Address network = Ipv6Address ("ff00::"); /* RFC 3513 */
|
||||
Ipv6Prefix networkMask = Ipv6Prefix (8);
|
||||
*route = Ipv6RoutingTableEntry::CreateNetworkRouteTo (network, networkMask, outputInterface);
|
||||
m_networkRoutes.push_back (route);
|
||||
m_networkRoutes.push_back (std::make_pair (route, 0));
|
||||
}
|
||||
|
||||
uint32_t Ipv6StaticRouting::GetNMulticastRoutes () const
|
||||
@@ -199,7 +180,7 @@ void Ipv6StaticRouting::RemoveMulticastRoute (uint32_t index)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << index);
|
||||
uint32_t tmp = 0;
|
||||
|
||||
|
||||
for (MulticastRoutesI i = m_multicastRoutes.begin () ; i != m_multicastRoutes.end () ; i++)
|
||||
{
|
||||
if (tmp == index)
|
||||
@@ -219,11 +200,11 @@ bool Ipv6StaticRouting::HasNetworkDest (Ipv6Address network, uint32_t interfaceI
|
||||
/* in the network table */
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin () ; j != m_networkRoutes.end () ; j++)
|
||||
{
|
||||
NS_ASSERT ((*j)->IsNetwork ());
|
||||
Ipv6Prefix prefix = (*j)->GetDestNetworkPrefix ();
|
||||
Ipv6Address entry = (*j)->GetDestNetwork ();
|
||||
Ipv6RoutingTableEntry* rtentry = j->first;
|
||||
Ipv6Prefix prefix = rtentry->GetDestNetworkPrefix ();
|
||||
Ipv6Address entry = rtentry->GetDestNetwork ();
|
||||
|
||||
if (prefix.IsMatch (network, entry) && (*j)->GetInterface () == interfaceIndex)
|
||||
if (prefix.IsMatch (network, entry) && rtentry->GetInterface () == interfaceIndex)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -237,10 +218,12 @@ Ptr<Ipv6Route> Ipv6StaticRouting::LookupStatic (Ipv6Address dst, uint32_t interf
|
||||
{
|
||||
NS_LOG_FUNCTION (this << dst << interface);
|
||||
Ptr<Ipv6Route> rtentry = 0;
|
||||
uint16_t longestMask = 0;
|
||||
uint32_t shortestMetric = 0xffffffff;
|
||||
|
||||
/* when sending on link-local multicast, there have to be interface specified */
|
||||
if (dst == Ipv6Address::GetAllNodesMulticast () || dst.IsSolicitedMulticast () ||
|
||||
dst == Ipv6Address::GetAllRoutersMulticast () || dst == Ipv6Address::GetAllHostsMulticast ())
|
||||
dst == Ipv6Address::GetAllRoutersMulticast () || dst == Ipv6Address::GetAllHostsMulticast ())
|
||||
{
|
||||
NS_ASSERT_MSG (interface > 0, "Try to send on link-local multicast address, and no interface index is given!");
|
||||
rtentry = Create<Ipv6Route> ();
|
||||
@@ -251,110 +234,83 @@ Ptr<Ipv6Route> Ipv6StaticRouting::LookupStatic (Ipv6Address dst, uint32_t interf
|
||||
return rtentry;
|
||||
}
|
||||
|
||||
/* is the destination in hosts table */
|
||||
for (HostRoutesCI i = m_hostRoutes.begin () ; i != m_hostRoutes.end () ; i++)
|
||||
for (NetworkRoutesI it = m_networkRoutes.begin () ; it != m_networkRoutes.end () ; it++)
|
||||
{
|
||||
NS_ASSERT ((*i)->IsHost ());
|
||||
if ((*i)->GetDest ().IsEqual (dst))
|
||||
Ipv6RoutingTableEntry* j = it->first;
|
||||
uint32_t metric = it->second;
|
||||
Ipv6Prefix mask = j->GetDestNetworkPrefix ();
|
||||
uint16_t maskLen = mask.GetPrefixLength ();
|
||||
Ipv6Address entry = j->GetDestNetwork ();
|
||||
|
||||
NS_LOG_LOGIC ("Searching for route to " << dst << ", mask length " << maskLen << ", metric " << metric);
|
||||
|
||||
if (mask.IsMatch (dst, entry))
|
||||
{
|
||||
if (!interface || interface == (*i)->GetInterface ())
|
||||
{
|
||||
NS_LOG_LOGIC ("Found global host route " << *i);
|
||||
Ipv6RoutingTableEntry* route = (*i);
|
||||
rtentry = Create<Ipv6Route> ();
|
||||
uint32_t interfaceIdx = route->GetInterface ();
|
||||
rtentry->SetDestination (route->GetDest ());
|
||||
NS_LOG_LOGIC ("Found global network route " << j << ", mask length " << maskLen << ", metric " << metric);
|
||||
|
||||
if (route->GetGateway ().IsAny ())
|
||||
{
|
||||
rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetDest ()));
|
||||
}
|
||||
else
|
||||
{
|
||||
rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetGateway ()));
|
||||
}
|
||||
|
||||
rtentry->SetGateway (route->GetGateway ());
|
||||
rtentry->SetOutputDevice (m_ipv6->GetNetDevice (interfaceIdx));
|
||||
return rtentry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* or in the network table */
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin () ; j != m_networkRoutes.end () ; j++)
|
||||
{
|
||||
NS_ASSERT ((*j)->IsNetwork ());
|
||||
Ipv6Prefix prefix = (*j)->GetDestNetworkPrefix ();
|
||||
Ipv6Address entry = (*j)->GetDestNetwork ();
|
||||
|
||||
if (prefix.IsMatch (dst, entry))
|
||||
{
|
||||
/* if interface is given, check the route will output on this interface */
|
||||
if (!interface || interface == (*j)->GetInterface ())
|
||||
if (!interface || interface == j->GetInterface ())
|
||||
{
|
||||
NS_LOG_LOGIC ("Found global network route " << *j);
|
||||
Ipv6RoutingTableEntry* route = (*j);
|
||||
rtentry = Create<Ipv6Route>();
|
||||
if (maskLen < longestMask)
|
||||
{
|
||||
NS_LOG_LOGIC ("Previous match longer, skipping");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (maskLen > longestMask)
|
||||
{
|
||||
shortestMetric = 0xffffffff;
|
||||
}
|
||||
|
||||
longestMask = maskLen;
|
||||
if (metric > shortestMetric)
|
||||
{
|
||||
NS_LOG_LOGIC ("Equal mask length, but previous metric shorter, skipping");
|
||||
continue;
|
||||
}
|
||||
|
||||
shortestMetric = metric;
|
||||
Ipv6RoutingTableEntry* route = j;
|
||||
uint32_t interfaceIdx = route->GetInterface ();
|
||||
rtentry->SetDestination (route->GetDest ());
|
||||
|
||||
rtentry = Create<Ipv6Route> ();
|
||||
|
||||
if (route->GetGateway ().IsAny ())
|
||||
{
|
||||
rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetDest ()));
|
||||
}
|
||||
else if (route->GetDest ().IsAny ()) /* default route */
|
||||
{
|
||||
rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetPrefixToUse ().IsAny () ? route->GetGateway () : route->GetPrefixToUse ()));
|
||||
}
|
||||
else
|
||||
{
|
||||
rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetGateway ()));
|
||||
}
|
||||
|
||||
rtentry->SetDestination (route->GetDest ());
|
||||
rtentry->SetGateway (route->GetGateway ());
|
||||
rtentry->SetOutputDevice (m_ipv6->GetNetDevice (interfaceIdx));
|
||||
return rtentry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* not found, return the default route if any */
|
||||
if (m_defaultRoute != 0)
|
||||
if(rtentry)
|
||||
{
|
||||
NS_ASSERT (m_defaultRoute->IsDefault ());
|
||||
NS_LOG_LOGIC ("Found global network route via default route " << m_defaultRoute);
|
||||
Ipv6RoutingTableEntry* route = m_defaultRoute;
|
||||
rtentry = Create<Ipv6Route>();
|
||||
uint32_t interfaceIdx = route->GetInterface ();
|
||||
rtentry->SetDestination (route->GetDest ());
|
||||
rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetPrefixToUse ().IsAny () ? route->GetGateway () : route->GetPrefixToUse ()));
|
||||
rtentry->SetGateway (route->GetGateway ());
|
||||
rtentry->SetOutputDevice (m_ipv6->GetNetDevice (interfaceIdx));
|
||||
return rtentry;
|
||||
}
|
||||
|
||||
/* beuh!!! not route at all */
|
||||
return 0;
|
||||
NS_LOG_LOGIC ("Matching route via " << rtentry->GetDestination () << " (throught " << rtentry->GetGateway () << ") at the end");
|
||||
}
|
||||
return rtentry;
|
||||
}
|
||||
|
||||
void Ipv6StaticRouting::DoDispose ()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
for (HostRoutesI i = m_hostRoutes.begin () ; i != m_hostRoutes.end () ; i = m_hostRoutes.erase (i))
|
||||
{
|
||||
delete (*i);
|
||||
}
|
||||
m_hostRoutes.clear ();
|
||||
|
||||
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin () ; j != m_networkRoutes.end () ; j = m_networkRoutes.erase (j))
|
||||
{
|
||||
delete (*j);
|
||||
delete j->first;
|
||||
}
|
||||
m_networkRoutes.clear ();
|
||||
|
||||
if (m_defaultRoute != 0)
|
||||
{
|
||||
delete m_defaultRoute;
|
||||
m_defaultRoute = 0;
|
||||
}
|
||||
|
||||
|
||||
for (MulticastRoutesI i = m_multicastRoutes.begin () ; i != m_multicastRoutes.end () ; i = m_multicastRoutes.erase (i))
|
||||
{
|
||||
delete (*i);
|
||||
@@ -392,23 +348,23 @@ Ptr<Ipv6MulticastRoute> Ipv6StaticRouting::LookupStatic (Ipv6Address origin, Ipv
|
||||
|
||||
if (group == route->GetGroup ())
|
||||
{
|
||||
if (interface == Ipv6::IF_ANY || interface == route->GetInputInterface ())
|
||||
{
|
||||
NS_LOG_LOGIC ("Found multicast route" << *i);
|
||||
mrtentry = Create<Ipv6MulticastRoute>();
|
||||
mrtentry->SetGroup (route->GetGroup ());
|
||||
mrtentry->SetOrigin (route->GetOrigin ());
|
||||
mrtentry->SetParent (route->GetInputInterface ());
|
||||
for (uint32_t j = 0 ; j < route->GetNOutputInterfaces () ; j++)
|
||||
if (interface == Ipv6::IF_ANY || interface == route->GetInputInterface ())
|
||||
{
|
||||
NS_LOG_LOGIC ("Found multicast route" << *i);
|
||||
mrtentry = Create<Ipv6MulticastRoute> ();
|
||||
mrtentry->SetGroup (route->GetGroup ());
|
||||
mrtentry->SetOrigin (route->GetOrigin ());
|
||||
mrtentry->SetParent (route->GetInputInterface ());
|
||||
for (uint32_t j = 0 ; j < route->GetNOutputInterfaces () ; j++)
|
||||
{
|
||||
if (route->GetOutputInterface (j))
|
||||
{
|
||||
if (route->GetOutputInterface (j))
|
||||
{
|
||||
NS_LOG_LOGIC ("Setting output interface index " << route->GetOutputInterface (j));
|
||||
mrtentry->SetOutputTtl (route->GetOutputInterface (j), Ipv6MulticastRoute::MAX_TTL - 1);
|
||||
}
|
||||
NS_LOG_LOGIC ("Setting output interface index " << route->GetOutputInterface (j));
|
||||
mrtentry->SetOutputTtl (route->GetOutputInterface (j), Ipv6MulticastRoute::MAX_TTL - 1);
|
||||
}
|
||||
return mrtentry;
|
||||
}
|
||||
}
|
||||
return mrtentry;
|
||||
}
|
||||
}
|
||||
}
|
||||
return mrtentry;
|
||||
@@ -416,23 +372,40 @@ Ptr<Ipv6MulticastRoute> Ipv6StaticRouting::LookupStatic (Ipv6Address origin, Ipv
|
||||
|
||||
uint32_t Ipv6StaticRouting::GetNRoutes ()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
uint32_t n = 0;
|
||||
if (m_defaultRoute != 0)
|
||||
{
|
||||
n++;
|
||||
}
|
||||
n += m_hostRoutes.size ();
|
||||
n += m_networkRoutes.size ();
|
||||
return n;
|
||||
return m_networkRoutes.size ();
|
||||
}
|
||||
|
||||
Ipv6RoutingTableEntry Ipv6StaticRouting::GetDefaultRoute ()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
if (m_defaultRoute != 0)
|
||||
Ipv6Address dst ("::");
|
||||
uint32_t shortestMetric = 0xffffffff;
|
||||
Ipv6RoutingTableEntry* result = 0;
|
||||
|
||||
for (NetworkRoutesI it = m_networkRoutes.begin () ; it != m_networkRoutes.end () ; it++)
|
||||
{
|
||||
return *m_defaultRoute;
|
||||
Ipv6RoutingTableEntry* j = it->first;
|
||||
uint32_t metric = it->second;
|
||||
Ipv6Prefix mask = j->GetDestNetworkPrefix ();
|
||||
uint16_t maskLen = mask.GetPrefixLength ();
|
||||
Ipv6Address entry = j->GetDestNetwork ();
|
||||
|
||||
if (maskLen)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (metric > shortestMetric)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
shortestMetric = metric;
|
||||
result = j;
|
||||
}
|
||||
|
||||
if (result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -443,38 +416,13 @@ Ipv6RoutingTableEntry Ipv6StaticRouting::GetDefaultRoute ()
|
||||
Ipv6RoutingTableEntry Ipv6StaticRouting::GetRoute (uint32_t index)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << index);
|
||||
|
||||
if (index == 0 && m_defaultRoute != 0)
|
||||
{
|
||||
return *m_defaultRoute;
|
||||
}
|
||||
|
||||
if (index > 0 && m_defaultRoute != 0)
|
||||
{
|
||||
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;
|
||||
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin () ; j != m_networkRoutes.end () ; j++)
|
||||
for (NetworkRoutesI it = m_networkRoutes.begin () ; it != m_networkRoutes.end () ; it++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
return *j;
|
||||
return it->first;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
@@ -483,43 +431,36 @@ Ipv6RoutingTableEntry Ipv6StaticRouting::GetRoute (uint32_t index)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Ipv6StaticRouting::RemoveRoute (uint32_t index)
|
||||
uint32_t Ipv6StaticRouting::GetMetric (uint32_t index)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << index);
|
||||
if (index == 0 && m_defaultRoute != 0)
|
||||
{
|
||||
delete m_defaultRoute;
|
||||
m_defaultRoute = 0;
|
||||
}
|
||||
|
||||
if (index > 0 && m_defaultRoute != 0)
|
||||
{
|
||||
index--;
|
||||
}
|
||||
|
||||
if (index < m_hostRoutes.size ())
|
||||
{
|
||||
uint32_t tmp = 0;
|
||||
for (HostRoutesI i = m_hostRoutes.begin () ; i != m_hostRoutes.end () ; i++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
delete *i;
|
||||
m_hostRoutes.erase (i);
|
||||
return;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
}
|
||||
index -= m_hostRoutes.size ();
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
uint32_t tmp = 0;
|
||||
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin () ; j != m_networkRoutes.end () ; j++)
|
||||
|
||||
for (NetworkRoutesI it = m_networkRoutes.begin () ; it != m_networkRoutes.end () ; it++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
delete *j;
|
||||
m_networkRoutes.erase (j);
|
||||
return it->second;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
NS_ASSERT (false);
|
||||
// quiet compiler.
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void Ipv6StaticRouting::RemoveRoute (uint32_t index)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << index);
|
||||
uint32_t tmp = 0;
|
||||
|
||||
for (NetworkRoutesI it = m_networkRoutes.begin () ; it != m_networkRoutes.end () ; it++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
delete it->first;
|
||||
m_networkRoutes.erase (it);
|
||||
return;
|
||||
}
|
||||
tmp++;
|
||||
@@ -527,15 +468,18 @@ void Ipv6StaticRouting::RemoveRoute (uint32_t index)
|
||||
NS_ASSERT (false);
|
||||
}
|
||||
|
||||
void Ipv6StaticRouting::RemoveRoute (Ipv6Address network, Ipv6Prefix prefix, uint32_t ifIndex)
|
||||
void Ipv6StaticRouting::RemoveRoute (Ipv6Address network, Ipv6Prefix prefix, uint32_t ifIndex, Ipv6Address prefixToUse)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << network << prefix << ifIndex);
|
||||
for (NetworkRoutesI i = m_networkRoutes.begin () ; i != m_networkRoutes.end () ; i++)
|
||||
|
||||
for (NetworkRoutesI it = m_networkRoutes.begin () ; it != m_networkRoutes.end () ; it++)
|
||||
{
|
||||
if (network == (*i)->GetDest () and (*i)->GetInterface () == ifIndex)
|
||||
Ipv6RoutingTableEntry* rtentry = it->first;
|
||||
if (network == rtentry->GetDest () && rtentry->GetInterface () == ifIndex &&
|
||||
rtentry->GetPrefixToUse () == prefixToUse)
|
||||
{
|
||||
delete *i;
|
||||
m_networkRoutes.erase (i);
|
||||
delete it->first;
|
||||
m_networkRoutes.erase (it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -557,7 +501,7 @@ Ptr<Ipv6Route> Ipv6StaticRouting::RouteOutput (Ptr<Packet> p, const Ipv6Header &
|
||||
// So, we just log it and fall through to LookupStatic ()
|
||||
NS_LOG_LOGIC ("RouteOutput ()::Multicast destination");
|
||||
}
|
||||
|
||||
|
||||
rtentry = LookupStatic (destination, oif);
|
||||
if (rtentry)
|
||||
{
|
||||
@@ -580,7 +524,8 @@ bool Ipv6StaticRouting::RouteInput (Ptr<const Packet> p, const Ipv6Header &ipHea
|
||||
{
|
||||
NS_LOG_LOGIC ("Multicast destination");
|
||||
Ptr<Ipv6MulticastRoute> mrtentry = LookupStatic (ipHeader.GetSourceAddress (),
|
||||
ipHeader.GetDestinationAddress (), m_ipv6->GetInterfaceForDevice (idev));
|
||||
ipHeader.GetDestinationAddress ()
|
||||
, m_ipv6->GetInterfaceForDevice (idev));
|
||||
|
||||
if (mrtentry)
|
||||
{
|
||||
@@ -594,9 +539,9 @@ bool Ipv6StaticRouting::RouteInput (Ptr<const Packet> p, const Ipv6Header &ipHea
|
||||
return false; // Let other routing protocols try to handle this
|
||||
}
|
||||
}
|
||||
//
|
||||
// This is a unicast packet. Check to see if we have a route for it.
|
||||
//
|
||||
//
|
||||
// This is a unicast packet. Check to see if we have a route for it.
|
||||
//
|
||||
NS_LOG_LOGIC ("Unicast destination");
|
||||
Ptr<Ipv6Route> rtentry = LookupStatic (ipHeader.GetDestinationAddress ());
|
||||
|
||||
@@ -618,7 +563,7 @@ void Ipv6StaticRouting::NotifyInterfaceUp (uint32_t i)
|
||||
for (uint32_t j = 0 ; j < m_ipv6->GetNAddresses (i) ; j++)
|
||||
{
|
||||
if (m_ipv6->GetAddress (i, j).GetAddress () != Ipv6Address () &&
|
||||
m_ipv6->GetAddress (i, j).GetPrefix () != Ipv6Prefix ())
|
||||
m_ipv6->GetAddress (i, j).GetPrefix () != Ipv6Prefix ())
|
||||
{
|
||||
if (m_ipv6->GetAddress (i, j).GetPrefix () == Ipv6Prefix (128))
|
||||
{
|
||||
@@ -628,7 +573,7 @@ void Ipv6StaticRouting::NotifyInterfaceUp (uint32_t i)
|
||||
else
|
||||
{
|
||||
AddNetworkRouteTo (m_ipv6->GetAddress (i, j).GetAddress ().CombinePrefix (m_ipv6->GetAddress (i, j).GetPrefix ()),
|
||||
m_ipv6->GetAddress (i, j).GetPrefix (), i);
|
||||
m_ipv6->GetAddress (i, j).GetPrefix (), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -636,8 +581,12 @@ void Ipv6StaticRouting::NotifyInterfaceUp (uint32_t i)
|
||||
|
||||
void Ipv6StaticRouting::NotifyInterfaceDown (uint32_t i)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << i);
|
||||
uint32_t j = 0;
|
||||
uint32_t max = GetNRoutes ();
|
||||
|
||||
/* remove all static routes that are going through this interface */
|
||||
for (uint32_t j = 0 ; j < GetNRoutes () ; j++)
|
||||
while (j < max)
|
||||
{
|
||||
Ipv6RoutingTableEntry route = GetRoute (j);
|
||||
|
||||
@@ -645,6 +594,10 @@ void Ipv6StaticRouting::NotifyInterfaceDown (uint32_t i)
|
||||
{
|
||||
RemoveRoute (j);
|
||||
}
|
||||
else
|
||||
{
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -673,13 +626,13 @@ void Ipv6StaticRouting::NotifyRemoveAddress (uint32_t interface, Ipv6InterfaceAd
|
||||
|
||||
Ipv6Address networkAddress = address.GetAddress ().CombinePrefix (address.GetPrefix ());
|
||||
Ipv6Prefix networkMask = address.GetPrefix ();
|
||||
|
||||
|
||||
// Remove all static routes that are going through this interface
|
||||
// which reference this network
|
||||
for (uint32_t j = 0 ; j < GetNRoutes () ; j++)
|
||||
{
|
||||
Ipv6RoutingTableEntry route = GetRoute (j);
|
||||
|
||||
|
||||
if (route.GetInterface () == interface &&
|
||||
route.IsNetwork () &&
|
||||
route.GetDestNetwork () == networkAddress &&
|
||||
@@ -693,11 +646,7 @@ void Ipv6StaticRouting::NotifyRemoveAddress (uint32_t interface, Ipv6InterfaceAd
|
||||
void Ipv6StaticRouting::NotifyAddRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse)
|
||||
{
|
||||
NS_LOG_INFO (this << dst << mask << nextHop << interface << prefixToUse);
|
||||
if (mask == Ipv6Prefix (128))
|
||||
{
|
||||
AddHostRouteTo (dst, nextHop, interface);
|
||||
}
|
||||
else if (dst != Ipv6Address::GetZero ())
|
||||
if (dst != Ipv6Address::GetZero ())
|
||||
{
|
||||
AddNetworkRouteTo (dst, mask, nextHop, interface);
|
||||
}
|
||||
@@ -706,40 +655,29 @@ void Ipv6StaticRouting::NotifyAddRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Ad
|
||||
/* this case is mainly used by configuring default route following RA processing,
|
||||
* in case of multipe prefix in RA, the first will configured default route
|
||||
*/
|
||||
if (!m_defaultRoute)
|
||||
{
|
||||
SetDefaultRoute (nextHop, interface, prefixToUse);
|
||||
}
|
||||
|
||||
/* for the moment, all default route has the same metric
|
||||
* so according to the longest prefix algorithm,
|
||||
* the default route choosen will be the last added
|
||||
*/
|
||||
SetDefaultRoute (nextHop, interface, prefixToUse);
|
||||
}
|
||||
}
|
||||
|
||||
void Ipv6StaticRouting::NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface)
|
||||
void Ipv6StaticRouting::NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << dst << mask << nextHop << interface);
|
||||
if (mask == Ipv6Prefix (128))
|
||||
{
|
||||
for (HostRoutesI j = m_hostRoutes.begin () ; j != m_hostRoutes.end () ; j++)
|
||||
{
|
||||
Ipv6Prefix prefix = (*j)->GetDestNetworkPrefix ();
|
||||
Ipv6Address entry = (*j)->GetDestNetwork ();
|
||||
|
||||
if (dst == entry && prefix == mask && (*j)->GetInterface () == interface)
|
||||
{
|
||||
delete (*j);
|
||||
m_hostRoutes.erase (j);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dst != Ipv6Address::GetZero ())
|
||||
if (dst != Ipv6Address::GetZero ())
|
||||
{
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin () ; j != m_networkRoutes.end () ; j++)
|
||||
{
|
||||
Ipv6Prefix prefix = (*j)->GetDestNetworkPrefix ();
|
||||
Ipv6Address entry = (*j)->GetDestNetwork ();
|
||||
Ipv6RoutingTableEntry* rtentry = j->first;
|
||||
Ipv6Prefix prefix = rtentry->GetDestNetworkPrefix ();
|
||||
Ipv6Address entry = rtentry->GetDestNetwork ();
|
||||
|
||||
if (dst == entry && prefix == mask && (*j)->GetInterface () == interface)
|
||||
if (dst == entry && prefix == mask && rtentry->GetInterface () == interface)
|
||||
{
|
||||
delete (*j);
|
||||
delete j->first;
|
||||
m_networkRoutes.erase (j);
|
||||
}
|
||||
}
|
||||
@@ -747,17 +685,7 @@ void Ipv6StaticRouting::NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv
|
||||
else
|
||||
{
|
||||
/* default route case */
|
||||
if (!m_defaultRoute)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_defaultRoute->GetInterface () == interface && m_defaultRoute->GetGateway () == nextHop)
|
||||
{
|
||||
NS_LOG_LOGIC ("Remove default route (maybe because autoconfigured address expired)");
|
||||
delete m_defaultRoute;
|
||||
m_defaultRoute = 0;
|
||||
}
|
||||
RemoveRoute (dst, mask, interface, prefixToUse);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -785,7 +713,7 @@ Ipv6Address Ipv6StaticRouting::SourceAddressSelection (uint32_t interface, Ipv6A
|
||||
return test.GetAddress ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,9 @@ class Ipv6MulticastRoutingTableEntry;
|
||||
/**
|
||||
* \ingroup routing
|
||||
* \defgroup ipv6StaticRouting Ipv6StaticRouting
|
||||
*/
|
||||
/**
|
||||
* \ingroup ipv6StaticRouting
|
||||
* \class Ipv6StaticRouting
|
||||
* \brief Static routing protocol for IP version 6 stack.
|
||||
* \see Ipv6RoutingProtocol
|
||||
@@ -74,15 +77,17 @@ class Ipv6StaticRouting : public Ipv6RoutingProtocol
|
||||
* \param nextHop next hop address to route the packet
|
||||
* \param interface interface index
|
||||
* \param prefixToUse prefix that should be used for source address for this destination
|
||||
* \param metric metric of route in case of multiple routes to same destination
|
||||
*/
|
||||
void AddHostRouteTo (Ipv6Address dest, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address ("::"));
|
||||
void AddHostRouteTo (Ipv6Address dest, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address ("::"), uint32_t metric = 0);
|
||||
|
||||
/**
|
||||
* \brief Add route to host.
|
||||
* \param dest destination address.
|
||||
* \param interface interface index
|
||||
* \param metric metric of route in case of multiple routes to same destination
|
||||
*/
|
||||
void AddHostRouteTo (Ipv6Address dest, uint32_t interface);
|
||||
void AddHostRouteTo (Ipv6Address dest, uint32_t interface, uint32_t metric = 0);
|
||||
|
||||
/**
|
||||
* \brief Add route to network.
|
||||
@@ -90,8 +95,9 @@ class Ipv6StaticRouting : public Ipv6RoutingProtocol
|
||||
* \param networkPrefix network prefix*
|
||||
* \param nextHop next hop address to route the packet
|
||||
* \param interface interface index
|
||||
* \param metric metric of route in case of multiple routes to same destination
|
||||
*/
|
||||
void AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface);
|
||||
void AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface, uint32_t metric = 0);
|
||||
|
||||
/**
|
||||
* \brief Add route to network.
|
||||
@@ -100,29 +106,27 @@ class Ipv6StaticRouting : public Ipv6RoutingProtocol
|
||||
* \param nextHop next hop address to route the packet
|
||||
* \param interface interface index
|
||||
* \param prefixToUse prefix that should be used for source address for this destination
|
||||
* \param metric metric of route in case of multiple routes to same destination
|
||||
*/
|
||||
void AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse);
|
||||
void AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse, uint32_t metric = 0);
|
||||
|
||||
/**
|
||||
* \brief Add route to network.
|
||||
* \param network network address
|
||||
* \param networkPrefix network prefix
|
||||
* \param interface interface index
|
||||
* \param metric metric of route in case of multiple routes to same destination
|
||||
*/
|
||||
void AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, uint32_t interface);
|
||||
void AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, uint32_t interface, uint32_t metric = 0);
|
||||
|
||||
/**
|
||||
* \brief Set the default route.
|
||||
* \param nextHop next hop address to route the packet
|
||||
* \param interface interface index
|
||||
* \param prefixToUse prefix to use (i.e for multihoming)
|
||||
* \param metric metric of route in case of multiple routes to same destination
|
||||
*/
|
||||
void SetDefaultRoute (Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address ("::"));
|
||||
|
||||
/**
|
||||
* \brief Remove the default route.
|
||||
*/
|
||||
void RemoveDefaultRoute ();
|
||||
void SetDefaultRoute (Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address ("::"), uint32_t metric = 0);
|
||||
|
||||
/**
|
||||
* \brief Get the number or entries in the routing table.
|
||||
@@ -132,6 +136,8 @@ class Ipv6StaticRouting : public Ipv6RoutingProtocol
|
||||
|
||||
/**
|
||||
* \brief Get the default route.
|
||||
*
|
||||
* If multiple default routes exist, the one with lowest metric is returned.
|
||||
* \return default Ipv6Route
|
||||
*/
|
||||
Ipv6RoutingTableEntry GetDefaultRoute ();
|
||||
@@ -143,6 +149,13 @@ class Ipv6StaticRouting : public Ipv6RoutingProtocol
|
||||
*/
|
||||
Ipv6RoutingTableEntry GetRoute (uint32_t i);
|
||||
|
||||
/**
|
||||
* \brief Get a metric for route from the static unicast routing table.
|
||||
* \param index The index (into the routing table) of the route to retrieve.
|
||||
* \return If route is set, the metric is returned. If not, an infinity metric (0xffffffff) is returned
|
||||
*/
|
||||
uint32_t GetMetric (uint32_t index);
|
||||
|
||||
/**
|
||||
* \brief Remove a route from the routing table.
|
||||
* \param i index
|
||||
@@ -154,8 +167,9 @@ class Ipv6StaticRouting : public Ipv6RoutingProtocol
|
||||
* \param network IPv6 network
|
||||
* \param prefix IPv6 prefix
|
||||
* \param ifIndex interface index
|
||||
* \param prefixToUse IPv6 prefix to use with this route (multihoming)
|
||||
*/
|
||||
void RemoveRoute (Ipv6Address network, Ipv6Prefix prefix, uint32_t ifIndex);
|
||||
void RemoveRoute (Ipv6Address network, Ipv6Prefix prefix, uint32_t ifIndex, Ipv6Address prefixToUse);
|
||||
|
||||
/**
|
||||
* \brief Add a multicast route for a given multicast source and group.
|
||||
@@ -219,7 +233,7 @@ class Ipv6StaticRouting : public Ipv6RoutingProtocol
|
||||
virtual void NotifyAddAddress (uint32_t interface, Ipv6InterfaceAddress address);
|
||||
virtual void NotifyRemoveAddress (uint32_t interface, Ipv6InterfaceAddress address);
|
||||
virtual void NotifyAddRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address::GetZero ());
|
||||
virtual void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface);
|
||||
virtual void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address::GetZero ());
|
||||
virtual void SetIpv6 (Ptr<Ipv6> ipv6);
|
||||
|
||||
protected:
|
||||
@@ -229,12 +243,9 @@ class Ipv6StaticRouting : public Ipv6RoutingProtocol
|
||||
void DoDispose ();
|
||||
|
||||
private:
|
||||
typedef std::list<Ipv6RoutingTableEntry *> HostRoutes;
|
||||
typedef std::list<Ipv6RoutingTableEntry *>::const_iterator HostRoutesCI;
|
||||
typedef std::list<Ipv6RoutingTableEntry *>::iterator HostRoutesI;
|
||||
typedef std::list<Ipv6RoutingTableEntry *> NetworkRoutes;
|
||||
typedef std::list<Ipv6RoutingTableEntry *>::const_iterator NetworkRoutesCI;
|
||||
typedef std::list<Ipv6RoutingTableEntry *>::iterator NetworkRoutesI;
|
||||
typedef std::list<std::pair <Ipv6RoutingTableEntry *, uint32_t> > NetworkRoutes;
|
||||
typedef std::list<std::pair <Ipv6RoutingTableEntry *, uint32_t> >::const_iterator NetworkRoutesCI;
|
||||
typedef std::list<std::pair <Ipv6RoutingTableEntry *, uint32_t> >::iterator NetworkRoutesI;
|
||||
|
||||
typedef std::list<Ipv6MulticastRoutingTableEntry *> MulticastRoutes;
|
||||
typedef std::list<Ipv6MulticastRoutingTableEntry *>::const_iterator MulticastRoutesCI;
|
||||
@@ -265,21 +276,11 @@ class Ipv6StaticRouting : public Ipv6RoutingProtocol
|
||||
*/
|
||||
Ipv6Address SourceAddressSelection (uint32_t interface, Ipv6Address dest);
|
||||
|
||||
/**
|
||||
* \brief the forwarding table for hosts.
|
||||
*/
|
||||
HostRoutes m_hostRoutes;
|
||||
|
||||
/**
|
||||
* \brief the forwarding table for network.
|
||||
*/
|
||||
NetworkRoutes m_networkRoutes;
|
||||
|
||||
/**
|
||||
* \brief the default route.
|
||||
*/
|
||||
Ipv6RoutingTableEntry *m_defaultRoute;
|
||||
|
||||
/**
|
||||
* \brief the forwarding table for multicast.
|
||||
*/
|
||||
|
||||
+5
-2
@@ -215,19 +215,22 @@ class ns3moduleheader_taskgen(TaskGen.task_gen):
|
||||
## get all of the ns3 headers
|
||||
ns3_dir_node = self.bld.path.find_dir("ns3")
|
||||
all_headers_inputs = []
|
||||
found_the_module = False
|
||||
for ns3headers in self.bld.all_task_gen:
|
||||
if isinstance(ns3headers, ns3header_taskgen):
|
||||
if ns3headers.module != self.module:
|
||||
continue
|
||||
found_the_module = True
|
||||
for source in ns3headers.to_list(ns3headers.source):
|
||||
source = os.path.basename(source)
|
||||
node = ns3_dir_node.find_or_declare(os.path.basename(source))
|
||||
if node is None:
|
||||
fatal("missing header file %s" % (source,))
|
||||
all_headers_inputs.append(node)
|
||||
if not all_headers_inputs:
|
||||
if not found_the_module:
|
||||
raise Utils.WscriptError("error finding headers for module %s" % self.module)
|
||||
assert all_headers_inputs
|
||||
if not all_headers_inputs:
|
||||
return
|
||||
module_obj = self.bld.name_to_obj("ns3-" + self.module, self.env)
|
||||
assert module_obj is not None
|
||||
all_headers_outputs = [ns3_dir_node.find_or_declare("%s-module.h" % self.module)]
|
||||
|
||||
@@ -542,8 +542,10 @@ def build(bld):
|
||||
# When --run'ing a program, tell WAF to only build that program,
|
||||
# nothing more; this greatly speeds up compilation when all you
|
||||
# want to do is run a test program.
|
||||
if not Options.options.compile_targets:
|
||||
Options.options.compile_targets = os.path.basename(program_name)
|
||||
Options.options.compile_targets += ',' + os.path.basename(program_name)
|
||||
for gen in bld.all_task_gen:
|
||||
if type(gen).__name__ in ['ns3header_taskgen', 'ns3moduleheader_taskgen']:
|
||||
gen.post()
|
||||
|
||||
if Options.options.regression or Options.options.regression_generate:
|
||||
regression_traces = env['REGRESSION_TRACES']
|
||||
@@ -553,6 +555,7 @@ def build(bld):
|
||||
regression.run_regression(bld, regression_traces)
|
||||
|
||||
if Options.options.check:
|
||||
Options.options.compile_targets += ',run-tests,ns3module'
|
||||
_run_check(bld)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user