merge with nsnam.org

This commit is contained in:
Pavel Boyko
2009-05-29 10:15:19 +04:00
143 changed files with 7335 additions and 3974 deletions

View File

@@ -52,11 +52,94 @@ us a note on ns-developers mailing list. </p>
<h2>New API:</h2>
<ul>
<li> <b>attributes for class Ipv4</b>
<p> class Ipv4 now contains attributes in ipv4.cc; the first one
is called "IpForward" that will enable/disable Ipv4 forwarding.
</li>
</ul>
<h2>Changes to existing API:</h2>
<ul>
<li><b> Routing decoupled from class Ipv4</b>
<p> All calls of the form "Ipv4::AddHostRouteTo ()" etc. (i.e. to
add static routes, both unicast and multicast) have been moved to a new
class Ipv4StaticRouting. In addition, class Ipv4 now holds only
one possible routing protocol; the previous way to add routing protocols
(by ordered list of priority) has been moved to a new class Ipv4ListRouting.
Class Ipv4 has a new minimal routing API (just to set and get the routing
protocol):
<pre>
- virtual void AddRoutingProtocol (Ptr&lt;Ipv4RoutingProtocol&gt; routingProtocol, int16_t priority) = 0;
+ virtual void SetRoutingProtocol (Ptr&lt;Ipv4RoutingProtocol&gt; routingProtocol) = 0;
+ virtual Ptr&lt;Ipv4RoutingProtocol&gt; GetRoutingProtocol (void) const = 0;
</pre>
</li>
<li><b> class Ipv4RoutingProtocol is refactored</b>
<p> The abstract base class Ipv4RoutingProtocol has been refactored to
align with corresponding Linux Ipv4 routing architecture, and has been
moved from ipv4.h to a new file ipv4-routing-protocol.h. The new
methods (RouteOutput () and RouteInput ()) are aligned with Linux
ip_route_output() and ip_route_input(). However,
the general nature of these calls (synchronous routing lookup for
locally originated packets, and an asynchronous, callback-based lookup
for forwarded packets) is still the same.
<pre>
- typedef Callback&lt;void, bool, const Ipv4Route&, Ptr&lt;Packet&gt;, const Ipv4Header&&gt; RouteReplyCallback;
+ typedef Callback&lt;void, Ptr&lt;Ipv4Route&gt;, Ptr&lt;const Packet&gt;, const Ipv4Header &&gt; UnicastForwardCallback;
+ typedef Callback&lt;void, Ptr&lt;Ipv4MulticastRoute&gt;, Ptr&lt;const Packet&gt;, const Ipv4Header &&gt; MulticastForwardCallback;
+ typedef Callback&lt;void, Ptr&lt;const Packet&gt;, const Ipv4Header &, uint32_t &gt; LocalDeliverCallback;
+ typedef Callback&lt;void, Ptr&lt;const Packet&gt;, const Ipv4Header &&gt; ErrorCallback;
- virtual bool RequestInterface (Ipv4Address destination, uint32_t& interface) = 0;
+ virtual Ptr&lt;Ipv4Route&gt; RouteOutput (const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &errno) = 0;
- virtual bool RequestRoute (uint32_t interface,
- const Ipv4Header &ipHeader,
- Ptr&lt;Packet&gt; packet,
- RouteReplyCallback routeReply) = 0;
+ virtual bool RouteInput (Ptr&lt;const Packet&gt; p, const Ipv4Header &header, Ptr&lt;const NetDevice&gt; idev,
+ UnicastForwardCallback ucb, MulticastForwardCallback mcb,
+ LocalDeliverCallback lcb, ErrorCallback ecb) = 0;
</pre>
</li>
<li><b> previous class Ipv4Route, Ipv4MulticastRoute renamed; new classes with
those same names added</b>
<p> The previous class Ipv4Route and Ipv4MulticastRoute are used by
Ipv4StaticRouting and Ipv4GlobalRouting to record internal routing table
entries, so they were renamed to class Ipv4RoutingTableEntry and
Ipv4MulticastRoutingTableEntry, respectively. In their place, new
class Ipv4Route and class Ipv4MulticastRoute have been added. These
are reference-counted objects that are analogous to Linux struct
rtable and struct mfc_cache, respectively, to achieve better compatibility
with Linux routing architecture in the future.
<li><b> class Ipv4 address-to-interface mapping functions changed</b>
<p> There was some general cleanup of functions that involve mappings
from Ipv4Address to either NetDevice or Ipv4 interface index.
<pre>
- virtual uint32_t FindInterfaceForAddr (Ipv4Address addr) const = 0;
- virtual uint32_t FindInterfaceForAddr (Ipv4Address addr, Ipv4Mask mask) const = 0;
+ virtual int32_t GetInterfaceForAddress (Ipv4Address address) const = 0;
+ virtual int32_t GetInterfaceForPrefix (Ipv4Address address, Ipv4Mask mask) const = 0;
- virtual int32_t FindInterfaceForDevice(Ptr&lt;NetDevice&gt; nd) const = 0;
+ virtual int32_t GetInterfaceForDevice (Ptr&lt;const NetDevice&gt; device) const = 0;
- virtual Ipv4Address GetSourceAddress (Ipv4Address destination) const = 0;
- virtual bool GetInterfaceForDestination (Ipv4Address dest,
- virtual uint32_t GetInterfaceByAddress (Ipv4Address addr, Ipv4Mask mask = Ipv4Mask("255.255.255.255"));
</pre>
<li><b> class Ipv4 multicast join API deleted</b>
<p> The following methods are not really used in present form since IGMP
is not being generated, so they have been removed (planned to be replaced
by multicast socket-based calls in the future):
<pre>
- virtual void JoinMulticastGroup (Ipv4Address origin, Ipv4Address group) = 0;
- virtual void LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group) = 0;
</pre>
<li><b>Deconflict NetDevice::ifIndex and Ipv4::ifIndex (bug 85).</b>
<p>All function parameters named "ifIndex" that refer
to an Ipv4 interface are instead named "interface".

View File

@@ -17,13 +17,21 @@ This release is scheduled for June/July 2009
New user-visible features
-------------------------
a) 802.11e EDCA support: Has been added possibilty to manage QoS traffic on wifi stations.
b) 802.11n initial support: Has been added support for A-MSDU frame aggregation feature.
a) 802.11 MAC:
- EDCA multi-qos-class support (Mirko Banchi)
- 802.11n initial support for A-MSDU frame aggregation (Mirko Banchi)
- aarf-cd and cara rate control algorithms (Federico Maguolo)
b) 802.11 PHY:
- 802.11b PHY support (Gary Pei)
- Nakagami propagation loss model (Timo Bingmann)
c) GammaVariable and ErlangVariable (Timo Bingmann)
API changes from ns-3.4
-----------------------
API changes for this release are documented in the file CHANGES.html
API changes for this release are documented in the file CHANGES.html. The
internal API and composition of the IPv4 stack underwent significant
refactoring in this release cycle.
Release 3.4
===========

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
@@ -20,6 +20,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -40,6 +46,10 @@ def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -254,6 +264,7 @@ def register_functions(root_module):
module = root_module
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -264,6 +275,9 @@ def register_functions_ns3_Config(module, root_module):
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
@@ -74,6 +74,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -94,6 +100,10 @@ def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -1229,6 +1239,7 @@ def register_functions(root_module):
[])
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -1239,6 +1250,9 @@ def register_functions_ns3_Config(module, root_module):
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
@@ -52,6 +52,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -72,6 +78,10 @@ def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -470,6 +480,7 @@ def register_functions(root_module):
module = root_module
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -480,6 +491,9 @@ def register_functions_ns3_Config(module, root_module):
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
@@ -186,6 +186,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -209,6 +215,10 @@ def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -1641,6 +1651,11 @@ def register_Ns3Object_methods(root_module, cls):
'ns3::Object::AggregateIterator',
[],
is_const=True)
## object.h: void ns3::Object::NotifyNewAggregate() [member function]
cls.add_method('NotifyNewAggregate',
'void',
[],
visibility='protected', is_virtual=True)
## object.h: void ns3::Object::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
@@ -2222,6 +2237,7 @@ def register_functions(root_module):
template_parameters=['unsigned char'])
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -2288,6 +2304,9 @@ def register_functions_ns3_Config(module, root_module):
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
## double.h: extern ns3::Ptr<ns3::AttributeChecker const> ns3::internal::MakeDoubleChecker(double min, double max, std::string name) [free function]
module.add_function('MakeDoubleChecker',

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
@@ -28,6 +28,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -48,6 +54,10 @@ def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -414,6 +424,7 @@ def register_functions(root_module):
module = root_module
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -424,6 +435,9 @@ def register_functions_ns3_Config(module, root_module):
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
@@ -18,6 +18,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -38,6 +44,10 @@ def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -206,6 +216,7 @@ def register_functions(root_module):
module = root_module
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -216,6 +227,9 @@ def register_functions_ns3_Config(module, root_module):
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
@@ -30,6 +30,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -50,6 +56,10 @@ def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -287,6 +297,7 @@ def register_functions(root_module):
module = root_module
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -297,6 +308,9 @@ def register_functions_ns3_Config(module, root_module):
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
@@ -17,6 +17,8 @@ def register_types(module):
module.add_class('Ipv4AddressHelper', allow_subclassing=False)
## ipv4-interface-container.h: ns3::Ipv4InterfaceContainer [class]
module.add_class('Ipv4InterfaceContainer')
## ipv4-static-routing-helper.h: ns3::Ipv4StaticRoutingHelper [class]
module.add_class('Ipv4StaticRoutingHelper', allow_subclassing=False)
## mobility-helper.h: ns3::MobilityHelper [class]
module.add_class('MobilityHelper', allow_subclassing=False)
## net-device-container.h: ns3::NetDeviceContainer [class]
@@ -35,8 +37,6 @@ def register_types(module):
module.add_class('PacketSocketHelper', allow_subclassing=False)
## point-to-point-helper.h: ns3::PointToPointHelper [class]
module.add_class('PointToPointHelper', allow_subclassing=False)
## static-multicast-route-helper.h: ns3::StaticMulticastRouteHelper [class]
module.add_class('StaticMulticastRouteHelper', allow_subclassing=False)
## tap-bridge-helper.h: ns3::TapBridgeHelper [class]
module.add_class('TapBridgeHelper', allow_subclassing=False)
## udp-echo-helper.h: ns3::UdpEchoClientHelper [class]
@@ -72,6 +72,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -92,6 +98,10 @@ def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -108,6 +118,7 @@ def register_methods(root_module):
register_Ns3InternetStackHelper_methods(root_module, root_module['ns3::InternetStackHelper'])
register_Ns3Ipv4AddressHelper_methods(root_module, root_module['ns3::Ipv4AddressHelper'])
register_Ns3Ipv4InterfaceContainer_methods(root_module, root_module['ns3::Ipv4InterfaceContainer'])
register_Ns3Ipv4StaticRoutingHelper_methods(root_module, root_module['ns3::Ipv4StaticRoutingHelper'])
register_Ns3MobilityHelper_methods(root_module, root_module['ns3::MobilityHelper'])
register_Ns3NetDeviceContainer_methods(root_module, root_module['ns3::NetDeviceContainer'])
register_Ns3NodeContainer_methods(root_module, root_module['ns3::NodeContainer'])
@@ -117,7 +128,6 @@ def register_methods(root_module):
register_Ns3PacketSinkHelper_methods(root_module, root_module['ns3::PacketSinkHelper'])
register_Ns3PacketSocketHelper_methods(root_module, root_module['ns3::PacketSocketHelper'])
register_Ns3PointToPointHelper_methods(root_module, root_module['ns3::PointToPointHelper'])
register_Ns3StaticMulticastRouteHelper_methods(root_module, root_module['ns3::StaticMulticastRouteHelper'])
register_Ns3TapBridgeHelper_methods(root_module, root_module['ns3::TapBridgeHelper'])
register_Ns3UdpEchoClientHelper_methods(root_module, root_module['ns3::UdpEchoClientHelper'])
register_Ns3UdpEchoServerHelper_methods(root_module, root_module['ns3::UdpEchoServerHelper'])
@@ -423,10 +433,14 @@ def register_Ns3InternetStackHelper_methods(root_module, cls):
'void',
[param('ns3::NodeContainer', 'c')],
is_const=True)
## internet-stack-helper.h: void ns3::InternetStackHelper::SetNscStack(std::string soname) [member function]
cls.add_method('SetNscStack',
## internet-stack-helper.h: void ns3::InternetStackHelper::SetTcp(std::string tid) [member function]
cls.add_method('SetTcp',
'void',
[param('std::string', 'soname')])
[param('std::string', 'tid')])
## internet-stack-helper.h: void ns3::InternetStackHelper::SetTcp(std::string tid, std::string attr, ns3::AttributeValue const & val) [member function]
cls.add_method('SetTcp',
'void',
[param('std::string', 'tid'), param('std::string', 'attr'), param('ns3::AttributeValue const &', 'val')])
## internet-stack-helper.h: static void ns3::InternetStackHelper::EnableAscii(std::ostream & os, ns3::NodeContainer n) [member function]
cls.add_method('EnableAscii',
'void',
@@ -500,6 +514,50 @@ def register_Ns3Ipv4InterfaceContainer_methods(root_module, cls):
[param('std::string', 'ipv4Name'), param('uint32_t', 'interface')])
return
def register_Ns3Ipv4StaticRoutingHelper_methods(root_module, cls):
## ipv4-static-routing-helper.h: ns3::Ipv4StaticRoutingHelper::Ipv4StaticRoutingHelper(ns3::Ipv4StaticRoutingHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4StaticRoutingHelper const &', 'arg0')])
## ipv4-static-routing-helper.h: ns3::Ipv4StaticRoutingHelper::Ipv4StaticRoutingHelper() [constructor]
cls.add_constructor([])
## ipv4-static-routing-helper.h: ns3::Ptr<ns3::Ipv4StaticRouting> ns3::Ipv4StaticRoutingHelper::GetStaticRouting(ns3::Ptr<ns3::Ipv4> ipv4) const [member function]
cls.add_method('GetStaticRouting',
'ns3::Ptr< ns3::Ipv4StaticRouting >',
[param('ns3::Ptr< ns3::Ipv4 >', 'ipv4')],
is_const=True)
## ipv4-static-routing-helper.h: void ns3::Ipv4StaticRoutingHelper::AddMulticastRoute(ns3::Ptr<ns3::Node> n, ns3::Ipv4Address source, ns3::Ipv4Address group, ns3::Ptr<ns3::NetDevice> input, ns3::NetDeviceContainer output) [member function]
cls.add_method('AddMulticastRoute',
'void',
[param('ns3::Ptr< ns3::Node >', 'n'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'group'), param('ns3::Ptr< ns3::NetDevice >', 'input'), param('ns3::NetDeviceContainer', 'output')])
## ipv4-static-routing-helper.h: void ns3::Ipv4StaticRoutingHelper::AddMulticastRoute(std::string n, ns3::Ipv4Address source, ns3::Ipv4Address group, ns3::Ptr<ns3::NetDevice> input, ns3::NetDeviceContainer output) [member function]
cls.add_method('AddMulticastRoute',
'void',
[param('std::string', 'n'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'group'), param('ns3::Ptr< ns3::NetDevice >', 'input'), param('ns3::NetDeviceContainer', 'output')])
## ipv4-static-routing-helper.h: void ns3::Ipv4StaticRoutingHelper::AddMulticastRoute(ns3::Ptr<ns3::Node> n, ns3::Ipv4Address source, ns3::Ipv4Address group, std::string inputName, ns3::NetDeviceContainer output) [member function]
cls.add_method('AddMulticastRoute',
'void',
[param('ns3::Ptr< ns3::Node >', 'n'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'group'), param('std::string', 'inputName'), param('ns3::NetDeviceContainer', 'output')])
## ipv4-static-routing-helper.h: void ns3::Ipv4StaticRoutingHelper::AddMulticastRoute(std::string nName, ns3::Ipv4Address source, ns3::Ipv4Address group, std::string inputName, ns3::NetDeviceContainer output) [member function]
cls.add_method('AddMulticastRoute',
'void',
[param('std::string', 'nName'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'group'), param('std::string', 'inputName'), param('ns3::NetDeviceContainer', 'output')])
## ipv4-static-routing-helper.h: void ns3::Ipv4StaticRoutingHelper::SetDefaultMulticastRoute(ns3::Ptr<ns3::Node> n, ns3::Ptr<ns3::NetDevice> nd) [member function]
cls.add_method('SetDefaultMulticastRoute',
'void',
[param('ns3::Ptr< ns3::Node >', 'n'), param('ns3::Ptr< ns3::NetDevice >', 'nd')])
## ipv4-static-routing-helper.h: void ns3::Ipv4StaticRoutingHelper::SetDefaultMulticastRoute(ns3::Ptr<ns3::Node> n, std::string ndName) [member function]
cls.add_method('SetDefaultMulticastRoute',
'void',
[param('ns3::Ptr< ns3::Node >', 'n'), param('std::string', 'ndName')])
## ipv4-static-routing-helper.h: void ns3::Ipv4StaticRoutingHelper::SetDefaultMulticastRoute(std::string nName, ns3::Ptr<ns3::NetDevice> nd) [member function]
cls.add_method('SetDefaultMulticastRoute',
'void',
[param('std::string', 'nName'), param('ns3::Ptr< ns3::NetDevice >', 'nd')])
## ipv4-static-routing-helper.h: void ns3::Ipv4StaticRoutingHelper::SetDefaultMulticastRoute(std::string nName, std::string ndName) [member function]
cls.add_method('SetDefaultMulticastRoute',
'void',
[param('std::string', 'nName'), param('std::string', 'ndName')])
return
def register_Ns3MobilityHelper_methods(root_module, cls):
## mobility-helper.h: ns3::MobilityHelper::MobilityHelper(ns3::MobilityHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::MobilityHelper const &', 'arg0')])
@@ -885,53 +943,6 @@ def register_Ns3PointToPointHelper_methods(root_module, cls):
[param('std::string', 'hubName'), param('ns3::NodeContainer', 'spokes'), param('ns3::NetDeviceContainer &', 'hubDevices'), param('ns3::NetDeviceContainer &', 'spokeDevices')])
return
def register_Ns3StaticMulticastRouteHelper_methods(root_module, cls):
## static-multicast-route-helper.h: ns3::StaticMulticastRouteHelper::StaticMulticastRouteHelper(ns3::StaticMulticastRouteHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::StaticMulticastRouteHelper const &', 'arg0')])
## static-multicast-route-helper.h: ns3::StaticMulticastRouteHelper::StaticMulticastRouteHelper() [constructor]
cls.add_constructor([])
## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::AddMulticastRoute(ns3::Ptr<ns3::Node> n, ns3::Ipv4Address source, ns3::Ipv4Address group, ns3::Ptr<ns3::NetDevice> input, ns3::NetDeviceContainer output) [member function]
cls.add_method('AddMulticastRoute',
'void',
[param('ns3::Ptr< ns3::Node >', 'n'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'group'), param('ns3::Ptr< ns3::NetDevice >', 'input'), param('ns3::NetDeviceContainer', 'output')])
## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::AddMulticastRoute(std::string n, ns3::Ipv4Address source, ns3::Ipv4Address group, ns3::Ptr<ns3::NetDevice> input, ns3::NetDeviceContainer output) [member function]
cls.add_method('AddMulticastRoute',
'void',
[param('std::string', 'n'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'group'), param('ns3::Ptr< ns3::NetDevice >', 'input'), param('ns3::NetDeviceContainer', 'output')])
## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::AddMulticastRoute(ns3::Ptr<ns3::Node> n, ns3::Ipv4Address source, ns3::Ipv4Address group, std::string inputName, ns3::NetDeviceContainer output) [member function]
cls.add_method('AddMulticastRoute',
'void',
[param('ns3::Ptr< ns3::Node >', 'n'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'group'), param('std::string', 'inputName'), param('ns3::NetDeviceContainer', 'output')])
## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::AddMulticastRoute(std::string nName, ns3::Ipv4Address source, ns3::Ipv4Address group, std::string inputName, ns3::NetDeviceContainer output) [member function]
cls.add_method('AddMulticastRoute',
'void',
[param('std::string', 'nName'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'group'), param('std::string', 'inputName'), param('ns3::NetDeviceContainer', 'output')])
## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::SetDefaultMulticastRoute(ns3::Ptr<ns3::Node> n, ns3::Ptr<ns3::NetDevice> nd) [member function]
cls.add_method('SetDefaultMulticastRoute',
'void',
[param('ns3::Ptr< ns3::Node >', 'n'), param('ns3::Ptr< ns3::NetDevice >', 'nd')])
## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::SetDefaultMulticastRoute(ns3::Ptr<ns3::Node> n, std::string ndName) [member function]
cls.add_method('SetDefaultMulticastRoute',
'void',
[param('ns3::Ptr< ns3::Node >', 'n'), param('std::string', 'ndName')])
## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::SetDefaultMulticastRoute(std::string nName, ns3::Ptr<ns3::NetDevice> nd) [member function]
cls.add_method('SetDefaultMulticastRoute',
'void',
[param('std::string', 'nName'), param('ns3::Ptr< ns3::NetDevice >', 'nd')])
## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::SetDefaultMulticastRoute(std::string nName, std::string ndName) [member function]
cls.add_method('SetDefaultMulticastRoute',
'void',
[param('std::string', 'nName'), param('std::string', 'ndName')])
## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::JoinMulticastGroup(ns3::Ptr<ns3::Node> n, ns3::Ipv4Address source, ns3::Ipv4Address group) [member function]
cls.add_method('JoinMulticastGroup',
'void',
[param('ns3::Ptr< ns3::Node >', 'n'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'group')])
## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::JoinMulticastGroup(std::string nName, ns3::Ipv4Address source, ns3::Ipv4Address group) [member function]
cls.add_method('JoinMulticastGroup',
'void',
[param('std::string', 'nName'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'group')])
return
def register_Ns3TapBridgeHelper_methods(root_module, cls):
## tap-bridge-helper.h: ns3::TapBridgeHelper::TapBridgeHelper(ns3::TapBridgeHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TapBridgeHelper const &', 'arg0')])
@@ -1264,6 +1275,7 @@ def register_functions(root_module):
module = root_module
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -1274,6 +1286,9 @@ def register_functions_ns3_Config(module, root_module):
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
@@ -23,8 +23,12 @@ def register_types(module):
module.add_enum('Flags_t', ['NONE', 'FIN', 'SYN', 'RST', 'PSH', 'ACK', 'URG'], outer_class=root_module['ns3::TcpHeader'])
## udp-header.h: ns3::UdpHeader [class]
module.add_class('UdpHeader', parent=root_module['ns3::Header'])
## ipv4-static-routing-impl.h: ns3::Ipv4StaticRoutingImpl [class]
module.add_class('Ipv4StaticRoutingImpl', parent=root_module['ns3::Ipv4StaticRouting'])
## ipv4-global-routing.h: ns3::Ipv4GlobalRouting [class]
module.add_class('Ipv4GlobalRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
## ipv4-list-routing-impl.h: ns3::Ipv4ListRoutingImpl [class]
module.add_class('Ipv4ListRoutingImpl', parent=root_module['ns3::Ipv4ListRouting'])
## Register a nested module for the namespace Config
@@ -38,6 +42,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -58,6 +68,10 @@ def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -73,7 +87,9 @@ def register_methods(root_module):
register_Ns3Icmpv4TimeExceeded_methods(root_module, root_module['ns3::Icmpv4TimeExceeded'])
register_Ns3TcpHeader_methods(root_module, root_module['ns3::TcpHeader'])
register_Ns3UdpHeader_methods(root_module, root_module['ns3::UdpHeader'])
register_Ns3Ipv4StaticRoutingImpl_methods(root_module, root_module['ns3::Ipv4StaticRoutingImpl'])
register_Ns3Ipv4GlobalRouting_methods(root_module, root_module['ns3::Ipv4GlobalRouting'])
register_Ns3Ipv4ListRoutingImpl_methods(root_module, root_module['ns3::Ipv4ListRoutingImpl'])
return
def register_Ns3Icmpv4DestinationUnreachable_methods(root_module, cls):
@@ -508,6 +524,118 @@ def register_Ns3UdpHeader_methods(root_module, cls):
is_const=True)
return
def register_Ns3Ipv4StaticRoutingImpl_methods(root_module, cls):
## ipv4-static-routing-impl.h: ns3::Ipv4StaticRoutingImpl::Ipv4StaticRoutingImpl(ns3::Ipv4StaticRoutingImpl const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4StaticRoutingImpl const &', 'arg0')])
## ipv4-static-routing-impl.h: static ns3::TypeId ns3::Ipv4StaticRoutingImpl::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ipv4-static-routing-impl.h: ns3::Ipv4StaticRoutingImpl::Ipv4StaticRoutingImpl() [constructor]
cls.add_constructor([])
## ipv4-static-routing-impl.h: ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4StaticRoutingImpl::RouteOutput(ns3::Ipv4Header const & header, uint32_t oif, ns3::Socket::SocketErrno & sockerr) [member function]
cls.add_method('RouteOutput',
'ns3::Ptr< ns3::Ipv4Route >',
[param('ns3::Ipv4Header const &', 'header'), param('uint32_t', 'oif'), param('ns3::Socket::SocketErrno &', 'sockerr')],
is_virtual=True)
## ipv4-static-routing-impl.h: bool ns3::Ipv4StaticRoutingImpl::RouteInput(ns3::Ptr<ns3::Packet const> p, ns3::Ipv4Header const & header, ns3::Ptr<const ns3::NetDevice> idev, ns3::Callback<void,ns3::Ptr<ns3::Ipv4Route>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback<void,ns3::Ptr<ns3::Ipv4MulticastRoute>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,unsigned int,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> lcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
cls.add_method('RouteInput',
'bool',
[param('ns3::Ptr< ns3::Packet const >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice const >', 'idev'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4Route >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ucb'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4MulticastRoute >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'mcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'lcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')],
is_virtual=True)
## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::AddHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
cls.add_method('AddHostRouteTo',
'void',
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
is_virtual=True)
## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::AddHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
cls.add_method('AddHostRouteTo',
'void',
[param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')],
is_virtual=True)
## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
cls.add_method('AddNetworkRouteTo',
'void',
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
is_virtual=True)
## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function]
cls.add_method('AddNetworkRouteTo',
'void',
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')],
is_virtual=True)
## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::SetDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface) [member function]
cls.add_method('SetDefaultRoute',
'void',
[param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
is_virtual=True)
## ipv4-static-routing-impl.h: uint32_t ns3::Ipv4StaticRoutingImpl::GetNRoutes() [member function]
cls.add_method('GetNRoutes',
'uint32_t',
[],
is_virtual=True)
## ipv4-static-routing-impl.h: ns3::Ipv4RoutingTableEntry ns3::Ipv4StaticRoutingImpl::GetDefaultRoute() [member function]
cls.add_method('GetDefaultRoute',
'ns3::Ipv4RoutingTableEntry',
[],
is_virtual=True)
## ipv4-static-routing-impl.h: ns3::Ipv4RoutingTableEntry ns3::Ipv4StaticRoutingImpl::GetRoute(uint32_t i) [member function]
cls.add_method('GetRoute',
'ns3::Ipv4RoutingTableEntry',
[param('uint32_t', 'i')],
is_virtual=True)
## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::RemoveRoute(uint32_t i) [member function]
cls.add_method('RemoveRoute',
'void',
[param('uint32_t', 'i')],
is_virtual=True)
## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::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')],
is_virtual=True)
## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::SetDefaultMulticastRoute(uint32_t outputInterface) [member function]
cls.add_method('SetDefaultMulticastRoute',
'void',
[param('uint32_t', 'outputInterface')],
is_virtual=True)
## ipv4-static-routing-impl.h: uint32_t ns3::Ipv4StaticRoutingImpl::GetNMulticastRoutes() const [member function]
cls.add_method('GetNMulticastRoutes',
'uint32_t',
[],
is_const=True, is_virtual=True)
## ipv4-static-routing-impl.h: ns3::Ipv4MulticastRoutingTableEntry ns3::Ipv4StaticRoutingImpl::GetMulticastRoute(uint32_t i) const [member function]
cls.add_method('GetMulticastRoute',
'ns3::Ipv4MulticastRoutingTableEntry',
[param('uint32_t', 'i')],
is_const=True, is_virtual=True)
## ipv4-static-routing-impl.h: bool ns3::Ipv4StaticRoutingImpl::RemoveMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface) [member function]
cls.add_method('RemoveMulticastRoute',
'bool',
[param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group'), param('uint32_t', 'inputInterface')],
is_virtual=True)
## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::RemoveMulticastRoute(uint32_t index) [member function]
cls.add_method('RemoveMulticastRoute',
'void',
[param('uint32_t', 'index')],
is_virtual=True)
## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_virtual=True)
## ipv4-static-routing-impl.h: ns3::Ptr<ns3::Node> ns3::Ipv4StaticRoutingImpl::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_const=True, is_virtual=True)
## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3Ipv4GlobalRouting_methods(root_module, cls):
## ipv4-global-routing.h: ns3::Ipv4GlobalRouting::Ipv4GlobalRouting(ns3::Ipv4GlobalRouting const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4GlobalRouting const &', 'arg0')])
@@ -518,15 +646,15 @@ def register_Ns3Ipv4GlobalRouting_methods(root_module, cls):
is_static=True)
## ipv4-global-routing.h: ns3::Ipv4GlobalRouting::Ipv4GlobalRouting() [constructor]
cls.add_constructor([])
## ipv4-global-routing.h: bool ns3::Ipv4GlobalRouting::RequestRoute(uint32_t interface, ns3::Ipv4Header const & ipHeader, ns3::Ptr<ns3::Packet> packet, ns3::Callback<void,bool,const ns3::Ipv4Route&,ns3::Ptr<ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> routeReply) [member function]
cls.add_method('RequestRoute',
'bool',
[param('uint32_t', 'interface'), param('ns3::Ipv4Header const &', 'ipHeader'), param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Callback< void, bool, ns3::Ipv4Route const &, ns3::Ptr< ns3::Packet >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'routeReply')],
## ipv4-global-routing.h: ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4GlobalRouting::RouteOutput(ns3::Ipv4Header const & header, uint32_t oif, ns3::Socket::SocketErrno & sockerr) [member function]
cls.add_method('RouteOutput',
'ns3::Ptr< ns3::Ipv4Route >',
[param('ns3::Ipv4Header const &', 'header'), param('uint32_t', 'oif'), param('ns3::Socket::SocketErrno &', 'sockerr')],
is_virtual=True)
## ipv4-global-routing.h: bool ns3::Ipv4GlobalRouting::RequestInterface(ns3::Ipv4Address destination, uint32_t & interface) [member function]
cls.add_method('RequestInterface',
## ipv4-global-routing.h: bool ns3::Ipv4GlobalRouting::RouteInput(ns3::Ptr<ns3::Packet const> p, ns3::Ipv4Header const & header, ns3::Ptr<const ns3::NetDevice> idev, ns3::Callback<void,ns3::Ptr<ns3::Ipv4Route>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback<void,ns3::Ptr<ns3::Ipv4MulticastRoute>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,unsigned int,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> lcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
cls.add_method('RouteInput',
'bool',
[param('ns3::Ipv4Address', 'destination'), param('uint32_t &', 'interface')],
[param('ns3::Ptr< ns3::Packet const >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice const >', 'idev'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4Route >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ucb'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4MulticastRoute >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'mcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'lcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')],
is_virtual=True)
## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::AddHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
cls.add_method('AddHostRouteTo',
@@ -548,14 +676,23 @@ def register_Ns3Ipv4GlobalRouting_methods(root_module, cls):
cls.add_method('GetNRoutes',
'uint32_t',
[])
## ipv4-global-routing.h: ns3::Ipv4Route * ns3::Ipv4GlobalRouting::GetRoute(uint32_t i) [member function]
## ipv4-global-routing.h: ns3::Ipv4RoutingTableEntry * ns3::Ipv4GlobalRouting::GetRoute(uint32_t i) [member function]
cls.add_method('GetRoute',
'ns3::Ipv4Route *',
'ns3::Ipv4RoutingTableEntry *',
[param('uint32_t', 'i')])
## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::RemoveRoute(uint32_t i) [member function]
cls.add_method('RemoveRoute',
'void',
[param('uint32_t', 'i')])
## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')])
## ipv4-global-routing.h: ns3::Ptr<ns3::Node> ns3::Ipv4GlobalRouting::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_const=True)
## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
@@ -563,18 +700,67 @@ def register_Ns3Ipv4GlobalRouting_methods(root_module, cls):
visibility='protected', is_virtual=True)
return
def register_Ns3Ipv4ListRoutingImpl_methods(root_module, cls):
## ipv4-list-routing-impl.h: ns3::Ipv4ListRoutingImpl::Ipv4ListRoutingImpl(ns3::Ipv4ListRoutingImpl const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4ListRoutingImpl const &', 'arg0')])
## ipv4-list-routing-impl.h: static ns3::TypeId ns3::Ipv4ListRoutingImpl::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ipv4-list-routing-impl.h: ns3::Ipv4ListRoutingImpl::Ipv4ListRoutingImpl() [constructor]
cls.add_constructor([])
## ipv4-list-routing-impl.h: ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4ListRoutingImpl::RouteOutput(ns3::Ipv4Header const & header, uint32_t oif, ns3::Socket::SocketErrno & sockerr) [member function]
cls.add_method('RouteOutput',
'ns3::Ptr< ns3::Ipv4Route >',
[param('ns3::Ipv4Header const &', 'header'), param('uint32_t', 'oif'), param('ns3::Socket::SocketErrno &', 'sockerr')],
is_virtual=True)
## ipv4-list-routing-impl.h: bool ns3::Ipv4ListRoutingImpl::RouteInput(ns3::Ptr<ns3::Packet const> p, ns3::Ipv4Header const & header, ns3::Ptr<const ns3::NetDevice> idev, ns3::Callback<void,ns3::Ptr<ns3::Ipv4Route>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback<void,ns3::Ptr<ns3::Ipv4MulticastRoute>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,unsigned int,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> lcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
cls.add_method('RouteInput',
'bool',
[param('ns3::Ptr< ns3::Packet const >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice const >', 'idev'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4Route >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ucb'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4MulticastRoute >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'mcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'lcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')],
is_virtual=True)
## ipv4-list-routing-impl.h: void ns3::Ipv4ListRoutingImpl::AddRoutingProtocol(ns3::Ptr<ns3::Ipv4RoutingProtocol> routingProtocol, int16_t priority) [member function]
cls.add_method('AddRoutingProtocol',
'void',
[param('ns3::Ptr< ns3::Ipv4RoutingProtocol >', 'routingProtocol'), param('int16_t', 'priority')],
is_virtual=True)
## ipv4-list-routing-impl.h: uint32_t ns3::Ipv4ListRoutingImpl::GetNRoutingProtocols() const [member function]
cls.add_method('GetNRoutingProtocols',
'uint32_t',
[],
is_const=True, is_virtual=True)
## ipv4-list-routing-impl.h: ns3::Ptr<ns3::Ipv4RoutingProtocol> ns3::Ipv4ListRoutingImpl::GetRoutingProtocol(uint32_t index, int16_t & priority) const [member function]
cls.add_method('GetRoutingProtocol',
'ns3::Ptr< ns3::Ipv4RoutingProtocol >',
[param('uint32_t', 'index'), param('int16_t &', 'priority')],
is_const=True, is_virtual=True)
## ipv4-list-routing-impl.h: ns3::Ptr<ns3::Ipv4StaticRouting> ns3::Ipv4ListRoutingImpl::GetStaticRouting() const [member function]
cls.add_method('GetStaticRouting',
'ns3::Ptr< ns3::Ipv4StaticRouting >',
[],
is_const=True, is_virtual=True)
## ipv4-list-routing-impl.h: void ns3::Ipv4ListRoutingImpl::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')])
## ipv4-list-routing-impl.h: ns3::Ptr<ns3::Node> ns3::Ipv4ListRoutingImpl::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_const=True)
## ipv4-list-routing-impl.h: void ns3::Ipv4ListRoutingImpl::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_functions(root_module):
module = root_module
## internet-stack.h: extern void ns3::AddInternetStack(ns3::Ptr<ns3::Node> node) [free function]
module.add_function('AddInternetStack',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')])
## internet-stack.h: extern void ns3::AddNscInternetStack(ns3::Ptr<ns3::Node> node, std::string const & soname) [free function]
module.add_function('AddNscInternetStack',
'void',
[param('ns3::Ptr< ns3::Node >', 'node'), param('std::string const &', 'soname')])
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -585,6 +771,9 @@ def register_functions_ns3_Config(module, root_module):
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
@@ -62,6 +62,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -82,6 +88,10 @@ def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -748,6 +758,7 @@ def register_functions(root_module):
[])
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -758,6 +769,9 @@ def register_functions_ns3_Config(module, root_module):
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
@@ -29,10 +29,10 @@ def register_types(module):
module.add_enum('InterfaceAddressScope_e', ['HOST', 'LINK', 'GLOBAL'], outer_class=root_module['ns3::Ipv4InterfaceAddress'])
## ipv4-address.h: ns3::Ipv4Mask [class]
module.add_class('Ipv4Mask')
## ipv4-route.h: ns3::Ipv4MulticastRoute [class]
module.add_class('Ipv4MulticastRoute')
## ipv4-route.h: ns3::Ipv4Route [class]
module.add_class('Ipv4Route')
## ipv4-routing-table-entry.h: ns3::Ipv4MulticastRoutingTableEntry [class]
module.add_class('Ipv4MulticastRoutingTableEntry')
## ipv4-routing-table-entry.h: ns3::Ipv4RoutingTableEntry [class]
module.add_class('Ipv4RoutingTableEntry')
## ipv6-address.h: ns3::Ipv6Address [class]
module.add_class('Ipv6Address')
## ipv6-address.h: ns3::Ipv6Address [class]
@@ -63,6 +63,10 @@ def register_types(module):
module.add_class('Ipv4MaskChecker', parent=root_module['ns3::AttributeChecker'])
## ipv4-address.h: ns3::Ipv4MaskValue [class]
module.add_class('Ipv4MaskValue', parent=root_module['ns3::AttributeValue'])
## ipv4-route.h: ns3::Ipv4MulticastRoute [class]
module.add_class('Ipv4MulticastRoute', parent=root_module['ns3::RefCountBase'])
## ipv4-route.h: ns3::Ipv4Route [class]
module.add_class('Ipv4Route', parent=root_module['ns3::RefCountBase'])
## ipv6-address.h: ns3::Ipv6AddressChecker [class]
module.add_class('Ipv6AddressChecker', parent=root_module['ns3::AttributeChecker'])
## ipv6-address.h: ns3::Ipv6AddressValue [class]
@@ -123,8 +127,10 @@ def register_types(module):
module.add_class('Ipv4', parent=root_module['ns3::Object'])
## ipv4-raw-socket-factory.h: ns3::Ipv4RawSocketFactory [class]
module.add_class('Ipv4RawSocketFactory', parent=root_module['ns3::SocketFactory'])
## ipv4.h: ns3::Ipv4RoutingProtocol [class]
## ipv4-routing-protocol.h: ns3::Ipv4RoutingProtocol [class]
module.add_class('Ipv4RoutingProtocol', parent=root_module['ns3::Object'])
## ipv4-static-routing.h: ns3::Ipv4StaticRouting [class]
module.add_class('Ipv4StaticRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
## net-device.h: ns3::NetDevice [class]
module.add_class('NetDevice', parent=root_module['ns3::Object'])
## net-device.h: ns3::NetDevice::PacketType [enumeration]
@@ -137,6 +143,8 @@ def register_types(module):
module.add_class('SimpleChannel', parent=root_module['ns3::Channel'])
## simple-net-device.h: ns3::SimpleNetDevice [class]
module.add_class('SimpleNetDevice', parent=root_module['ns3::NetDevice'])
## ipv4-list-routing.h: ns3::Ipv4ListRouting [class]
module.add_class('Ipv4ListRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
module.add_container('ns3::olsr::MprSet', 'ns3::Ipv4Address', container_type='set')
module.add_container('std::vector< ns3::Ipv4Address >', 'ns3::Ipv4Address', container_type='vector')
@@ -152,6 +160,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -172,6 +186,10 @@ def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -188,8 +206,8 @@ def register_methods(root_module):
register_Ns3Ipv4AddressGenerator_methods(root_module, root_module['ns3::Ipv4AddressGenerator'])
register_Ns3Ipv4InterfaceAddress_methods(root_module, root_module['ns3::Ipv4InterfaceAddress'])
register_Ns3Ipv4Mask_methods(root_module, root_module['ns3::Ipv4Mask'])
register_Ns3Ipv4MulticastRoute_methods(root_module, root_module['ns3::Ipv4MulticastRoute'])
register_Ns3Ipv4Route_methods(root_module, root_module['ns3::Ipv4Route'])
register_Ns3Ipv4MulticastRoutingTableEntry_methods(root_module, root_module['ns3::Ipv4MulticastRoutingTableEntry'])
register_Ns3Ipv4RoutingTableEntry_methods(root_module, root_module['ns3::Ipv4RoutingTableEntry'])
register_Ns3Ipv6Address_methods(root_module, root_module['ns3::Ipv6Address'])
register_Ns3Ipv6Prefix_methods(root_module, root_module['ns3::Ipv6Prefix'])
register_Ns3Mac48Address_methods(root_module, root_module['ns3::Mac48Address'])
@@ -201,6 +219,8 @@ def register_methods(root_module):
register_Ns3Ipv4Header_methods(root_module, root_module['ns3::Ipv4Header'])
register_Ns3Ipv4MaskChecker_methods(root_module, root_module['ns3::Ipv4MaskChecker'])
register_Ns3Ipv4MaskValue_methods(root_module, root_module['ns3::Ipv4MaskValue'])
register_Ns3Ipv4MulticastRoute_methods(root_module, root_module['ns3::Ipv4MulticastRoute'])
register_Ns3Ipv4Route_methods(root_module, root_module['ns3::Ipv4Route'])
register_Ns3Ipv6AddressChecker_methods(root_module, root_module['ns3::Ipv6AddressChecker'])
register_Ns3Ipv6AddressValue_methods(root_module, root_module['ns3::Ipv6AddressValue'])
register_Ns3Ipv6Header_methods(root_module, root_module['ns3::Ipv6Header'])
@@ -229,11 +249,13 @@ def register_methods(root_module):
register_Ns3Ipv4_methods(root_module, root_module['ns3::Ipv4'])
register_Ns3Ipv4RawSocketFactory_methods(root_module, root_module['ns3::Ipv4RawSocketFactory'])
register_Ns3Ipv4RoutingProtocol_methods(root_module, root_module['ns3::Ipv4RoutingProtocol'])
register_Ns3Ipv4StaticRouting_methods(root_module, root_module['ns3::Ipv4StaticRouting'])
register_Ns3NetDevice_methods(root_module, root_module['ns3::NetDevice'])
register_Ns3Node_methods(root_module, root_module['ns3::Node'])
register_Ns3PacketSocketFactory_methods(root_module, root_module['ns3::PacketSocketFactory'])
register_Ns3SimpleChannel_methods(root_module, root_module['ns3::SimpleChannel'])
register_Ns3SimpleNetDevice_methods(root_module, root_module['ns3::SimpleNetDevice'])
register_Ns3Ipv4ListRouting_methods(root_module, root_module['ns3::Ipv4ListRouting'])
return
def register_Ns3Address_methods(root_module, cls):
@@ -664,125 +686,125 @@ def register_Ns3Ipv4Mask_methods(root_module, cls):
[param('uint32_t', 'mask')])
return
def register_Ns3Ipv4MulticastRoute_methods(root_module, cls):
def register_Ns3Ipv4MulticastRoutingTableEntry_methods(root_module, cls):
cls.add_output_stream_operator()
## ipv4-route.h: ns3::Ipv4MulticastRoute::Ipv4MulticastRoute() [constructor]
## ipv4-routing-table-entry.h: ns3::Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry() [constructor]
cls.add_constructor([])
## ipv4-route.h: ns3::Ipv4MulticastRoute::Ipv4MulticastRoute(ns3::Ipv4MulticastRoute const & route) [copy constructor]
cls.add_constructor([param('ns3::Ipv4MulticastRoute const &', 'route')])
## ipv4-route.h: ns3::Ipv4MulticastRoute::Ipv4MulticastRoute(ns3::Ipv4MulticastRoute const * route) [constructor]
cls.add_constructor([param('ns3::Ipv4MulticastRoute const *', 'route')])
## ipv4-route.h: static ns3::Ipv4MulticastRoute ns3::Ipv4MulticastRoute::CreateMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface, std::vector<unsigned int, std::allocator<unsigned int> > outputInterfaces) [member function]
## ipv4-routing-table-entry.h: ns3::Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry(ns3::Ipv4MulticastRoutingTableEntry const & route) [copy constructor]
cls.add_constructor([param('ns3::Ipv4MulticastRoutingTableEntry const &', 'route')])
## ipv4-routing-table-entry.h: ns3::Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry(ns3::Ipv4MulticastRoutingTableEntry const * route) [constructor]
cls.add_constructor([param('ns3::Ipv4MulticastRoutingTableEntry const *', 'route')])
## ipv4-routing-table-entry.h: static ns3::Ipv4MulticastRoutingTableEntry ns3::Ipv4MulticastRoutingTableEntry::CreateMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface, std::vector<unsigned int, std::allocator<unsigned int> > outputInterfaces) [member function]
cls.add_method('CreateMulticastRoute',
'ns3::Ipv4MulticastRoute',
'ns3::Ipv4MulticastRoutingTableEntry',
[param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group'), param('uint32_t', 'inputInterface'), param('std::vector< unsigned int >', 'outputInterfaces')],
is_static=True)
## ipv4-route.h: ns3::Ipv4Address ns3::Ipv4MulticastRoute::GetGroup() const [member function]
## ipv4-routing-table-entry.h: ns3::Ipv4Address ns3::Ipv4MulticastRoutingTableEntry::GetGroup() const [member function]
cls.add_method('GetGroup',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h: uint32_t ns3::Ipv4MulticastRoute::GetInputInterface() const [member function]
## ipv4-routing-table-entry.h: uint32_t ns3::Ipv4MulticastRoutingTableEntry::GetInputInterface() const [member function]
cls.add_method('GetInputInterface',
'uint32_t',
[],
is_const=True)
## ipv4-route.h: uint32_t ns3::Ipv4MulticastRoute::GetNOutputInterfaces() const [member function]
## ipv4-routing-table-entry.h: uint32_t ns3::Ipv4MulticastRoutingTableEntry::GetNOutputInterfaces() const [member function]
cls.add_method('GetNOutputInterfaces',
'uint32_t',
[],
is_const=True)
## ipv4-route.h: ns3::Ipv4Address ns3::Ipv4MulticastRoute::GetOrigin() const [member function]
## ipv4-routing-table-entry.h: ns3::Ipv4Address ns3::Ipv4MulticastRoutingTableEntry::GetOrigin() const [member function]
cls.add_method('GetOrigin',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h: uint32_t ns3::Ipv4MulticastRoute::GetOutputInterface(uint32_t n) const [member function]
## ipv4-routing-table-entry.h: uint32_t ns3::Ipv4MulticastRoutingTableEntry::GetOutputInterface(uint32_t n) const [member function]
cls.add_method('GetOutputInterface',
'uint32_t',
[param('uint32_t', 'n')],
is_const=True)
## ipv4-route.h: std::vector<unsigned int, std::allocator<unsigned int> > ns3::Ipv4MulticastRoute::GetOutputInterfaces() const [member function]
## ipv4-routing-table-entry.h: std::vector<unsigned int, std::allocator<unsigned int> > ns3::Ipv4MulticastRoutingTableEntry::GetOutputInterfaces() const [member function]
cls.add_method('GetOutputInterfaces',
'std::vector< unsigned int >',
[],
is_const=True)
return
def register_Ns3Ipv4Route_methods(root_module, cls):
def register_Ns3Ipv4RoutingTableEntry_methods(root_module, cls):
cls.add_output_stream_operator()
## ipv4-route.h: ns3::Ipv4Route::Ipv4Route() [constructor]
## ipv4-routing-table-entry.h: ns3::Ipv4RoutingTableEntry::Ipv4RoutingTableEntry() [constructor]
cls.add_constructor([])
## ipv4-route.h: ns3::Ipv4Route::Ipv4Route(ns3::Ipv4Route const & route) [copy constructor]
cls.add_constructor([param('ns3::Ipv4Route const &', 'route')])
## ipv4-route.h: ns3::Ipv4Route::Ipv4Route(ns3::Ipv4Route const * route) [constructor]
cls.add_constructor([param('ns3::Ipv4Route const *', 'route')])
## ipv4-route.h: static ns3::Ipv4Route ns3::Ipv4Route::CreateDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface) [member function]
## ipv4-routing-table-entry.h: ns3::Ipv4RoutingTableEntry::Ipv4RoutingTableEntry(ns3::Ipv4RoutingTableEntry const & route) [copy constructor]
cls.add_constructor([param('ns3::Ipv4RoutingTableEntry const &', 'route')])
## ipv4-routing-table-entry.h: ns3::Ipv4RoutingTableEntry::Ipv4RoutingTableEntry(ns3::Ipv4RoutingTableEntry const * route) [constructor]
cls.add_constructor([param('ns3::Ipv4RoutingTableEntry const *', 'route')])
## ipv4-routing-table-entry.h: static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface) [member function]
cls.add_method('CreateDefaultRoute',
'ns3::Ipv4Route',
'ns3::Ipv4RoutingTableEntry',
[param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
is_static=True)
## ipv4-route.h: static ns3::Ipv4Route ns3::Ipv4Route::CreateHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
## ipv4-routing-table-entry.h: static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
cls.add_method('CreateHostRouteTo',
'ns3::Ipv4Route',
'ns3::Ipv4RoutingTableEntry',
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
is_static=True)
## ipv4-route.h: static ns3::Ipv4Route ns3::Ipv4Route::CreateHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
## ipv4-routing-table-entry.h: static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
cls.add_method('CreateHostRouteTo',
'ns3::Ipv4Route',
'ns3::Ipv4RoutingTableEntry',
[param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')],
is_static=True)
## ipv4-route.h: static ns3::Ipv4Route ns3::Ipv4Route::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
## ipv4-routing-table-entry.h: static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
cls.add_method('CreateNetworkRouteTo',
'ns3::Ipv4Route',
'ns3::Ipv4RoutingTableEntry',
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
is_static=True)
## ipv4-route.h: static ns3::Ipv4Route ns3::Ipv4Route::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function]
## ipv4-routing-table-entry.h: static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function]
cls.add_method('CreateNetworkRouteTo',
'ns3::Ipv4Route',
'ns3::Ipv4RoutingTableEntry',
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')],
is_static=True)
## ipv4-route.h: ns3::Ipv4Address ns3::Ipv4Route::GetDest() const [member function]
## ipv4-routing-table-entry.h: ns3::Ipv4Address ns3::Ipv4RoutingTableEntry::GetDest() const [member function]
cls.add_method('GetDest',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h: ns3::Ipv4Address ns3::Ipv4Route::GetDestNetwork() const [member function]
## ipv4-routing-table-entry.h: ns3::Ipv4Address ns3::Ipv4RoutingTableEntry::GetDestNetwork() const [member function]
cls.add_method('GetDestNetwork',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h: ns3::Ipv4Mask ns3::Ipv4Route::GetDestNetworkMask() const [member function]
## ipv4-routing-table-entry.h: ns3::Ipv4Mask ns3::Ipv4RoutingTableEntry::GetDestNetworkMask() const [member function]
cls.add_method('GetDestNetworkMask',
'ns3::Ipv4Mask',
[],
is_const=True)
## ipv4-route.h: ns3::Ipv4Address ns3::Ipv4Route::GetGateway() const [member function]
## ipv4-routing-table-entry.h: ns3::Ipv4Address ns3::Ipv4RoutingTableEntry::GetGateway() const [member function]
cls.add_method('GetGateway',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h: uint32_t ns3::Ipv4Route::GetInterface() const [member function]
## ipv4-routing-table-entry.h: uint32_t ns3::Ipv4RoutingTableEntry::GetInterface() const [member function]
cls.add_method('GetInterface',
'uint32_t',
[],
is_const=True)
## ipv4-route.h: bool ns3::Ipv4Route::IsDefault() const [member function]
## ipv4-routing-table-entry.h: bool ns3::Ipv4RoutingTableEntry::IsDefault() const [member function]
cls.add_method('IsDefault',
'bool',
[],
is_const=True)
## ipv4-route.h: bool ns3::Ipv4Route::IsGateway() const [member function]
## ipv4-routing-table-entry.h: bool ns3::Ipv4RoutingTableEntry::IsGateway() const [member function]
cls.add_method('IsGateway',
'bool',
[],
is_const=True)
## ipv4-route.h: bool ns3::Ipv4Route::IsHost() const [member function]
## ipv4-routing-table-entry.h: bool ns3::Ipv4RoutingTableEntry::IsHost() const [member function]
cls.add_method('IsHost',
'bool',
[],
is_const=True)
## ipv4-route.h: bool ns3::Ipv4Route::IsNetwork() const [member function]
## ipv4-routing-table-entry.h: bool ns3::Ipv4RoutingTableEntry::IsNetwork() const [member function]
cls.add_method('IsNetwork',
'bool',
[],
@@ -1403,6 +1425,97 @@ def register_Ns3Ipv4MaskValue_methods(root_module, cls):
is_virtual=True)
return
def register_Ns3Ipv4MulticastRoute_methods(root_module, cls):
## ipv4-route.h: ns3::Ipv4MulticastRoute::MAX_INTERFACES [variable]
cls.add_static_attribute('MAX_INTERFACES', 'uint32_t const', is_const=True)
## ipv4-route.h: ns3::Ipv4MulticastRoute::MAX_TTL [variable]
cls.add_static_attribute('MAX_TTL', 'uint32_t const', is_const=True)
## ipv4-route.h: ns3::Ipv4MulticastRoute::Ipv4MulticastRoute(ns3::Ipv4MulticastRoute const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4MulticastRoute const &', 'arg0')])
## ipv4-route.h: ns3::Ipv4MulticastRoute::Ipv4MulticastRoute() [constructor]
cls.add_constructor([])
## ipv4-route.h: void ns3::Ipv4MulticastRoute::SetGroup(ns3::Ipv4Address const group) [member function]
cls.add_method('SetGroup',
'void',
[param('ns3::Ipv4Address const', 'group')])
## ipv4-route.h: ns3::Ipv4Address ns3::Ipv4MulticastRoute::GetGroup() const [member function]
cls.add_method('GetGroup',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h: void ns3::Ipv4MulticastRoute::SetOrigin(ns3::Ipv4Address const group) [member function]
cls.add_method('SetOrigin',
'void',
[param('ns3::Ipv4Address const', 'group')])
## ipv4-route.h: ns3::Ipv4Address ns3::Ipv4MulticastRoute::GetOrigin() const [member function]
cls.add_method('GetOrigin',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h: void ns3::Ipv4MulticastRoute::SetParent(uint32_t iif) [member function]
cls.add_method('SetParent',
'void',
[param('uint32_t', 'iif')])
## ipv4-route.h: uint32_t ns3::Ipv4MulticastRoute::GetParent() const [member function]
cls.add_method('GetParent',
'uint32_t',
[],
is_const=True)
## ipv4-route.h: void ns3::Ipv4MulticastRoute::SetOutputTtl(uint32_t oif, uint32_t ttl) [member function]
cls.add_method('SetOutputTtl',
'void',
[param('uint32_t', 'oif'), param('uint32_t', 'ttl')])
## ipv4-route.h: uint32_t ns3::Ipv4MulticastRoute::GetOutputTtl(uint32_t oif) const [member function]
cls.add_method('GetOutputTtl',
'uint32_t',
[param('uint32_t', 'oif')],
is_const=True)
return
def register_Ns3Ipv4Route_methods(root_module, cls):
cls.add_output_stream_operator()
## ipv4-route.h: ns3::Ipv4Route::Ipv4Route(ns3::Ipv4Route const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4Route const &', 'arg0')])
## ipv4-route.h: ns3::Ipv4Route::Ipv4Route() [constructor]
cls.add_constructor([])
## ipv4-route.h: ns3::Ipv4Address ns3::Ipv4Route::GetDestination() const [member function]
cls.add_method('GetDestination',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h: ns3::Ipv4Address ns3::Ipv4Route::GetGateway() const [member function]
cls.add_method('GetGateway',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h: ns3::Ptr<ns3::NetDevice> ns3::Ipv4Route::GetOutputDevice() const [member function]
cls.add_method('GetOutputDevice',
'ns3::Ptr< ns3::NetDevice >',
[],
is_const=True)
## ipv4-route.h: ns3::Ipv4Address ns3::Ipv4Route::GetSource() const [member function]
cls.add_method('GetSource',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h: void ns3::Ipv4Route::SetDestination(ns3::Ipv4Address dest) [member function]
cls.add_method('SetDestination',
'void',
[param('ns3::Ipv4Address', 'dest')])
## ipv4-route.h: void ns3::Ipv4Route::SetGateway(ns3::Ipv4Address gw) [member function]
cls.add_method('SetGateway',
'void',
[param('ns3::Ipv4Address', 'gw')])
## ipv4-route.h: void ns3::Ipv4Route::SetOutputDevice(ns3::Ptr<ns3::NetDevice> outputDevice) [member function]
cls.add_method('SetOutputDevice',
'void',
[param('ns3::Ptr< ns3::NetDevice >', 'outputDevice')])
## ipv4-route.h: void ns3::Ipv4Route::SetSource(ns3::Ipv4Address src) [member function]
cls.add_method('SetSource',
'void',
[param('ns3::Ipv4Address', 'src')])
return
def register_Ns3Ipv6AddressChecker_methods(root_module, cls):
## ipv6-address.h: ns3::Ipv6AddressChecker::Ipv6AddressChecker(ns3::Ipv6AddressChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv6AddressChecker const &', 'arg0')])
@@ -2219,6 +2332,16 @@ def register_Ns3UdpSocket_methods(root_module, cls):
is_static=True)
## udp-socket.h: ns3::UdpSocket::UdpSocket() [constructor]
cls.add_constructor([])
## udp-socket.h: int ns3::UdpSocket::MulticastJoinGroup(uint32_t interface, ns3::Address const & groupAddress) [member function]
cls.add_method('MulticastJoinGroup',
'int',
[param('uint32_t', 'interface'), param('ns3::Address const &', 'groupAddress')],
is_pure_virtual=True, is_virtual=True)
## udp-socket.h: int ns3::UdpSocket::MulticastLeaveGroup(uint32_t interface, ns3::Address const & groupAddress) [member function]
cls.add_method('MulticastLeaveGroup',
'int',
[param('uint32_t', 'interface'), param('ns3::Address const &', 'groupAddress')],
is_pure_virtual=True, is_virtual=True)
## udp-socket.h: void ns3::UdpSocket::SetRcvBufSize(uint32_t size) [member function]
cls.add_method('SetRcvBufSize',
'void',
@@ -2229,24 +2352,44 @@ def register_Ns3UdpSocket_methods(root_module, cls):
'uint32_t',
[],
is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
## udp-socket.h: void ns3::UdpSocket::SetIpTtl(uint32_t ipTtl) [member function]
## udp-socket.h: void ns3::UdpSocket::SetIpTtl(uint8_t ipTtl) [member function]
cls.add_method('SetIpTtl',
'void',
[param('uint32_t', 'ipTtl')],
[param('uint8_t', 'ipTtl')],
is_pure_virtual=True, visibility='private', is_virtual=True)
## udp-socket.h: uint32_t ns3::UdpSocket::GetIpTtl() const [member function]
## udp-socket.h: uint8_t ns3::UdpSocket::GetIpTtl() const [member function]
cls.add_method('GetIpTtl',
'uint32_t',
'uint8_t',
[],
is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
## udp-socket.h: void ns3::UdpSocket::SetIpMulticastTtl(uint32_t ipTtl) [member function]
## udp-socket.h: void ns3::UdpSocket::SetIpMulticastTtl(uint8_t ipTtl) [member function]
cls.add_method('SetIpMulticastTtl',
'void',
[param('uint32_t', 'ipTtl')],
[param('uint8_t', 'ipTtl')],
is_pure_virtual=True, visibility='private', is_virtual=True)
## udp-socket.h: uint32_t ns3::UdpSocket::GetIpMulticastTtl() const [member function]
## udp-socket.h: uint8_t ns3::UdpSocket::GetIpMulticastTtl() const [member function]
cls.add_method('GetIpMulticastTtl',
'uint32_t',
'uint8_t',
[],
is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
## udp-socket.h: void ns3::UdpSocket::SetIpMulticastIf(int32_t ipIf) [member function]
cls.add_method('SetIpMulticastIf',
'void',
[param('int32_t', 'ipIf')],
is_pure_virtual=True, visibility='private', is_virtual=True)
## udp-socket.h: int32_t ns3::UdpSocket::GetIpMulticastIf() const [member function]
cls.add_method('GetIpMulticastIf',
'int32_t',
[],
is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
## udp-socket.h: void ns3::UdpSocket::SetIpMulticastLoop(bool loop) [member function]
cls.add_method('SetIpMulticastLoop',
'void',
[param('bool', 'loop')],
is_pure_virtual=True, visibility='private', is_virtual=True)
## udp-socket.h: bool ns3::UdpSocket::GetIpMulticastLoop() const [member function]
cls.add_method('GetIpMulticastLoop',
'bool',
[],
is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
## udp-socket.h: void ns3::UdpSocket::SetMtuDiscover(bool discover) [member function]
@@ -2572,6 +2715,8 @@ def register_Ns3EthernetTrailer_methods(root_module, cls):
return
def register_Ns3Ipv4_methods(root_module, cls):
## ipv4.h: ns3::Ipv4::IF_ANY [variable]
cls.add_static_attribute('IF_ANY', 'uint32_t const', is_const=True)
## ipv4.h: ns3::Ipv4::Ipv4(ns3::Ipv4 const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4 const &', 'arg0')])
## ipv4.h: static ns3::TypeId ns3::Ipv4::GetTypeId() [member function]
@@ -2581,81 +2726,16 @@ def register_Ns3Ipv4_methods(root_module, cls):
is_static=True)
## ipv4.h: ns3::Ipv4::Ipv4() [constructor]
cls.add_constructor([])
## ipv4.h: void ns3::Ipv4::AddRoutingProtocol(ns3::Ptr<ns3::Ipv4RoutingProtocol> routingProtocol, int16_t priority) [member function]
cls.add_method('AddRoutingProtocol',
## ipv4.h: void ns3::Ipv4::SetRoutingProtocol(ns3::Ptr<ns3::Ipv4RoutingProtocol> routingProtocol) [member function]
cls.add_method('SetRoutingProtocol',
'void',
[param('ns3::Ptr< ns3::Ipv4RoutingProtocol >', 'routingProtocol'), param('int16_t', 'priority')],
[param('ns3::Ptr< ns3::Ipv4RoutingProtocol >', 'routingProtocol')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h: void ns3::Ipv4::AddHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
cls.add_method('AddHostRouteTo',
'void',
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h: void ns3::Ipv4::AddHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
cls.add_method('AddHostRouteTo',
'void',
[param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h: void ns3::Ipv4::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
cls.add_method('AddNetworkRouteTo',
'void',
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h: void ns3::Ipv4::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function]
cls.add_method('AddNetworkRouteTo',
'void',
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h: void ns3::Ipv4::SetDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface) [member function]
cls.add_method('SetDefaultRoute',
'void',
[param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h: uint32_t ns3::Ipv4::GetNRoutes() [member function]
cls.add_method('GetNRoutes',
'uint32_t',
[],
is_pure_virtual=True, is_virtual=True)
## ipv4.h: ns3::Ipv4Route ns3::Ipv4::GetRoute(uint32_t i) [member function]
cls.add_method('GetRoute',
'ns3::Ipv4Route',
[param('uint32_t', 'i')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h: void ns3::Ipv4::RemoveRoute(uint32_t i) [member function]
cls.add_method('RemoveRoute',
'void',
[param('uint32_t', 'i')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h: void ns3::Ipv4::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')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h: void ns3::Ipv4::RemoveMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface) [member function]
cls.add_method('RemoveMulticastRoute',
'void',
[param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group'), param('uint32_t', 'inputInterface')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h: void ns3::Ipv4::SetDefaultMulticastRoute(uint32_t outputInterface) [member function]
cls.add_method('SetDefaultMulticastRoute',
'void',
[param('uint32_t', 'outputInterface')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h: uint32_t ns3::Ipv4::GetNMulticastRoutes() const [member function]
cls.add_method('GetNMulticastRoutes',
'uint32_t',
## ipv4.h: ns3::Ptr<ns3::Ipv4RoutingProtocol> ns3::Ipv4::GetRoutingProtocol() const [member function]
cls.add_method('GetRoutingProtocol',
'ns3::Ptr< ns3::Ipv4RoutingProtocol >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h: ns3::Ipv4MulticastRoute ns3::Ipv4::GetMulticastRoute(uint32_t i) const [member function]
cls.add_method('GetMulticastRoute',
'ns3::Ipv4MulticastRoute',
[param('uint32_t', 'i')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h: void ns3::Ipv4::RemoveMulticastRoute(uint32_t i) [member function]
cls.add_method('RemoveMulticastRoute',
'void',
[param('uint32_t', 'i')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h: uint32_t ns3::Ipv4::AddInterface(ns3::Ptr<ns3::NetDevice> device) [member function]
cls.add_method('AddInterface',
'uint32_t',
@@ -2666,36 +2746,26 @@ def register_Ns3Ipv4_methods(root_module, cls):
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h: uint32_t ns3::Ipv4::FindInterfaceForAddr(ns3::Ipv4Address addr) const [member function]
cls.add_method('FindInterfaceForAddr',
'uint32_t',
[param('ns3::Ipv4Address', 'addr')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h: uint32_t ns3::Ipv4::FindInterfaceForAddr(ns3::Ipv4Address addr, ns3::Ipv4Mask mask) const [member function]
cls.add_method('FindInterfaceForAddr',
'uint32_t',
[param('ns3::Ipv4Address', 'addr'), param('ns3::Ipv4Mask', 'mask')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h: int32_t ns3::Ipv4::FindInterfaceForDevice(ns3::Ptr<ns3::NetDevice> nd) const [member function]
cls.add_method('FindInterfaceForDevice',
## ipv4.h: int32_t ns3::Ipv4::GetInterfaceForAddress(ns3::Ipv4Address address) const [member function]
cls.add_method('GetInterfaceForAddress',
'int32_t',
[param('ns3::Ptr< ns3::NetDevice >', 'nd')],
[param('ns3::Ipv4Address', 'address')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h: ns3::Ptr<ns3::NetDevice> ns3::Ipv4::GetNetDevice(uint32_t i) [member function]
## ipv4.h: int32_t ns3::Ipv4::GetInterfaceForPrefix(ns3::Ipv4Address address, ns3::Ipv4Mask mask) const [member function]
cls.add_method('GetInterfaceForPrefix',
'int32_t',
[param('ns3::Ipv4Address', 'address'), param('ns3::Ipv4Mask', 'mask')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h: ns3::Ptr<ns3::NetDevice> ns3::Ipv4::GetNetDevice(uint32_t interface) [member function]
cls.add_method('GetNetDevice',
'ns3::Ptr< ns3::NetDevice >',
[param('uint32_t', 'i')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h: void ns3::Ipv4::JoinMulticastGroup(ns3::Ipv4Address origin, ns3::Ipv4Address group) [member function]
cls.add_method('JoinMulticastGroup',
'void',
[param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h: void ns3::Ipv4::LeaveMulticastGroup(ns3::Ipv4Address origin, ns3::Ipv4Address group) [member function]
cls.add_method('LeaveMulticastGroup',
'void',
[param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group')],
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h: int32_t ns3::Ipv4::GetInterfaceForDevice(ns3::Ptr<const ns3::NetDevice> device) const [member function]
cls.add_method('GetInterfaceForDevice',
'int32_t',
[param('ns3::Ptr< ns3::NetDevice const >', 'device')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h: uint32_t ns3::Ipv4::AddAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
cls.add_method('AddAddress',
'uint32_t',
@@ -2711,51 +2781,46 @@ def register_Ns3Ipv4_methods(root_module, cls):
'ns3::Ipv4InterfaceAddress',
[param('uint32_t', 'interface'), param('uint32_t', 'addressIndex')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h: void ns3::Ipv4::SetMetric(uint32_t i, uint16_t metric) [member function]
## ipv4.h: void ns3::Ipv4::SetMetric(uint32_t interface, uint16_t metric) [member function]
cls.add_method('SetMetric',
'void',
[param('uint32_t', 'i'), param('uint16_t', 'metric')],
[param('uint32_t', 'interface'), param('uint16_t', 'metric')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h: uint16_t ns3::Ipv4::GetMetric(uint32_t i) const [member function]
## ipv4.h: uint16_t ns3::Ipv4::GetMetric(uint32_t interface) const [member function]
cls.add_method('GetMetric',
'uint16_t',
[param('uint32_t', 'i')],
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h: ns3::Ipv4Address ns3::Ipv4::GetSourceAddress(ns3::Ipv4Address destination) const [member function]
cls.add_method('GetSourceAddress',
'ns3::Ipv4Address',
[param('ns3::Ipv4Address', 'destination')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h: bool ns3::Ipv4::GetInterfaceForDestination(ns3::Ipv4Address dest, uint32_t & interface) const [member function]
cls.add_method('GetInterfaceForDestination',
'bool',
[param('ns3::Ipv4Address', 'dest'), param('uint32_t &', 'interface')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h: uint16_t ns3::Ipv4::GetMtu(uint32_t i) const [member function]
## ipv4.h: uint16_t ns3::Ipv4::GetMtu(uint32_t interface) const [member function]
cls.add_method('GetMtu',
'uint16_t',
[param('uint32_t', 'i')],
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h: bool ns3::Ipv4::IsUp(uint32_t i) const [member function]
## ipv4.h: bool ns3::Ipv4::IsUp(uint32_t interface) const [member function]
cls.add_method('IsUp',
'bool',
[param('uint32_t', 'i')],
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h: void ns3::Ipv4::SetUp(uint32_t i) [member function]
## ipv4.h: void ns3::Ipv4::SetUp(uint32_t interface) [member function]
cls.add_method('SetUp',
'void',
[param('uint32_t', 'i')],
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h: void ns3::Ipv4::SetDown(uint32_t i) [member function]
## ipv4.h: void ns3::Ipv4::SetDown(uint32_t interface) [member function]
cls.add_method('SetDown',
'void',
[param('uint32_t', 'i')],
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h: uint32_t ns3::Ipv4::GetInterfaceByAddress(ns3::Ipv4Address addr, ns3::Ipv4Mask mask=ns3::Ipv4Mask(((const char*)"255.255.255.255"))) [member function]
cls.add_method('GetInterfaceByAddress',
'uint32_t',
[param('ns3::Ipv4Address', 'addr'), param('ns3::Ipv4Mask', 'mask', default_value='ns3::Ipv4Mask(((const char*)"255.255.255.255"))')],
is_virtual=True)
## ipv4.h: void ns3::Ipv4::SetIpForward(bool forward) [member function]
cls.add_method('SetIpForward',
'void',
[param('bool', 'forward')],
is_pure_virtual=True, visibility='private', is_virtual=True)
## ipv4.h: bool ns3::Ipv4::GetIpForward() const [member function]
cls.add_method('GetIpForward',
'bool',
[],
is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
return
def register_Ns3Ipv4RawSocketFactory_methods(root_module, cls):
@@ -2771,24 +2836,124 @@ def register_Ns3Ipv4RawSocketFactory_methods(root_module, cls):
return
def register_Ns3Ipv4RoutingProtocol_methods(root_module, cls):
## ipv4.h: ns3::Ipv4RoutingProtocol::INTERFACE_ANY [variable]
cls.add_static_attribute('INTERFACE_ANY', 'uint32_t const', is_const=True)
## ipv4.h: ns3::Ipv4RoutingProtocol::Ipv4RoutingProtocol(ns3::Ipv4RoutingProtocol const & arg0) [copy constructor]
## ipv4-routing-protocol.h: ns3::Ipv4RoutingProtocol::Ipv4RoutingProtocol(ns3::Ipv4RoutingProtocol const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4RoutingProtocol const &', 'arg0')])
## ipv4.h: ns3::Ipv4RoutingProtocol::Ipv4RoutingProtocol() [constructor]
## ipv4-routing-protocol.h: ns3::Ipv4RoutingProtocol::Ipv4RoutingProtocol() [constructor]
cls.add_constructor([])
## ipv4.h: bool ns3::Ipv4RoutingProtocol::RequestRoute(uint32_t interface, ns3::Ipv4Header const & ipHeader, ns3::Ptr<ns3::Packet> packet, ns3::Callback<void,bool,const ns3::Ipv4Route&,ns3::Ptr<ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> routeReply) [member function]
cls.add_method('RequestRoute',
'bool',
[param('uint32_t', 'interface'), param('ns3::Ipv4Header const &', 'ipHeader'), param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Callback< void, bool, ns3::Ipv4Route const &, ns3::Ptr< ns3::Packet >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'routeReply')],
## ipv4-routing-protocol.h: static ns3::TypeId ns3::Ipv4RoutingProtocol::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ipv4-routing-protocol.h: ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4RoutingProtocol::RouteOutput(ns3::Ipv4Header const & header, uint32_t oif, ns3::Socket::SocketErrno & sockerr) [member function]
cls.add_method('RouteOutput',
'ns3::Ptr< ns3::Ipv4Route >',
[param('ns3::Ipv4Header const &', 'header'), param('uint32_t', 'oif'), param('ns3::Socket::SocketErrno &', 'sockerr')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h: bool ns3::Ipv4RoutingProtocol::RequestInterface(ns3::Ipv4Address destination, uint32_t & interface) [member function]
cls.add_method('RequestInterface',
## ipv4-routing-protocol.h: bool ns3::Ipv4RoutingProtocol::RouteInput(ns3::Ptr<ns3::Packet const> p, ns3::Ipv4Header const & header, ns3::Ptr<const ns3::NetDevice> idev, ns3::Callback<void,ns3::Ptr<ns3::Ipv4Route>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback<void,ns3::Ptr<ns3::Ipv4MulticastRoute>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,unsigned int,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> lcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
cls.add_method('RouteInput',
'bool',
[param('ns3::Ipv4Address', 'destination'), param('uint32_t &', 'interface')],
[param('ns3::Ptr< ns3::Packet const >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice const >', 'idev'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4Route >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ucb'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4MulticastRoute >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'mcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'lcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3Ipv4StaticRouting_methods(root_module, cls):
## ipv4-static-routing.h: ns3::Ipv4StaticRouting::Ipv4StaticRouting(ns3::Ipv4StaticRouting const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4StaticRouting const &', 'arg0')])
## ipv4-static-routing.h: ns3::Ipv4StaticRouting::Ipv4StaticRouting() [constructor]
cls.add_constructor([])
## ipv4-static-routing.h: static ns3::TypeId ns3::Ipv4StaticRouting::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
cls.add_method('AddHostRouteTo',
'void',
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
cls.add_method('AddHostRouteTo',
'void',
[param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
cls.add_method('AddNetworkRouteTo',
'void',
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function]
cls.add_method('AddNetworkRouteTo',
'void',
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::SetDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface) [member function]
cls.add_method('SetDefaultRoute',
'void',
[param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4-static-routing.h: uint32_t ns3::Ipv4StaticRouting::GetNRoutes() [member function]
cls.add_method('GetNRoutes',
'uint32_t',
[],
is_pure_virtual=True, is_virtual=True)
## ipv4-static-routing.h: ns3::Ipv4RoutingTableEntry ns3::Ipv4StaticRouting::GetDefaultRoute() [member function]
cls.add_method('GetDefaultRoute',
'ns3::Ipv4RoutingTableEntry',
[],
is_pure_virtual=True, is_virtual=True)
## ipv4-static-routing.h: ns3::Ipv4RoutingTableEntry ns3::Ipv4StaticRouting::GetRoute(uint32_t i) [member function]
cls.add_method('GetRoute',
'ns3::Ipv4RoutingTableEntry',
[param('uint32_t', 'i')],
is_pure_virtual=True, is_virtual=True)
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::RemoveRoute(uint32_t i) [member function]
cls.add_method('RemoveRoute',
'void',
[param('uint32_t', 'i')],
is_pure_virtual=True, is_virtual=True)
## 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')],
is_pure_virtual=True, is_virtual=True)
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::SetDefaultMulticastRoute(uint32_t outputInterface) [member function]
cls.add_method('SetDefaultMulticastRoute',
'void',
[param('uint32_t', 'outputInterface')],
is_pure_virtual=True, is_virtual=True)
## ipv4-static-routing.h: uint32_t ns3::Ipv4StaticRouting::GetNMulticastRoutes() const [member function]
cls.add_method('GetNMulticastRoutes',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4-static-routing.h: ns3::Ipv4MulticastRoutingTableEntry ns3::Ipv4StaticRouting::GetMulticastRoute(uint32_t i) const [member function]
cls.add_method('GetMulticastRoute',
'ns3::Ipv4MulticastRoutingTableEntry',
[param('uint32_t', 'i')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4-static-routing.h: bool ns3::Ipv4StaticRouting::RemoveMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface) [member function]
cls.add_method('RemoveMulticastRoute',
'bool',
[param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group'), param('uint32_t', 'inputInterface')],
is_pure_virtual=True, is_virtual=True)
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::RemoveMulticastRoute(uint32_t index) [member function]
cls.add_method('RemoveMulticastRoute',
'void',
[param('uint32_t', 'index')],
is_pure_virtual=True, is_virtual=True)
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_pure_virtual=True, is_virtual=True)
## ipv4-static-routing.h: ns3::Ptr<ns3::Node> ns3::Ipv4StaticRouting::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3NetDevice_methods(root_module, cls):
## net-device.h: ns3::NetDevice::NetDevice(ns3::NetDevice const & arg0) [copy constructor]
cls.add_constructor([param('ns3::NetDevice const &', 'arg0')])
@@ -3177,6 +3342,33 @@ def register_Ns3SimpleNetDevice_methods(root_module, cls):
visibility='protected', is_virtual=True)
return
def register_Ns3Ipv4ListRouting_methods(root_module, cls):
## ipv4-list-routing.h: ns3::Ipv4ListRouting::Ipv4ListRouting(ns3::Ipv4ListRouting const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4ListRouting const &', 'arg0')])
## ipv4-list-routing.h: ns3::Ipv4ListRouting::Ipv4ListRouting() [constructor]
cls.add_constructor([])
## ipv4-list-routing.h: static ns3::TypeId ns3::Ipv4ListRouting::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ipv4-list-routing.h: void ns3::Ipv4ListRouting::AddRoutingProtocol(ns3::Ptr<ns3::Ipv4RoutingProtocol> routingProtocol, int16_t priority) [member function]
cls.add_method('AddRoutingProtocol',
'void',
[param('ns3::Ptr< ns3::Ipv4RoutingProtocol >', 'routingProtocol'), param('int16_t', 'priority')],
is_pure_virtual=True, is_virtual=True)
## ipv4-list-routing.h: uint32_t ns3::Ipv4ListRouting::GetNRoutingProtocols() const [member function]
cls.add_method('GetNRoutingProtocols',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4-list-routing.h: ns3::Ptr<ns3::Ipv4RoutingProtocol> ns3::Ipv4ListRouting::GetRoutingProtocol(uint32_t index, int16_t & priority) const [member function]
cls.add_method('GetRoutingProtocol',
'ns3::Ptr< ns3::Ipv4RoutingProtocol >',
[param('uint32_t', 'index'), param('int16_t &', 'priority')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_functions(root_module):
module = root_module
## address.h: extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeAddressChecker() [free function]
@@ -3237,6 +3429,7 @@ def register_functions(root_module):
[param('ns3::Buffer::Iterator &', 'i'), param('ns3::Mac48Address', 'ad')])
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -3247,6 +3440,13 @@ def register_functions_ns3_Config(module, root_module):
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
## address-utils.h: extern bool ns3::addressUtils::IsMulticast(ns3::Address const & ad) [free function]
module.add_function('IsMulticast',
'bool',
[param('ns3::Address const &', 'ad')])
return
def register_functions_ns3_internal(module, root_module):
return

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
@@ -24,6 +24,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -44,6 +50,10 @@ def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -91,6 +101,15 @@ def register_types_ns3_olsr(module):
module.add_class('TwoHopNeighborTuple')
module.add_container('std::vector< ns3::olsr::MessageHeader::Hello::LinkMessage >', 'ns3::olsr::MessageHeader::Hello::LinkMessage', container_type='vector')
module.add_container('std::vector< ns3::olsr::MessageHeader::Hna::Association >', 'ns3::olsr::MessageHeader::Hna::Association', container_type='vector')
typehandlers.add_type_alias('std::vector< ns3::olsr::DuplicateTuple, std::allocator< ns3::olsr::DuplicateTuple > >', 'ns3::olsr::DuplicateSet')
typehandlers.add_type_alias('std::vector< ns3::olsr::TopologyTuple, std::allocator< ns3::olsr::TopologyTuple > >', 'ns3::olsr::TopologySet')
typehandlers.add_type_alias('std::set< ns3::Ipv4Address, std::less< ns3::Ipv4Address >, std::allocator< ns3::Ipv4Address > >', 'ns3::olsr::MprSet')
typehandlers.add_type_alias('std::vector< ns3::olsr::MprSelectorTuple, std::allocator< ns3::olsr::MprSelectorTuple > >', 'ns3::olsr::MprSelectorSet')
typehandlers.add_type_alias('std::vector< ns3::olsr::MessageHeader, std::allocator< ns3::olsr::MessageHeader > >', 'ns3::olsr::MessageList')
typehandlers.add_type_alias('std::vector< ns3::olsr::IfaceAssocTuple, std::allocator< ns3::olsr::IfaceAssocTuple > >', 'ns3::olsr::IfaceAssocSet')
typehandlers.add_type_alias('std::vector< ns3::olsr::NeighborTuple, std::allocator< ns3::olsr::NeighborTuple > >', 'ns3::olsr::NeighborSet')
typehandlers.add_type_alias('std::vector< ns3::olsr::TwoHopNeighborTuple, std::allocator< ns3::olsr::TwoHopNeighborTuple > >', 'ns3::olsr::TwoHopNeighborSet')
typehandlers.add_type_alias('std::vector< ns3::olsr::LinkTuple, std::allocator< ns3::olsr::LinkTuple > >', 'ns3::olsr::LinkSet')
def register_methods(root_module):
register_Ns3OlsrState_methods(root_module, root_module['ns3::OlsrState'])
@@ -740,15 +759,15 @@ def register_Ns3OlsrRoutingProtocol_methods(root_module, cls):
cls.add_method('SetMainInterface',
'void',
[param('uint32_t', 'interface')])
## olsr-routing-protocol.h: bool ns3::olsr::RoutingProtocol::RequestRoute(uint32_t ifIndex, ns3::Ipv4Header const & ipHeader, ns3::Ptr<ns3::Packet> packet, ns3::Callback<void,bool,const ns3::Ipv4Route&,ns3::Ptr<ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> routeReply) [member function]
cls.add_method('RequestRoute',
'bool',
[param('uint32_t', 'ifIndex'), param('ns3::Ipv4Header const &', 'ipHeader'), param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Callback< void, bool, ns3::Ipv4Route const &, ns3::Ptr< ns3::Packet >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'routeReply')],
## olsr-routing-protocol.h: ns3::Ptr<ns3::Ipv4Route> ns3::olsr::RoutingProtocol::RouteOutput(ns3::Ipv4Header const & header, uint32_t oif, ns3::Socket::SocketErrno & sockerr) [member function]
cls.add_method('RouteOutput',
'ns3::Ptr< ns3::Ipv4Route >',
[param('ns3::Ipv4Header const &', 'header'), param('uint32_t', 'oif'), param('ns3::Socket::SocketErrno &', 'sockerr')],
visibility='private', is_virtual=True)
## olsr-routing-protocol.h: bool ns3::olsr::RoutingProtocol::RequestInterface(ns3::Ipv4Address destination, uint32_t & ifIndex) [member function]
cls.add_method('RequestInterface',
## olsr-routing-protocol.h: bool ns3::olsr::RoutingProtocol::RouteInput(ns3::Ptr<ns3::Packet const> p, ns3::Ipv4Header const & header, ns3::Ptr<const ns3::NetDevice> idev, ns3::Callback<void,ns3::Ptr<ns3::Ipv4Route>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback<void,ns3::Ptr<ns3::Ipv4MulticastRoute>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,unsigned int,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> lcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
cls.add_method('RouteInput',
'bool',
[param('ns3::Ipv4Address', 'destination'), param('uint32_t &', 'ifIndex')],
[param('ns3::Ptr< ns3::Packet const >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice const >', 'idev'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4Route >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ucb'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4MulticastRoute >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'mcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'lcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')],
visibility='private', is_virtual=True)
## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::DoDispose() [member function]
cls.add_method('DoDispose',
@@ -808,6 +827,7 @@ def register_functions(root_module):
module = root_module
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -818,6 +838,9 @@ def register_functions_ns3_Config(module, root_module):
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
@@ -18,6 +18,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -38,6 +44,10 @@ def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -85,6 +95,7 @@ def register_functions(root_module):
module = root_module
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -95,6 +106,9 @@ def register_functions_ns3_Config(module, root_module):
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
@@ -18,6 +18,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -38,6 +44,10 @@ def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -81,6 +91,7 @@ def register_functions(root_module):
module = root_module
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -91,6 +102,9 @@ def register_functions_ns3_Config(module, root_module):
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
@@ -22,6 +22,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -42,6 +48,10 @@ def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -301,6 +311,7 @@ def register_functions(root_module):
module = root_module
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -311,6 +322,9 @@ def register_functions_ns3_Config(module, root_module):
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
@@ -61,6 +61,10 @@ def register_types(module):
module.add_class('RealtimeSimulatorImpl', parent=root_module['ns3::SimulatorImpl'])
## realtime-simulator-impl.h: ns3::RealtimeSimulatorImpl::SynchronizationMode [enumeration]
module.add_enum('SynchronizationMode', ['SYNC_BEST_EFFORT', 'SYNC_HARD_LIMIT'], outer_class=root_module['ns3::RealtimeSimulatorImpl'])
typehandlers.add_type_alias('ns3::TimeUnit< 2 >', 'ns3::TimeSquare')
typehandlers.add_type_alias('ns3::TimeUnit< - 1 >', 'ns3::TimeInvert')
typehandlers.add_type_alias('ns3::TimeUnit< 0 >', 'ns3::Scalar')
typehandlers.add_type_alias('ns3::TimeUnit< 1 >', 'ns3::Time')
## Register a nested module for the namespace Config
@@ -74,6 +78,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -96,6 +106,10 @@ def register_types_ns3_TimeStepPrecision(module):
## nstime.h: ns3::TimeStepPrecision::precision_t [enumeration]
module.add_enum('precision_t', ['S', 'MS', 'US', 'NS', 'PS', 'FS'])
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -1530,6 +1544,7 @@ def register_functions(root_module):
[param('uint64_t', 'ts')])
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -1548,6 +1563,9 @@ def register_functions_ns3_TimeStepPrecision(module, root_module):
[param('ns3::TimeStepPrecision::precision_t', 'precision')])
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
@@ -25,6 +25,8 @@ def register_types(module):
module.add_class('CounterCalculator', template_parameters=['unsigned int'], parent=root_module['ns3::DataCalculator'])
## packet-data-calculators.h: ns3::PacketCounterCalculator [class]
module.add_class('PacketCounterCalculator', parent=root_module['ns3::CounterCalculator< unsigned int >'])
typehandlers.add_type_alias('std::list< ns3::Ptr< ns3::DataCalculator >, std::allocator< ns3::Ptr< ns3::DataCalculator > > >', 'ns3::DataCalculatorList')
typehandlers.add_type_alias('std::list< std::pair< std::string, std::string >, std::allocator< std::pair< std::string, std::string > > >', 'ns3::MetadataList')
## Register a nested module for the namespace Config
@@ -38,6 +40,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -58,6 +66,10 @@ def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -419,6 +431,7 @@ def register_functions(root_module):
module = root_module
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -429,6 +442,9 @@ def register_functions_ns3_Config(module, root_module):
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
@@ -20,6 +20,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -40,6 +46,10 @@ def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -217,6 +227,7 @@ def register_functions(root_module):
module = root_module
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -227,6 +238,9 @@ def register_functions_ns3_Config(module, root_module):
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
@@ -20,6 +20,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -40,6 +46,10 @@ def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -115,6 +125,7 @@ def register_functions(root_module):
module = root_module
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -125,6 +136,9 @@ def register_functions_ns3_Config(module, root_module):
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
@@ -18,6 +18,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -38,6 +44,10 @@ def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -81,6 +91,7 @@ def register_functions(root_module):
module = root_module
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -91,6 +102,9 @@ def register_functions_ns3_Config(module, root_module):
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
@@ -135,6 +135,7 @@ def register_types(module):
module.add_class('YansWifiChannel', parent=root_module['ns3::WifiChannel'])
## aarf-wifi-manager.h: ns3::AarfWifiManager [class]
module.add_class('AarfWifiManager', parent=root_module['ns3::ArfWifiManager'])
typehandlers.add_type_alias('std::vector< ns3::ThresholdsItem, std::allocator< ns3::ThresholdsItem > >', 'ns3::Thresholds')
## Register a nested module for the namespace Config
@@ -148,6 +149,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -168,6 +175,10 @@ def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -4181,6 +4192,7 @@ def register_functions(root_module):
[param('uint8_t', 'tid')])
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -4191,6 +4203,9 @@ def register_functions_ns3_Config(module, root_module):
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return

View File

@@ -1,4 +1,4 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
@@ -288,6 +288,12 @@ def register_types(module):
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
@@ -309,6 +315,10 @@ def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
@@ -786,6 +796,7 @@ def register_functions(root_module):
root_module.end_section('ns3_module_helper')
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
@@ -796,6 +807,9 @@ def register_functions_ns3_Config(module, root_module):
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return

View File

@@ -15,7 +15,7 @@ import Build
import Utils
## https://launchpad.net/pybindgen/
REQUIRED_PYBINDGEN_VERSION = (0, 10, 0, 630)
REQUIRED_PYBINDGEN_VERSION = (0, 10, 0, 640)
REQUIRED_PYGCCXML_VERSION = (0, 9, 5)
@@ -109,14 +109,14 @@ def configure(conf):
pybindgen_version_str = out.strip()
pybindgen_version = tuple([int(x) for x in pybindgen_version_str.split('.')])
conf.check_message('pybindgen', 'version',
(pybindgen_version >= REQUIRED_PYBINDGEN_VERSION),
(pybindgen_version == REQUIRED_PYBINDGEN_VERSION),
pybindgen_version_str)
if not (pybindgen_version >= REQUIRED_PYBINDGEN_VERSION):
Logs.warn("pybindgen (found %s) is too old (need %s)" %
if not (pybindgen_version == REQUIRED_PYBINDGEN_VERSION):
Logs.warn("pybindgen (found %s), (need %s)" %
(pybindgen_version_str,
'.'.join([str(x) for x in REQUIRED_PYBINDGEN_VERSION])))
conf.report_optional_feature("python", "Python Bindings", False,
"PyBindGen too old and newer version could not be retrieved")
"PyBindGen version not correct and newer version could not be retrieved")
return
## If all has gone well, we finally enable the Python bindings

View File

@@ -105,7 +105,7 @@ main (int argc, char *argv[])
// 2) Set up a default multicast route on the sender n0
// 3) Have node n4 join the multicast group
// We have a helper that can help us with static multicast
StaticMulticastRouteHelper multicast;
Ipv4StaticRoutingHelper multicast;
// 1) Configure a (static) multicast route on node n2 (multicastRouter)
Ptr<Node> multicastRouter = c.Get (2); // The node in question
@@ -121,10 +121,6 @@ main (int argc, char *argv[])
Ptr<NetDevice> senderIf = nd0.Get(0);
multicast.SetDefaultMulticastRoute (sender, senderIf);
// 3) Have node n4 join the multicast group
Ptr<Node> receiver = c.Get (4);
multicast.JoinMulticastGroup (receiver, multicastSource, multicastGroup);
//
// Create an OnOff application to send UDP datagrams from node zero to the
// multicast group (node four will be listening).

View File

@@ -55,7 +55,6 @@
#include "ns3/core-module.h"
#include "ns3/simulator-module.h"
#include "ns3/node-module.h"
#include "ns3/internet-stack-module.h"
#include "ns3/emu-module.h"
#include "ns3/v4ping-module.h"
#include "ns3/helper-module.h"
@@ -149,7 +148,8 @@ main (int argc, char *argv[])
// of ARP, IPv4, ICMP, UDP and TCP.
//
NS_LOG_INFO ("Add Internet Stack");
AddInternetStack (node);
InternetStackHelper internetStackHelper;
internetStackHelper.Install (node);
NS_LOG_INFO ("Create IPv4 Interface");
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
@@ -175,7 +175,9 @@ main (int argc, char *argv[])
Ipv4Address gateway ("1.2.3.4");
NS_ABORT_MSG_IF (gateway == "1.2.3.4", "You must change the gateway IP address before running this example");
ipv4->SetDefaultRoute (gateway, interface);
Ipv4StaticRoutingHelper ipv4RoutingHelper;
Ptr<Ipv4StaticRouting> staticRouting = ipv4RoutingHelper.GetStaticRouting (ipv4);
staticRouting->SetDefaultRoute (gateway, interface);
//
// Create the ping application. This application knows how to send

View File

@@ -97,12 +97,14 @@ main (int argc, char *argv[])
ipv4C->SetMetric (ifIndexC, 1);
ipv4C->SetUp (ifIndexC);
Ipv4StaticRoutingHelper ipv4RoutingHelper;
// Create static routes from A to C
Ptr<Ipv4StaticRouting> staticRoutingA = ipv4RoutingHelper.GetStaticRouting (ipv4A);
// The ifIndex for this outbound route is 1; the first p2p link added
ipv4A->AddHostRouteTo (Ipv4Address ("192.168.1.1"), Ipv4Address ("10.1.1.2"), 1);
staticRoutingA->AddHostRouteTo (Ipv4Address ("192.168.1.1"), Ipv4Address ("10.1.1.2"), 1);
Ptr<Ipv4StaticRouting> staticRoutingB = ipv4RoutingHelper.GetStaticRouting (ipv4B);
// The ifIndex we want on node B is 2; 0 corresponds to loopback, and 1 to the first point to point link
ipv4B->AddHostRouteTo (Ipv4Address ("192.168.1.1"), Ipv4Address ("10.1.1.6"), 2);
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)

View File

@@ -91,7 +91,7 @@ int main (int argc, char *argv[])
InternetStackHelper internet;
// The next statement switches the nodes to 'NSC'-Mode.
// It disables the native ns-3 TCP model and loads the NSC library.
internet.SetNscStack (nscStack);
internet.SetTcp ("ns3::NscTcpL4Protocol","Library",StringValue(nscStack));
internet.Install (n);
if (tcpCong != "cubic") // make sure we only fail if both --nscstack and --TCP_CONGESTION are used

View File

@@ -69,7 +69,7 @@ int main(int argc, char *argv[])
InternetStackHelper internetStack;
internetStack.SetNscStack ("liblinux2.6.26.so");
internetStack.SetTcp ("ns3::NscTcpL4Protocol","Library",StringValue("liblinux2.6.26.so"));
// this switches nodes 0 and 1 to NSCs Linux 2.6.26 stack.
internetStack.Install (n.Get(0));
internetStack.Install (n.Get(1));
@@ -87,7 +87,7 @@ int main(int argc, char *argv[])
{
// the next statement doesn't change anything for the nodes 0, 1, and 2; since they
// already have a stack assigned.
internetStack.SetNscStack ("liblinux2.6.18.so");
internetStack.SetTcp ("ns3::NscTcpL4Protocol","Library",StringValue("liblinux2.6.18.so"));
// this switches node 3 to NSCs Linux 2.6.18 stack.
internetStack.Install (n.Get(3));
// and then agains disables sack/timestamps/wscale on node 3.

View File

@@ -0,0 +1,229 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 The Boeing Company
*
* 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: Guangyu Pei <guangyu.pei@boeing.com>
*/
#include "ns3/core-module.h"
#include "ns3/common-module.h"
#include "ns3/node-module.h"
#include "ns3/helper-module.h"
#include "ns3/mobility-module.h"
#include "ns3/contrib-module.h"
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
NS_LOG_COMPONENT_DEFINE ("Main");
using namespace ns3;
class Experiment
{
public:
Experiment ();
Experiment (std::string name);
uint32_t Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy,
const NqosWifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel);
private:
void ReceivePacket (Ptr<Socket> socket);
void SetPosition (Ptr<Node> node, Vector position);
Vector GetPosition (Ptr<Node> node);
Ptr<Socket> SetupPacketReceive (Ptr<Node> node);
void GenerateTraffic (Ptr<Socket> socket, uint32_t pktSize,
uint32_t pktCount, Time pktInterval );
uint32_t m_pktsTotal;
Gnuplot2dDataset m_output;
};
Experiment::Experiment ()
{}
Experiment::Experiment (std::string name)
: m_output (name)
{
m_output.SetStyle (Gnuplot2dDataset::LINES);
}
void
Experiment::SetPosition (Ptr<Node> node, Vector position)
{
Ptr<MobilityModel> mobility = node->GetObject<MobilityModel> ();
mobility->SetPosition (position);
}
Vector
Experiment::GetPosition (Ptr<Node> node)
{
Ptr<MobilityModel> mobility = node->GetObject<MobilityModel> ();
return mobility->GetPosition ();
}
void
Experiment::ReceivePacket (Ptr<Socket> socket)
{
Ptr<Packet> packet;
while (packet = socket->Recv ())
{
m_pktsTotal ++;
}
}
Ptr<Socket>
Experiment::SetupPacketReceive (Ptr<Node> node)
{
TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
Ptr<Socket> sink = Socket::CreateSocket (node, tid);
InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (), 80);
sink->Bind (local);
sink->SetRecvCallback (MakeCallback (&Experiment::ReceivePacket, this));
return sink;
}
void
Experiment::GenerateTraffic (Ptr<Socket> socket, uint32_t pktSize,
uint32_t pktCount, Time pktInterval )
{
if (pktCount > 0)
{
socket->Send (Create<Packet> (pktSize));
Simulator::Schedule (pktInterval, &Experiment::GenerateTraffic, this,
socket, pktSize,pktCount-1, pktInterval);
}
else
{
socket->Close ();
}
}
uint32_t
Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy,
const NqosWifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel)
{
m_pktsTotal = 0;
NodeContainer c;
c.Create (2);
InternetStackHelper internet;
internet.Install (c);
YansWifiPhyHelper phy = wifiPhy;
phy.SetChannel (wifiChannel.Create ());
NqosWifiMacHelper mac = wifiMac;
NetDeviceContainer devices = wifi.Install (phy, mac, c);
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
positionAlloc->Add (Vector (0.0, 0.0, 0.0));
positionAlloc->Add (Vector (5.0, 0.0, 0.0));
mobility.SetPositionAllocator (positionAlloc);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (c);
Ipv4AddressHelper ipv4;
NS_LOG_INFO ("Assign IP Addresses.");
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer i = ipv4.Assign (devices);
Ptr<Socket> recvSink = SetupPacketReceive (c.Get (0));
TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
Ptr<Socket> source = Socket::CreateSocket (c.Get (1), tid);
InetSocketAddress remote = InetSocketAddress (Ipv4Address ("255.255.255.255"), 80);
source->Connect (remote);
uint32_t packetSize = 1014;
uint32_t maxPacketCount = 200;
Time interPacketInterval = Seconds (1.);
Simulator::Schedule (Seconds (1.0), &Experiment::GenerateTraffic,
this, source, packetSize, maxPacketCount,interPacketInterval);
Simulator::Run ();
Simulator::Destroy ();
return m_pktsTotal;
}
int main (int argc, char *argv[])
{
std::ofstream outfile ("clear-channel.plt");
std::vector <std::string> modes;
modes.push_back ("wifib-1mbs");
modes.push_back ("wifib-2mbs");
modes.push_back ("wifib-5.5mbs");
modes.push_back ("wifib-11mbs");
// disable fragmentation
Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200"));
Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("2200"));
CommandLine cmd;
cmd.Parse (argc, argv);
Gnuplot gnuplot = Gnuplot ("clear-channel.eps");
for (uint32_t i = 0; i < modes.size(); i++)
{
std::cout << modes[i] << std::endl;
Gnuplot2dDataset dataset (modes[i]);
for (double rss = -102.0; rss <= -80.0; rss += 0.5)
{
Experiment experiment;
dataset.SetStyle (Gnuplot2dDataset::LINES);
WifiHelper wifi;
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode",
StringValue (modes[i]));
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode",StringValue(modes[i]),
"ControlMode",StringValue(modes[i]));
wifiMac.SetType ("ns3::AdhocWifiMac");
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
YansWifiChannelHelper wifiChannel ;
wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
wifiChannel.AddPropagationLoss ("ns3::FixedRssLossModel","Rss",DoubleValue(rss));
NS_LOG_DEBUG (modes[i]);
experiment = Experiment (modes[i]);
wifiPhy.Set ("Standard", StringValue ("802.11b") );
wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (-110.0) );
wifiPhy.Set ("CcaMode1Threshold", DoubleValue (-110.0) );
wifiPhy.Set ("TxPowerStart", DoubleValue (15.0) );
wifiPhy.Set ("RxGain", DoubleValue (0) );
wifiPhy.Set ("RxNoiseFigure", DoubleValue (7) );
uint32_t pktsRecvd = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
dataset.Add (rss, pktsRecvd);
}
gnuplot.AddDataset (dataset);
}
gnuplot.SetTerminal ("postscript eps color enh \"Times-BoldItalic\"");
gnuplot.SetLegend ("RSS(dBm)", "Number of packets received");
gnuplot.SetExtra ("set xrange [-102:-83]");
gnuplot.GenerateOutput (outfile);
outfile.close ();
return 0;
}

View File

@@ -116,6 +116,10 @@ def build(bld):
['core', 'simulator', 'mobility', 'wifi'])
obj.source = 'wifi-adhoc.cc'
obj = bld.create_ns3_program('wifi-clear-channel-cmu',
['core', 'simulator', 'mobility', 'wifi'])
obj.source = 'wifi-clear-channel-cmu.cc'
obj = bld.create_ns3_program('wifi-ap',
['core', 'simulator', 'mobility', 'wifi'])
obj.source = 'wifi-ap.cc'

View File

@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA
* Copyright (c) 2008 Timo Bingmann
*
* 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
@@ -15,45 +15,298 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
* Author: Timo Bingmann <timo.bingmann@student.kit.edu>
*/
#include "ns3/propagation-loss-model.h"
#include "ns3/jakes-propagation-loss-model.h"
#include "ns3/constant-position-mobility-model.h"
#include "ns3/config.h"
#include "ns3/string.h"
#include "ns3/boolean.h"
#include "ns3/double.h"
#include "ns3/gnuplot.h"
#include "ns3/simulator.h"
#include <map>
using namespace ns3;
static void
PrintOne (double minTxpower, double maxTxpower, double stepTxpower, double min, double max, double step)
/// Round a double number to the given precision. e.g. dround(0.234, 0.1) = 0.2
/// and dround(0.257, 0.1) = 0.3
static double dround(double number, double precision)
{
number /= precision;
if (number >= 0)
{
number = floor(number + 0.5);
}
else
{
number = ceil(number - 0.5);
}
number *= precision;
return number;
}
static Gnuplot
TestDeterministic (Ptr<PropagationLossModel> model)
{
Ptr<ConstantPositionMobilityModel> a = CreateObject<ConstantPositionMobilityModel> ();
Ptr<ConstantPositionMobilityModel> b = CreateObject<ConstantPositionMobilityModel> ();
Ptr<LogDistancePropagationLossModel> log = CreateObject<LogDistancePropagationLossModel> ();
Ptr<PropagationLossModel> model = log;
Gnuplot plot;
a->SetPosition (Vector (0.0, 0.0, 0.0));
for (double x = min; x < max; x+= step)
{
b->SetPosition (Vector (x, 0.0, 0.0));
std::cout << x << " ";
for (double txpower = minTxpower; txpower < maxTxpower; txpower += stepTxpower)
{
double rxPowerDbm = model->CalcRxPower (txpower, a, b);
std::cout << rxPowerDbm << " ";
}
std::cout << std::endl;
}
plot.AppendExtra("set xlabel 'Distance'");
plot.AppendExtra("set ylabel 'rxPower (dBm)'");
plot.AppendExtra("set key top right");
double txPowerDbm = +20; // dBm
Gnuplot2dDataset dataset;
dataset.SetStyle(Gnuplot2dDataset::LINES);
{
a->SetPosition (Vector (0.0, 0.0, 0.0));
for (double distance = 0.0; distance < 2500.0; distance += 10.0)
{
b->SetPosition (Vector (distance, 0.0, 0.0));
// CalcRxPower() returns dBm.
double rxPowerDbm = model->CalcRxPower (txPowerDbm, a, b);
dataset.Add(distance, rxPowerDbm);
Simulator::Stop (Seconds (1.0));
Simulator::Run ();
}
}
std::ostringstream os;
os << "txPower " << txPowerDbm << "dBm";
dataset.SetTitle(os.str());
plot.AddDataset(dataset);
plot.AddDataset( Gnuplot2dFunction("-94 dBm CSThreshold", "-94.0") );
return plot;
}
static Gnuplot
TestProbabilistic (Ptr<PropagationLossModel> model, unsigned int samples = 100000)
{
Ptr<ConstantPositionMobilityModel> a = CreateObject<ConstantPositionMobilityModel> ();
Ptr<ConstantPositionMobilityModel> b = CreateObject<ConstantPositionMobilityModel> ();
Gnuplot plot;
plot.AppendExtra("set xlabel 'Distance'");
plot.AppendExtra("set ylabel 'rxPower (dBm)'");
plot.AppendExtra("set zlabel 'Probability' offset 0,+10");
plot.AppendExtra("set view 50, 120, 1.0, 1.0");
plot.AppendExtra("set key top right");
plot.AppendExtra("set ticslevel 0");
plot.AppendExtra("set xtics offset -0.5,0");
plot.AppendExtra("set ytics offset 0,-0.5");
plot.AppendExtra("set xrange [100:]");
double txPowerDbm = +20; // dBm
Gnuplot3dDataset dataset;
dataset.SetStyle("with linespoints");
dataset.SetExtra("pointtype 3 pointsize 0.5");
typedef std::map<double, unsigned int> rxPowerMapType;
// Take given number of samples from CalcRxPower() and show probability
// density for discrete distances.
{
a->SetPosition (Vector (0.0, 0.0, 0.0));
for (double distance = 100.0; distance < 2500.0; distance += 100.0)
{
b->SetPosition (Vector (distance, 0.0, 0.0));
rxPowerMapType rxPowerMap;
for (unsigned int samp = 0; samp < samples; ++samp)
{
// CalcRxPower() returns dBm.
double rxPowerDbm = model->CalcRxPower (txPowerDbm, a, b);
rxPowerDbm = dround(rxPowerDbm, 1.0);
rxPowerMap[ rxPowerDbm ] ++;
Simulator::Stop (Seconds (0.01));
Simulator::Run ();
}
for (rxPowerMapType::const_iterator i = rxPowerMap.begin();
i != rxPowerMap.end(); ++i)
{
dataset.Add(distance, i->first, (double)i->second / (double)samples);
}
dataset.AddEmptyLine();
}
}
std::ostringstream os;
os << "txPower " << txPowerDbm << "dBm";
dataset.SetTitle(os.str());
plot.AddDataset(dataset);
return plot;
}
static Gnuplot
TestDeterministicByTime (Ptr<PropagationLossModel> model,
Time timeStep = Seconds(0.001),
Time timeTotal = Seconds(1.0),
double distance = 100.0)
{
Ptr<ConstantPositionMobilityModel> a = CreateObject<ConstantPositionMobilityModel> ();
Ptr<ConstantPositionMobilityModel> b = CreateObject<ConstantPositionMobilityModel> ();
Gnuplot plot;
plot.AppendExtra("set xlabel 'Time (s)'");
plot.AppendExtra("set ylabel 'rxPower (dBm)'");
plot.AppendExtra("set key center right");
double txPowerDbm = +20; // dBm
Gnuplot2dDataset dataset;
dataset.SetStyle(Gnuplot2dDataset::LINES);
{
a->SetPosition (Vector (0.0, 0.0, 0.0));
b->SetPosition (Vector (distance, 0.0, 0.0));
Time start = Simulator::Now();
while( Simulator::Now() < start + timeTotal )
{
// CalcRxPower() returns dBm.
double rxPowerDbm = model->CalcRxPower (txPowerDbm, a, b);
Time elapsed = Simulator::Now() - start;
dataset.Add(elapsed.GetSeconds(), rxPowerDbm);
Simulator::Stop (timeStep);
Simulator::Run ();
}
}
std::ostringstream os;
os << "txPower " << txPowerDbm << "dBm";
dataset.SetTitle(os.str());
plot.AddDataset(dataset);
plot.AddDataset( Gnuplot2dFunction("-94 dBm CSThreshold", "-94.0") );
return plot;
}
int main (int argc, char *argv[])
{
GnuplotCollection gnuplots("main-propagation-loss.pdf");
Config::SetDefault ("ns3::LogDistancePropagationLossModel::ReferenceDistance", StringValue ("1.0"));
Config::SetDefault ("ns3::LogDistancePropagationLossModel::Exponent", StringValue ("4"));
{
Ptr<FriisPropagationLossModel> friis = CreateObject<FriisPropagationLossModel> ();
PrintOne (-10, 20, 5, 0, 10000, 2);
Gnuplot plot = TestDeterministic(friis);
plot.SetTitle("ns3::FriisPropagationLossModel (Default Parameters)");
gnuplots.AddPlot(plot);
}
{
Ptr<LogDistancePropagationLossModel> log = CreateObject<LogDistancePropagationLossModel> ();
log->SetAttribute("Exponent", DoubleValue (2.5));
Gnuplot plot = TestDeterministic(log);
plot.SetTitle("ns3::LogDistancePropagationLossModel (Exponent = 2.5)");
gnuplots.AddPlot(plot);
}
{
Ptr<RandomPropagationLossModel> random = CreateObject<RandomPropagationLossModel> ();
random->SetAttribute("Variable", RandomVariableValue(ExponentialVariable(50.0)));
Gnuplot plot = TestDeterministic(random);
plot.SetTitle("ns3::RandomPropagationLossModel with Exponential Distribution");
gnuplots.AddPlot(plot);
}
{
Ptr<JakesPropagationLossModel> jakes = CreateObject<JakesPropagationLossModel> ();
// doppler frequency shift for 5.15 GHz at 100 km/h
jakes->SetAttribute("DopplerFreq", DoubleValue(477.9));
Gnuplot plot = TestDeterministicByTime (jakes, Seconds(0.001), Seconds(1.0));
plot.SetTitle("ns3::JakesPropagationLossModel (with 477.9 Hz shift and 1 millisec resolution)");
gnuplots.AddPlot(plot);
}
{
Ptr<JakesPropagationLossModel> jakes = CreateObject<JakesPropagationLossModel> ();
// doppler frequency shift for 5.15 GHz at 100 km/h
jakes->SetAttribute("DopplerFreq", DoubleValue(477.9));
Gnuplot plot = TestDeterministicByTime (jakes, Seconds(0.0001), Seconds(0.1));
plot.SetTitle("ns3::JakesPropagationLossModel (with 477.9 Hz shift and 0.1 millisec resolution)");
gnuplots.AddPlot(plot);
}
{
Ptr<ThreeLogDistancePropagationLossModel> log3 = CreateObject<ThreeLogDistancePropagationLossModel> ();
Gnuplot plot = TestDeterministic(log3);
plot.SetTitle("ns3::ThreeLogDistancePropagationLossModel (Defaults)");
gnuplots.AddPlot(plot);
}
{
Ptr<ThreeLogDistancePropagationLossModel> log3 = CreateObject<ThreeLogDistancePropagationLossModel> ();
// more prominent example values:
log3->SetAttribute("Exponent0", DoubleValue(1.0));
log3->SetAttribute("Exponent1", DoubleValue(3.0));
log3->SetAttribute("Exponent2", DoubleValue(10.0));
Gnuplot plot = TestDeterministic(log3);
plot.SetTitle("ns3::ThreeLogDistancePropagationLossModel (Exponents 1.0, 3.0 and 10.0)");
gnuplots.AddPlot(plot);
}
{
Ptr<NakagamiPropagationLossModel> nak = CreateObject<NakagamiPropagationLossModel> ();
Gnuplot plot = TestProbabilistic(nak);
plot.SetTitle("ns3::NakagamiPropagationLossModel (Default Parameters)");
gnuplots.AddPlot(plot);
}
{
Ptr<ThreeLogDistancePropagationLossModel> log3 = CreateObject<ThreeLogDistancePropagationLossModel> ();
Ptr<NakagamiPropagationLossModel> nak = CreateObject<NakagamiPropagationLossModel> ();
log3->SetNext(nak);
Gnuplot plot = TestProbabilistic(log3);
plot.SetTitle("ns3::ThreeLogDistancePropagationLossModel and ns3::NakagamiPropagationLossModel (Default Parameters)");
gnuplots.AddPlot(plot);
}
gnuplots.GenerateOutput(std::cout);
return 0;
}

View File

@@ -18,10 +18,12 @@
* Author: Tom Henderson (tomhend@u.washington.edu)
*/
#include "ns3/address.h"
#include "ns3/address-utils.h"
#include "ns3/log.h"
#include "ns3/inet-socket-address.h"
#include "ns3/node.h"
#include "ns3/socket.h"
#include "ns3/udp-socket.h"
#include "ns3/simulator.h"
#include "ns3/socket-factory.h"
#include "ns3/packet.h"
@@ -88,6 +90,19 @@ void PacketSink::StartApplication() // Called at time specified by Start
m_socket = Socket::CreateSocket (GetNode(), m_tid);
m_socket->Bind (m_local);
m_socket->Listen ();
if (addressUtils::IsMulticast (m_local))
{
Ptr<UdpSocket> udpSocket = DynamicCast<UdpSocket> (m_socket);
if (udpSocket)
{
// equivalent to setsockopt (MCAST_JOIN_GROUP)
udpSocket->MulticastJoinGroup (0, m_local);
}
else
{
NS_FATAL_ERROR ("Error: joining multicast on a non-UDP socket");
}
}
}
m_socket->SetRecvCallback (MakeCallback(&PacketSink::HandleRead, this));

View File

@@ -18,9 +18,11 @@
#include "ns3/log.h"
#include "ns3/ipv4-address.h"
#include "ns3/address-utils.h"
#include "ns3/nstime.h"
#include "ns3/inet-socket-address.h"
#include "ns3/socket.h"
#include "ns3/udp-socket.h"
#include "ns3/simulator.h"
#include "ns3/socket-factory.h"
#include "ns3/packet.h"
@@ -78,6 +80,19 @@ UdpEchoServer::StartApplication (void)
m_socket = Socket::CreateSocket (GetNode(), tid);
InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (), m_port);
m_socket->Bind (local);
if (addressUtils::IsMulticast (m_local))
{
Ptr<UdpSocket> udpSocket = DynamicCast<UdpSocket> (m_socket);
if (udpSocket)
{
// equivalent to setsockopt (MCAST_JOIN_GROUP)
udpSocket->MulticastJoinGroup (0, m_local);
}
else
{
NS_FATAL_ERROR ("Error: joining multicast on a non-UDP socket");
}
}
}
m_socket->SetRecvCallback(MakeCallback(&UdpEchoServer::HandleRead, this));

View File

@@ -160,6 +160,24 @@ Object::AggregateObject (Ptr<Object> o)
other->m_next = next;
NS_ASSERT (CheckLoose ());
NS_ASSERT (o->CheckLoose ());
// call NotifyNewAggregate in the listed chain
Object *currentObject = this;
do
{
// the NotifyNewAggregate of the current object implementation
// should be called on the next object in the linked chain
currentObject->NotifyNewAggregate ();
currentObject = currentObject->m_next;
} while (currentObject != this);
}
/**
* This function must be implemented in the stack that needs to notify
* other stacks connected to the node of their presence in the node.
*/
void
Object::NotifyNewAggregate ()
{
}
Object::AggregateIterator

View File

@@ -160,6 +160,13 @@ public:
AggregateIterator GetAggregateIterator (void) const;
protected:
/**
* This function is called by the AggregateObject on all the objects connected in the listed chain.
* This way the new object aggregated will be used if needed by the NotifyNewAggregate corresponding
* to each object connected in the listed chain. It should be implemented by objects needing an
* additional/special behavior when aggregated to another object.
*/
virtual void NotifyNewAggregate ();
/**
* This method is called by Object::Dispose or by the object's
* destructor, whichever comes first.

View File

@@ -342,7 +342,7 @@ TapBridge::CreateTap (void)
Ptr<NetDevice> nd = GetBridgedNetDevice ();
Ptr<Node> n = nd->GetNode ();
Ptr<Ipv4> ipv4 = n->GetObject<Ipv4> ();
uint32_t index = ipv4->FindInterfaceForDevice (nd);
uint32_t index = ipv4->GetInterfaceForDevice (nd);
if (ipv4->GetNAddresses (index) > 1)
{
NS_LOG_WARN ("Underlying bridged NetDevice has multiple IP addresses; using first one.");

View File

@@ -98,7 +98,6 @@ void
AdhocWifiMac::SetEifsNoDifs (Time eifsNoDifs)
{
m_dcfManager->SetEifsNoDifs (eifsNoDifs);
m_eifsNoDifs = eifsNoDifs;
}
void
AdhocWifiMac::SetAckTimeout (Time ackTimeout)
@@ -128,7 +127,7 @@ AdhocWifiMac::GetSifs (void) const
Time
AdhocWifiMac::GetEifsNoDifs (void) const
{
return m_eifsNoDifs;
return m_dcfManager->GetEifsNoDifs ();
}
Time
AdhocWifiMac::GetAckTimeout (void) const
@@ -241,7 +240,7 @@ AdhocWifiMac::SupportsSendFrom (void) const
}
void
AdhocWifiMac::ForwardUp (Ptr<Packet> packet, WifiMacHeader const *hdr)
AdhocWifiMac::ForwardUp (Ptr<Packet> packet, const WifiMacHeader *hdr)
{
NS_LOG_DEBUG ("received size="<<packet->GetSize ()<<", from="<<hdr->GetAddr2 ());
m_upCallback (packet, hdr->GetAddr2 (), hdr->GetAddr1 ());

View File

@@ -83,7 +83,7 @@ private:
// inherited from Object base class.
virtual void DoDispose (void);
/* invoked by the MacLows. */
void ForwardUp (Ptr<Packet> packet, WifiMacHeader const*hdr);
void ForwardUp (Ptr<Packet> packet, const WifiMacHeader *hdr);
AdhocWifiMac (const AdhocWifiMac & ctor_arg);
AdhocWifiMac &operator = (const AdhocWifiMac &o);
Ptr<DcaTxop> GetDcaTxop(void) const;
@@ -97,7 +97,6 @@ private:
MacRxMiddle *m_rxMiddle;
Ptr<MacLow> m_low;
Ssid m_ssid;
Time m_eifsNoDifs;
};
} // namespace ns3

View File

@@ -232,7 +232,7 @@ DcaTxop::GetAifsn (void) const
}
void
DcaTxop::Queue (Ptr<const Packet> packet, WifiMacHeader const &hdr)
DcaTxop::Queue (Ptr<const Packet> packet, const WifiMacHeader &hdr)
{
NS_LOG_FUNCTION (this << packet << &hdr);
WifiMacTrailer fcs;

View File

@@ -67,8 +67,8 @@ class DcaTxop : public Object
public:
static TypeId GetTypeId (void);
typedef Callback <void, WifiMacHeader const&> TxOk;
typedef Callback <void, WifiMacHeader const&> TxFailed;
typedef Callback <void, const WifiMacHeader&> TxOk;
typedef Callback <void, const WifiMacHeader&> TxFailed;
DcaTxop ();
~DcaTxop ();
@@ -104,7 +104,7 @@ public:
* Store the packet in the internal queue until it
* can be sent safely.
*/
void Queue (Ptr<const Packet> packet, WifiMacHeader const &hdr);
void Queue (Ptr<const Packet> packet, const WifiMacHeader &hdr);
private:
class TransmissionListener;

View File

@@ -275,6 +275,11 @@ DcfManager::SetEifsNoDifs (Time eifsNoDifs)
{
m_eifsNoDifs = eifsNoDifs;
}
Time
DcfManager::GetEifsNoDifs () const
{
return m_eifsNoDifs;
}
void
DcfManager::Add (DcfState *dcf)

View File

@@ -168,6 +168,11 @@ public:
*/
void SetEifsNoDifs (Time eifsNoDifs);
/**
* \return value set previously using SetEifsNoDifs.
*/
Time GetEifsNoDifs () const;
/**
* \param dcf a new DcfState.
*

View File

@@ -123,7 +123,7 @@ InterferenceHelper::NiChange::operator < (InterferenceHelper::NiChange const &o)
****************************************************************/
InterferenceHelper::InterferenceHelper ()
: m_80211a (false),
: m_80211_standard (WIFI_PHY_STANDARD_80211a),
m_errorRateModel (0)
{}
InterferenceHelper::~InterferenceHelper ()
@@ -227,12 +227,25 @@ InterferenceHelper::GetEnergyDuration (double energyW)
Time
InterferenceHelper::CalculateTxDuration (uint32_t size, WifiMode payloadMode, WifiPreamble preamble) const
{
NS_ASSERT (m_80211a);
uint64_t delay = 0;
delay += m_plcpLongPreambleDelayUs;
// symbol duration is 4us
delay += 4;
delay += lrint (ceil ((size * 8.0 + 16.0 + 6.0) / payloadMode.GetDataRate () / 4e-6) * 4);
switch (m_80211_standard)
{
case WIFI_PHY_STANDARD_80211a:
case WIFI_PHY_STANDARD_holland:
delay += m_plcpLongPreambleDelayUs;
// symbol duration is 4us
delay += 4;
delay += lrint (ceil ((size * 8.0 + 16.0 + 6.0) / payloadMode.GetDataRate () / 4e-6) * 4);
break;
case WIFI_PHY_STANDARD_80211b:
delay += m_plcpLongPreambleDelayUs;
delay += lrint (ceil ((size * 8.0 + 48.0) / payloadMode.GetDataRate () / 4e-6) * 4);
break;
default:
NS_ASSERT (false);
break;
}
return MicroSeconds (delay);
}
@@ -240,7 +253,7 @@ void
InterferenceHelper::Configure80211aParameters (void)
{
NS_LOG_FUNCTION (this);
m_80211a = true;
m_80211_standard = WIFI_PHY_STANDARD_80211a;
m_plcpLongPreambleDelayUs = 16;
m_plcpShortPreambleDelayUs = 16;
m_longPlcpHeaderMode = WifiPhy::Get6mba ();
@@ -250,6 +263,20 @@ InterferenceHelper::Configure80211aParameters (void)
m_maxPacketDuration = CalculateTxDuration (4095, WifiPhy::Get6mba (), WIFI_PREAMBLE_LONG);
}
void
InterferenceHelper::Configure80211bParameters (void)
{
NS_LOG_FUNCTION (this);
m_80211_standard = WIFI_PHY_STANDARD_80211b;
m_plcpLongPreambleDelayUs = 144;
m_plcpShortPreambleDelayUs = 144; // fixed preamable for 802.11b
m_longPlcpHeaderMode = WifiPhy::Get1mbb ();
m_shortPlcpHeaderMode = WifiPhy::Get1mbb ();
// PLCP Header: signal 8, service 8, length 16, CRC 16 bits
m_plcpHeaderLength = 8 + 8 + 16 + 16;
m_maxPacketDuration = CalculateTxDuration (4095, WifiPhy::Get1mbb (), WIFI_PREAMBLE_LONG);
}
void
InterferenceHelper::AppendEvent (Ptr<InterferenceHelper::Event> event)
{

View File

@@ -25,6 +25,7 @@
#include <list>
#include "wifi-mode.h"
#include "wifi-preamble.h"
#include "wifi-phy-standard.h"
#include "ns3/nstime.h"
#include "ns3/ref-count-base.h"
@@ -69,6 +70,7 @@ public:
~InterferenceHelper ();
void Configure80211aParameters (void);
void Configure80211bParameters (void);
void SetNoiseFigure (double value);
void SetErrorRateModel (Ptr<ErrorRateModel> rate);
@@ -120,7 +122,7 @@ private:
Time m_maxPacketDuration;
double m_noiseFigure; /**< noise figure (linear) */
Events m_events;
bool m_80211a;
enum WifiPhyStandard m_80211_standard;
Ptr<ErrorRateModel> m_errorRateModel;
};

View File

@@ -127,7 +127,7 @@ JakesPropagationLossModel::PathCoefficients::GetLoss (void)
NS_OBJECT_ENSURE_REGISTERED (JakesPropagationLossModel);
const double JakesPropagationLossModel::PI = 3.1415;
const double JakesPropagationLossModel::PI = 3.14159265358979323846;
TypeId
JakesPropagationLossModel::GetTypeId (void)

View File

@@ -59,7 +59,7 @@ MsduAggregator::Deaggregate (Ptr<Packet> aggregatedPacket)
padding = (4 - ((hdr.GetLength () + 14) %4 )) % 4;
if (padding > 0)
if (padding > 0 && deserialized < maxSize)
{
aggregatedPacket->RemoveAtStart (padding);
deserialized += padding;

View File

@@ -57,19 +57,20 @@ MsduStandardAggregator::Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggrega
Ptr<Packet> currentPacket;
AmsduSubframeHeader currentHdr;
uint32_t padding = CalculatePadding (packet);
uint32_t padding = CalculatePadding (aggregatedPacket);
uint32_t actualSize = aggregatedPacket->GetSize ();
if ((14 + packet->GetSize () + actualSize + padding) <= m_maxAmsduLength)
{
if (padding)
{
aggregatedPacket->AddPaddingAtEnd (padding);
}
currentHdr.SetDestinationAddr (dest);
currentHdr.SetSourceAddr (src);
currentHdr.SetLength (packet->GetSize ());
currentPacket = packet->Copy ();
if (padding)
{
currentPacket->AddPaddingAtEnd (padding);
}
currentPacket->AddHeader (currentHdr);
aggregatedPacket->AddAtEnd (currentPacket);
return true;
@@ -80,7 +81,7 @@ MsduStandardAggregator::Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggrega
uint32_t
MsduStandardAggregator::CalculatePadding (Ptr<const Packet> packet)
{
return (4 - ((packet->GetSize() + 14) %4 )) % 4;
return (4 - (packet->GetSize() %4 )) % 4;
}
} //namespace ns3

View File

@@ -43,7 +43,8 @@ public:
virtual bool Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket,
Mac48Address src, Mac48Address dest);
private:
/* Calculates how much padding must be added to the end of packet.
/* Calculates how much padding must be added to the end of aggregated packet,
after that a new packet is added.
Each A-MSDU subframe is padded so that its length is multiple of 4 octects.
*/
uint32_t CalculatePadding (Ptr<const Packet> packet);

View File

@@ -152,7 +152,6 @@ NqapWifiMac::SetEifsNoDifs (Time eifsNoDifs)
{
NS_LOG_FUNCTION (this << eifsNoDifs);
m_dcfManager->SetEifsNoDifs (eifsNoDifs);
m_eifsNoDifs = eifsNoDifs;
}
void
NqapWifiMac::SetAckTimeout (Time ackTimeout)
@@ -182,7 +181,7 @@ NqapWifiMac::GetSifs (void) const
Time
NqapWifiMac::GetEifsNoDifs (void) const
{
return m_eifsNoDifs;
return m_dcfManager->GetEifsNoDifs ();
}
Time
NqapWifiMac::GetAckTimeout (void) const

View File

@@ -129,7 +129,6 @@ private:
Ptr<MacLow> m_low;
Ssid m_ssid;
EventId m_beaconEvent;
Time m_eifsNoDifs;
};
} // namespace ns3

View File

@@ -156,7 +156,6 @@ NqstaWifiMac::SetEifsNoDifs (Time eifsNoDifs)
{
NS_LOG_FUNCTION (this << eifsNoDifs);
m_dcfManager->SetEifsNoDifs (eifsNoDifs);
m_eifsNoDifs = eifsNoDifs;
}
void
NqstaWifiMac::SetAckTimeout (Time ackTimeout)
@@ -186,7 +185,7 @@ NqstaWifiMac::GetSifs (void) const
Time
NqstaWifiMac::GetEifsNoDifs (void) const
{
return m_eifsNoDifs;
return m_dcfManager->GetEifsNoDifs ();
}
Time
NqstaWifiMac::GetAckTimeout (void) const

View File

@@ -160,7 +160,6 @@ private:
MacRxMiddle *m_rxMiddle;
Ptr<MacLow> m_low;
Ssid m_ssid;
Time m_eifsNoDifs;
TracedCallback<Mac48Address> m_assocLogger;
TracedCallback<Mac48Address> m_deAssocLogger;

View File

@@ -107,7 +107,7 @@ RandomPropagationLossModel::DoCalcRxPower (double txPowerDbm,
NS_OBJECT_ENSURE_REGISTERED (FriisPropagationLossModel);
const double FriisPropagationLossModel::PI = 3.1415;
const double FriisPropagationLossModel::PI = 3.14159265358979323846;
TypeId
FriisPropagationLossModel::GetTypeId (void)
@@ -408,5 +408,139 @@ ThreeLogDistancePropagationLossModel::DoCalcRxPower (double txPowerDbm,
return txPowerDbm - pathLossDb;
}
// ------------------------------------------------------------------------- //
NS_OBJECT_ENSURE_REGISTERED (NakagamiPropagationLossModel);
TypeId
NakagamiPropagationLossModel::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::NakagamiPropagationLossModel")
.SetParent<PropagationLossModel> ()
.AddConstructor<NakagamiPropagationLossModel> ()
.AddAttribute ("Distance1",
"Beginning of the second distance field. Default is 80m.",
DoubleValue (80.0),
MakeDoubleAccessor (&NakagamiPropagationLossModel::m_distance1),
MakeDoubleChecker<double> ())
.AddAttribute ("Distance2",
"Beginning of the third distance field. Default is 200m.",
DoubleValue (200.0),
MakeDoubleAccessor (&NakagamiPropagationLossModel::m_distance2),
MakeDoubleChecker<double> ())
.AddAttribute ("m0",
"m0 for distances smaller than Distance1. Default is 1.5.",
DoubleValue (1.5),
MakeDoubleAccessor (&NakagamiPropagationLossModel::m_m0),
MakeDoubleChecker<double> ())
.AddAttribute ("m1",
"m1 for distances smaller than Distance2. Default is 0.75.",
DoubleValue (0.75),
MakeDoubleAccessor (&NakagamiPropagationLossModel::m_m1),
MakeDoubleChecker<double> ())
.AddAttribute ("m2",
"m2 for distances greater than Distance2. Default is 0.75.",
DoubleValue (0.75),
MakeDoubleAccessor (&NakagamiPropagationLossModel::m_m2),
MakeDoubleChecker<double> ())
;
return tid;
}
NakagamiPropagationLossModel::NakagamiPropagationLossModel ()
{}
double
NakagamiPropagationLossModel::DoCalcRxPower (double txPowerDbm,
Ptr<MobilityModel> a,
Ptr<MobilityModel> b) const
{
// select m parameter
double distance = a->GetDistanceFrom (b);
NS_ASSERT(distance >= 0);
double m;
if (distance < m_distance1)
{
m = m_m0;
}
else if (distance < m_distance2)
{
m = m_m1;
}
else
{
m = m_m2;
}
// the current power unit is dBm, but Watt is put into the Nakagami /
// Rayleigh distribution.
double powerW = pow(10, (txPowerDbm - 30) / 10);
double resultPowerW;
// switch between Erlang- and Gamma distributions: this is only for
// speed. (Gamma is equal to Erlang for any positive integer m.)
unsigned int int_m = static_cast<unsigned int>(floor(m));
if (int_m == m)
{
resultPowerW = m_erlangRandomVariable.GetValue(int_m, powerW / m);
}
else
{
resultPowerW = m_gammaRandomVariable.GetValue(m, powerW / m);
}
double resultPowerDbm = 10 * log10(resultPowerW) + 30;
NS_LOG_DEBUG ("Nakagami distance=" << distance << "m, " <<
"power=" << powerW <<"W, " <<
"resultPower=" << resultPowerW << "W=" << resultPowerDbm << "dBm");
return resultPowerDbm;
}
// ------------------------------------------------------------------------- //
NS_OBJECT_ENSURE_REGISTERED (FixedRssLossModel);
TypeId
FixedRssLossModel::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::FixedRssLossModel")
.SetParent<PropagationLossModel> ()
.AddConstructor<FixedRssLossModel> ()
.AddAttribute ("Rss", "The fixed receiver Rss.",
DoubleValue (-150.0),
MakeDoubleAccessor (&FixedRssLossModel::m_rss),
MakeDoubleChecker<double> ())
;
return tid;
}
FixedRssLossModel::FixedRssLossModel ()
: PropagationLossModel ()
{}
FixedRssLossModel::~FixedRssLossModel ()
{}
void
FixedRssLossModel::SetRss (double rss)
{
m_rss = rss;
}
double
FixedRssLossModel::DoCalcRxPower (double txPowerDbm,
Ptr<MobilityModel> a,
Ptr<MobilityModel> b) const
{
return m_rss;
}
// ------------------------------------------------------------------------- //
} // namespace ns3

View File

@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
* Contributions: Timo Bingmann <timo.bingmann@student.kit.edu>
* Contributions: Gary Pei <guangyu.pei@boeing.com> for fixed RSS
*/
#ifndef PROPAGATION_LOSS_MODEL_H
@@ -296,6 +297,79 @@ private:
double m_referenceLoss;
};
/**
* \brief Nakagami-m fast fading propagation loss model.
*
* The Nakagami-m distribution is applied to the power level. The probability
* density function is defined as
* \f[ p(x; m, \omega) = \frac{2 m^m}{\Gamma(m) \omega^m} x^{2m - 1} e^{-\frac{m}{\omega} x^2} = 2 x \cdot p_{\text{Gamma}}(x^2, m, \frac{m}{\omega}) \f]
* with \f$ m \f$ the fading depth parameter and \f$ \omega \f$ the average received power.
*
* It is implemented by either a ns3::GammaVariable or a ns3::ErlangVariable
* random variable.
*
* Like in ns3::ThreeLogDistancePropagationLossModel, the m parameter is varied
* over three distance fields:
* \f[ \underbrace{0 \cdots\cdots}_{m_0} \underbrace{d_1 \cdots\cdots}_{m_1} \underbrace{d_2 \cdots\cdots}_{m_2} \infty \f]
*
* For m = 1 the Nakagami-m distribution equals the Rayleigh distribution. Thus
* this model also implements Rayleigh distribution based fast fading.
*/
class NakagamiPropagationLossModel : public PropagationLossModel
{
public:
static TypeId GetTypeId (void);
NakagamiPropagationLossModel ();
// Parameters are all accessible via attributes.
private:
NakagamiPropagationLossModel (const NakagamiPropagationLossModel& o);
NakagamiPropagationLossModel& operator= (const NakagamiPropagationLossModel& o);
virtual double DoCalcRxPower (double txPowerDbm,
Ptr<MobilityModel> a,
Ptr<MobilityModel> b) const;
double m_distance1;
double m_distance2;
double m_m0;
double m_m1;
double m_m2;
ErlangVariable m_erlangRandomVariable;
GammaVariable m_gammaRandomVariable;
};
/**
* \brief The propagation loss is fixed. The user can set received power level.
*/
class FixedRssLossModel : public PropagationLossModel
{
public:
static TypeId GetTypeId (void);
FixedRssLossModel ();
virtual ~FixedRssLossModel ();
/**
* \param RSS (dBm) the received signal strength
*
* Set the RSS.
*/
void SetRss (double rss);
private:
FixedRssLossModel (const FixedRssLossModel &o);
FixedRssLossModel & operator = (const FixedRssLossModel &o);
virtual double DoCalcRxPower (double txPowerDbm,
Ptr<MobilityModel> a,
Ptr<MobilityModel> b) const;
double m_rss;
};
} // namespace ns3
#endif /* PROPAGATION_LOSS_MODEL_H */

View File

@@ -188,7 +188,6 @@ QapWifiMac::SetEifsNoDifs (Time eifsNoDifs)
{
NS_LOG_FUNCTION (this << eifsNoDifs);
m_dcfManager->SetEifsNoDifs (eifsNoDifs);
m_eifsNoDifs = eifsNoDifs;
}
void
@@ -224,7 +223,7 @@ QapWifiMac::GetSifs (void) const
Time
QapWifiMac::GetEifsNoDifs (void) const
{
return m_eifsNoDifs;
return m_dcfManager->GetEifsNoDifs ();
}
Time

View File

@@ -88,7 +88,7 @@ public:
private:
virtual void DoDispose (void);
void Receive (Ptr<Packet> packet, WifiMacHeader const *hdr);
void Receive (Ptr<Packet> packet, WifiMacHeader const*hdr);
void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to);
/* Next function is invoked only when ap relies a frame. */
@@ -139,7 +139,6 @@ private:
Ssid m_ssid;
EventId m_beaconEvent;
Time m_beaconInterval;
Time m_eifsNoDifs;
};
} //namespace ns3

View File

@@ -164,7 +164,6 @@ QstaWifiMac::SetEifsNoDifs (Time eifsNoDifs)
{
NS_LOG_FUNCTION (this << eifsNoDifs);
m_dcfManager->SetEifsNoDifs (eifsNoDifs);
m_eifsNoDifs = eifsNoDifs;
}
void
@@ -200,7 +199,7 @@ QstaWifiMac::GetSifs (void) const
Time
QstaWifiMac::GetEifsNoDifs (void) const
{
return m_eifsNoDifs;
return m_dcfManager->GetEifsNoDifs ();
}
Time

View File

@@ -163,7 +163,6 @@ private:
EventId m_beaconWatchdog;
uint32_t m_maxMissedBeacons;
Time m_eifsNoDifs;
};
} //namespace ns3

View File

@@ -32,7 +32,7 @@ namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (WifiMacQueue);
WifiMacQueue::Item::Item (Ptr<const Packet> packet,
WifiMacHeader const &hdr,
const WifiMacHeader &hdr,
Time tstamp)
: packet (packet), hdr (hdr), tstamp (tstamp)
{}
@@ -89,7 +89,7 @@ WifiMacQueue::GetMaxDelay (void) const
}
void
WifiMacQueue::Enqueue (Ptr<const Packet> packet, WifiMacHeader const &hdr)
WifiMacQueue::Enqueue (Ptr<const Packet> packet, const WifiMacHeader &hdr)
{
Cleanup ();
if (m_size == m_maxSize)

View File

@@ -60,7 +60,7 @@ public:
uint32_t GetMaxSize (void) const;
Time GetMaxDelay (void) const;
void Enqueue (Ptr<const Packet> packet, WifiMacHeader const &hdr);
void Enqueue (Ptr<const Packet> packet, const WifiMacHeader &hdr);
Ptr<const Packet> Dequeue (WifiMacHeader *hdr);
Ptr<const Packet> Peek (WifiMacHeader *hdr);
/**
@@ -109,7 +109,7 @@ private:
struct Item {
Item (Ptr<const Packet> packet,
WifiMacHeader const &hdr,
const WifiMacHeader &hdr,
Time tstamp);
Ptr<const Packet> packet;
WifiMacHeader hdr;

View File

@@ -165,7 +165,44 @@ WifiModeFactory::CreateQam (std::string uniqueName,
item->isMandatory = isMandatory;
return WifiMode (uid);
}
WifiMode
WifiModeFactory::CreateDbpsk (std::string uniqueName,
bool isMandatory,
uint32_t bandwidth,
uint32_t dataRate,
uint32_t phyRate)
{
WifiModeFactory *factory = GetFactory ();
uint32_t uid = factory->AllocateUid (uniqueName);
WifiModeItem *item = factory->Get (uid);
item->uniqueUid = uniqueName;
item->bandwidth = bandwidth;
item->dataRate = dataRate;
item->phyRate = phyRate;
item->modulation = WifiMode::DBPSK;
item->constellationSize = 2;
item->isMandatory = isMandatory;
return WifiMode (uid);
}
WifiMode
WifiModeFactory::CreateDqpsk (std::string uniqueName,
bool isMandatory,
uint32_t bandwidth,
uint32_t dataRate,
uint32_t phyRate)
{
WifiModeFactory *factory = GetFactory ();
uint32_t uid = factory->AllocateUid (uniqueName);
WifiModeItem *item = factory->Get (uid);
item->uniqueUid = uniqueName;
item->bandwidth = bandwidth;
item->dataRate = dataRate;
item->phyRate = phyRate;
item->modulation = WifiMode::DQPSK;
item->constellationSize = 4;
item->isMandatory = isMandatory;
return WifiMode (uid);
}
bool
WifiModeFactory::Search (std::string name, WifiMode *mode)
{

View File

@@ -41,6 +41,8 @@ class WifiMode
public:
enum ModulationType {
BPSK,
DBPSK,
DQPSK,
QAM
};
@@ -170,6 +172,40 @@ public:
uint32_t phyRate,
uint8_t constellationSize);
/**
* \param uniqueName the name of the associated WifiMode. This name
* must be unique accross _all_ instances.
* \param isMandatory true if this WifiMode is mandatory, false otherwise.
* \param bandwidth the bandwidth (Hz) of the signal generated when the
* 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
* The phyRate includes FEC so, is typically higher than the dataRate.
*
* Create a DBPSK WifiMode.
*/
static WifiMode CreateDbpsk (std::string uniqueName,
bool isMandatory,
uint32_t bandwidth,
uint32_t dataRate,
uint32_t phyRate);
/**
* \param uniqueName the name of the associated WifiMode. This name
* must be unique accross _all_ instances.
* \param isMandatory true if this WifiMode is mandatory, false otherwise.
* \param bandwidth the bandwidth (Hz) of the signal generated when the
* 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
* The phyRate includes FEC so, is typically higher than the dataRate.
*
* Create a DQPSK WifiMode.
*/
static WifiMode CreateDqpsk (std::string uniqueName,
bool isMandatory,
uint32_t bandwidth,
uint32_t dataRate,
uint32_t phyRate);
private:
friend class WifiMode;
friend std::istream & operator >> (std::istream &is, WifiMode &mode);

View File

@@ -24,6 +24,7 @@ namespace ns3 {
enum WifiPhyStandard {
WIFI_PHY_STANDARD_80211a,
WIFI_PHY_STANDARD_80211b,
WIFI_PHY_STANDARD_holland
};

View File

@@ -199,6 +199,43 @@ WifiPhy::NotifyPromiscSniff (Ptr<const Packet> packet)
m_phyPromiscSnifferTrace (packet);
}
WifiMode
WifiPhy::Get1mbb (void)
{
static WifiMode mode = WifiModeFactory::CreateDbpsk ("wifib-1mbs",
true,
22000000, 1000000, 1000000);
return mode;
}
WifiMode
WifiPhy::Get2mbb (void)
{
static WifiMode mode = WifiModeFactory::CreateDqpsk ("wifib-2mbs",
true,
22000000, 2000000, 2000000);
return mode;
}
WifiMode
WifiPhy::Get5_5mbb (void)
{
static WifiMode mode = WifiModeFactory::CreateDqpsk ("wifib-5.5mbs",
true,
22000000, 5500000, 5500000);
return mode;
}
WifiMode
WifiPhy::Get11mbb (void)
{
static WifiMode mode = WifiModeFactory::CreateDqpsk ("wifib-11mbs",
true,
22000000, 11000000, 11000000);
return mode;
}
} // namespace ns3
namespace {
@@ -215,6 +252,10 @@ public:
ns3::WifiPhy::Get36mba ();
ns3::WifiPhy::Get48mba ();
ns3::WifiPhy::Get54mba ();
ns3::WifiPhy::Get1mbb ();
ns3::WifiPhy::Get2mbb ();
ns3::WifiPhy::Get5_5mbb ();
ns3::WifiPhy::Get11mbb ();
}
} g_constructor;
}

View File

@@ -252,6 +252,11 @@ public:
static WifiMode Get36mba (void);
static WifiMode Get48mba (void);
static WifiMode Get54mba (void);
static WifiMode Get1mbb (void);
static WifiMode Get2mbb (void);
static WifiMode Get5_5mbb (void);
static WifiMode Get11mbb (void);
/**
* Public method used to fire a PhyTxBegin trace. Implemented for encapsulation

View File

@@ -1,5 +1,12 @@
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
def configure(conf):
have_gsl = conf.pkg_check_modules('GSL', 'gsl', mandatory=False)
conf.env['ENABLE_GSL'] = have_gsl
conf.report_optional_feature("GSL", "GNU Scientific Library (GSL)",
conf.env['ENABLE_GSL'],
"GSL not found")
def build(bld):
obj = bld.create_ns3_module('wifi', ['node'])
obj.source = [
@@ -107,6 +114,12 @@ def build(bld):
'mac-low.h',
]
if bld.env['ENABLE_GSL']:
obj.uselib = 'GSL GSLCBLAS M'
obj.env.append_value('CXXDEFINES', "ENABLE_GSL")
obj = bld.create_ns3_program('wifi-phy-test',
['core', 'simulator', 'mobility', 'node', 'wifi'])
obj.source = 'wifi-phy-test.cc'

View File

@@ -263,7 +263,159 @@ YansErrorRateModel::GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbi
31 // adFreePlusOne
);
}
else if (mode == WifiPhy::Get1mbb ())
{
return Get80211bDsssDbpskSuccessRate (snr,nbits);
}
else if (mode == WifiPhy::Get2mbb ())
{
return Get80211bDsssDqpskSuccessRate (snr,nbits);
}
else if (mode == WifiPhy::Get5_5mbb ())
{
return Get80211bDsssDqpskCck5_5SuccessRate (snr,nbits);
}
else if (mode == WifiPhy::Get11mbb ())
{
return Get80211bDsssDqpskCck11SuccessRate (snr,nbits);
}
return 0;
}
// 802.11b ber based on "Wireless Network Coexistence: Wireless
// LAN in the 21st Century" by Robert Morrow page 187
double
YansErrorRateModel::DqpskFunction (double x) const
{
return ((sqrt (2.0) + 1.0) / sqrt (8.0*3.1415926*sqrt (2.0)))
*(1.0/sqrt (x))
*exp ( - (2.0 - sqrt (2.0)) * x) ;
}
double
YansErrorRateModel::Get80211bDsssDbpskSuccessRate (double sinr, uint32_t nbits) const
{
double EbN0 = sinr * 22000000.0 / 1000000.0; // 1 bit per symbol with 1 MSPS
double ber = 0.5 * exp (-EbN0);
return pow ((1.0 - ber), nbits);
}
double
YansErrorRateModel::Get80211bDsssDqpskSuccessRate (double sinr,uint32_t nbits) const
{
double EbN0 = sinr * 22000000.0 / 1000000.0 / 2.0; // 2 bits per symbol, 1 MSPS
double ber = DqpskFunction (EbN0);
return pow ((1.0 - ber), nbits);
}
double
YansErrorRateModel::Get80211bDsssDqpskCck5_5SuccessRate (double sinr,uint32_t nbits) const
{
#ifdef ENABLE_GSL
// symbol error probability
double EbN0 = sinr * 22000000.0 / 1375000.0 / 4.0;
double sep = SymbolErrorProb16Cck (4.0*EbN0/2.0);
return pow (1.0-sep,nbits/4.0);
#else
NS_LOG_WARN ("Running a 802.11b CCK Matlab model less accurate than GSL model");
// The matlab model
double ber;
if (sinr > WLAN_SIR_PERFECT)
{
ber = 0.0 ;
}
else if (sinr < WLAN_SIR_IMPOSSIBLE)
{
ber = 0.5;
}
else
{ // fitprops.coeff from matlab berfit
double a1 = 5.3681634344056195e-001;
double a2 = 3.3092430025608586e-003;
double a3 = 4.1654372361004000e-001;
double a4 = 1.0288981434358866e+000;
ber = a1 * exp (-(pow ((sinr-a2)/a3,a4)));
}
return pow ((1.0 - ber), nbits);
#endif
}
double
YansErrorRateModel::Get80211bDsssDqpskCck11SuccessRate (double sinr,uint32_t nbits) const
{
#ifdef ENABLE_GSL
// symbol error probability
double EbN0 = sinr * 22000000.0 / 1375000.0 / 8.0;
double sep = SymbolErrorProb256Cck (8.0*EbN0/2.0);
return pow (1.0-sep,nbits/8.0);
#else
NS_LOG_WARN ("Running a 802.11b CCK Matlab model less accurate than GSL model");
// The matlab model
double ber;
if (sinr > WLAN_SIR_PERFECT)
{
ber = 0.0 ;
}
else if (sinr < WLAN_SIR_IMPOSSIBLE)
{
ber = 0.5;
}
else
{ // fitprops.coeff from matlab berfit
double a1 = 7.9056742265333456e-003;
double a2 = -1.8397449399176360e-001;
double a3 = 1.0740689468707241e+000;
double a4 = 1.0523316904502553e+000;
double a5 = 3.0552298746496687e-001;
double a6 = 2.2032715128698435e+000;
ber = (a1*sinr*sinr+a2*sinr+a3)/(sinr*sinr*sinr+a4*sinr*sinr+a5*sinr+a6);
}
return pow ((1.0 - ber), nbits);
#endif
}
#ifdef ENABLE_GSL
double
IntegralFunction (double x, void *params)
{
double beta = ((FunctionParameters *) params)->beta;
double n = ((FunctionParameters *) params)->n;
double IntegralFunction = pow (2*gsl_cdf_ugaussian_P (x+ beta) - 1, n-1)
* exp (-x*x/2.0) / sqrt (2.0 * M_PI);
return IntegralFunction;
}
double
YansErrorRateModel::SymbolErrorProb16Cck (double e2) const
{
double sep;
double error;
FunctionParameters params;
params.beta = sqrt (2.0*e2);
params.n = 8.0;
gsl_integration_workspace * w = gsl_integration_workspace_alloc (1000);
gsl_function F;
F.function = &IntegralFunction;
F.params = &params;
gsl_integration_qagiu (&F,-params.beta, 0, 1e-7, 1000, w, &sep, &error);
gsl_integration_workspace_free (w);
if (error == 0.0)
{
sep = 1.0;
}
return 1.0 - sep;
}
double YansErrorRateModel::SymbolErrorProb256Cck (double e1) const
{
return 1.0 - pow (1.0 - SymbolErrorProb16Cck (e1/2.0), 2.0);
}
#endif
} // namespace ns3

View File

@@ -21,11 +21,51 @@
#define YANS_ERROR_RATE_MODEL_H
#include <stdint.h>
#ifdef ENABLE_GSL
#include <gsl/gsl_math.h>
#include <gsl/gsl_integration.h>
#include <gsl/gsl_cdf.h>
#include <gsl/gsl_sf_bessel.h>
#endif
#include "wifi-mode.h"
#include "error-rate-model.h"
namespace ns3 {
#ifdef ENABLE_GSL
typedef struct FunctionParameterType
{
double beta;
double n;
} FunctionParameters;
double IntegralFunction (double x, void *params);
#endif
/**
* \brief Model the error rate for different modulations.
*
* A packet of interest (e.g., a packet can potentially be received by the MAC)
* is divided into chunks. Each chunk is related to an start/end receiving event.
* For each chunk, it calculates the ratio (SINR) between received power of packet
* of interest and summation of noise and interfering power of all the other incoming
* packets. Then, it will calculate the success rate of the chunk based on
* BER of the modulation. The success reception rate of the packet is derived from
* the success rate of all chunks.
*
* The 802.11b modulations:
* - 1 Mbps mode is based on DBPSK. BER is from equation 5.2-69 from John G. Proakis
* Digitial Communications, 2001 edition
* - 2 Mbps model is based on DQPSK. Equation 8 from "Tight bounds and accurate
* approximations for dqpsk transmission bit error rate", G. Ferrari and G.E. Corazza
* ELECTRONICS LETTERS, 40(20):1284-1285, September 2004
* - 5.5 Mbps and 11 Mbps are based on equations (18) and (17) from "Properties and
* performance of the ieee 802.11b complementarycode-key signal sets",
* Michael B. Pursley and Thomas C. Royster. IEEE TRANSACTIONS ON COMMUNICATIONS,
* 57(2):440-449, February 2009.
* - More detailed description and validation can be found in
* http://www.nsnam.org/~pei/80211b.pdf
*/
class YansErrorRateModel : public ErrorRateModel
{
public:
@@ -52,6 +92,19 @@ private:
uint32_t phyRate,
uint32_t m, uint32_t dfree,
uint32_t adFree, uint32_t adFreePlusOne) const;
double DqpskFunction (double x) const;
double Get80211bDsssDbpskSuccessRate (double sinr, uint32_t nbits) const;
double Get80211bDsssDqpskSuccessRate (double sinr,uint32_t nbits) const;
double Get80211bDsssDqpskCck5_5SuccessRate (double sinr,uint32_t nbits) const;
double Get80211bDsssDqpskCck11SuccessRate (double sinr,uint32_t nbits) const;
#ifdef ENABLE_GSL
double SymbolErrorProb16Cck (double e2) const; /// equation (18) in Pursley's paper
double SymbolErrorProb256Cck (double e1) const; /// equation (17) in Pursley's paper
#endif
private:
static const double WLAN_SIR_PERFECT = 10.0;
static const double WLAN_SIR_IMPOSSIBLE = 0.1;
};

View File

@@ -110,6 +110,7 @@ YansWifiPhy::GetTypeId (void)
EnumValue (WIFI_PHY_STANDARD_80211a),
MakeEnumAccessor (&YansWifiPhy::SetStandard),
MakeEnumChecker (WIFI_PHY_STANDARD_80211a, "802.11a",
WIFI_PHY_STANDARD_80211b, "802.11b",
WIFI_PHY_STANDARD_holland, "holland"))
.AddAttribute ("State", "The state of the PHY layer",
PointerValue (),
@@ -158,6 +159,9 @@ YansWifiPhy::SetStandard (enum WifiPhyStandard standard)
case WIFI_PHY_STANDARD_80211a:
Configure80211a ();
break;
case WIFI_PHY_STANDARD_80211b:
Configure80211b ();
break;
case WIFI_PHY_STANDARD_holland:
ConfigureHolland ();
break;
@@ -475,6 +479,18 @@ YansWifiPhy::Configure80211a (void)
m_modes.push_back (WifiPhy::Get54mba ());
}
void
YansWifiPhy::Configure80211b (void)
{
NS_LOG_FUNCTION (this);
m_interference.Configure80211bParameters ();
m_modes.push_back (WifiPhy::Get1mbb ());
m_modes.push_back (WifiPhy::Get2mbb ());
m_modes.push_back (WifiPhy::Get5_5mbb ());
m_modes.push_back (WifiPhy::Get11mbb ());
}
void
YansWifiPhy::ConfigureHolland (void)
{

View File

@@ -141,6 +141,7 @@ private:
YansWifiPhy (const YansWifiPhy &o);
virtual void DoDispose (void);
void Configure80211a (void);
void Configure80211b (void);
void ConfigureHolland (void);
double GetEdThresholdW (void) const;
double DbmToW (double dbm) const;

View File

@@ -16,6 +16,136 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
* Author: Faker Moatamri <faker.moatamri@sophia.inria.fr>
*/
/**
* \ingroup internetStack
* \defgroup internetStackModel Internet Stack Model
*
* \section internetStackTracingModel Tracing in the Internet Stack
*
* The internet stack provides a number of trace sources in its various
* protocol implementations. These trace sources can be hooked using your own
* custom trace code, or you can use our helper functions in some cases to
* arrange for tracing to be enabled.
*
* \subsection internetStackArpTracingModel Tracing in ARP
*
* ARP provides two trace hooks, one in the cache, and one in the layer three
* protocol. The trace accessor in the cache is given the name "Drop." When
* a packet is transmitted over an interface that requires ARP, it is first
* queued for transmission in the ARP cache until the required MAC address is
* resolved. There are a number of retries that may be done trying to get the
* address, and if the maximum retry count is exceeded the packet in question
* is dropped by ARP. The single trace hook in the ARP cache is called,
*
* - If an outbound packet is placed in the ARP cache pending address resolution
* and no resolution can be made within the maximum retry count, the outbound
* packet is dropped and this trace is fired;
*
* A second trace hook lives in the ARP L3 protocol (also named "Drop") and may
* be called for a number of reasons.
*
* - If an ARP reply is received for an entry that is not waiting for a reply,
* the ARP reply packet is dropped and this trace is fired;
* - If an ARP reply is received for a non-existant entry, the ARP reply packet
* is dropped and this trace is fired;
* - If an ARP cache entry is in the DEAD state (has timed out) and an ARP reply
* packet is received, the reply packet is dropped and this trace is fired.
* - Each ARP cache entry has a queue of pending packets. If the size of the
* queue is exceeded, the outbound packet is dropped and this trace is fired.
*
* \subsection internetStackIpv4TracingModel Tracing in IPv4
*
* The IPv4 layer three protocol provides three trace hooks. These are the
* "Tx" (ns3::Ipv4L3Protocol::m_txTrace), "Rx" (ns3::Ipv4L3Protocol::m_rxTrace)
* and "Drop" (ns3::Ipv4L3Protocol::m_dropTrace) trace sources.
*
* The "Tx" trace is fired in a number of situations, all of which indicate that
* a given packet is about to be sent down to a given ns3::Ipv4Interface.
*
* - In the case of a packet destined for the broadcast address, the
* Ipv4InterfaceList is iterated and for every interface that is up and can
* fragment the packet or has a large enough MTU to transmit the packet,
* the trace is hit. See ns3::Ipv4L3Protocol::Send.
*
* - In the case of a packet that needs routing, the "Tx" trace may be fired
* just before a packet is sent to the interface appropriate to the default
* gateway. See ns3::Ipv4L3Protocol::SendRealOut.
*
* - Also in the case of a packet that needs routing, the "Tx" trace may be
* fired just before a packet is sent to the outgoing interface appropriate
* to the discovered route. See ns3::Ipv4L3Protocol::SendRealOut.
*
* The "Rx" trace is fired when a packet is passed from the device up to the
* ns3::Ipv4L3Protocol::Receive function.
*
* - In the receive function, the Ipv4InterfaceList is iterated, and if the
* Ipv4Interface corresponding to the receiving device is fount to be in the
* UP state, the trace is fired.
*
* The "Drop" trace is fired in any case where the packet is dropped (in both
* the transmit and receive paths).
*
* - In the ns3::Ipv4Interface::Receive function, the packet is dropped and the
* drop trace is hit if the interface corresponding to the receiving device
* is in the DOWN state.
*
* - Also in the ns3::Ipv4Interface::Receive function, the packet is dropped and
* the drop trace is hit if the checksum is found to be bad.
*
* - In ns3::Ipv4L3Protocol::Send, an outgoing packet bound for the broadcast
* address is dropped and the "Drop" trace is fired if the "don't fragement"
* bit is set and fragmentation is available and required.
*
* - Also in ns3::Ipv4L3Protocol::Send, an outgoing packet destined for the
* broadcast address is dropped and the "Drop" trace is hit if fragmentation
* is not available and is required (MTU < packet size).
*
* - In the case of a broadcast address, an outgoing packet is cloned for each
* outgoing interface. If any of the interfaces is in the DOWN state, the
* "Drop" trace event fires with a reference to the copied packet.
*
* - In the case of a packet requiring a route, an outgoing packet is dropped
* and the "Drop" trace event fires if no route to the remote host is found.
*
* - In ns3::Ipv4L3Protocol::SendRealOut, an outgoing packet being routed
* is dropped and the "Drop" trace is fired if the "don't fragement" bit is
* set and fragmentation is available and required.
*
* - Also in ns3::Ipv4L3Protocol::SendRealOut, an outgoing packet being routed
* is dropped and the "Drop" trace is hit if fragmentation is not available
* and is required (MTU < packet size).
*
* - An outgoing packet being routed is dropped and the "Drop" trace event fires
* if the required Ipv4Interface is in the DOWN state.
*
* - If a packet is being forwarded, and the TTL is exceeded (see
* ns3::Ipv4L3Protocol::DoForward), the packet is dropped and the "Drop" trace
* event is fired.
*
* \subsection internetStackNs3TCPTracingModel Tracing in ns-3 TCP
*
* There is currently one trace source in the ns-3 TCP implementation named
* "CongestionWindow" (see ns3::TcpSocketImpl::m_cWnd). This is set in a number
* of places (see file tcp-socket-impl.cc) whenever the value of the congestion
* window is changed.
*
* \subsection internetStackNscTCPTracingModel Tracing in NSC TCP
*
* There is currently one trace source in the Network Simulation Cradle TCP
* implementation named "CongestionWindow" (see ns3::NscTcpSocketImpl::m_cWnd).
* This is set in a number of places (see file nsc-tcp-socket-impl.cc) when
* the value of the cogestion window is initially set. Note that this is not
* instrumented from the underlying TCP implementaion.
*
* \subsection internetStackNs3UdpTracingModel Tracing in ns-3 UDP
*
* There is currently one trace source in the ns-3 UDP implementation named
* "Drop" (see ns3::UdpSocketImpl::m_dropTrace). This is set when a packet
* is received in ns3::UdpSocketImpl::ForwardUp and the receive buffer cannot
* accomodate the encapsulated data.
*/
#include "ns3/assert.h"
@@ -24,10 +154,16 @@
#include "ns3/names.h"
#include "ns3/ipv4.h"
#include "internet-stack-helper.h"
#include "ns3/internet-stack.h"
#include "ns3/packet-socket-factory.h"
#include "ns3/config.h"
#include "ns3/simulator.h"
#include "ns3/string.h"
#include "ns3/net-device.h"
#include "ns3/callback.h"
#include "ns3/node.h"
#include "ns3/core-config.h"
#include "ns3/ipv4-list-routing-impl.h"
#include "ns3/ipv4-static-routing-impl.h"
#include <limits>
namespace ns3 {
@@ -35,8 +171,9 @@ namespace ns3 {
std::vector<InternetStackHelper::Trace> InternetStackHelper::m_traces;
std::string InternetStackHelper::m_pcapBaseFilename;
InternetStackHelper::InternetStackHelper() : m_nscLibrary("")
InternetStackHelper::InternetStackHelper ()
{
SetTcp ("ns3::TcpL4Protocol");
}
void
@@ -55,9 +192,16 @@ InternetStackHelper::Cleanup (void)
}
void
InternetStackHelper::SetNscStack(const std::string soname)
InternetStackHelper::SetTcp (const std::string tid)
{
m_nscLibrary = soname;
m_tcpFactory.SetTypeId (tid);
}
void
InternetStackHelper::SetTcp (std::string tid, std::string n0, const AttributeValue &v0)
{
m_tcpFactory.SetTypeId (tid);
m_tcpFactory.Set (n0,v0);
}
void
@@ -69,6 +213,15 @@ InternetStackHelper::Install (NodeContainer c) const
}
}
static void
CreateAndAggregateObjectFromTypeId (Ptr<Node> node, const std::string typeId)
{
ObjectFactory factory;
factory.SetTypeId(typeId);
Ptr<Object> protocol = factory.Create <Object> ();
node->AggregateObject (protocol);
}
void
InternetStackHelper::Install (Ptr<Node> node) const
{
@@ -79,17 +232,22 @@ InternetStackHelper::Install (Ptr<Node> node) const
return;
}
if (m_nscLibrary != "")
{
AddNscInternetStack (node, m_nscLibrary);
}
else
{
AddInternetStack (node);
}
CreateAndAggregateObjectFromTypeId (node, "ns3::ArpL3Protocol");
CreateAndAggregateObjectFromTypeId (node, "ns3::Ipv4L3Protocol");
CreateAndAggregateObjectFromTypeId (node, "ns3::Icmpv4L4Protocol");
CreateAndAggregateObjectFromTypeId (node, "ns3::UdpL4Protocol");
node->AggregateObject (m_tcpFactory.Create<Object> ());
Ptr<PacketSocketFactory> factory = CreateObject<PacketSocketFactory> ();
node->AggregateObject (factory);
// Set routing
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
// XXX cut this over to use of TypeIds and factories
Ptr<Ipv4ListRoutingImpl> ipv4RoutingImpl = CreateObject<Ipv4ListRoutingImpl> ();
Ptr<Ipv4StaticRoutingImpl> ipv4staticRoutingImpl = CreateObject<Ipv4StaticRoutingImpl> ();
ipv4staticRoutingImpl->SetNode (node);
ipv4RoutingImpl->AddRoutingProtocol (ipv4staticRoutingImpl, 0);
ipv4->SetRoutingProtocol (ipv4RoutingImpl);
ipv4RoutingImpl->SetNode (node);
}
void

View File

@@ -25,9 +25,13 @@
#include "net-device-container.h"
#include "ns3/pcap-writer.h"
#include "ns3/packet.h"
#include "ns3/ptr.h"
#include "ns3/object-factory.h"
namespace ns3 {
class Node;
/**
* \brief aggregate IP/TCP/UDP functionality to existing Nodes.
*/
@@ -65,18 +69,32 @@ public:
*/
void Install (NodeContainer c) const;
/**
* \brief Enable or disable use of the Network Simulation Cradle stack.
/**
* \brief set the Tcp stack which will not need any other parameter.
*
* Give the NSC stack a shared library file name to use when creating the
* statck implementation. By providing a non-empty string as a parameter, you
* select the NSC version of the stack. By providing an empty string, you
* select the ns-3 default version.
* This function sets up the tcp stack to the given TypeId. It should not be
* used for NSC stack setup because the nsc stack needs the Library attribute
* to be setup, please use instead the version that requires an attribute
* and a value. If you choose to use this function anyways to set nsc stack
* the default value for the linux library will be used: "liblinux2.6.26.so".
*
* \param soname name of the shared library with the nsc tcp stack
* to use, e.g. 'liblinux2.6.26.so'.
* \param tid the type id, typically it is set to "ns3::TcpL4Protocol"
*/
void SetNscStack(std::string soname);
void SetTcp(std::string tid);
/**
* \brief This function is used to setup the Network Simulation Cradle stack with library value.
*
* Give the NSC stack a shared library file name to use when creating the
* stack implementation. The attr string is actually the attribute name to
* be setup and val is its value. The attribute is the stack implementation
* to be used and the value is the shared library name.
*
* \param tid The type id, for the case of nsc it would be "ns3::NscTcpL4Protocol"
* \param attr The attribute name that must be setup, for example "Library"
* \param val The attribute value, which will be in fact the shared library name (example:"liblinux2.6.26.so")
*/
void SetTcp (std::string tid, std::string attr, const AttributeValue &val);
/**
* \param os output stream
@@ -113,7 +131,7 @@ public:
static void EnablePcapAll (std::string filename);
private:
std::string m_nscLibrary;
ObjectFactory m_tcpFactory;
static void Cleanup (void);
static void LogRxIp (std::string context, Ptr<const Packet> packet, uint32_t deviceId);
static void LogTxIp (std::string context, Ptr<const Packet> packet, uint32_t deviceId);

View File

@@ -131,7 +131,7 @@ Ipv4AddressHelper::Assign (const NetDeviceContainer &c)
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
NS_ASSERT_MSG (ipv4, "Ipv4AddressHelper::Allocate(): Bad ipv4");
int32_t interface = ipv4->FindInterfaceForDevice (device);
int32_t interface = ipv4->GetInterfaceForDevice (device);
if (interface == -1)
{
interface = ipv4->AddInterface (device);

View File

@@ -41,7 +41,10 @@ public:
Ipv4Address GetAddress (uint32_t i, uint32_t j = 0) const;
void SetMetric (uint32_t i, uint16_t metric);
/**
* \param ipv4 pointer to Ipv4 object
* \param interface interface index of the Ipv4Interface to add to the container
*/
void Add (Ptr<Ipv4> ipv4, uint32_t interface);
void Add (std::string ipv4Name, uint32_t interface);

View File

@@ -0,0 +1,190 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <vector>
#include "ns3/log.h"
#include "ns3/ptr.h"
#include "ns3/names.h"
#include "ns3/node.h"
#include "ns3/ipv4.h"
#include "ns3/ipv4-route.h"
#include "ns3/ipv4-list-routing.h"
#include "ns3/assert.h"
#include "ns3/ipv4-address.h"
#include "ns3/ipv4-routing-protocol.h"
#include "ipv4-static-routing-helper.h"
NS_LOG_COMPONENT_DEFINE("Ipv4StaticRoutingHelper");
namespace ns3 {
Ptr<Ipv4StaticRouting>
Ipv4StaticRoutingHelper::GetStaticRouting (Ptr<Ipv4> ipv4) const
{
NS_LOG_FUNCTION (this);
Ptr<Ipv4RoutingProtocol> ipv4rp = ipv4->GetRoutingProtocol ();
NS_ASSERT_MSG (ipv4rp, "No routing protocol associated with Ipv4");
if (DynamicCast<Ipv4StaticRouting> (ipv4rp))
{
NS_LOG_LOGIC ("Static routing found as the main IPv4 routing protocol.");
return DynamicCast<Ipv4StaticRouting> (ipv4rp);
}
if (DynamicCast<Ipv4ListRouting> (ipv4rp))
{
Ptr<Ipv4ListRouting> lrp = DynamicCast<Ipv4ListRouting> (ipv4rp);
int16_t priority;
for (uint32_t i = 0; i < lrp->GetNRoutingProtocols (); i++)
{
NS_LOG_LOGIC ("Searching for static routing in list");
Ptr<Ipv4RoutingProtocol> temp = lrp->GetRoutingProtocol (i, priority);
if (DynamicCast<Ipv4StaticRouting> (temp))
{
NS_LOG_LOGIC ("Found static routing in list");
return DynamicCast<Ipv4StaticRouting> (temp);
}
}
}
NS_LOG_LOGIC ("Static routing not found");
return 0;
}
void
Ipv4StaticRoutingHelper::AddMulticastRoute (
Ptr<Node> n,
Ipv4Address source,
Ipv4Address group,
Ptr<NetDevice> input,
NetDeviceContainer output)
{
Ptr<Ipv4> ipv4 = n->GetObject<Ipv4> ();
// We need to convert the NetDeviceContainer to an array of interface
// numbers
std::vector<uint32_t> outputInterfaces;
for (NetDeviceContainer::Iterator i = output.Begin (); i != output.End (); ++i)
{
Ptr<NetDevice> nd = *i;
int32_t interface = ipv4->GetInterfaceForDevice (nd);
NS_ASSERT_MSG(interface >= 0,
"Ipv4StaticRoutingHelper::AddMulticastRoute(): "
"Expected an interface associated with the device nd");
outputInterfaces.push_back(interface);
}
int32_t inputInterface = ipv4->GetInterfaceForDevice (input);
NS_ASSERT_MSG(inputInterface >= 0,
"Ipv4StaticRoutingHelper::AddMulticastRoute(): "
"Expected an interface associated with the device input");
Ipv4StaticRoutingHelper helper;
Ptr<Ipv4StaticRouting> ipv4StaticRouting = helper.GetStaticRouting (ipv4);
if (!ipv4StaticRouting)
{
NS_ASSERT_MSG (ipv4StaticRouting,
"Ipv4StaticRoutingHelper::SetDefaultMulticastRoute(): "
"Expected an Ipv4StaticRouting associated with this node");
}
ipv4StaticRouting->AddMulticastRoute (source, group, inputInterface, outputInterfaces);
}
void
Ipv4StaticRoutingHelper::AddMulticastRoute (
Ptr<Node> n,
Ipv4Address source,
Ipv4Address group,
std::string inputName,
NetDeviceContainer output)
{
Ptr<NetDevice> input = Names::Find<NetDevice> (inputName);
AddMulticastRoute (n, source, group, input, output);
}
void
Ipv4StaticRoutingHelper::AddMulticastRoute (
std::string nName,
Ipv4Address source,
Ipv4Address group,
Ptr<NetDevice> input,
NetDeviceContainer output)
{
Ptr<Node> n = Names::Find<Node> (nName);
AddMulticastRoute (n, source, group, input, output);
}
void
Ipv4StaticRoutingHelper::AddMulticastRoute (
std::string nName,
Ipv4Address source,
Ipv4Address group,
std::string inputName,
NetDeviceContainer output)
{
Ptr<NetDevice> input = Names::Find<NetDevice> (inputName);
Ptr<Node> n = Names::Find<Node> (nName);
AddMulticastRoute (n, source, group, input, output);
}
void
Ipv4StaticRoutingHelper::SetDefaultMulticastRoute (
Ptr<Node> n,
Ptr<NetDevice> nd)
{
Ptr<Ipv4> ipv4 = n->GetObject<Ipv4> ();
int32_t interfaceSrc = ipv4->GetInterfaceForDevice (nd);
NS_ASSERT_MSG(interfaceSrc >= 0,
"Ipv4StaticRoutingHelper::SetDefaultMulticastRoute(): "
"Expected an interface associated with the device");
Ipv4StaticRoutingHelper helper;
Ptr<Ipv4StaticRouting> ipv4StaticRouting = helper.GetStaticRouting (ipv4);
if (!ipv4StaticRouting)
{
NS_ASSERT_MSG (ipv4StaticRouting,
"Ipv4StaticRoutingHelper::SetDefaultMulticastRoute(): "
"Expected an Ipv4StaticRouting associated with this node");
}
ipv4StaticRouting->SetDefaultMulticastRoute (interfaceSrc);
}
void
Ipv4StaticRoutingHelper::SetDefaultMulticastRoute (
Ptr<Node> n,
std::string ndName)
{
Ptr<NetDevice> nd = Names::Find<NetDevice> (ndName);
SetDefaultMulticastRoute (n, nd);
}
void
Ipv4StaticRoutingHelper::SetDefaultMulticastRoute (
std::string nName,
Ptr<NetDevice> nd)
{
Ptr<Node> n = Names::Find<Node> (nName);
SetDefaultMulticastRoute (n, nd);
}
void
Ipv4StaticRoutingHelper::SetDefaultMulticastRoute (
std::string nName,
std::string ndName)
{
Ptr<Node> n = Names::Find<Node> (nName);
Ptr<NetDevice> nd = Names::Find<NetDevice> (ndName);
SetDefaultMulticastRoute (n, nd);
}
}; // namespace ns3

View File

@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 University of Washington
* Copyright (c) 2009 University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -14,12 +14,13 @@
* 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: Tom Henderson <tomhend@u.washington.edu>
*/
#ifndef STATIC_MULTICAST_ROUTE_HELPER_H
#define STATIC_MULTICAST_ROUTE_HELPER_H
#ifndef IPV4_STATIC_ROUTING_HELPER_H
#define IPV4_STATIC_ROUTING_HELPER_H
#include "ns3/ipv4.h"
#include "ns3/ipv4-static-routing.h"
#include "ns3/ptr.h"
#include "ns3/ipv4-address.h"
#include "ns3/node.h"
@@ -29,10 +30,10 @@
namespace ns3 {
class StaticMulticastRouteHelper
class Ipv4StaticRoutingHelper
{
public:
StaticMulticastRouteHelper ();
Ptr<Ipv4StaticRouting> GetStaticRouting (Ptr<Ipv4> ipv4) const;
void AddMulticastRoute (Ptr<Node> n, Ipv4Address source, Ipv4Address group,
Ptr<NetDevice> input, NetDeviceContainer output);
@@ -43,15 +44,20 @@ public:
void AddMulticastRoute (std::string nName, Ipv4Address source, Ipv4Address group,
std::string inputName, NetDeviceContainer output);
/**
* \brief Add a default route to the static routing protocol to forward
* packets out a particular interface
*
* Functionally equivalent to:
* route add 224.0.0.0 netmask 240.0.0.0 dev nd
*/
void SetDefaultMulticastRoute (Ptr<Node> n, Ptr<NetDevice> nd);
void SetDefaultMulticastRoute (Ptr<Node> n, std::string ndName);
void SetDefaultMulticastRoute (std::string nName, Ptr<NetDevice> nd);
void SetDefaultMulticastRoute (std::string nName, std::string ndName);
void JoinMulticastGroup (Ptr<Node> n, Ipv4Address source, Ipv4Address group);
void JoinMulticastGroup (std::string nName, Ipv4Address source, Ipv4Address group);
};
} // namespace ns3
#endif /* STATIC_MULTICAST_ROUTE_HELPER_H */
#endif /* IPV4_STATIC_ROUTING_HELPER_H */

View File

@@ -21,6 +21,7 @@
#include "ns3/olsr-routing-protocol.h"
#include "ns3/node-list.h"
#include "ns3/names.h"
#include "ns3/ipv4-list-routing.h"
namespace ns3 {
@@ -72,7 +73,9 @@ OlsrHelper::Install (Ptr<Node> node)
Ptr<olsr::RoutingProtocol> agent = m_agentFactory.Create<olsr::RoutingProtocol> ();
node->AggregateObject (agent);
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
ipv4->AddRoutingProtocol (agent, 10);
Ptr<Ipv4ListRouting> ipv4Routing = DynamicCast<Ipv4ListRouting> (ipv4->GetRoutingProtocol ());
NS_ASSERT (ipv4Routing);
ipv4Routing->AddRoutingProtocol (agent, 10);
agent->SetNode (node);
agent->Start ();
}

View File

@@ -38,22 +38,6 @@ PacketSinkHelper::SetAttribute (std::string name, const AttributeValue &value)
m_factory.Set (name, value);
}
#if 0
void
PacketSinkHelper::SetUdpLocal (Ipv4Address ip, uint16_t port)
{
m_factory.Set ("Protocol", String ("ns3::UdpSocketFactory"));
m_factory.Set ("Local", Address (InetSocketAddress (ip, port)));
}
void
PacketSinkHelper::SetTcpLocal (Ipv4Address ip, uint16_t port)
{
m_factory.Set ("Protocol", String ("ns3::TcpSocketFactory"));
m_factory.Set ("Local", Address (InetSocketAddress (ip, port)));
}
#endif
ApplicationContainer
PacketSinkHelper::Install (Ptr<Node> node) const
{

View File

@@ -1,153 +0,0 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Tom Henderson <tomhend@u.washington.edu>
*/
#include <vector>
#include "ns3/ptr.h"
#include "ns3/assert.h"
#include "ns3/ipv4-address.h"
#include "ns3/ipv4.h"
#include "ns3/names.h"
#include "static-multicast-route-helper.h"
namespace ns3 {
StaticMulticastRouteHelper::StaticMulticastRouteHelper ()
{
}
void
StaticMulticastRouteHelper::AddMulticastRoute (
Ptr<Node> n,
Ipv4Address source,
Ipv4Address group,
Ptr<NetDevice> input,
NetDeviceContainer output)
{
Ptr<Ipv4> ipv4 = n->GetObject<Ipv4> ();
// We need to convert the NetDeviceContainer to an array of interface
std::vector<uint32_t> outputInterfaces;
for (NetDeviceContainer::Iterator i = output.Begin (); i != output.End (); ++i)
{
Ptr<NetDevice> nd = *i;
uint32_t ointerface = ipv4->FindInterfaceForDevice (nd);
outputInterfaces.push_back(ointerface);
}
uint32_t iinterface = ipv4->FindInterfaceForDevice (input);
ipv4->AddMulticastRoute (source, group, iinterface, outputInterfaces);
}
void
StaticMulticastRouteHelper::AddMulticastRoute (
Ptr<Node> n,
Ipv4Address source,
Ipv4Address group,
std::string inputName,
NetDeviceContainer output)
{
Ptr<NetDevice> input = Names::Find<NetDevice> (inputName);
AddMulticastRoute (n, source, group, input, output);
}
void
StaticMulticastRouteHelper::AddMulticastRoute (
std::string nName,
Ipv4Address source,
Ipv4Address group,
Ptr<NetDevice> input,
NetDeviceContainer output)
{
Ptr<Node> n = Names::Find<Node> (nName);
AddMulticastRoute (n, source, group, input, output);
}
void
StaticMulticastRouteHelper::AddMulticastRoute (
std::string nName,
Ipv4Address source,
Ipv4Address group,
std::string inputName,
NetDeviceContainer output)
{
Ptr<NetDevice> input = Names::Find<NetDevice> (inputName);
Ptr<Node> n = Names::Find<Node> (nName);
AddMulticastRoute (n, source, group, input, output);
}
void
StaticMulticastRouteHelper::SetDefaultMulticastRoute (
Ptr<Node> n,
Ptr<NetDevice> nd)
{
Ptr<Ipv4> ipv4 = n->GetObject<Ipv4> ();
uint32_t interfaceSrc = ipv4->FindInterfaceForDevice (nd);
ipv4->SetDefaultMulticastRoute (interfaceSrc);
}
void
StaticMulticastRouteHelper::SetDefaultMulticastRoute (
Ptr<Node> n,
std::string ndName)
{
Ptr<NetDevice> nd = Names::Find<NetDevice> (ndName);
SetDefaultMulticastRoute (n, nd);
}
void
StaticMulticastRouteHelper::SetDefaultMulticastRoute (
std::string nName,
Ptr<NetDevice> nd)
{
Ptr<Node> n = Names::Find<Node> (nName);
SetDefaultMulticastRoute (n, nd);
}
void
StaticMulticastRouteHelper::SetDefaultMulticastRoute (
std::string nName,
std::string ndName)
{
Ptr<Node> n = Names::Find<Node> (nName);
Ptr<NetDevice> nd = Names::Find<NetDevice> (ndName);
SetDefaultMulticastRoute (n, nd);
}
void
StaticMulticastRouteHelper::JoinMulticastGroup (
Ptr<Node> n,
Ipv4Address source,
Ipv4Address group)
{
Ptr<Ipv4> ipv4 = n->GetObject<Ipv4> ();
ipv4->JoinMulticastGroup (source, group);
}
void
StaticMulticastRouteHelper::JoinMulticastGroup (
std::string nName,
Ipv4Address source,
Ipv4Address group)
{
Ptr<Node> n = Names::Find<Node> (nName);
JoinMulticastGroup (n, source, group);
}
} // namespace ns3

View File

@@ -7,12 +7,12 @@ def build(bld):
'net-device-container.cc',
'wifi-helper.cc',
'olsr-helper.cc',
'static-multicast-route-helper.cc',
'point-to-point-helper.cc',
'csma-helper.cc',
'mobility-helper.cc',
'ns2-mobility-helper.cc',
'ipv4-address-helper.cc',
'ipv4-static-routing-helper.cc',
'internet-stack-helper.cc',
'application-container.cc',
'on-off-helper.cc',
@@ -34,12 +34,12 @@ def build(bld):
'net-device-container.h',
'wifi-helper.h',
'olsr-helper.h',
'static-multicast-route-helper.h',
'point-to-point-helper.h',
'csma-helper.h',
'mobility-helper.h',
'ns2-mobility-helper.h',
'ipv4-address-helper.h',
'ipv4-static-routing-helper.h',
'internet-stack-helper.h',
'application-container.h',
'on-off-helper.h',

View File

@@ -125,7 +125,7 @@ private:
};
/**
* \brief Make it easy to create and manager PHY objects for the yans model.
* \brief Make it easy to create and manage PHY objects for the yans model.
*
* The yans PHY model is described in "Yet Another Network Simulator",
* http://cutebugs.net/files/wns2-yans.pdf

View File

@@ -1,167 +0,0 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA
*
* 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
*
* Authors:
* Mathieu Lacage <mathieu.lacage@sophia.inria.fr>,
*/
#include "ns3/packet.h"
#include "ns3/log.h"
#include "ns3/node.h"
#include "ns3/net-device.h"
#include "ns3/address.h"
#include "ns3/pointer.h"
#include "arp-ipv4-interface.h"
#include "ipv4-l3-protocol.h"
#include "arp-l3-protocol.h"
#include "arp-cache.h"
NS_LOG_COMPONENT_DEFINE ("ArpIpv4Interface");
namespace ns3 {
TypeId
ArpIpv4Interface::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::ArpIpv4Interface")
.SetParent<Ipv4Interface> ()
.AddAttribute ("ArpCache",
"The arp cache for this ipv4 interface",
PointerValue (0),
MakePointerAccessor (&ArpIpv4Interface::m_cache),
MakePointerChecker<ArpIpv4Interface> ())
;
return tid;
}
ArpIpv4Interface::ArpIpv4Interface ()
: m_node (0),
m_device (0)
{
NS_LOG_FUNCTION (this);
}
ArpIpv4Interface::~ArpIpv4Interface ()
{
NS_LOG_FUNCTION (this);
}
void
ArpIpv4Interface::DoDispose (void)
{
NS_LOG_FUNCTION (this);
m_device = 0;
m_cache = 0;
Ipv4Interface::DoDispose ();
}
void
ArpIpv4Interface::SetNode (Ptr<Node> node)
{
m_node = node;
DoSetup ();
}
void
ArpIpv4Interface::SetDevice (Ptr<NetDevice> device)
{
m_device = device;
DoSetup ();
}
Ptr<NetDevice>
ArpIpv4Interface::GetDevice (void) const
{
return m_device;
}
void
ArpIpv4Interface::DoSetup (void)
{
if (m_node == 0 || m_device == 0)
{
return;
}
Ptr<ArpL3Protocol> arp = m_node->GetObject<ArpL3Protocol> ();
m_cache = arp->CreateCache (m_device, this);
}
void
ArpIpv4Interface::SendTo (Ptr<Packet> p, Ipv4Address dest)
{
NS_LOG_FUNCTION (this << p << dest);
NS_ASSERT (GetDevice () != 0);
// XXX multi-address case
if (dest == GetAddress (0).GetLocal ())
{
Ptr<Ipv4L3Protocol> ipv4 = m_node->GetObject<Ipv4L3Protocol> ();
ipv4->Receive (0, p, Ipv4L3Protocol::PROT_NUMBER,
GetDevice ()->GetBroadcast (),
GetDevice ()->GetBroadcast (),
NetDevice::PACKET_HOST // note: linux uses PACKET_LOOPBACK here
);
return;
}
if (m_device->NeedsArp ())
{
NS_LOG_LOGIC ("Needs ARP");
Ptr<ArpL3Protocol> arp =
m_node->GetObject<ArpL3Protocol> ();
Address hardwareDestination;
bool found;
// XXX multi-address case
if (dest.IsBroadcast () ||
dest.IsSubnetDirectedBroadcast (GetAddress (0).GetMask ()) )
{
NS_LOG_LOGIC ("IsBroadcast");
hardwareDestination = GetDevice ()->GetBroadcast ();
found = true;
}
else if (dest.IsMulticast ())
{
NS_LOG_LOGIC ("IsMulticast");
NS_ASSERT_MSG(GetDevice ()->IsMulticast (),
"ArpIpv4Interface::SendTo (): Sending multicast packet over "
"non-multicast device");
hardwareDestination = GetDevice ()->GetMulticast(dest);
found = true;
}
else
{
NS_LOG_LOGIC ("ARP Lookup");
found = arp->Lookup (p, dest, GetDevice (), m_cache, &hardwareDestination);
}
if (found)
{
NS_LOG_LOGIC ("Address Resolved. Send.");
GetDevice ()->Send (p, hardwareDestination,
Ipv4L3Protocol::PROT_NUMBER);
}
}
else
{
NS_LOG_LOGIC ("Doesn't need ARP");
GetDevice ()->Send (p, GetDevice ()->GetBroadcast (),
Ipv4L3Protocol::PROT_NUMBER);
}
}
}//namespace ns3

View File

@@ -1,65 +0,0 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA
*
* 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
*
* Authors:
* Mathieu Lacage <mathieu.lacage@sophia.inria.fr>,
*/
#ifndef ARP_IPV4_INTERFACE_H
#define ARP_IPV4_INTERFACE_H
#include "ipv4-interface.h"
#include "ns3/ptr.h"
namespace ns3 {
class Node;
class ArpCache;
/**
* \ingroup arp
* \brief an Ipv4 Interface which uses ARP
*
* If you need to use ARP on top of a specific NetDevice, you
* can use this Ipv4Interface subclass to wrap it for the Ipv4 class
* when calling Ipv4::AggregateObject.
*/
class ArpIpv4Interface : public Ipv4Interface
{
public:
static TypeId GetTypeId (void);
ArpIpv4Interface ();
virtual ~ArpIpv4Interface ();
void SetNode (Ptr<Node> node);
void SetDevice (Ptr<NetDevice> device);
virtual Ptr<NetDevice> GetDevice (void) const;
private:
virtual void SendTo (Ptr<Packet> p, Ipv4Address dest);
virtual void DoDispose (void);
void DoSetup (void);
Ptr<Node> m_node;
Ptr<NetDevice> m_device;
Ptr<ArpCache> m_cache;
};
}//namespace ns3
#endif /* ARP_IPV4_INTERFACE_H */

View File

@@ -43,6 +43,7 @@ ArpL3Protocol::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::ArpL3Protocol")
.SetParent<Object> ()
.AddConstructor<ArpL3Protocol> ()
.AddAttribute ("CacheList",
"The list of ARP caches",
ObjectVectorValue (),
@@ -72,6 +73,23 @@ ArpL3Protocol::SetNode (Ptr<Node> node)
m_node = node;
}
/*
* This method is called by AddAgregate and completes the aggregation
* by setting the node in the ipv4 stack
*/
void
ArpL3Protocol::NotifyNewAggregate ()
{
Ptr<Node>node = this->GetObject<Node> ();
//verify that it's a valid node and that
//the node was not set before
if (node!= 0 && m_node == 0)
{
this->SetNode (node);
}
Object::NotifyNewAggregate ();
}
void
ArpL3Protocol::DoDispose (void)
{

View File

@@ -78,6 +78,11 @@ public:
Address *hardwareDestination);
protected:
virtual void DoDispose (void);
/*
* This function will notify other components connected to the node that a new stack member is now connected
* This will be used to notify Layer 3 protocol of layer 4 protocol stack to connect them together.
*/
virtual void NotifyNewAggregate ();
private:
typedef std::list<Ptr<ArpCache> > CacheList;
Ptr<ArpCache> FindCache (Ptr<NetDevice> device);

View File

@@ -1,4 +1,5 @@
#include "icmpv4-l4-protocol.h"
#include "ipv4-raw-socket-factory-impl.h"
#include "ipv4-interface.h"
#include "ipv4-l3-protocol.h"
#include "ns3/assert.h"
@@ -6,6 +7,7 @@
#include "ns3/node.h"
#include "ns3/packet.h"
#include "ns3/boolean.h"
#include "ns3/ipv4-route.h"
namespace ns3 {
@@ -47,6 +49,27 @@ Icmpv4L4Protocol::SetNode (Ptr<Node> node)
m_node = node;
}
/*
* This method is called by AddAgregate and completes the aggregation
* by setting the node in the ICMP stack and adding ICMP factory to
* IPv4 stack connected to the node
*/
void
Icmpv4L4Protocol::NotifyNewAggregate ()
{
bool is_not_initialized = (m_node == 0);
Ptr<Node>node = this->GetObject<Node> ();
Ptr<Ipv4L3Protocol> ipv4 = this->GetObject<Ipv4L3Protocol> ();
if (is_not_initialized && node!= 0 && ipv4 != 0)
{
this->SetNode (node);
ipv4->Insert (this);
Ptr<Ipv4RawSocketFactoryImpl> rawFactory = CreateObject<Ipv4RawSocketFactoryImpl> ();
ipv4->AggregateObject (rawFactory);
}
Object::NotifyNewAggregate ();
}
uint16_t
Icmpv4L4Protocol::GetStaticProtocolNumber (void)
{
@@ -62,19 +85,27 @@ void
Icmpv4L4Protocol::SendMessage (Ptr<Packet> packet, Ipv4Address dest, uint8_t type, uint8_t code)
{
Ptr<Ipv4L3Protocol> ipv4 = m_node->GetObject<Ipv4L3Protocol> ();
uint32_t i;
if (!ipv4->GetInterfaceForDestination (dest, i))
NS_ASSERT (ipv4 != 0 && ipv4->GetRoutingProtocol () != 0);
Ipv4Header header;
header.SetDestination (dest);
Socket::SocketErrno errno;
Ptr<Ipv4Route> route;
uint32_t oif = 0; //specify non-zero if bound to a source address
route = ipv4->GetRoutingProtocol ()->RouteOutput (header, oif, errno);
if (route != 0)
{
NS_LOG_LOGIC ("Route exists");
Ipv4Address source = route->GetSource ();
SendMessage (packet, source, dest, type, code, route);
}
else
{
NS_LOG_WARN ("drop icmp message");
return;
}
// XXX handle multi-address case
Ipv4Address source = ipv4->GetAddress (i, 0).GetLocal ();
SendMessage (packet, source, dest, type, code);
}
void
Icmpv4L4Protocol::SendMessage (Ptr<Packet> packet, Ipv4Address source, Ipv4Address dest, uint8_t type, uint8_t code)
Icmpv4L4Protocol::SendMessage (Ptr<Packet> packet, Ipv4Address source, Ipv4Address dest, uint8_t type, uint8_t code, Ptr<Ipv4Route> route)
{
Ptr<Ipv4L3Protocol> ipv4 = m_node->GetObject<Ipv4L3Protocol> ();
Icmpv4Header icmp;
@@ -85,7 +116,7 @@ Icmpv4L4Protocol::SendMessage (Ptr<Packet> packet, Ipv4Address source, Ipv4Addre
icmp.EnableChecksum ();
}
packet->AddHeader (icmp);
ipv4->Send (packet, source, dest, ICMP_PROTOCOL);
ipv4->Send (packet, source, dest, ICMP_PROTOCOL, route);
}
void
Icmpv4L4Protocol::SendDestUnreachFragNeeded (Ipv4Header header,
@@ -140,7 +171,7 @@ Icmpv4L4Protocol::HandleEcho (Ptr<Packet> p,
Icmpv4Echo echo;
p->RemoveHeader (echo);
reply->AddHeader (echo);
SendMessage (reply, destination, source, Icmpv4Header::ECHO_REPLY, 0);
SendMessage (reply, destination, source, Icmpv4Header::ECHO_REPLY, 0, 0);
}
void
Icmpv4L4Protocol::Forward (Ipv4Address source, Icmpv4Header icmp,

View File

@@ -9,6 +9,7 @@ namespace ns3 {
class Node;
class Ipv4Interface;
class Ipv4Route;
class Icmpv4L4Protocol : public Ipv4L4Protocol
{
@@ -29,7 +30,12 @@ public:
void SendDestUnreachFragNeeded (Ipv4Header header, Ptr<const Packet> orgData, uint16_t nextHopMtu);
void SendTimeExceededTtl (Ipv4Header header, Ptr<const Packet> orgData);
void SendDestUnreachPort (Ipv4Header header, Ptr<const Packet> orgData);
protected:
/*
* This function will notify other components connected to the node that a new stack member is now connected
* This will be used to notify Layer 3 protocol of layer 4 protocol stack to connect them together.
*/
virtual void NotifyNewAggregate ();
private:
void HandleEcho (Ptr<Packet> p,
Icmpv4Header header,
@@ -46,7 +52,7 @@ private:
void SendDestUnreach (Ipv4Header header, Ptr<const Packet> orgData,
uint8_t code, uint16_t nextHopMtu);
void SendMessage (Ptr<Packet> packet, Ipv4Address dest, uint8_t type, uint8_t code);
void SendMessage (Ptr<Packet> packet, Ipv4Address source, Ipv4Address dest, uint8_t type, uint8_t code);
void SendMessage (Ptr<Packet> packet, Ipv4Address source, Ipv4Address dest, uint8_t type, uint8_t code, Ptr<Ipv4Route> route);
void Forward (Ipv4Address source, Icmpv4Header icmp,
uint32_t info, Ipv4Header ipHeader,
const uint8_t payload[8]);

View File

@@ -1,141 +0,0 @@
// -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
//
// Copyright (c) 2006 Georgia Tech Research Corporation
//
// 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: George F. Riley<riley@ece.gatech.edu>
//
#include "ns3/net-device.h"
#include "ns3/callback.h"
#include "ns3/node.h"
#include "ns3/core-config.h"
#include "udp-l4-protocol.h"
#include "tcp-l4-protocol.h"
#include "ipv4-l3-protocol.h"
#include "arp-l3-protocol.h"
#include "udp-socket-factory-impl.h"
#include "tcp-socket-factory-impl.h"
#include "ipv4-raw-socket-factory-impl.h"
#include "icmpv4-l4-protocol.h"
#ifdef NETWORK_SIMULATION_CRADLE
#include "nsc-tcp-socket-factory-impl.h"
#include "nsc-tcp-l4-protocol.h"
#endif
namespace ns3 {
static void
AddArpStack (Ptr<Node> node)
{
Ptr<ArpL3Protocol> arp = CreateObject<ArpL3Protocol> ();
arp->SetNode (node);
node->AggregateObject (arp);
}
static void
AddUdpStack(Ptr<Node> node)
{
Ptr<Ipv4L3Protocol> ipv4 = node->GetObject<Ipv4L3Protocol> ();
Ptr<UdpL4Protocol> udp = CreateObject<UdpL4Protocol> ();
udp->SetNode (node);
ipv4->Insert (udp);
node->AggregateObject (udp);
Ptr<UdpSocketFactoryImpl> udpFactory = CreateObject<UdpSocketFactoryImpl> ();
udpFactory->SetUdp (udp);
node->AggregateObject (udpFactory);
}
static void
AddIcmpStack (Ptr<Node> node)
{
Ptr<Ipv4L3Protocol> ipv4 = node->GetObject<Ipv4L3Protocol> ();
Ptr<Icmpv4L4Protocol> icmp = CreateObject<Icmpv4L4Protocol> ();
icmp->SetNode (node);
ipv4->Insert (icmp);
node->AggregateObject (icmp);
Ptr<Ipv4RawSocketFactoryImpl> rawFactory = CreateObject<Ipv4RawSocketFactoryImpl> ();
node->AggregateObject (rawFactory);
}
static void
AddTcpStack(Ptr<Node> node)
{
Ptr<Ipv4L3Protocol> ipv4 = node->GetObject<Ipv4L3Protocol> ();
Ptr<TcpL4Protocol> tcp = CreateObject<TcpL4Protocol> ();
tcp->SetNode (node);
ipv4->Insert (tcp);
node->AggregateObject (tcp);
Ptr<TcpSocketFactoryImpl> tcpFactory = CreateObject<TcpSocketFactoryImpl> ();
tcpFactory->SetTcp (tcp);
node->AggregateObject (tcpFactory);
}
static void
AddIpv4Stack(Ptr<Node> node)
{
Ptr<Ipv4L3Protocol> ipv4 = CreateObject<Ipv4L3Protocol> ();
ipv4->SetNode (node);
node->AggregateObject (ipv4);
}
void
AddInternetStack (Ptr<Node> node)
{
AddArpStack (node);
AddIpv4Stack (node);
AddIcmpStack (node);
AddUdpStack (node);
AddTcpStack (node);
}
#ifdef NETWORK_SIMULATION_CRADLE
static void
AddNscStack(Ptr<Node> node, const std::string &soname)
{
Ptr<Ipv4L3Protocol> ipv4 = node->GetObject<Ipv4L3Protocol> ();
Ptr<NscTcpL4Protocol> tcp = CreateObject<NscTcpL4Protocol> ();
tcp->SetNscLibrary(soname);
tcp->SetNode (node);
ipv4->Insert (tcp);
node->AggregateObject (tcp);
Ptr<NscTcpSocketFactoryImpl> tcpFactory = CreateObject<NscTcpSocketFactoryImpl> ();
tcpFactory->SetTcp (tcp);
node->AggregateObject (tcpFactory);
}
void
AddNscInternetStack (Ptr<Node> node, const std::string &soname)
{
AddArpStack (node);
AddIpv4Stack (node);
AddIcmpStack (node);
AddUdpStack (node);
AddNscStack (node, soname);
}
#else
void
AddNscInternetStack (Ptr<Node> node, const std::string &soname)
{
NS_FATAL_ERROR ("NSC Not enabled on this platform.");
}
#endif
}//namespace ns3

View File

@@ -1,163 +0,0 @@
// -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
//
// Copyright (c) 2006 Georgia Tech Research Corporation
//
// 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: George F. Riley<riley@ece.gatech.edu>
#ifndef INTERNET_STACK_H
#define INTERNET_STACK_H
#include "ns3/ptr.h"
/**
* \ingroup internetStack
* \defgroup internetStackModel Internet Stack Model
*
* \section internetStackTracingModel Tracing in the Internet Stack
*
* The internet stack provides a number of trace sources in its various
* protocol implementations. These trace sources can be hooked using your own
* custom trace code, or you can use our helper functions in some cases to
* arrange for tracing to be enabled.
*
* \subsection internetStackArpTracingModel Tracing in ARP
*
* ARP provides two trace hooks, one in the cache, and one in the layer three
* protocol. The trace accessor in the cache is given the name "Drop." When
* a packet is transmitted over an interface that requires ARP, it is first
* queued for transmission in the ARP cache until the required MAC address is
* resolved. There are a number of retries that may be done trying to get the
* address, and if the maximum retry count is exceeded the packet in question
* is dropped by ARP. The single trace hook in the ARP cache is called,
*
* - If an outbound packet is placed in the ARP cache pending address resolution
* and no resolution can be made within the maximum retry count, the outbound
* packet is dropped and this trace is fired;
*
* A second trace hook lives in the ARP L3 protocol (also named "Drop") and may
* be called for a number of reasons.
*
* - If an ARP reply is received for an entry that is not waiting for a reply,
* the ARP reply packet is dropped and this trace is fired;
* - If an ARP reply is received for a non-existant entry, the ARP reply packet
* is dropped and this trace is fired;
* - If an ARP cache entry is in the DEAD state (has timed out) and an ARP reply
* packet is received, the reply packet is dropped and this trace is fired.
* - Each ARP cache entry has a queue of pending packets. If the size of the
* queue is exceeded, the outbound packet is dropped and this trace is fired.
*
* \subsection internetStackIpv4TracingModel Tracing in IPv4
*
* The IPv4 layer three protocol provides three trace hooks. These are the
* "Tx" (ns3::Ipv4L3Protocol::m_txTrace), "Rx" (ns3::Ipv4L3Protocol::m_rxTrace)
* and "Drop" (ns3::Ipv4L3Protocol::m_dropTrace) trace sources.
*
* The "Tx" trace is fired in a number of situations, all of which indicate that
* a given packet is about to be sent down to a given ns3::Ipv4Interface.
*
* - In the case of a packet destined for the broadcast address, the
* Ipv4InterfaceList is iterated and for every interface that is up and can
* fragment the packet or has a large enough MTU to transmit the packet,
* the trace is hit. See ns3::Ipv4L3Protocol::Send.
*
* - In the case of a packet that needs routing, the "Tx" trace may be fired
* just before a packet is sent to the interface appropriate to the default
* gateway. See ns3::Ipv4L3Protocol::SendRealOut.
*
* - Also in the case of a packet that needs routing, the "Tx" trace may be
* fired just before a packet is sent to the outgoing interface appropriate
* to the discovered route. See ns3::Ipv4L3Protocol::SendRealOut.
*
* The "Rx" trace is fired when a packet is passed from the device up to the
* ns3::Ipv4L3Protocol::Receive function.
*
* - In the receive function, the Ipv4InterfaceList is iterated, and if the
* Ipv4Interface corresponding to the receiving device is fount to be in the
* UP state, the trace is fired.
*
* The "Drop" trace is fired in any case where the packet is dropped (in both
* the transmit and receive paths).
*
* - In the ns3::Ipv4Interface::Receive function, the packet is dropped and the
* drop trace is hit if the interface corresponding to the receiving device
* is in the DOWN state.
*
* - Also in the ns3::Ipv4Interface::Receive function, the packet is dropped and
* the drop trace is hit if the checksum is found to be bad.
*
* - In ns3::Ipv4L3Protocol::Send, an outgoing packet bound for the broadcast
* address is dropped and the "Drop" trace is fired if the "don't fragement"
* bit is set and fragmentation is available and required.
*
* - Also in ns3::Ipv4L3Protocol::Send, an outgoing packet destined for the
* broadcast address is dropped and the "Drop" trace is hit if fragmentation
* is not available and is required (MTU < packet size).
*
* - In the case of a broadcast address, an outgoing packet is cloned for each
* outgoing interface. If any of the interfaces is in the DOWN state, the
* "Drop" trace event fires with a reference to the copied packet.
*
* - In the case of a packet requiring a route, an outgoing packet is dropped
* and the "Drop" trace event fires if no route to the remote host is found.
*
* - In ns3::Ipv4L3Protocol::SendRealOut, an outgoing packet being routed
* is dropped and the "Drop" trace is fired if the "don't fragement" bit is
* set and fragmentation is available and required.
*
* - Also in ns3::Ipv4L3Protocol::SendRealOut, an outgoing packet being routed
* is dropped and the "Drop" trace is hit if fragmentation is not available
* and is required (MTU < packet size).
*
* - An outgoing packet being routed is dropped and the "Drop" trace event fires
* if the required Ipv4Interface is in the DOWN state.
*
* - If a packet is being forwarded, and the TTL is exceeded (see
* ns3::Ipv4L3Protocol::DoForward), the packet is dropped and the "Drop" trace
* event is fired.
*
* \subsection internetStackNs3TCPTracingModel Tracing in ns-3 TCP
*
* There is currently one trace source in the ns-3 TCP implementation named
* "CongestionWindow" (see ns3::TcpSocketImpl::m_cWnd). This is set in a number
* of places (see file tcp-socket-impl.cc) whenever the value of the congestion
* window is changed.
*
* \subsection internetStackNscTCPTracingModel Tracing in NSC TCP
*
* There is currently one trace source in the Network Simulation Cradle TCP
* implementation named "CongestionWindow" (see ns3::NscTcpSocketImpl::m_cWnd).
* This is set in a number of places (see file nsc-tcp-socket-impl.cc) when
* the value of the cogestion window is initially set. Note that this is not
* instrumented from the underlying TCP implementaion.
*
* \subsection internetStackNs3UdpTracingModel Tracing in ns-3 UDP
*
* There is currently one trace source in the ns-3 UDP implementation named
* "Drop" (see ns3::UdpSocketImpl::m_dropTrace). This is set when a packet
* is received in ns3::UdpSocketImpl::ForwardUp and the receive buffer cannot
* accomodate the encapsulated data.
*/
namespace ns3 {
class Node;
void AddInternetStack (Ptr<Node> node);
void AddNscInternetStack (Ptr<Node> node, const std::string &soname);
}//namespace ns3
#endif /* INTERNET_STACK_H */

View File

@@ -18,9 +18,11 @@
#include "ns3/log.h"
#include "ns3/object.h"
#include "ipv4-global-routing.h"
#include "ns3/packet.h"
#include "ns3/node.h"
#include "ns3/ipv4-route.h"
#include "ns3/ipv4-routing-table-entry.h"
#include "ipv4-global-routing.h"
NS_LOG_COMPONENT_DEFINE ("Ipv4GlobalRouting");
@@ -42,14 +44,19 @@ Ipv4GlobalRouting::Ipv4GlobalRouting ()
NS_LOG_FUNCTION_NOARGS ();
}
Ipv4GlobalRouting::~Ipv4GlobalRouting ()
{
NS_LOG_FUNCTION_NOARGS ();
}
void
Ipv4GlobalRouting::AddHostRouteTo (Ipv4Address dest,
Ipv4Address nextHop,
uint32_t interface)
{
NS_LOG_FUNCTION (dest << nextHop << interface);
Ipv4Route *route = new Ipv4Route ();
*route = Ipv4Route::CreateHostRouteTo (dest, nextHop, interface);
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
*route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, nextHop, interface);
m_hostRoutes.push_back (route);
}
@@ -58,8 +65,8 @@ Ipv4GlobalRouting::AddHostRouteTo (Ipv4Address dest,
uint32_t interface)
{
NS_LOG_FUNCTION (dest << interface);
Ipv4Route *route = new Ipv4Route ();
*route = Ipv4Route::CreateHostRouteTo (dest, interface);
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
*route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, interface);
m_hostRoutes.push_back (route);
}
@@ -70,8 +77,8 @@ Ipv4GlobalRouting::AddNetworkRouteTo (Ipv4Address network,
uint32_t interface)
{
NS_LOG_FUNCTION (network << networkMask << nextHop << interface);
Ipv4Route *route = new Ipv4Route ();
*route = Ipv4Route::CreateNetworkRouteTo (network,
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
*route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
networkMask,
nextHop,
interface);
@@ -84,17 +91,21 @@ Ipv4GlobalRouting::AddNetworkRouteTo (Ipv4Address network,
uint32_t interface)
{
NS_LOG_FUNCTION (network << networkMask << interface);
Ipv4Route *route = new Ipv4Route ();
*route = Ipv4Route::CreateNetworkRouteTo (network,
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
*route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
networkMask,
interface);
m_networkRoutes.push_back (route);
}
Ipv4Route *
Ptr<Ipv4Route>
Ipv4GlobalRouting::LookupGlobal (Ipv4Address dest)
{
NS_LOG_FUNCTION_NOARGS ();
Ptr<Ipv4Route> rtentry = 0;
bool found = false;
Ipv4RoutingTableEntry* route = 0;
for (HostRoutesCI i = m_hostRoutes.begin ();
i != m_hostRoutes.end ();
i++)
@@ -103,23 +114,45 @@ Ipv4GlobalRouting::LookupGlobal (Ipv4Address dest)
if ((*i)->GetDest ().IsEqual (dest))
{
NS_LOG_LOGIC ("Found global host route" << *i);
return (*i);
route = (*i);
found = true;
break;
}
}
for (NetworkRoutesI j = m_networkRoutes.begin ();
j != m_networkRoutes.end ();
j++)
if (found == false)
{
NS_ASSERT ((*j)->IsNetwork ());
Ipv4Mask mask = (*j)->GetDestNetworkMask ();
Ipv4Address entry = (*j)->GetDestNetwork ();
if (mask.IsMatch (dest, entry))
for (NetworkRoutesI j = m_networkRoutes.begin ();
j != m_networkRoutes.end ();
j++)
{
NS_LOG_LOGIC ("Found global network route" << *j);
return (*j);
NS_ASSERT ((*j)->IsNetwork ());
Ipv4Mask mask = (*j)->GetDestNetworkMask ();
Ipv4Address entry = (*j)->GetDestNetwork ();
if (mask.IsMatch (dest, entry))
{
NS_LOG_LOGIC ("Found global network route" << *j);
route = (*j);
found = true;
break;
}
}
}
return 0;
if (found == true)
{
Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
rtentry = Create<Ipv4Route> ();
rtentry->SetDestination (route->GetDest ());
// XXX handle multi-address case
rtentry->SetSource (ipv4->GetAddress (route->GetInterface(), 0).GetLocal ());
rtentry->SetGateway (route->GetGateway ());
uint32_t interfaceIdx = route->GetInterface ();
rtentry->SetOutputDevice (ipv4->GetNetDevice (interfaceIdx));
return rtentry;
}
else
{
return 0;
}
}
uint32_t
@@ -132,7 +165,7 @@ Ipv4GlobalRouting::GetNRoutes (void)
return n;
}
Ipv4Route *
Ipv4RoutingTableEntry *
Ipv4GlobalRouting::GetRoute (uint32_t index)
{
NS_LOG_FUNCTION (index);
@@ -207,70 +240,6 @@ Ipv4GlobalRouting::RemoveRoute (uint32_t index)
NS_ASSERT (false);
}
bool
Ipv4GlobalRouting::RequestRoute (
uint32_t interface,
Ipv4Header const &ipHeader,
Ptr<Packet> packet,
RouteReplyCallback routeReply)
{
NS_LOG_FUNCTION (this << interface << &ipHeader << packet << &routeReply);
NS_LOG_LOGIC ("source = " << ipHeader.GetSource ());
NS_LOG_LOGIC ("destination = " << ipHeader.GetDestination ());
if (ipHeader.GetDestination ().IsMulticast ())
{
NS_LOG_LOGIC ("Multicast destination-- returning false");
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.
//
NS_LOG_LOGIC ("Unicast destination- looking up");
Ipv4Route *route = LookupGlobal (ipHeader.GetDestination ());
if (route != 0)
{
routeReply (true, *route, packet, ipHeader);
return true;
}
else
{
return false; // Let other routing protocols try to handle this
// route request.
}
}
bool
Ipv4GlobalRouting::RequestInterface (Ipv4Address destination, uint32_t& interface)
{
NS_LOG_FUNCTION (this << destination << &interface);
//
// First, see if this is a multicast packet we have a route for. If we
// have a route, then send the packet down each of the specified interfaces.
//
if (destination.IsMulticast ())
{
NS_LOG_LOGIC ("Multicast destination-- returning false");
return false; // Let other routing protocols try to handle this
}
//
// See if this is a unicast packet we have a route for.
//
NS_LOG_LOGIC ("Unicast destination- looking up");
Ipv4Route *route = LookupGlobal (destination);
if (route)
{
interface = route->GetInterface ();
return true;
}
else
{
return false;
}
}
void
Ipv4GlobalRouting::DoDispose (void)
{
@@ -290,4 +259,80 @@ Ipv4GlobalRouting::DoDispose (void)
Ipv4RoutingProtocol::DoDispose ();
}
Ptr<Ipv4Route>
Ipv4GlobalRouting::RouteOutput (const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr)
{
//
// First, see if this is a multicast packet we have a route for. If we
// have a route, then send the packet down each of the specified interfaces.
//
if (header.GetDestination().IsMulticast ())
{
NS_LOG_LOGIC ("Multicast destination-- returning false");
return 0; // Let other routing protocols try to handle this
}
//
// See if this is a unicast packet we have a route for.
//
NS_LOG_LOGIC ("Unicast destination- looking up");
Ptr<Ipv4Route> rtentry = LookupGlobal (header.GetDestination());
if (rtentry)
{
sockerr = Socket::ERROR_NOTERROR;
}
else
{
sockerr = Socket::ERROR_NOROUTETOHOST;
}
return rtentry;
}
bool
Ipv4GlobalRouting::RouteInput (Ptr<const Packet> p, const Ipv4Header &ipHeader, Ptr<const NetDevice> idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb,
LocalDeliverCallback lcb, ErrorCallback ecb)
{
NS_LOG_FUNCTION (this << p << ipHeader << ipHeader.GetSource () << ipHeader.GetDestination () << idev);
if (ipHeader.GetDestination ().IsMulticast ())
{
NS_LOG_LOGIC ("Multicast destination-- returning false");
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.
//
NS_LOG_LOGIC ("Unicast destination- looking up");
Ptr<Ipv4Route> rtentry = LookupGlobal (ipHeader.GetDestination ());
if (rtentry != 0)
{
NS_LOG_LOGIC ("Found unicast destination- calling unicast callback");
ucb (rtentry, p, ipHeader);
return true;
}
else
{
NS_LOG_LOGIC ("Did not find unicast destination- returning false");
return false; // Let other routing protocols try to handle this
// route request.
}
}
void
Ipv4GlobalRouting::SetNode (Ptr<Node> node)
{
NS_LOG_FUNCTION_NOARGS ();
m_node = node;
}
Ptr<Node>
Ipv4GlobalRouting::GetNode (void) const
{
NS_LOG_FUNCTION_NOARGS ();
return m_node;
}
}//namespace ns3

View File

@@ -26,6 +26,7 @@
#include "ns3/ipv4-header.h"
#include "ns3/ptr.h"
#include "ns3/ipv4.h"
#include "ns3/ipv4-routing-protocol.h"
namespace ns3 {
@@ -34,12 +35,13 @@ class NetDevice;
class Ipv4Interface;
class Ipv4Address;
class Ipv4Header;
class Ipv4Route;
class Ipv4RoutingTableEntry;
class Ipv4MulticastRoutingTableEntry;
class Node;
/**
* @brief Global routing protocol for IP version 4 stacks.
* \brief Global routing protocol for IP version 4 stacks.
*
* In ns-3 we have the concept of a pluggable routing protocol. Routing
* protocols are added to a list maintained by the Ipv4L3Protocol. Every
@@ -60,126 +62,65 @@ class Node;
*
* This class deals with Ipv4 unicast routes only.
*
* @see Ipv4RoutingProtocol
* @see GlobalRouteManager
* \see Ipv4RoutingProtocol
* \see GlobalRouteManager
*/
class Ipv4GlobalRouting : public Ipv4RoutingProtocol
{
public:
static TypeId GetTypeId (void);
/**
* @brief Construct an empty Ipv4GlobalRouting routing protocol,
* \brief Construct an empty Ipv4GlobalRouting routing protocol,
*
* The Ipv4GlobalRouting class supports host and network unicast routes.
* This method initializes the lists containing these routes to empty.
*
* @see Ipv4GlobalRouting
* \see Ipv4GlobalRouting
*/
Ipv4GlobalRouting ();
virtual ~Ipv4GlobalRouting ();
virtual Ptr<Ipv4Route> RouteOutput (const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr);
virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
UnicastForwardCallback ucb, MulticastForwardCallback mcb,
LocalDeliverCallback lcb, ErrorCallback ecb);
/**
* @brief Request that a check for a route bw performed and if a route is found
* that the packet be sent on its way using the pre-packaged send callback.
* \brief Add a host route to the global routing table.
*
* The source and destination IP addresses for the packet in question are found
* in the provided Ipv4Header. There are two major processing forks depending
* on the type of destination address.
*
* If the destination address is unicast then the routing table is consulted
* for a route to the destination and if it is found, the routeReply callback
* is executed to send the packet (with the found route).
*
* If the destination address is a multicast, then the method will return
* false.
*
* @param interface The network interface index over which the packed was
* received. If the packet is from a local source, interface will be set to
* Ipv4RoutingProtocol::INTERFACE_INDEX_ANY.
* @param ipHeader the Ipv4Header containing the source and destination IP
* addresses for the packet.
* @param packet The packet to be sent if a route is found.
* @param routeReply A callback that packaged up the call to actually send the
* packet.
* @return Returns true if a route is found and the packet has been sent,
* otherwise returns false indicating that the next routing protocol should
* be consulted.
*
* @see Ipv4GlobalRouting
* @see Ipv4RoutingProtocol
*/
virtual bool RequestRoute (uint32_t interface,
Ipv4Header const &ipHeader,
Ptr<Packet> packet,
RouteReplyCallback routeReply);
/**
* @brief Check to see if we can determine the interface index that will be
* used if a packet is sent to this destination.
*
* This method addresses a problem in the IP stack where a destination address
* must be present and checksummed into the IP header before the actual
* interface over which the packet is sent can be determined. The answer is
* to implement a known and intentional cross-layer violation. This is the
* endpoint of a call chain that started up quite high in the stack (sockets)
* and has found its way down to the Ipv4L3Protocol which is consulting the
* routing protocols for what they would do if presented with a packet of the
* given destination.
*
* If there are multiple paths out of the node, the resolution is performed
* by Ipv4L3Protocol::GetInterfaceforDestination which has access to more
* contextual information that is useful for making a determination.
*
* This method will return false on a multicast address.
*
* @param destination The Ipv4Address if the destination of a hypothetical
* packet. This may be a multicast group address.
* @param interface A reference to the interface index over which a packet
* sent to this destination would be sent.
* @return Returns true if a route is found to the destination that involves
* a single output interface index, otherwise returns false indicating that
* the next routing protocol should be consulted.
*
* @see Ipv4GlobalRouting
* @see Ipv4RoutingProtocol
* @see Ipv4L3Protocol
*/
virtual bool RequestInterface (Ipv4Address destination, uint32_t& interface);
/**
* @brief Add a host route to the global 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
* \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
* \see Ipv4Address
*/
void AddHostRouteTo (Ipv4Address dest,
Ipv4Address nextHop,
uint32_t interface);
/**
* @brief Add a host route to the global routing table.
* \brief Add a host route to the global routing table.
*
* @param dest The Ipv4Address destination for this route.
* @param interface The network interface index used to send packets to the
* \param dest The Ipv4Address destination for this route.
* \param interface The network interface index used to send packets to the
* destination.
*
* @see Ipv4Address
* \see Ipv4Address
*/
void AddHostRouteTo (Ipv4Address dest,
uint32_t interface);
/**
* @brief Add a network route to the global routing table.
* \brief Add a network route to the global routing table.
*
* @param network The Ipv4Address network for this route.
* @param networkMask The Ipv4Mask to extract the network.
* @param nextHop The next hop in the route to the destination network.
* @param interface The network interface index used to send packets to the
* \param network The Ipv4Address network for this route.
* \param networkMask The Ipv4Mask to extract the network.
* \param nextHop The next hop in the route to the destination network.
* \param interface The network interface index used to send packets to the
* destination.
*
* @see Ipv4Address
* \see Ipv4Address
*/
void AddNetworkRouteTo (Ipv4Address network,
Ipv4Mask networkMask,
@@ -187,29 +128,29 @@ public:
uint32_t interface);
/**
* @brief Add a network route to the global routing table.
* \brief Add a network route to the global routing table.
*
* @param network The Ipv4Address network for this route.
* @param networkMask The Ipv4Mask to extract the network.
* @param interface The network interface index used to send packets to the
* \param network The Ipv4Address network for this route.
* \param networkMask The Ipv4Mask to extract the network.
* \param interface The network interface index used to send packets to the
* destination.
*
* @see Ipv4Address
* \see Ipv4Address
*/
void AddNetworkRouteTo (Ipv4Address network,
Ipv4Mask networkMask,
uint32_t interface);
/**
* @brief Get the number of individual unicast routes that have been added
* \brief Get the number of individual unicast routes that have been added
* to the routing table.
*
* @warning The default route counts as one of the routes.
* \warning The default route counts as one of the routes.
*/
uint32_t GetNRoutes (void);
/**
* @brief Get a route from the global unicast routing table.
* \brief Get a route from the global unicast routing table.
*
* Externally, the unicast global routing table appears simply as a table with
* n entries. The one sublety of note is that if a default route has been set
@@ -220,18 +161,18 @@ public:
* Similarly, if the default route has been set, calling RemoveRoute (0) will
* remove the default route.
*
* @param i The index (into the routing table) of the route to retrieve. If
* \param i The index (into the routing table) of the route to retrieve. If
* the default route has been set, it will occupy index zero.
* @return If route is set, a pointer to that Ipv4Route is returned, otherwise
* \return If route is set, a pointer to that Ipv4RoutingTableEntry is returned, otherwise
* a zero pointer is returned.
*
* @see Ipv4Route
* @see Ipv4GlobalRouting::RemoveRoute
* \see Ipv4RoutingTableEntry
* \see Ipv4GlobalRouting::RemoveRoute
*/
Ipv4Route *GetRoute (uint32_t i);
Ipv4RoutingTableEntry *GetRoute (uint32_t i);
/**
* @brief Remove a route from the global unicast routing table.
* \brief Remove a route from the global unicast routing table.
*
* Externally, the unicast global routing table appears simply as a table with
* n entries. The one sublety of note is that if a default route has been set
@@ -239,30 +180,35 @@ public:
* default route has been set, calling RemoveRoute (0) will remove the
* default route.
*
* @param i The index (into the routing table) of the route to remove. If
* \param i The index (into the routing table) of the route to remove. If
* the default route has been set, it will occupy index zero.
*
* @see Ipv4Route
* @see Ipv4GlobalRouting::GetRoute
* @see Ipv4GlobalRouting::AddRoute
* \see Ipv4RoutingTableEntry
* \see Ipv4GlobalRouting::GetRoute
* \see Ipv4GlobalRouting::AddRoute
*/
void RemoveRoute (uint32_t i);
void SetNode (Ptr<Node> node);
Ptr<Node> GetNode (void) const;
protected:
void DoDispose (void);
private:
typedef std::list<Ipv4Route *> HostRoutes;
typedef std::list<Ipv4Route *>::const_iterator HostRoutesCI;
typedef std::list<Ipv4Route *>::iterator HostRoutesI;
typedef std::list<Ipv4Route *> NetworkRoutes;
typedef std::list<Ipv4Route *>::const_iterator NetworkRoutesCI;
typedef std::list<Ipv4Route *>::iterator NetworkRoutesI;
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;
Ipv4Route *LookupGlobal (Ipv4Address dest);
Ptr<Ipv4Route> LookupGlobal (Ipv4Address dest);
HostRoutes m_hostRoutes;
NetworkRoutes m_networkRoutes;
Ptr<Node> m_node;
};
} // Namespace ns3

View File

@@ -19,10 +19,16 @@
*/
#include "ipv4-interface.h"
#include "loopback-net-device.h"
#include "ns3/ipv4-address.h"
#include "ipv4-l3-protocol.h"
#include "arp-l3-protocol.h"
#include "arp-cache.h"
#include "ns3/net-device.h"
#include "ns3/log.h"
#include "ns3/packet.h"
#include "ns3/node.h"
#include "ns3/pointer.h"
NS_LOG_COMPONENT_DEFINE ("Ipv4Interface");
@@ -33,19 +39,27 @@ Ipv4Interface::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::Ipv4Interface")
.SetParent<Object> ()
.AddAttribute ("ArpCache",
"The arp cache for this ipv4 interface",
PointerValue (0),
MakePointerAccessor (&Ipv4Interface::m_cache),
MakePointerChecker<Ipv4Interface> ())
;
;
return tid;
}
/**
* By default, Ipv4 interface are created in the "down" state
* with ip address 192.168.0.1 and a matching mask. Before
* becoming useable, the user must invoke SetUp on them
* once the final Ipv4 address and mask has been set.
*/
/**
* By default, Ipv4 interface are created in the "down" state
* with no IP addresses. Before becoming useable, the user must
* invoke SetUp on them once an Ipv4 address and mask have been set.
*/
Ipv4Interface::Ipv4Interface ()
: m_ifup(false),
m_metric(1)
: m_ifup (false),
m_metric (1),
m_node (0),
m_device (0),
m_cache (0)
{
NS_LOG_FUNCTION (this);
}
@@ -59,9 +73,46 @@ void
Ipv4Interface::DoDispose (void)
{
NS_LOG_FUNCTION_NOARGS ();
m_node = 0;
m_device = 0;
Object::DoDispose ();
}
void
Ipv4Interface::SetNode (Ptr<Node> node)
{
m_node = node;
DoSetup ();
}
void
Ipv4Interface::SetDevice (Ptr<NetDevice> device)
{
m_device = device;
DoSetup ();
}
void
Ipv4Interface::DoSetup (void)
{
if (m_node == 0 || m_device == 0)
{
return;
}
if (!m_device->NeedsArp ())
{
return;
}
Ptr<ArpL3Protocol> arp = m_node->GetObject<ArpL3Protocol> ();
m_cache = arp->CreateCache (m_device, this);
}
Ptr<NetDevice>
Ipv4Interface::GetDevice (void) const
{
return m_device;
}
void
Ipv4Interface::SetMetric (uint16_t metric)
{
@@ -80,12 +131,7 @@ uint16_t
Ipv4Interface::GetMtu (void) const
{
NS_LOG_FUNCTION_NOARGS ();
if (GetDevice () == 0)
{
uint32_t mtu = (1<<16) - 1;
return mtu;
}
return GetDevice ()->GetMtu ();
return m_device->GetMtu ();
}
/**
@@ -121,15 +167,92 @@ Ipv4Interface::SetDown (void)
m_ifup = false;
}
// public wrapper on private virtual function
void
Ipv4Interface::Send(Ptr<Packet> p, Ipv4Address dest)
void
Ipv4Interface::Send (Ptr<Packet> p, Ipv4Address dest)
{
NS_LOG_FUNCTION_NOARGS ();
if (IsUp()) {
NS_LOG_LOGIC ("SendTo");
SendTo(p, dest);
}
if (!IsUp())
{
return;
}
// Check for a loopback device
if (DynamicCast<LoopbackNetDevice> (m_device))
{
// XXX additional checks needed here (such as whether multicast
// goes to loopback)?
m_device->Send (p, m_device->GetBroadcast (),
Ipv4L3Protocol::PROT_NUMBER);
return;
}
// is this packet aimed at a local interface ?
for (Ipv4InterfaceAddressListCI i = m_ifaddrs.begin (); i != m_ifaddrs.end (); ++i)
{
if (dest == (*i).GetLocal ())
{
Ptr<Ipv4L3Protocol> ipv4 = m_node->GetObject<Ipv4L3Protocol> ();
ipv4->Receive (0, p, Ipv4L3Protocol::PROT_NUMBER,
m_device->GetBroadcast (),
m_device->GetBroadcast (),
NetDevice::PACKET_HOST // note: linux uses PACKET_LOOPBACK here
);
return;
}
}
if (m_device->NeedsArp ())
{
NS_LOG_LOGIC ("Needs ARP" << " " << dest);
Ptr<ArpL3Protocol> arp = m_node->GetObject<ArpL3Protocol> ();
Address hardwareDestination;
bool found = false;
if (dest.IsBroadcast ())
{
NS_LOG_LOGIC ("All-network Broadcast");
hardwareDestination = m_device->GetBroadcast ();
found = true;
}
else if (dest.IsMulticast ())
{
NS_LOG_LOGIC ("IsMulticast");
NS_ASSERT_MSG(m_device->IsMulticast (),
"ArpIpv4Interface::SendTo (): Sending multicast packet over "
"non-multicast device");
hardwareDestination = m_device->GetMulticast(dest);
found = true;
}
else
{
for (Ipv4InterfaceAddressListCI i = m_ifaddrs.begin (); i != m_ifaddrs.end (); ++i)
{
if (dest.IsSubnetDirectedBroadcast ((*i).GetMask ()))
{
NS_LOG_LOGIC ("Subnetwork Broadcast");
hardwareDestination = m_device->GetBroadcast ();
found = true;
break;
}
}
if (!found)
{
NS_LOG_LOGIC ("ARP Lookup");
found = arp->Lookup (p, dest, m_device, m_cache, &hardwareDestination);
}
}
if (found)
{
NS_LOG_LOGIC ("Address Resolved. Send.");
m_device ->Send (p, hardwareDestination,
Ipv4L3Protocol::PROT_NUMBER);
}
}
else
{
NS_LOG_LOGIC ("Doesn't need ARP");
m_device->Send (p, m_device->GetBroadcast (),
Ipv4L3Protocol::PROT_NUMBER);
}
}
uint32_t

View File

@@ -32,6 +32,8 @@ namespace ns3 {
class NetDevice;
class Packet;
class Node;
class ArpCache;
/**
* \brief The IPv4 representation of a network interface
@@ -40,26 +42,9 @@ class Packet;
* of Linux; the main purpose is to provide address-family
* specific information (addresses) about an interface.
*
* This class defines two APIs:
* - the public API which is expected to be used by both
* the IPv4 layer and the user during forwarding and
* configuration.
* - the private API which is expected to be implemented
* by subclasses of this base class. One such subclass
* will be a Loopback interface which loops every
* packet sent back to the ipv4 layer. Another such
* subclass typically contains the Ipv4 <-> MAC address
* translation logic which will use most of the time the
* ARP/RARP protocols.
*
* By default, Ipv4 interface are created in the "down" state
* with ip address 192.168.0.1 and a matching mask. Before
* becoming useable, the user must invoke SetUp on them
* once the final Ipv4 address and mask has been set.
*
* Subclasses must implement the two methods:
* - Ipv4Interface::SendTo
* - Ipv4Interface::GetDevice
* no IP addresses. Before becoming useable, the user must
* add an address of some type and invoke Setup on them.
*/
class Ipv4Interface : public Object
{
@@ -69,18 +54,29 @@ public:
Ipv4Interface ();
virtual ~Ipv4Interface();
void SetNode (Ptr<Node> node);
void SetDevice (Ptr<NetDevice> device);
/**
* \returns the underlying NetDevice. This method can return
* zero if this interface has no associated NetDevice.
* \returns the underlying NetDevice. This method cannot return zero.
*/
virtual Ptr<NetDevice> GetDevice (void) const = 0;
Ptr<NetDevice> GetDevice (void) const;
/**
* \param metric configured routing metric (cost) of this interface
*
* Note: This is synonymous to the Metric value that ifconfig prints
* out. It is used by ns-3 global routing, but other routing daemons
* choose to ignore it.
*/
void SetMetric (uint16_t metric);
/**
* \returns configured routing metric (cost) of this interface
*
* Note: This is synonymous to the Metric value that ifconfig prints
* out. It is used by ns-3 global routing, but other routing daemons
* may choose to ignore it.
*/
uint16_t GetMetric (void) const;
@@ -88,6 +84,8 @@ public:
* This function a pass-through to NetDevice GetMtu, modulo
* the LLC/SNAP header i.e., ipv4MTU = NetDeviceMtu - LLCSNAPSIZE
* \returns the Maximum Transmission Unit associated to this interface.
*
* XXX deprecated? This is duplicate API to GetDevice ()->GetMtu ()
*/
uint16_t GetMtu (void) const;
@@ -100,14 +98,17 @@ public:
* \returns true if this interface is enabled, false otherwise.
*/
bool IsUp (void) const;
/**
* \returns true if this interface is disabled, false otherwise.
*/
bool IsDown (void) const;
/**
* Enable this interface
*/
void SetUp (void);
/**
* Disable this interface
*/
@@ -147,16 +148,19 @@ public:
protected:
virtual void DoDispose (void);
private:
virtual void SendTo (Ptr<Packet> p, Ipv4Address dest) = 0;
bool m_ifup;
uint16_t m_metric;
void DoSetup (void);
typedef std::list<Ipv4InterfaceAddress> Ipv4InterfaceAddressList;
typedef std::list<Ipv4InterfaceAddress>::const_iterator Ipv4InterfaceAddressListCI;
typedef std::list<Ipv4InterfaceAddress>::iterator Ipv4InterfaceAddressListI;
bool m_ifup;
uint16_t m_metric;
Ipv4InterfaceAddressList m_ifaddrs;
Ptr<Node> m_node;
Ptr<NetDevice> m_device;
Ptr<ArpCache> m_cache;
};
}; // namespace ns3
} // namespace ns3
#endif

View File

@@ -29,7 +29,8 @@
#include "ns3/ipv4.h"
#include "ns3/traced-callback.h"
#include "ns3/ipv4-header.h"
#include "ipv4-static-routing.h"
#include "ns3/ipv4-routing-protocol.h"
#include "ipv4-static-routing-impl.h"
namespace ns3 {
@@ -38,6 +39,7 @@ class NetDevice;
class Ipv4Interface;
class Ipv4Address;
class Ipv4Header;
class Ipv4RoutingTableEntry;
class Ipv4Route;
class Node;
class Socket;
@@ -64,6 +66,10 @@ public:
void SetNode (Ptr<Node> node);
// functions defined in base class Ipv4
void SetRoutingProtocol (Ptr<Ipv4RoutingProtocol> routing);
Ptr<Ipv4RoutingProtocol> GetRoutingProtocol (void) const;
Ptr<Socket> CreateRawSocket (void);
void DeleteRawSocket (Ptr<Socket> socket);
@@ -104,15 +110,6 @@ public:
*/
void SetDefaultTtl (uint8_t ttl);
/**
* \param device the device to match
* \returns the matching interface, zero if not found.
*
* Try to find an Ipv4Interface whose NetDevice is equal to
* the input NetDevice.
*/
Ptr<Ipv4Interface> FindInterfaceForDevice (Ptr<const NetDevice> device);
/**
* Lower layer calls this method after calling L3Demux::Lookup
* The ARP subclass needs to know from which NetDevice this
@@ -128,64 +125,21 @@ public:
* \param source source address of packet
* \param destination address of packet
* \param protocol number of packet
* \param route route entry
*
* Higher-level layers call this method to send a packet
* down the stack to the MAC and PHY layers.
*/
void Send (Ptr<Packet> packet, Ipv4Address source,
Ipv4Address destination, uint8_t protocol);
void AddHostRouteTo (Ipv4Address dest,
Ipv4Address nextHop,
uint32_t interface);
void AddHostRouteTo (Ipv4Address dest,
uint32_t interface);
void AddNetworkRouteTo (Ipv4Address network,
Ipv4Mask networkMask,
Ipv4Address nextHop,
uint32_t interface);
void AddNetworkRouteTo (Ipv4Address network,
Ipv4Mask networkMask,
uint32_t interface);
void SetDefaultRoute (Ipv4Address nextHop,
uint32_t interface);
void Lookup (Ipv4Header const &ipHeader,
Ptr<Packet> packet,
Ipv4RoutingProtocol::RouteReplyCallback routeReply);
uint32_t GetNRoutes (void);
Ipv4Route GetRoute (uint32_t i);
void RemoveRoute (uint32_t i);
void AddMulticastRoute (Ipv4Address origin,
Ipv4Address group,
uint32_t inputInterface,
std::vector<uint32_t> outputInterfaces);
void SetDefaultMulticastRoute (uint32_t onputInterface);
uint32_t GetNMulticastRoutes (void) const;
Ipv4MulticastRoute GetMulticastRoute (uint32_t i) const;
void RemoveMulticastRoute (Ipv4Address origin,
Ipv4Address group,
uint32_t inputInterface);
void RemoveMulticastRoute (uint32_t i);
Ipv4Address destination, uint8_t protocol, Ptr<Ipv4Route> route);
uint32_t AddInterface (Ptr<NetDevice> device);
Ptr<Ipv4Interface> GetInterface (uint32_t i) const;
uint32_t GetNInterfaces (void) const;
uint32_t FindInterfaceForAddr (Ipv4Address addr) const;
uint32_t FindInterfaceForAddr (Ipv4Address addr, Ipv4Mask mask) const;
int32_t FindInterfaceForDevice (Ptr<NetDevice> device) const;
void JoinMulticastGroup (Ipv4Address origin, Ipv4Address group);
void LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group);
int32_t GetInterfaceForAddress (Ipv4Address addr) const;
int32_t GetInterfaceForPrefix (Ipv4Address addr, Ipv4Mask mask) const;
int32_t GetInterfaceForDevice (Ptr<const NetDevice> device) const;
uint32_t AddAddress (uint32_t i, Ipv4InterfaceAddress address);
Ipv4InterfaceAddress GetAddress (uint32_t interfaceIndex, uint32_t addressIndex) const;
@@ -193,9 +147,6 @@ public:
void SetMetric (uint32_t i, uint16_t metric);
uint16_t GetMetric (uint32_t i) const;
Ipv4Address GetSourceAddress (Ipv4Address destination) const;
bool GetInterfaceForDestination (Ipv4Address destination,
uint32_t& interface) const;
uint16_t GetMtu (uint32_t i) const;
bool IsUp (uint32_t i) const;
void SetUp (uint32_t i);
@@ -209,39 +160,52 @@ public:
protected:
virtual void DoDispose (void);
/**
* This function will notify other components connected to the node that a new stack member is now connected
* This will be used to notify Layer 3 protocol of layer 4 protocol stack to connect them together.
*/
virtual void NotifyNewAggregate ();
private:
Ipv4L3Protocol(const Ipv4L3Protocol &);
Ipv4L3Protocol &operator = (const Ipv4L3Protocol &);
void Lookup (uint32_t interface,
Ipv4Header const &ipHeader,
Ptr<Packet> packet,
Ipv4RoutingProtocol::RouteReplyCallback routeReply);
void SendRealOut (bool found,
Ipv4Route const &route,
Ptr<Packet> packet,
Ipv4Header const &ipHeader);
bool Forwarding (uint32_t interface,
Ptr<Packet> packet,
Ipv4Header &ipHeader,
Ptr<NetDevice> device);
void ForwardUp (Ptr<Packet> p, Ipv4Header const&ip, Ptr<Ipv4Interface> incomingInterface);
virtual void SetIpForward (bool forward);
virtual bool GetIpForward (void) const;
Ipv4Header BuildHeader (
Ipv4Address source,
Ipv4Address destination,
uint8_t protocol,
uint16_t payloadSize,
uint8_t ttl,
bool mayFragment);
void
SendRealOut (Ptr<Ipv4Route> route,
Ptr<Packet> packet,
Ipv4Header const &ipHeader);
void
IpForward (Ptr<Ipv4Route> rtentry,
Ptr<const Packet> p,
const Ipv4Header &header);
void
IpMulticastForward (Ptr<Ipv4MulticastRoute> mrtentry,
Ptr<const Packet> p,
const Ipv4Header &header);
void LocalDeliver (Ptr<const Packet> p, Ipv4Header const&ip, uint32_t iif);
uint32_t AddIpv4Interface (Ptr<Ipv4Interface> interface);
void SetupLoopback (void);
Ptr<Icmpv4L4Protocol> GetIcmp (void) const;
bool IsUnicast (Ipv4Address ad, Ipv4Mask interfaceMask) const;
void DoForward (uint32_t interface,
Ptr<Packet> packet,
Ipv4Header ipHeader);
typedef std::list<Ptr<Ipv4Interface> > Ipv4InterfaceList;
typedef std::list<std::pair<Ipv4Address, Ipv4Address> > Ipv4MulticastGroupList;
typedef std::list< std::pair< int, Ptr<Ipv4RoutingProtocol> > > Ipv4RoutingProtocolList;
typedef std::list<Ptr<Ipv4RawSocketImpl> > SocketList;
typedef std::list<Ptr<Ipv4L4Protocol> > L4List_t;
bool m_ipForward;
L4List_t m_protocols;
Ipv4InterfaceList m_interfaces;
uint32_t m_nInterfaces;
@@ -253,10 +217,8 @@ private:
TracedCallback<Ptr<const Packet>, uint32_t> m_rxTrace;
TracedCallback<Ptr<const Packet> > m_dropTrace;
Ipv4RoutingProtocolList m_routingProtocols;
Ptr<Ipv4StaticRouting> m_staticRouting;
Ipv4MulticastGroupList m_multicastGroups;
Ptr<Ipv4RoutingProtocol> m_routingProtocol;
Ptr<Ipv4StaticRouting> GetStaticRouting (void) const;
SocketList m_sockets;
};

View File

@@ -0,0 +1,270 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "ns3/log.h"
#include "ns3/ipv4.h"
#include "ns3/ipv4-route.h"
#include "ns3/node.h"
#include "ns3/ipv4-static-routing.h"
#include "ipv4-list-routing-impl.h"
NS_LOG_COMPONENT_DEFINE ("Ipv4ListRoutingImpl");
namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (Ipv4ListRoutingImpl);
TypeId
Ipv4ListRoutingImpl::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::Ipv4ListRoutingImpl")
.SetParent<Ipv4ListRouting> ()
;
return tid;
}
Ipv4ListRoutingImpl::Ipv4ListRoutingImpl ()
: m_node (0)
{
NS_LOG_FUNCTION_NOARGS ();
}
Ipv4ListRoutingImpl::~Ipv4ListRoutingImpl ()
{
NS_LOG_FUNCTION_NOARGS ();
}
void
Ipv4ListRoutingImpl::DoDispose (void)
{
NS_LOG_FUNCTION_NOARGS ();
for (Ipv4RoutingProtocolList::iterator rprotoIter = m_routingProtocols.begin ();
rprotoIter != m_routingProtocols.end (); rprotoIter++)
{
// Note: Calling dispose on these protocols causes memory leak
// The routing protocols should not maintain a pointer to
// this object, so Dispose() shouldn't be necessary.
(*rprotoIter).second = 0;
}
m_routingProtocols.clear ();
m_node = 0;
}
Ptr<Ipv4Route>
Ipv4ListRoutingImpl::RouteOutput (const Ipv4Header &header, uint32_t oif, enum Socket::SocketErrno &sockerr)
{
NS_LOG_FUNCTION (this << header.GetDestination () << " " << header.GetSource () << " " << oif);
Ptr<Ipv4Route> route;
for (Ipv4RoutingProtocolList::const_iterator i = m_routingProtocols.begin ();
i != m_routingProtocols.end ();
i++)
{
NS_LOG_LOGIC ("Checking protocol " << (*i).second->GetInstanceTypeId () << " with priority " << (*i).first);
NS_LOG_LOGIC ("Requesting source address for destination " << header.GetDestination ());
route = (*i).second->RouteOutput (header, oif, sockerr);
if (route)
{
NS_LOG_LOGIC ("Found route " << route);
sockerr = Socket::ERROR_NOTERROR;
return route;
}
}
NS_LOG_LOGIC ("Done checking " << GetTypeId ());
NS_LOG_LOGIC ("");
sockerr = Socket::ERROR_NOROUTETOHOST;
return 0;
}
// Patterned after Linux ip_route_input and ip_route_input_slow
bool
Ipv4ListRoutingImpl::RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
UnicastForwardCallback ucb, MulticastForwardCallback mcb,
LocalDeliverCallback lcb, ErrorCallback ecb)
{
bool retVal = false;
NS_LOG_FUNCTION (p << header << idev);
NS_LOG_LOGIC ("RouteInput logic for node: " << m_node->GetId ());
Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
NS_ASSERT (ipv4);
uint32_t iif = ipv4->GetInterfaceForDevice (idev);
// Multicast recognition; handle local delivery here
//
if (header.GetDestination().IsMulticast ())
{
#ifdef NOTYET
if (ipv4->MulticastCheckGroup (iif, header.GetDestination ()))
#endif
if (true)
{
NS_LOG_LOGIC ("Multicast packet for me-- local deliver");
Ptr<Packet> packetCopy = p->Copy();
// Here may want to disable lcb callback in recursive RouteInput
// call below
lcb (packetCopy, header, iif);
// Fall through-- we may also need to forward this
retVal = true;
}
for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
m_routingProtocols.begin ();
rprotoIter != m_routingProtocols.end ();
rprotoIter++)
{
NS_LOG_LOGIC ("Multicast packet for me-- trying to forward");
if ((*rprotoIter).second->RouteInput (p, header, idev, ucb, mcb, lcb, ecb))
{
retVal = true;
}
}
return retVal;
}
if (header.GetDestination ().IsBroadcast ())
{
NS_LOG_LOGIC ("For me (Ipv4Addr broadcast address)");
// TODO: Local Deliver for broadcast
// TODO: Forward broadcast
}
// TODO: Configurable option to enable RFC 1222 Strong End System Model
// Right now, we will be permissive and allow a source to send us
// a packet to one of our other interface addresses; that is, the
// destination unicast address does not match one of the iif addresses,
// but we check our other interfaces. This could be an option
// (to remove the outer loop immediately below and just check iif).
for (uint32_t j = 0; j < ipv4->GetNInterfaces (); j++)
{
for (uint32_t i = 0; i < ipv4->GetNAddresses (j); i++)
{
Ipv4InterfaceAddress iaddr = ipv4->GetAddress (j, i);
Ipv4Address addr = iaddr.GetLocal ();
if (addr.IsEqual (header.GetDestination ()))
{
if (j == iif)
{
NS_LOG_LOGIC ("For me (destination " << addr << " match)");
}
else
{
NS_LOG_LOGIC ("For me (destination " << addr << " match) on another interface " << header.GetDestination ());
}
lcb (p, header, iif);
return true;
}
if (header.GetDestination ().IsEqual (iaddr.GetBroadcast ()))
{
NS_LOG_LOGIC ("For me (interface broadcast address)");
lcb (p, header, iif);
return true;
}
NS_LOG_LOGIC ("Address "<< addr << " not a match");
}
}
// Next, try to find a route
for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
m_routingProtocols.begin ();
rprotoIter != m_routingProtocols.end ();
rprotoIter++)
{
if ((*rprotoIter).second->RouteInput (p, header, idev, ucb, mcb, lcb, ecb))
{
return true;
}
}
// No routing protocol has found a route.
return retVal;
}
void
Ipv4ListRoutingImpl::AddRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol, int16_t priority)
{
NS_LOG_FUNCTION (this << routingProtocol->GetInstanceTypeId () << priority);
m_routingProtocols.push_back
(std::pair<int, Ptr<Ipv4RoutingProtocol> > (-priority, routingProtocol));
m_routingProtocols.sort ();
}
uint32_t
Ipv4ListRoutingImpl::GetNRoutingProtocols (void) const
{
NS_LOG_FUNCTION (this);
return m_routingProtocols.size ();
}
Ptr<Ipv4RoutingProtocol>
Ipv4ListRoutingImpl::GetRoutingProtocol (uint32_t index, int16_t& priority) const
{
NS_LOG_FUNCTION (index);
if (index > m_routingProtocols.size ())
{
NS_FATAL_ERROR ("Ipv4ListRoutingImpl::GetRoutingProtocol(): index " << index << " out of range");
}
uint32_t i = 0;
for (Ipv4RoutingProtocolList::const_iterator rprotoIter = m_routingProtocols.begin ();
rprotoIter != m_routingProtocols.end (); rprotoIter++, i++)
{
if (i == index)
{
priority = (*rprotoIter).first;
return (*rprotoIter).second;
}
}
return 0;
}
Ptr<Ipv4StaticRouting>
Ipv4ListRoutingImpl::GetStaticRouting (void) const
{
NS_LOG_FUNCTION (this);
Ipv4StaticRouting* srp;
for (Ipv4RoutingProtocolList::const_iterator rprotoIter = m_routingProtocols.begin ();
rprotoIter != m_routingProtocols.end (); rprotoIter++)
{
NS_LOG_LOGIC ("Searching for static routing");
srp = dynamic_cast<Ipv4StaticRouting*> (PeekPointer((*rprotoIter).second));
if (srp)
{
NS_LOG_LOGIC ("Found static routing");
return Ptr<Ipv4StaticRouting> (srp);
}
}
NS_LOG_LOGIC ("Static routing not found");
return 0;
}
void
Ipv4ListRoutingImpl::SetNode (Ptr<Node> node)
{
NS_LOG_FUNCTION_NOARGS ();
m_node = node;
}
Ptr<Node>
Ipv4ListRoutingImpl::GetNode (void) const
{
NS_LOG_FUNCTION_NOARGS ();
return m_node;
}
}//namespace ns3

View File

@@ -0,0 +1,65 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef IPV4_LIST_ROUTING_IMPL_H
#define IPV4_LIST_ROUTING_IMPL_H
#include <list>
#include "ns3/ipv4-list-routing.h"
namespace ns3 {
class Ipv4StaticRouting;
class Ipv4ListRoutingImpl : public Ipv4ListRouting
{
public:
static TypeId GetTypeId (void);
Ipv4ListRoutingImpl ();
~Ipv4ListRoutingImpl ();
virtual Ptr<Ipv4Route> RouteOutput (const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr);
virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
UnicastForwardCallback ucb, MulticastForwardCallback mcb,
LocalDeliverCallback lcb, ErrorCallback ecb);
virtual void AddRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol, int16_t priority);
virtual uint32_t GetNRoutingProtocols (void) const;
virtual Ptr<Ipv4RoutingProtocol> GetRoutingProtocol (uint32_t index, int16_t& priority) const;
virtual Ptr<Ipv4StaticRouting> GetStaticRouting (void) const;
void SetNode (Ptr<Node> node);
Ptr<Node> GetNode (void) const;
protected:
void DoDispose (void);
private:
typedef std::list< std::pair< int, Ptr<Ipv4RoutingProtocol> > > Ipv4RoutingProtocolList;
Ipv4RoutingProtocolList m_routingProtocols;
Ptr<Node> m_node;
};
} // Namespace ns3
#endif /* IPV4_LIST_ROUTING_IMPL_H */

View File

@@ -1,82 +0,0 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA
*
* 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
*
* Authors:
* Mathieu Lacage <mathieu.lacage@sophia.inria.fr>,
*/
#include "ns3/log.h"
#include "ns3/net-device.h"
#include "ns3/node.h"
#include "ns3/mac48-address.h"
#include "ns3/packet.h"
#include "ipv4-loopback-interface.h"
#include "ipv4-l3-protocol.h"
NS_LOG_COMPONENT_DEFINE ("Ipv4LoopbackInterface");
namespace ns3 {
TypeId
Ipv4LoopbackInterface::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::Ipv4LoopbackInterface")
.SetParent<Ipv4Interface> ()
;
return tid;
}
Ipv4LoopbackInterface::Ipv4LoopbackInterface ()
: m_node (0)
{
NS_LOG_FUNCTION (this);
}
Ipv4LoopbackInterface::~Ipv4LoopbackInterface ()
{
NS_LOG_FUNCTION (this);
NS_ASSERT (m_node != 0);
}
Ptr<NetDevice>
Ipv4LoopbackInterface::GetDevice (void) const
{
return 0;
}
void
Ipv4LoopbackInterface::SetNode (Ptr<Node> node)
{
m_node = node;
}
void
Ipv4LoopbackInterface::SendTo (Ptr<Packet> packet, Ipv4Address dest)
{
NS_LOG_FUNCTION (this << packet << dest);
Ptr<Ipv4L3Protocol> ipv4 =
m_node->GetObject<Ipv4L3Protocol> ();
ipv4->Receive (0, packet, Ipv4L3Protocol::PROT_NUMBER,
Mac48Address ("ff:ff:ff:ff:ff:ff"),
Mac48Address ("ff:ff:ff:ff:ff:ff"),
NetDevice::PACKET_HOST // note: linux uses PACKET_LOOPBACK here
);
}
}//namespace ns3

View File

@@ -1,53 +0,0 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA
*
* 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
*
* Authors:
* Mathieu Lacage <mathieu.lacage@sophia.inria.fr>,
*/
#ifndef IPV4_LOOPBACK_INTERFACE_H
#define IPV4_LOOPBACK_INTERFACE_H
#include "ipv4-interface.h"
#include "ns3/ptr.h"
namespace ns3 {
class Node;
/**
* \brief An IPv4 loopback interface
*/
class Ipv4LoopbackInterface : public Ipv4Interface
{
public:
static TypeId GetTypeId (void);
Ipv4LoopbackInterface ();
virtual ~Ipv4LoopbackInterface ();
virtual Ptr<NetDevice> GetDevice (void) const;
void SetNode (Ptr<Node> node);
private:
virtual void SendTo (Ptr<Packet> p, Ipv4Address dest);
Ptr<Node> m_node;
};
}//namespace ns3
#endif /* IPV4_LOOPBACK_INTERFACE_H */

Some files were not shown because too many files have changed in this diff Show More