--- a/.hgignore Tue Dec 21 17:39:54 2010 +0100
+++ b/.hgignore Tue Dec 21 17:46:35 2010 +0100
@@ -13,6 +13,7 @@
.*\.py[co]$
\.pcap$
\.mob$
+\.routes$
^doc/manual/manual/
doc/manual/manual.aux
doc/manual/manual.cp
@@ -34,4 +35,4 @@
\.patch$
\.diff$
\.tr$
-\#[^\#/]+\#$
\ No newline at end of file
+\#[^\#/]+\#$
--- a/CHANGES.html Tue Dec 21 17:39:54 2010 +0100
+++ b/CHANGES.html Tue Dec 21 17:46:35 2010 +0100
@@ -58,8 +58,67 @@
</ul>
<h2>New API:</h2>
+<ul>
+<li><b>Pyviz visualizer</b>
+<p>A Python-based visualizer called pyviz is now integrated with ns-3.
+For Python simulations, there is an API to start the visualizer. You
+have to import the visualizer module, and call visualizer.start()
+instead of ns3.Simulator.Run(). For C++ simulations, there is no API.
+For C++ simulations (but also works for Python ones) you need to set
+the GlobalValue SimulatorImplementationType to
+"ns3::VisualSimulatorImpl". This can be set from the command-line,
+for example (add the
+<tt>--SimulatorImplementationType=ns3::VisualSimulatorImpl</tt>
+option), or via the waf option <tt>--visualizer</tt>, in addition to
+the usual <tt>--run</tt> option to run programs.
+</p></li>
+
+<li><b>WaypointMobility attributes</b>
+<p>Two attributes were added to WaypointMobility model: LazyNotify and
+InitialPositionIs Waypoint. See RELEASE_NOTES for details. </p> </li>
+
+<li><b>802.11g rates for ERP-OFDM added</b>
+<p>New WifiModes of the form ErpOfdmRatexxMbps, where xx is the rate
+in Mbps (6, 9, 12, 18, 24, 36, 48, 54), are available for 802.11g.
+More details are in the RELEASE_NOTES for details. </p> </li>
+
+<li><b>Socket::GetSocketType ()</b>
+<p>This is analogous to getsockopt(SO_TYPE). ipv4-raw-socket, ipv6-raw-socket,
+ and packet-socket return NS3_SOCK_RAW. tcp-socket and nsc-tcp-socket return
+ NS3_SOCK_STREAM. udp-socket returns NS3_SOCK_DGRAM.</p></li>
+
+<li><b>BulkSendApplication</b>
+<p>Sends data as fast as possible up to MaxBytes or unlimited if MaxBytes is
+zero. Think OnOff, but without the "off" and without the variable data rate.
+This application only works with NS3_SOCK_STREAM and NS3_SOCK_SEQPACKET sockets,
+for example TCP sockets and not UDP sockets. A helper class exists to
+facilitate creating BulkSendApplications. The API for the helper class
+is similar to existing application helper classes, for example, OnOff.
+</p></li>
+
+<li><b>Rakhmatov Vrudhula non-linear battery model</b>
+<p>New class and helper for this battery model. </p></li>
+
+<li><b>Print IPv4 routing tables</b>
+<p>New class methods and helpers for printing IPv4 routing tables
+to an output stream. </p></li>
+
+</ul>
<h2>Changes to existing API:</h2>
+<ul>
+<li><b>Consolidation of Wi-Fi MAC high functionality</b>
+<p>Wi-Fi MAC high classes have been reorganised in attempt to
+consolidate shared functionality into a single class. This new class
+is RegularWifiMac, and it derives from the abstract WifiMac, and is
+parent of AdhocWifiMac, StaWifiMac, ApWifiMac, and
+MeshWifiInterfaceMac. The QoS and non-QoS class variants are no
+longer, with a RegularWifiMac attribute "QosSupported" allowing
+selection between these two modes of operation. QosWifiMacHelper and
+NqosWifiMacHelper continue to work as previously, with a
+behind-the-scenes manipulation of the 'afore-mentioned attribute.
+</p>
+</ul>
<h2>Changed behavior:</h2>
<ul>
@@ -189,6 +248,8 @@
</pre>
</li>
+<li>The method OutputStreamWrapper::SetStream (std::ostream *ostream) was removed.</li>
+)
</ul>
<h2>Changed behavior:</h2>
--- a/RELEASE_NOTES Tue Dec 21 17:39:54 2010 +0100
+++ b/RELEASE_NOTES Tue Dec 21 17:46:35 2010 +0100
@@ -23,6 +23,24 @@
New user-visible features
-------------------------
+ - NS-3 PyViz, a live simulation visualizer, has been added. The
+ visualizer interacts with a running simulation, such that it uses no
+ trace files. It can be most useful for debugging purposes, i.e. to
+ figure out if mobility models are what you expect, where packets are
+ being dropped, etc. There is also a builtin interactive python console
+ that can be used to debug the state of the running objects. Although
+ it is mostly written in Python, it works both with Python and pure C++
+ simulations.
+
+ - Wi-Fi MAC high classes have been reorganised in attempt to
+ consolidate shared functionality into a single class. This new
+ class is RegularWifiMac, and it derives from the abstract
+ WifiMac, and is parent of AdhocWifiMac, StaWifiMac, ApWifiMac,
+ and MeshWifiInterfaceMac. The QoS and non-QoS class variants are
+ no longer, with a RegularWifiMac attribute "QosSupported"
+ allowing selection between these two modes of
+ operation.
+
- Support for IEEE 802.11g (specifically, rates with Modulation
Class ERP-OFDM) has been added to the wifi module. The new
WifiModes have names of the form ErpOfdmRatexxMbps, where xx is
@@ -47,11 +65,26 @@
regression tests but they are now called from the test.py
program.
+ - New BulkSendApplication sends data as fast as possible up to
+ MaxBytes or unlimited if MaxBytes is zero. Think OnOff, but
+ without the "off" and without the variable data rate. This
+ application only works with SOCK_STREAM and SOCK_SEQPACKET
+ sockets, for example TCP sockets and not UDP sockets.
+
+ - Extensions to the energy models: 1) a new Rakhmatov Vrudhula
+ non-linear battery model, 2) additional support for modeling
+ energy consumption in WiFi devices, 3) an example for how to add
+ energy models to a WiFi-based simulation (in examples/energy/
+ directory).
+
+ - New methods to print IPv4 routing tables to an output stream.
+
Bugs fixed
----------
The following lists many of the bugs fixed or small feature additions
since ns-3.9, in many cases referencing the Bugzilla bug number
+ - bug 978 - Consolidate Wi-Fi MAC high functionality
- bug 852 - Add support for 802.11g devices
- bug 892 - WaypointMobilityModel incompatible with MobilityHelper::Install
- bug 893 - Lazy CourseChange notification for WaypointMobilityModel
--- a/bindings/python/apidefs/gcc-ILP32/callbacks_list.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-ILP32/callbacks_list.py Tue Dec 21 17:46:35 2010 +0100
@@ -1,34 +1,35 @@
callback_classes = [
+ ['void', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::Packet const>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
- ['void', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::Packet>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
+ ['void', 'int', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['bool', 'ns3::Ptr<ns3::Packet>', 'ns3::Address const&', 'ns3::Address const&', 'unsigned short', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::Packet>', 'double', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::Packet>', 'double', 'ns3::UanTxMode', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::Packet>', 'ns3::UanAddress const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::PacketBurst const>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
- ['void', 'ns3::Ptr<ns3::Packet>', 'ns3::Mac48Address', 'ns3::Mac48Address', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Mac48Address', 'ns3::Mac48Address', 'unsigned int', 'bool', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'unsigned int', 'ns3::Mac48Address', 'ns3::Mac48Address', 'ns3::dot11s::PeerLink::PeerState', 'ns3::dot11s::PeerLink::PeerState', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['unsigned int', 'ns3::Mac48Address', 'ns3::Ptr<ns3::MeshWifiInterfaceMac>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::Packet>', 'ns3::WifiMacHeader const*', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['std::vector<ns3::Mac48Address, std::allocator<ns3::Mac48Address> >', 'unsigned int', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'bool', 'ns3::Ptr<ns3::Packet>', 'ns3::Mac48Address', 'ns3::Mac48Address', 'unsigned short', 'unsigned int', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
- ['void', 'ns3::WifiMacHeader const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['bool', 'std::string', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'bool', 'unsigned long long', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
- ['void', 'ns3::Mac48Address', 'unsigned char', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
- ['void', 'ns3::Mac48Address', 'unsigned char', 'bool', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::Packet const>', 'ns3::Ipv4Header const&', 'ns3::Socket::SocketErrno', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['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'],
['void', 'ns3::Ptr<ns3::Socket>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::Socket>', 'unsigned int', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::Socket>', 'ns3::Address const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['bool', 'ns3::Ptr<ns3::Socket>', 'ns3::Address const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
+ ['void', 'ns3::WifiMacHeader const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ipv4Address', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::ArpCache const>', 'ns3::Ipv4Address', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['bool', 'ns3::Ptr<ns3::Packet>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['bool', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<ns3::Packet const>', 'unsigned short', 'ns3::Address const&', 'ns3::Address const&', 'ns3::NetDevice::PacketType', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['bool', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<ns3::Packet const>', 'unsigned short', 'ns3::Address const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
+ ['void', 'ns3::Ptr<ns3::Packet>', 'ns3::Mac48Address', 'ns3::Mac48Address', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
+ ['void', 'ns3::Mac48Address', 'unsigned char', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
+ ['void', 'ns3::Mac48Address', 'unsigned char', 'bool', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<ns3::Packet const>', 'unsigned short', 'ns3::Address const&', 'ns3::Address const&', 'ns3::NetDevice::PacketType', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
]
--- a/bindings/python/apidefs/gcc-ILP32/ns3_module_aodv.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-ILP32/ns3_module_aodv.py Tue Dec 21 17:46:35 2010 +0100
@@ -442,6 +442,16 @@
'bool',
[],
is_const=True)
+ ## aodv-routing-protocol.h: uint32_t ns3::aodv::RoutingProtocol::GetMaxQueueLen() const [member function]
+ cls.add_method('GetMaxQueueLen',
+ 'uint32_t',
+ [],
+ is_const=True)
+ ## aodv-routing-protocol.h: ns3::Time ns3::aodv::RoutingProtocol::GetMaxQueueTime() const [member function]
+ cls.add_method('GetMaxQueueTime',
+ 'ns3::Time',
+ [],
+ is_const=True)
## aodv-routing-protocol.h: static ns3::TypeId ns3::aodv::RoutingProtocol::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
@@ -467,6 +477,11 @@
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
is_virtual=True)
+ ## aodv-routing-protocol.h: void ns3::aodv::RoutingProtocol::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTable',
+ 'void',
+ [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True, is_virtual=True)
## aodv-routing-protocol.h: bool ns3::aodv::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<ns3::Packet const>, ns3::Ipv4Header const&, 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<ns3::Packet const>, ns3::Ipv4Header const&, ns3::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> ecb) [member function]
cls.add_method('RouteInput',
'bool',
@@ -498,6 +513,14 @@
'void',
[param('ns3::Ptr< ns3::Ipv4 >', 'ipv4')],
is_virtual=True)
+ ## aodv-routing-protocol.h: void ns3::aodv::RoutingProtocol::SetMaxQueueLen(uint32_t len) [member function]
+ cls.add_method('SetMaxQueueLen',
+ 'void',
+ [param('uint32_t', 'len')])
+ ## aodv-routing-protocol.h: void ns3::aodv::RoutingProtocol::SetMaxQueueTime(ns3::Time t) [member function]
+ cls.add_method('SetMaxQueueTime',
+ 'void',
+ [param('ns3::Time', 't')])
## aodv-routing-protocol.h: ns3::aodv::RoutingProtocol::AODV_PORT [variable]
cls.add_static_attribute('AODV_PORT', 'uint32_t const', is_const=True)
return
@@ -548,10 +571,11 @@
cls.add_method('MarkLinkAsUnidirectional',
'bool',
[param('ns3::Ipv4Address', 'neighbor'), param('ns3::Time', 'blacklistTimeout')])
- ## aodv-rtable.h: void ns3::aodv::RoutingTable::Print(std::ostream & os) [member function]
+ ## aodv-rtable.h: void ns3::aodv::RoutingTable::Print(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
cls.add_method('Print',
'void',
- [param('std::ostream &', 'os')])
+ [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True)
## aodv-rtable.h: void ns3::aodv::RoutingTable::Purge() [member function]
cls.add_method('Purge',
'void',
@@ -674,10 +698,10 @@
cls.add_method('LookupPrecursor',
'bool',
[param('ns3::Ipv4Address', 'id')])
- ## aodv-rtable.h: void ns3::aodv::RoutingTableEntry::Print(std::ostream & os) const [member function]
+ ## aodv-rtable.h: void ns3::aodv::RoutingTableEntry::Print(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
cls.add_method('Print',
'void',
- [param('std::ostream &', 'os')],
+ [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
is_const=True)
## aodv-rtable.h: void ns3::aodv::RoutingTableEntry::SetBalcklistTimeout(ns3::Time t) [member function]
cls.add_method('SetBalcklistTimeout',
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bindings/python/apidefs/gcc-ILP32/ns3_module_bulk_send.py Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,164 @@
+from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
+
+def register_types(module):
+ root_module = module.get_root()
+
+ ## bulk-send-application.h: ns3::BulkSendApplication [class]
+ module.add_class('BulkSendApplication', parent=root_module['ns3::Application'])
+
+ ## Register a nested module for the namespace Config
+
+ nested_module = module.add_cpp_namespace('Config')
+ register_types_ns3_Config(nested_module)
+
+
+ ## Register a nested module for the namespace FatalImpl
+
+ nested_module = module.add_cpp_namespace('FatalImpl')
+ register_types_ns3_FatalImpl(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 aodv
+
+ nested_module = module.add_cpp_namespace('aodv')
+ register_types_ns3_aodv(nested_module)
+
+
+ ## Register a nested module for the namespace dot11s
+
+ nested_module = module.add_cpp_namespace('dot11s')
+ register_types_ns3_dot11s(nested_module)
+
+
+ ## Register a nested module for the namespace flame
+
+ nested_module = module.add_cpp_namespace('flame')
+ register_types_ns3_flame(nested_module)
+
+
+ ## Register a nested module for the namespace internal
+
+ nested_module = module.add_cpp_namespace('internal')
+ register_types_ns3_internal(nested_module)
+
+
+ ## Register a nested module for the namespace olsr
+
+ nested_module = module.add_cpp_namespace('olsr')
+ register_types_ns3_olsr(nested_module)
+
+
+def register_types_ns3_Config(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_FatalImpl(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_addressUtils(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_aodv(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_dot11s(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_flame(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_internal(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_olsr(module):
+ root_module = module.get_root()
+
+
+def register_methods(root_module):
+ register_Ns3BulkSendApplication_methods(root_module, root_module['ns3::BulkSendApplication'])
+ return
+
+def register_Ns3BulkSendApplication_methods(root_module, cls):
+ ## bulk-send-application.h: ns3::BulkSendApplication::BulkSendApplication(ns3::BulkSendApplication const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::BulkSendApplication const &', 'arg0')])
+ ## bulk-send-application.h: ns3::BulkSendApplication::BulkSendApplication() [constructor]
+ cls.add_constructor([])
+ ## bulk-send-application.h: ns3::Ptr<ns3::Socket> ns3::BulkSendApplication::GetSocket() const [member function]
+ cls.add_method('GetSocket',
+ 'ns3::Ptr< ns3::Socket >',
+ [],
+ is_const=True)
+ ## bulk-send-application.h: static ns3::TypeId ns3::BulkSendApplication::GetTypeId() [member function]
+ cls.add_method('GetTypeId',
+ 'ns3::TypeId',
+ [],
+ is_static=True)
+ ## bulk-send-application.h: void ns3::BulkSendApplication::SetMaxBytes(uint32_t maxBytes) [member function]
+ cls.add_method('SetMaxBytes',
+ 'void',
+ [param('uint32_t', 'maxBytes')])
+ ## bulk-send-application.h: void ns3::BulkSendApplication::DoDispose() [member function]
+ cls.add_method('DoDispose',
+ 'void',
+ [],
+ visibility='protected', is_virtual=True)
+ ## bulk-send-application.h: void ns3::BulkSendApplication::StartApplication() [member function]
+ cls.add_method('StartApplication',
+ 'void',
+ [],
+ visibility='private', is_virtual=True)
+ ## bulk-send-application.h: void ns3::BulkSendApplication::StopApplication() [member function]
+ cls.add_method('StopApplication',
+ 'void',
+ [],
+ visibility='private', is_virtual=True)
+ return
+
+def register_functions(root_module):
+ module = root_module
+ register_functions_ns3_Config(module.get_submodule('Config'), root_module)
+ register_functions_ns3_FatalImpl(module.get_submodule('FatalImpl'), root_module)
+ register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
+ register_functions_ns3_aodv(module.get_submodule('aodv'), root_module)
+ register_functions_ns3_dot11s(module.get_submodule('dot11s'), root_module)
+ register_functions_ns3_flame(module.get_submodule('flame'), root_module)
+ register_functions_ns3_internal(module.get_submodule('internal'), root_module)
+ register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
+ return
+
+def register_functions_ns3_Config(module, root_module):
+ return
+
+def register_functions_ns3_FatalImpl(module, root_module):
+ return
+
+def register_functions_ns3_addressUtils(module, root_module):
+ return
+
+def register_functions_ns3_aodv(module, root_module):
+ return
+
+def register_functions_ns3_dot11s(module, root_module):
+ return
+
+def register_functions_ns3_flame(module, root_module):
+ return
+
+def register_functions_ns3_internal(module, root_module):
+ return
+
+def register_functions_ns3_olsr(module, root_module):
+ return
+
--- a/bindings/python/apidefs/gcc-ILP32/ns3_module_common.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-ILP32/ns3_module_common.py Tue Dec 21 17:46:35 2010 +0100
@@ -2075,6 +2075,8 @@
cls.add_constructor([param('ns3::OutputStreamWrapper const &', 'arg0')])
## output-stream-wrapper.h: ns3::OutputStreamWrapper::OutputStreamWrapper(std::string filename, std::_Ios_Openmode filemode) [constructor]
cls.add_constructor([param('std::string', 'filename'), param('std::_Ios_Openmode', 'filemode')])
+ ## output-stream-wrapper.h: ns3::OutputStreamWrapper::OutputStreamWrapper(std::ostream * os) [constructor]
+ cls.add_constructor([param('std::ostream *', 'os')])
## output-stream-wrapper.h: std::ostream * ns3::OutputStreamWrapper::GetStream() [member function]
cls.add_method('GetStream',
'std::ostream *',
--- a/bindings/python/apidefs/gcc-ILP32/ns3_module_core.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-ILP32/ns3_module_core.py Tue Dec 21 17:46:35 2010 +0100
@@ -211,6 +211,7 @@
module.add_class('Vector3DChecker', parent=root_module['ns3::AttributeChecker'])
## vector.h: ns3::Vector3DValue [class]
module.add_class('Vector3DValue', parent=root_module['ns3::AttributeValue'])
+ module.add_container('std::set< ns3::TypeId >', 'ns3::TypeId', container_type='set')
module.add_container('std::list< ns3::Ptr< ns3::SpectrumPhy > >', 'ns3::Ptr< ns3::SpectrumPhy >', container_type='list')
module.add_container('std::list< ns3::Ptr< ns3::Packet > >', 'ns3::Ptr< ns3::Packet >', container_type='list')
module.add_container('std::list< ns3::Ptr< ns3::UanPhy > >', 'ns3::Ptr< ns3::UanPhy >', container_type='list')
@@ -350,6 +351,7 @@
register_Ns3TestRunner_methods(root_module, root_module['ns3::TestRunner'])
register_Ns3TestSuite_methods(root_module, root_module['ns3::TestSuite'])
register_Ns3TracedValue__Double_methods(root_module, root_module['ns3::TracedValue< double >'])
+ register_Ns3TracedValue__Ns3Time_methods(root_module, root_module['ns3::TracedValue< ns3::Time >'])
register_Ns3TriangularVariable_methods(root_module, root_module['ns3::TriangularVariable'])
register_Ns3TypeId_methods(root_module, root_module['ns3::TypeId'])
register_Ns3TypeIdAttributeInfo_methods(root_module, root_module['ns3::TypeId::AttributeInfo'])
@@ -1339,6 +1341,40 @@
[param('double const &', 'v')])
return
+def register_Ns3TracedValue__Ns3Time_methods(root_module, cls):
+ ## traced-value.h: ns3::TracedValue<ns3::Time>::TracedValue() [constructor]
+ cls.add_constructor([])
+ ## traced-value.h: ns3::TracedValue<ns3::Time>::TracedValue(ns3::TracedValue<ns3::Time> const & o) [copy constructor]
+ cls.add_constructor([param('ns3::TracedValue< ns3::Time > const &', 'o')])
+ ## traced-value.h: ns3::TracedValue<ns3::Time>::TracedValue(ns3::Time const & v) [constructor]
+ cls.add_constructor([param('ns3::Time const &', 'v')])
+ ## traced-value.h: void ns3::TracedValue<ns3::Time>::Connect(ns3::CallbackBase const & cb, std::basic_string<char,std::char_traits<char>,std::allocator<char> > path) [member function]
+ cls.add_method('Connect',
+ 'void',
+ [param('ns3::CallbackBase const &', 'cb'), param('std::string', 'path')])
+ ## traced-value.h: void ns3::TracedValue<ns3::Time>::ConnectWithoutContext(ns3::CallbackBase const & cb) [member function]
+ cls.add_method('ConnectWithoutContext',
+ 'void',
+ [param('ns3::CallbackBase const &', 'cb')])
+ ## traced-value.h: void ns3::TracedValue<ns3::Time>::Disconnect(ns3::CallbackBase const & cb, std::basic_string<char,std::char_traits<char>,std::allocator<char> > path) [member function]
+ cls.add_method('Disconnect',
+ 'void',
+ [param('ns3::CallbackBase const &', 'cb'), param('std::string', 'path')])
+ ## traced-value.h: void ns3::TracedValue<ns3::Time>::DisconnectWithoutContext(ns3::CallbackBase const & cb) [member function]
+ cls.add_method('DisconnectWithoutContext',
+ 'void',
+ [param('ns3::CallbackBase const &', 'cb')])
+ ## traced-value.h: ns3::Time ns3::TracedValue<ns3::Time>::Get() const [member function]
+ cls.add_method('Get',
+ 'ns3::Time',
+ [],
+ is_const=True)
+ ## traced-value.h: void ns3::TracedValue<ns3::Time>::Set(ns3::Time const & v) [member function]
+ cls.add_method('Set',
+ 'void',
+ [param('ns3::Time const &', 'v')])
+ return
+
def register_Ns3TriangularVariable_methods(root_module, cls):
## random-variable.h: ns3::TriangularVariable::TriangularVariable(ns3::TriangularVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TriangularVariable const &', 'arg0')])
@@ -3176,7 +3212,7 @@
module.add_function('TypeNameGet',
'std::string',
[],
- template_parameters=['long'])
+ template_parameters=['long long'])
## type-name.h: extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
--- a/bindings/python/apidefs/gcc-ILP32/ns3_module_helper.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-ILP32/ns3_module_helper.py Tue Dec 21 17:46:35 2010 +0100
@@ -19,6 +19,8 @@
module.add_class('AsciiTraceHelperForIpv6', allow_subclassing=True)
## athstats-helper.h: ns3::AthstatsHelper [class]
module.add_class('AthstatsHelper')
+ ## bulk-send-helper.h: ns3::BulkSendHelper [class]
+ module.add_class('BulkSendHelper')
## csma-star-helper.h: ns3::CsmaStarHelper [class]
module.add_class('CsmaStarHelper')
## ipv4-address-helper.h: ns3::Ipv4AddressHelper [class]
@@ -229,6 +231,7 @@
register_Ns3AsciiTraceHelperForIpv4_methods(root_module, root_module['ns3::AsciiTraceHelperForIpv4'])
register_Ns3AsciiTraceHelperForIpv6_methods(root_module, root_module['ns3::AsciiTraceHelperForIpv6'])
register_Ns3AthstatsHelper_methods(root_module, root_module['ns3::AthstatsHelper'])
+ register_Ns3BulkSendHelper_methods(root_module, root_module['ns3::BulkSendHelper'])
register_Ns3CsmaStarHelper_methods(root_module, root_module['ns3::CsmaStarHelper'])
register_Ns3Ipv4AddressHelper_methods(root_module, root_module['ns3::Ipv4AddressHelper'])
register_Ns3Ipv4InterfaceContainer_methods(root_module, root_module['ns3::Ipv4InterfaceContainer'])
@@ -667,6 +670,32 @@
[param('std::string', 'filename'), param('ns3::NodeContainer', 'n')])
return
+def register_Ns3BulkSendHelper_methods(root_module, cls):
+ ## bulk-send-helper.h: ns3::BulkSendHelper::BulkSendHelper(ns3::BulkSendHelper const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::BulkSendHelper const &', 'arg0')])
+ ## bulk-send-helper.h: ns3::BulkSendHelper::BulkSendHelper(std::string protocol, ns3::Address address) [constructor]
+ cls.add_constructor([param('std::string', 'protocol'), param('ns3::Address', 'address')])
+ ## bulk-send-helper.h: ns3::ApplicationContainer ns3::BulkSendHelper::Install(ns3::NodeContainer c) const [member function]
+ cls.add_method('Install',
+ 'ns3::ApplicationContainer',
+ [param('ns3::NodeContainer', 'c')],
+ is_const=True)
+ ## bulk-send-helper.h: ns3::ApplicationContainer ns3::BulkSendHelper::Install(ns3::Ptr<ns3::Node> node) const [member function]
+ cls.add_method('Install',
+ 'ns3::ApplicationContainer',
+ [param('ns3::Ptr< ns3::Node >', 'node')],
+ is_const=True)
+ ## bulk-send-helper.h: ns3::ApplicationContainer ns3::BulkSendHelper::Install(std::string nodeName) const [member function]
+ cls.add_method('Install',
+ 'ns3::ApplicationContainer',
+ [param('std::string', 'nodeName')],
+ is_const=True)
+ ## bulk-send-helper.h: void ns3::BulkSendHelper::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
+ cls.add_method('SetAttribute',
+ 'void',
+ [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
+ return
+
def register_Ns3CsmaStarHelper_methods(root_module, cls):
## csma-star-helper.h: ns3::CsmaStarHelper::CsmaStarHelper(ns3::CsmaStarHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CsmaStarHelper const &', 'arg0')])
@@ -809,6 +838,26 @@
'ns3::Ptr< ns3::Ipv4RoutingProtocol >',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_pure_virtual=True, is_const=True, is_virtual=True)
+ ## ipv4-routing-helper.h: void ns3::Ipv4RoutingHelper::PrintRoutingTableAllAt(ns3::Time printTime, ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTableAllAt',
+ 'void',
+ [param('ns3::Time', 'printTime'), param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True)
+ ## ipv4-routing-helper.h: void ns3::Ipv4RoutingHelper::PrintRoutingTableAllEvery(ns3::Time printInterval, ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTableAllEvery',
+ 'void',
+ [param('ns3::Time', 'printInterval'), param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True)
+ ## ipv4-routing-helper.h: void ns3::Ipv4RoutingHelper::PrintRoutingTableAt(ns3::Time printTime, ns3::Ptr<ns3::Node> node, ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTableAt',
+ 'void',
+ [param('ns3::Time', 'printTime'), param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True)
+ ## ipv4-routing-helper.h: void ns3::Ipv4RoutingHelper::PrintRoutingTableEvery(ns3::Time printInterval, ns3::Ptr<ns3::Node> node, ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTableEvery',
+ 'void',
+ [param('ns3::Time', 'printInterval'), param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True)
return
def register_Ns3Ipv6AddressHelper_methods(root_module, cls):
--- a/bindings/python/apidefs/gcc-ILP32/ns3_module_internet_stack.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-ILP32/ns3_module_internet_stack.py Tue Dec 21 17:46:35 2010 +0100
@@ -3552,6 +3552,10 @@
cls.add_method('CreateSocket',
'ns3::Ptr< ns3::Socket >',
[])
+ ## tcp-l4-protocol.h: ns3::Ptr<ns3::Socket> ns3::TcpL4Protocol::CreateSocket(ns3::TypeId socketTypeId) [member function]
+ cls.add_method('CreateSocket',
+ 'ns3::Ptr< ns3::Socket >',
+ [param('ns3::TypeId', 'socketTypeId')])
## tcp-l4-protocol.h: ns3::Ipv4EndPoint * ns3::TcpL4Protocol::Allocate() [member function]
cls.add_method('Allocate',
'ns3::Ipv4EndPoint *',
--- a/bindings/python/apidefs/gcc-ILP32/ns3_module_mesh.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-ILP32/ns3_module_mesh.py Tue Dec 21 17:46:35 2010 +0100
@@ -11,12 +11,12 @@
module.add_class('MeshInformationElementVector', parent=root_module['ns3::WifiInformationElementVector'])
## mesh-l2-routing-protocol.h: ns3::MeshL2RoutingProtocol [class]
module.add_class('MeshL2RoutingProtocol', parent=root_module['ns3::Object'])
- ## mesh-wifi-interface-mac.h: ns3::MeshWifiInterfaceMac [class]
- module.add_class('MeshWifiInterfaceMac', parent=root_module['ns3::WifiMac'])
## mesh-wifi-interface-mac-plugin.h: ns3::MeshWifiInterfaceMacPlugin [class]
module.add_class('MeshWifiInterfaceMacPlugin', parent=root_module['ns3::SimpleRefCount< ns3::MeshWifiInterfaceMacPlugin, ns3::empty, ns3::DefaultDeleter<ns3::MeshWifiInterfaceMacPlugin> >'])
## mesh-point-device.h: ns3::MeshPointDevice [class]
module.add_class('MeshPointDevice', parent=root_module['ns3::NetDevice'])
+ ## mesh-wifi-interface-mac.h: ns3::MeshWifiInterfaceMac [class]
+ module.add_class('MeshWifiInterfaceMac', parent=root_module['ns3::RegularWifiMac'])
## Register a nested module for the namespace Config
@@ -102,9 +102,9 @@
register_Ns3MeshWifiBeacon_methods(root_module, root_module['ns3::MeshWifiBeacon'])
register_Ns3MeshInformationElementVector_methods(root_module, root_module['ns3::MeshInformationElementVector'])
register_Ns3MeshL2RoutingProtocol_methods(root_module, root_module['ns3::MeshL2RoutingProtocol'])
- register_Ns3MeshWifiInterfaceMac_methods(root_module, root_module['ns3::MeshWifiInterfaceMac'])
register_Ns3MeshWifiInterfaceMacPlugin_methods(root_module, root_module['ns3::MeshWifiInterfaceMacPlugin'])
register_Ns3MeshPointDevice_methods(root_module, root_module['ns3::MeshPointDevice'])
+ register_Ns3MeshWifiInterfaceMac_methods(root_module, root_module['ns3::MeshWifiInterfaceMac'])
return
def register_Ns3MeshWifiBeacon_methods(root_module, cls):
@@ -179,260 +179,6 @@
[param('ns3::Ptr< ns3::MeshPointDevice >', 'mp')])
return
-def register_Ns3MeshWifiInterfaceMac_methods(root_module, cls):
- ## mesh-wifi-interface-mac.h: ns3::MeshWifiInterfaceMac::MeshWifiInterfaceMac(ns3::MeshWifiInterfaceMac const & arg0) [copy constructor]
- cls.add_constructor([param('ns3::MeshWifiInterfaceMac const &', 'arg0')])
- ## mesh-wifi-interface-mac.h: ns3::MeshWifiInterfaceMac::MeshWifiInterfaceMac() [constructor]
- cls.add_constructor([])
- ## mesh-wifi-interface-mac.h: bool ns3::MeshWifiInterfaceMac::CheckSupportedRates(ns3::SupportedRates rates) const [member function]
- cls.add_method('CheckSupportedRates',
- 'bool',
- [param('ns3::SupportedRates', 'rates')],
- is_const=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::FinishConfigureStandard(ns3::WifiPhyStandard standard) [member function]
- cls.add_method('FinishConfigureStandard',
- 'void',
- [param('ns3::WifiPhyStandard', 'standard')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetAckTimeout() const [member function]
- cls.add_method('GetAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## mesh-wifi-interface-mac.h: ns3::Mac48Address ns3::MeshWifiInterfaceMac::GetAddress() const [member function]
- cls.add_method('GetAddress',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetBeaconInterval() const [member function]
- cls.add_method('GetBeaconInterval',
- 'ns3::Time',
- [],
- is_const=True)
- ## mesh-wifi-interface-mac.h: ns3::Mac48Address ns3::MeshWifiInterfaceMac::GetBssid() const [member function]
- cls.add_method('GetBssid',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetCtsTimeout() const [member function]
- cls.add_method('GetCtsTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetEifsNoDifs() const [member function]
- cls.add_method('GetEifsNoDifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## mesh-wifi-interface-mac.h: uint16_t ns3::MeshWifiInterfaceMac::GetFrequencyChannel() const [member function]
- cls.add_method('GetFrequencyChannel',
- 'uint16_t',
- [],
- is_const=True)
- ## mesh-wifi-interface-mac.h: uint32_t ns3::MeshWifiInterfaceMac::GetLinkMetric(ns3::Mac48Address peerAddress) [member function]
- cls.add_method('GetLinkMetric',
- 'uint32_t',
- [param('ns3::Mac48Address', 'peerAddress')])
- ## mesh-wifi-interface-mac.h: ns3::Mac48Address ns3::MeshWifiInterfaceMac::GetMeshPointAddress() const [member function]
- cls.add_method('GetMeshPointAddress',
- 'ns3::Mac48Address',
- [],
- is_const=True)
- ## mesh-wifi-interface-mac.h: ns3::WifiPhyStandard ns3::MeshWifiInterfaceMac::GetPhyStandard() const [member function]
- cls.add_method('GetPhyStandard',
- 'ns3::WifiPhyStandard',
- [],
- is_const=True)
- ## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetPifs() const [member function]
- cls.add_method('GetPifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetSifs() const [member function]
- cls.add_method('GetSifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetSlot() const [member function]
- cls.add_method('GetSlot',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## mesh-wifi-interface-mac.h: ns3::Ssid ns3::MeshWifiInterfaceMac::GetSsid() const [member function]
- cls.add_method('GetSsid',
- 'ns3::Ssid',
- [],
- is_const=True, is_virtual=True)
- ## mesh-wifi-interface-mac.h: ns3::Ptr<ns3::WifiRemoteStationManager> ns3::MeshWifiInterfaceMac::GetStationManager() [member function]
- cls.add_method('GetStationManager',
- 'ns3::Ptr< ns3::WifiRemoteStationManager >',
- [])
- ## mesh-wifi-interface-mac.h: ns3::SupportedRates ns3::MeshWifiInterfaceMac::GetSupportedRates() const [member function]
- cls.add_method('GetSupportedRates',
- 'ns3::SupportedRates',
- [],
- is_const=True)
- ## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetTbtt() const [member function]
- cls.add_method('GetTbtt',
- 'ns3::Time',
- [],
- is_const=True)
- ## mesh-wifi-interface-mac.h: static ns3::TypeId ns3::MeshWifiInterfaceMac::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
- ## mesh-wifi-interface-mac.h: ns3::Ptr<ns3::WifiPhy> ns3::MeshWifiInterfaceMac::GetWifiPhy() const [member function]
- cls.add_method('GetWifiPhy',
- 'ns3::Ptr< ns3::WifiPhy >',
- [],
- is_const=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::InstallPlugin(ns3::Ptr<ns3::MeshWifiInterfaceMacPlugin> plugin) [member function]
- cls.add_method('InstallPlugin',
- 'void',
- [param('ns3::Ptr< ns3::MeshWifiInterfaceMacPlugin >', 'plugin')])
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::Report(std::ostream & arg0) const [member function]
- cls.add_method('Report',
- 'void',
- [param('std::ostream &', 'arg0')],
- is_const=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::ResetStats() [member function]
- cls.add_method('ResetStats',
- 'void',
- [])
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SendManagementFrame(ns3::Ptr<ns3::Packet> frame, ns3::WifiMacHeader const & hdr) [member function]
- cls.add_method('SendManagementFrame',
- 'void',
- [param('ns3::Ptr< ns3::Packet >', 'frame'), param('ns3::WifiMacHeader const &', 'hdr')])
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetAckTimeout(ns3::Time ackTimeout) [member function]
- cls.add_method('SetAckTimeout',
- 'void',
- [param('ns3::Time', 'ackTimeout')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetAddress(ns3::Mac48Address address) [member function]
- cls.add_method('SetAddress',
- 'void',
- [param('ns3::Mac48Address', 'address')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetBeaconGeneration(bool enable) [member function]
- cls.add_method('SetBeaconGeneration',
- 'void',
- [param('bool', 'enable')])
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetBeaconInterval(ns3::Time interval) [member function]
- cls.add_method('SetBeaconInterval',
- 'void',
- [param('ns3::Time', 'interval')])
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetCtsTimeout(ns3::Time ctsTimeout) [member function]
- cls.add_method('SetCtsTimeout',
- 'void',
- [param('ns3::Time', 'ctsTimeout')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetEifsNoDifs(ns3::Time eifsNoDifs) [member function]
- cls.add_method('SetEifsNoDifs',
- 'void',
- [param('ns3::Time', 'eifsNoDifs')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetForwardUpCallback(ns3::Callback<void, ns3::Ptr<ns3::Packet>, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> upCallback) [member function]
- cls.add_method('SetForwardUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'upCallback')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetLinkDownCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkDown) [member function]
- cls.add_method('SetLinkDownCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkDown')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetLinkMetricCallback(ns3::Callback<unsigned int, ns3::Mac48Address, ns3::Ptr<ns3::MeshWifiInterfaceMac>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> cb) [member function]
- cls.add_method('SetLinkMetricCallback',
- 'void',
- [param('ns3::Callback< unsigned int, ns3::Mac48Address, ns3::Ptr< ns3::MeshWifiInterfaceMac >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')])
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
- cls.add_method('SetLinkUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetMeshPointAddress(ns3::Mac48Address arg0) [member function]
- cls.add_method('SetMeshPointAddress',
- 'void',
- [param('ns3::Mac48Address', 'arg0')])
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetPifs(ns3::Time pifs) [member function]
- cls.add_method('SetPifs',
- 'void',
- [param('ns3::Time', 'pifs')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetQueue(ns3::AcIndex ac) [member function]
- cls.add_method('SetQueue',
- 'void',
- [param('ns3::AcIndex', 'ac')])
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetRandomStartDelay(ns3::Time interval) [member function]
- cls.add_method('SetRandomStartDelay',
- 'void',
- [param('ns3::Time', 'interval')])
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetSifs(ns3::Time sifs) [member function]
- cls.add_method('SetSifs',
- 'void',
- [param('ns3::Time', 'sifs')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetSlot(ns3::Time slotTime) [member function]
- cls.add_method('SetSlot',
- 'void',
- [param('ns3::Time', 'slotTime')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetSsid(ns3::Ssid ssid) [member function]
- cls.add_method('SetSsid',
- 'void',
- [param('ns3::Ssid', 'ssid')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetWifiPhy(ns3::Ptr<ns3::WifiPhy> phy) [member function]
- cls.add_method('SetWifiPhy',
- 'void',
- [param('ns3::Ptr< ns3::WifiPhy >', 'phy')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetWifiRemoteStationManager(ns3::Ptr<ns3::WifiRemoteStationManager> stationManager) [member function]
- cls.add_method('SetWifiRemoteStationManager',
- 'void',
- [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::ShiftTbtt(ns3::Time shift) [member function]
- cls.add_method('ShiftTbtt',
- 'void',
- [param('ns3::Time', 'shift')])
- ## mesh-wifi-interface-mac.h: bool ns3::MeshWifiInterfaceMac::SupportsSendFrom() const [member function]
- cls.add_method('SupportsSendFrom',
- 'bool',
- [],
- is_const=True, is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SwitchFrequencyChannel(uint16_t new_id) [member function]
- cls.add_method('SwitchFrequencyChannel',
- 'void',
- [param('uint16_t', 'new_id')])
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::DoDispose() [member function]
- cls.add_method('DoDispose',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::DoStart() [member function]
- cls.add_method('DoStart',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::ForwardUp(ns3::Ptr<ns3::Packet> packet, ns3::Mac48Address src, ns3::Mac48Address dst) [member function]
- cls.add_method('ForwardUp',
- 'void',
- [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Mac48Address', 'src'), param('ns3::Mac48Address', 'dst')],
- visibility='private', is_virtual=True)
- return
-
def register_Ns3MeshWifiInterfaceMacPlugin_methods(root_module, cls):
## mesh-wifi-interface-mac-plugin.h: ns3::MeshWifiInterfaceMacPlugin::MeshWifiInterfaceMacPlugin() [constructor]
cls.add_constructor([])
@@ -634,6 +380,137 @@
is_const=True, is_virtual=True)
return
+def register_Ns3MeshWifiInterfaceMac_methods(root_module, cls):
+ ## mesh-wifi-interface-mac.h: ns3::MeshWifiInterfaceMac::MeshWifiInterfaceMac(ns3::MeshWifiInterfaceMac const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::MeshWifiInterfaceMac const &', 'arg0')])
+ ## mesh-wifi-interface-mac.h: ns3::MeshWifiInterfaceMac::MeshWifiInterfaceMac() [constructor]
+ cls.add_constructor([])
+ ## mesh-wifi-interface-mac.h: bool ns3::MeshWifiInterfaceMac::CheckSupportedRates(ns3::SupportedRates rates) const [member function]
+ cls.add_method('CheckSupportedRates',
+ 'bool',
+ [param('ns3::SupportedRates', 'rates')],
+ is_const=True)
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
+ cls.add_method('Enqueue',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')],
+ is_virtual=True)
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
+ cls.add_method('Enqueue',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
+ is_virtual=True)
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::FinishConfigureStandard(ns3::WifiPhyStandard standard) [member function]
+ cls.add_method('FinishConfigureStandard',
+ 'void',
+ [param('ns3::WifiPhyStandard', 'standard')],
+ is_virtual=True)
+ ## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetBeaconInterval() const [member function]
+ cls.add_method('GetBeaconInterval',
+ 'ns3::Time',
+ [],
+ is_const=True)
+ ## mesh-wifi-interface-mac.h: uint16_t ns3::MeshWifiInterfaceMac::GetFrequencyChannel() const [member function]
+ cls.add_method('GetFrequencyChannel',
+ 'uint16_t',
+ [],
+ is_const=True)
+ ## mesh-wifi-interface-mac.h: uint32_t ns3::MeshWifiInterfaceMac::GetLinkMetric(ns3::Mac48Address peerAddress) [member function]
+ cls.add_method('GetLinkMetric',
+ 'uint32_t',
+ [param('ns3::Mac48Address', 'peerAddress')])
+ ## mesh-wifi-interface-mac.h: ns3::Mac48Address ns3::MeshWifiInterfaceMac::GetMeshPointAddress() const [member function]
+ cls.add_method('GetMeshPointAddress',
+ 'ns3::Mac48Address',
+ [],
+ is_const=True)
+ ## mesh-wifi-interface-mac.h: ns3::WifiPhyStandard ns3::MeshWifiInterfaceMac::GetPhyStandard() const [member function]
+ cls.add_method('GetPhyStandard',
+ 'ns3::WifiPhyStandard',
+ [],
+ is_const=True)
+ ## mesh-wifi-interface-mac.h: ns3::SupportedRates ns3::MeshWifiInterfaceMac::GetSupportedRates() const [member function]
+ cls.add_method('GetSupportedRates',
+ 'ns3::SupportedRates',
+ [],
+ is_const=True)
+ ## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetTbtt() const [member function]
+ cls.add_method('GetTbtt',
+ 'ns3::Time',
+ [],
+ is_const=True)
+ ## mesh-wifi-interface-mac.h: static ns3::TypeId ns3::MeshWifiInterfaceMac::GetTypeId() [member function]
+ cls.add_method('GetTypeId',
+ 'ns3::TypeId',
+ [],
+ is_static=True)
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::InstallPlugin(ns3::Ptr<ns3::MeshWifiInterfaceMacPlugin> plugin) [member function]
+ cls.add_method('InstallPlugin',
+ 'void',
+ [param('ns3::Ptr< ns3::MeshWifiInterfaceMacPlugin >', 'plugin')])
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::Report(std::ostream & arg0) const [member function]
+ cls.add_method('Report',
+ 'void',
+ [param('std::ostream &', 'arg0')],
+ is_const=True)
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::ResetStats() [member function]
+ cls.add_method('ResetStats',
+ 'void',
+ [])
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SendManagementFrame(ns3::Ptr<ns3::Packet> frame, ns3::WifiMacHeader const & hdr) [member function]
+ cls.add_method('SendManagementFrame',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'frame'), param('ns3::WifiMacHeader const &', 'hdr')])
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetBeaconGeneration(bool enable) [member function]
+ cls.add_method('SetBeaconGeneration',
+ 'void',
+ [param('bool', 'enable')])
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetBeaconInterval(ns3::Time interval) [member function]
+ cls.add_method('SetBeaconInterval',
+ 'void',
+ [param('ns3::Time', 'interval')])
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetLinkMetricCallback(ns3::Callback<unsigned int, ns3::Mac48Address, ns3::Ptr<ns3::MeshWifiInterfaceMac>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> cb) [member function]
+ cls.add_method('SetLinkMetricCallback',
+ 'void',
+ [param('ns3::Callback< unsigned int, ns3::Mac48Address, ns3::Ptr< ns3::MeshWifiInterfaceMac >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')])
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
+ cls.add_method('SetLinkUpCallback',
+ 'void',
+ [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
+ is_virtual=True)
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetMeshPointAddress(ns3::Mac48Address arg0) [member function]
+ cls.add_method('SetMeshPointAddress',
+ 'void',
+ [param('ns3::Mac48Address', 'arg0')])
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetRandomStartDelay(ns3::Time interval) [member function]
+ cls.add_method('SetRandomStartDelay',
+ 'void',
+ [param('ns3::Time', 'interval')])
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::ShiftTbtt(ns3::Time shift) [member function]
+ cls.add_method('ShiftTbtt',
+ 'void',
+ [param('ns3::Time', 'shift')])
+ ## mesh-wifi-interface-mac.h: bool ns3::MeshWifiInterfaceMac::SupportsSendFrom() const [member function]
+ cls.add_method('SupportsSendFrom',
+ 'bool',
+ [],
+ is_const=True, is_virtual=True)
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SwitchFrequencyChannel(uint16_t new_id) [member function]
+ cls.add_method('SwitchFrequencyChannel',
+ 'void',
+ [param('uint16_t', 'new_id')])
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::DoDispose() [member function]
+ cls.add_method('DoDispose',
+ 'void',
+ [],
+ visibility='private', is_virtual=True)
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::Receive(ns3::Ptr<ns3::Packet> packet, ns3::WifiMacHeader const * hdr) [member function]
+ cls.add_method('Receive',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::WifiMacHeader const *', 'hdr')],
+ visibility='private', is_virtual=True)
+ return
+
def register_functions(root_module):
module = root_module
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
--- a/bindings/python/apidefs/gcc-ILP32/ns3_module_nix_vector_routing.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-ILP32/ns3_module_nix_vector_routing.py Tue Dec 21 17:46:35 2010 +0100
@@ -139,6 +139,11 @@
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
visibility='private', is_virtual=True)
+ ## ipv4-nix-vector-routing.h: void ns3::Ipv4NixVectorRouting::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTable',
+ 'void',
+ [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True, visibility='private', is_virtual=True)
## ipv4-nix-vector-routing.h: bool ns3::Ipv4NixVectorRouting::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<ns3::Packet const>, ns3::Ipv4Header const&, 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<ns3::Packet const>, ns3::Ipv4Header const&, ns3::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> ecb) [member function]
cls.add_method('RouteInput',
'bool',
--- a/bindings/python/apidefs/gcc-ILP32/ns3_module_node.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-ILP32/ns3_module_node.py Tue Dec 21 17:46:35 2010 +0100
@@ -5,6 +5,8 @@
## packetbb.h: ns3::PbbAddressLength [enumeration]
module.add_enum('PbbAddressLength', ['IPV4', 'IPV6'])
+ ## tcp-socket.h: ns3::TcpStates_t [enumeration]
+ module.add_enum('TcpStates_t', ['CLOSED', 'LISTEN', 'SYN_SENT', 'SYN_RCVD', 'ESTABLISHED', 'CLOSE_WAIT', 'LAST_ACK', 'FIN_WAIT_1', 'FIN_WAIT_2', 'CLOSING', 'TIME_WAIT', 'LAST_STATE'])
## ethernet-header.h: ns3::ethernet_header_t [enumeration]
module.add_enum('ethernet_header_t', ['LENGTH', 'VLAN', 'QINQ'])
## address.h: ns3::Address [class]
@@ -103,6 +105,8 @@
module.add_class('Socket', parent=root_module['ns3::Object'])
## socket.h: ns3::Socket::SocketErrno [enumeration]
module.add_enum('SocketErrno', ['ERROR_NOTERROR', 'ERROR_ISCONN', 'ERROR_NOTCONN', 'ERROR_MSGSIZE', 'ERROR_AGAIN', 'ERROR_SHUTDOWN', 'ERROR_OPNOTSUPP', 'ERROR_AFNOSUPPORT', 'ERROR_INVAL', 'ERROR_BADF', 'ERROR_NOROUTETOHOST', 'ERROR_NODEV', 'ERROR_ADDRNOTAVAIL', 'SOCKET_ERRNO_LAST'], outer_class=root_module['ns3::Socket'])
+ ## socket.h: ns3::Socket::SocketType [enumeration]
+ module.add_enum('SocketType', ['NS3_SOCK_STREAM', 'NS3_SOCK_SEQPACKET', 'NS3_SOCK_DGRAM', 'NS3_SOCK_RAW'], outer_class=root_module['ns3::Socket'])
## socket.h: ns3::SocketAddressTag [class]
module.add_class('SocketAddressTag', parent=root_module['ns3::Tag'])
## socket-factory.h: ns3::SocketFactory [class]
@@ -212,12 +216,12 @@
module.add_container('ns3::olsr::MprSet', 'ns3::Ipv4Address', container_type='set')
module.add_container('std::vector< ns3::Ipv4Address >', 'ns3::Ipv4Address', container_type='vector')
module.add_container('std::vector< ns3::Ipv6Address >', 'ns3::Ipv6Address', container_type='vector')
+ typehandlers.add_type_alias('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ns3::PhyMacRxEndErrorCallback')
+ typehandlers.add_type_alias('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', 'ns3::PhyMacRxEndErrorCallback*')
+ typehandlers.add_type_alias('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', 'ns3::PhyMacRxEndErrorCallback&')
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ns3::PhyMacTxEndCallback')
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', 'ns3::PhyMacTxEndCallback*')
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', 'ns3::PhyMacTxEndCallback&')
- typehandlers.add_type_alias('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ns3::PhyMacRxEndErrorCallback')
- typehandlers.add_type_alias('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', 'ns3::PhyMacRxEndErrorCallback*')
- typehandlers.add_type_alias('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', 'ns3::PhyMacRxEndErrorCallback&')
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ns3::PhyMacRxEndOkCallback')
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', 'ns3::PhyMacRxEndOkCallback*')
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', 'ns3::PhyMacRxEndOkCallback&')
@@ -2217,6 +2221,11 @@
'int',
[param('ns3::Address &', 'address')],
is_pure_virtual=True, is_const=True, is_virtual=True)
+ ## socket.h: ns3::Socket::SocketType ns3::Socket::GetSocketType() const [member function]
+ cls.add_method('GetSocketType',
+ 'ns3::Socket::SocketType',
+ [],
+ is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h: uint32_t ns3::Socket::GetTxAvailable() const [member function]
cls.add_method('GetTxAvailable',
'uint32_t',
@@ -2586,6 +2595,8 @@
'ns3::TypeId',
[],
is_static=True)
+ ## tcp-socket.h: ns3::TcpSocket::TcpStateName [variable]
+ cls.add_static_attribute('TcpStateName', 'char const * [ 11 ] const', is_const=True)
## tcp-socket.h: uint32_t ns3::TcpSocket::GetConnCount() const [member function]
cls.add_method('GetConnCount',
'uint32_t',
@@ -2611,6 +2622,11 @@
'uint32_t',
[],
is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
+ ## tcp-socket.h: ns3::Time ns3::TcpSocket::GetPersistTimeout() const [member function]
+ cls.add_method('GetPersistTimeout',
+ 'ns3::Time',
+ [],
+ is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
## tcp-socket.h: uint32_t ns3::TcpSocket::GetRcvBufSize() const [member function]
cls.add_method('GetRcvBufSize',
'uint32_t',
@@ -2656,6 +2672,11 @@
'void',
[param('uint32_t', 'count')],
is_pure_virtual=True, visibility='private', is_virtual=True)
+ ## tcp-socket.h: void ns3::TcpSocket::SetPersistTimeout(ns3::Time timeout) [member function]
+ cls.add_method('SetPersistTimeout',
+ 'void',
+ [param('ns3::Time', 'timeout')],
+ is_pure_virtual=True, visibility='private', is_virtual=True)
## tcp-socket.h: void ns3::TcpSocket::SetRcvBufSize(uint32_t size) [member function]
cls.add_method('SetRcvBufSize',
'void',
@@ -3400,6 +3421,11 @@
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
is_pure_virtual=True, is_virtual=True)
+ ## ipv4-routing-protocol.h: void ns3::Ipv4RoutingProtocol::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTable',
+ 'void',
+ [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_pure_virtual=True, is_const=True, is_virtual=True)
## 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<ns3::Packet const>, ns3::Ipv4Header const&, 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<ns3::Packet const>, ns3::Ipv4Header const&, ns3::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> ecb) [member function]
cls.add_method('RouteInput',
'bool',
--- a/bindings/python/apidefs/gcc-ILP32/ns3_module_simulator.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-ILP32/ns3_module_simulator.py Tue Dec 21 17:46:35 2010 +0100
@@ -25,6 +25,10 @@
module.add_enum('State', ['RUNNING', 'EXPIRED', 'SUSPENDED'], outer_class=root_module['ns3::Timer'])
## timer-impl.h: ns3::TimerImpl [class]
module.add_class('TimerImpl', allow_subclassing=True)
+ ## traced-value.h: ns3::TracedValue<ns3::Time> [class]
+ module.add_class('TracedValue', template_parameters=['ns3::Time'])
+ ## traced-value.h: ns3::TracedValue<ns3::Time> [class]
+ root_module['ns3::TracedValue< ns3::Time >'].implicitly_converts_to(root_module['ns3::Time'])
## watchdog.h: ns3::Watchdog [class]
module.add_class('Watchdog')
## nstime.h: ns3::Scalar [class]
@@ -389,13 +393,13 @@
def register_Ns3Time_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_inplace_numeric_operator('*=', param('ns3::Time const &', 'right'))
+ cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', 'right'))
cls.add_inplace_numeric_operator('/=', param('ns3::Time const &', 'right'))
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('<=')
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('>=')
- cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bindings/python/apidefs/gcc-ILP32/ns3_module_visualizer.py Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,125 @@
+from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
+
+def register_types(module):
+ root_module = module.get_root()
+
+
+ ## Register a nested module for the namespace Config
+
+ nested_module = module.add_cpp_namespace('Config')
+ register_types_ns3_Config(nested_module)
+
+
+ ## Register a nested module for the namespace FatalImpl
+
+ nested_module = module.add_cpp_namespace('FatalImpl')
+ register_types_ns3_FatalImpl(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 aodv
+
+ nested_module = module.add_cpp_namespace('aodv')
+ register_types_ns3_aodv(nested_module)
+
+
+ ## Register a nested module for the namespace dot11s
+
+ nested_module = module.add_cpp_namespace('dot11s')
+ register_types_ns3_dot11s(nested_module)
+
+
+ ## Register a nested module for the namespace flame
+
+ nested_module = module.add_cpp_namespace('flame')
+ register_types_ns3_flame(nested_module)
+
+
+ ## Register a nested module for the namespace internal
+
+ nested_module = module.add_cpp_namespace('internal')
+ register_types_ns3_internal(nested_module)
+
+
+ ## Register a nested module for the namespace olsr
+
+ nested_module = module.add_cpp_namespace('olsr')
+ register_types_ns3_olsr(nested_module)
+
+
+def register_types_ns3_Config(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_FatalImpl(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_addressUtils(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_aodv(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_dot11s(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_flame(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_internal(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_olsr(module):
+ root_module = module.get_root()
+
+
+def register_methods(root_module):
+ return
+
+def register_functions(root_module):
+ module = root_module
+ register_functions_ns3_Config(module.get_submodule('Config'), root_module)
+ register_functions_ns3_FatalImpl(module.get_submodule('FatalImpl'), root_module)
+ register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
+ register_functions_ns3_aodv(module.get_submodule('aodv'), root_module)
+ register_functions_ns3_dot11s(module.get_submodule('dot11s'), root_module)
+ register_functions_ns3_flame(module.get_submodule('flame'), root_module)
+ register_functions_ns3_internal(module.get_submodule('internal'), root_module)
+ register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
+ return
+
+def register_functions_ns3_Config(module, root_module):
+ return
+
+def register_functions_ns3_FatalImpl(module, root_module):
+ return
+
+def register_functions_ns3_addressUtils(module, root_module):
+ return
+
+def register_functions_ns3_aodv(module, root_module):
+ return
+
+def register_functions_ns3_dot11s(module, root_module):
+ return
+
+def register_functions_ns3_flame(module, root_module):
+ return
+
+def register_functions_ns3_internal(module, root_module):
+ return
+
+def register_functions_ns3_olsr(module, root_module):
+ return
+
--- a/bindings/python/apidefs/gcc-ILP32/ns3_module_wifi.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-ILP32/ns3_module_wifi.py Tue Dec 21 17:46:35 2010 +0100
@@ -20,7 +20,7 @@
## wifi-mode.h: ns3::WifiCodeRate [enumeration]
module.add_enum('WifiCodeRate', ['WIFI_CODE_RATE_UNDEFINED', 'WIFI_CODE_RATE_3_4', 'WIFI_CODE_RATE_2_3', 'WIFI_CODE_RATE_1_2'])
## edca-txop-n.h: ns3::TypeOfStation [enumeration]
- module.add_enum('TypeOfStation', ['STA', 'AP', 'ADHOC_STA'])
+ module.add_enum('TypeOfStation', ['STA', 'AP', 'ADHOC_STA', 'MESH'])
## block-ack-manager.h: ns3::Bar [struct]
module.add_class('Bar')
## block-ack-agreement.h: ns3::BlockAckAgreement [class]
@@ -135,8 +135,6 @@
module.add_class('AarfWifiManager', parent=root_module['ns3::WifiRemoteStationManager'])
## aarfcd-wifi-manager.h: ns3::AarfcdWifiManager [class]
module.add_class('AarfcdWifiManager', parent=root_module['ns3::WifiRemoteStationManager'])
- ## adhoc-wifi-mac.h: ns3::AdhocWifiMac [class]
- module.add_class('AdhocWifiMac', parent=root_module['ns3::WifiMac'])
## amrr-wifi-manager.h: ns3::AmrrWifiManager [class]
module.add_class('AmrrWifiManager', parent=root_module['ns3::WifiRemoteStationManager'])
## amsdu-subframe-header.h: ns3::AmsduSubframeHeader [class]
@@ -171,18 +169,10 @@
module.add_class('MsduAggregator', parent=root_module['ns3::Object'])
## nist-error-rate-model.h: ns3::NistErrorRateModel [class]
module.add_class('NistErrorRateModel', parent=root_module['ns3::ErrorRateModel'])
- ## nqap-wifi-mac.h: ns3::NqapWifiMac [class]
- module.add_class('NqapWifiMac', parent=root_module['ns3::WifiMac'])
- ## nqsta-wifi-mac.h: ns3::NqstaWifiMac [class]
- module.add_class('NqstaWifiMac', parent=root_module['ns3::WifiMac'])
## onoe-wifi-manager.h: ns3::OnoeWifiManager [class]
module.add_class('OnoeWifiManager', parent=root_module['ns3::WifiRemoteStationManager'])
- ## qadhoc-wifi-mac.h: ns3::QadhocWifiMac [class]
- module.add_class('QadhocWifiMac', parent=root_module['ns3::WifiMac'])
- ## qap-wifi-mac.h: ns3::QapWifiMac [class]
- module.add_class('QapWifiMac', parent=root_module['ns3::WifiMac'])
- ## qsta-wifi-mac.h: ns3::QstaWifiMac [class]
- module.add_class('QstaWifiMac', parent=root_module['ns3::WifiMac'])
+ ## regular-wifi-mac.h: ns3::RegularWifiMac [class]
+ module.add_class('RegularWifiMac', parent=root_module['ns3::WifiMac'])
## rraa-wifi-manager.h: ns3::RraaWifiManager [class]
module.add_class('RraaWifiManager', parent=root_module['ns3::WifiRemoteStationManager'])
## ssid.h: ns3::Ssid [class]
@@ -191,6 +181,8 @@
module.add_class('SsidChecker', parent=root_module['ns3::AttributeChecker'])
## ssid.h: ns3::SsidValue [class]
module.add_class('SsidValue', parent=root_module['ns3::AttributeValue'])
+ ## sta-wifi-mac.h: ns3::StaWifiMac [class]
+ module.add_class('StaWifiMac', parent=root_module['ns3::RegularWifiMac'])
## supported-rates.h: ns3::SupportedRates [class]
module.add_class('SupportedRates', parent=root_module['ns3::WifiInformationElement'])
## wifi-channel.h: ns3::WifiChannel [class]
@@ -205,18 +197,22 @@
module.add_class('YansErrorRateModel', parent=root_module['ns3::ErrorRateModel'])
## yans-wifi-channel.h: ns3::YansWifiChannel [class]
module.add_class('YansWifiChannel', parent=root_module['ns3::WifiChannel'])
+ ## adhoc-wifi-mac.h: ns3::AdhocWifiMac [class]
+ module.add_class('AdhocWifiMac', parent=root_module['ns3::RegularWifiMac'])
+ ## ap-wifi-mac.h: ns3::ApWifiMac [class]
+ module.add_class('ApWifiMac', parent=root_module['ns3::RegularWifiMac'])
## dca-txop.h: ns3::DcaTxop [class]
module.add_class('DcaTxop', parent=root_module['ns3::Dcf'])
module.add_container('ns3::WifiModeList', 'ns3::WifiMode', container_type='vector')
- typehandlers.add_type_alias('__gnu_cxx::__normal_iterator< ns3::WifiMode const *, std::vector< ns3::WifiMode, std::allocator< ns3::WifiMode > > >', 'ns3::WifiModeListIterator')
- typehandlers.add_type_alias('__gnu_cxx::__normal_iterator< ns3::WifiMode const *, std::vector< ns3::WifiMode, std::allocator< ns3::WifiMode > > >*', 'ns3::WifiModeListIterator*')
- typehandlers.add_type_alias('__gnu_cxx::__normal_iterator< ns3::WifiMode const *, std::vector< ns3::WifiMode, std::allocator< ns3::WifiMode > > >&', 'ns3::WifiModeListIterator&')
typehandlers.add_type_alias('std::vector< ns3::WifiMode, std::allocator< ns3::WifiMode > >', 'ns3::WifiModeList')
typehandlers.add_type_alias('std::vector< ns3::WifiMode, std::allocator< ns3::WifiMode > >*', 'ns3::WifiModeList*')
typehandlers.add_type_alias('std::vector< ns3::WifiMode, std::allocator< ns3::WifiMode > >&', 'ns3::WifiModeList&')
typehandlers.add_type_alias('uint8_t', 'ns3::WifiInformationElementId')
typehandlers.add_type_alias('uint8_t*', 'ns3::WifiInformationElementId*')
typehandlers.add_type_alias('uint8_t&', 'ns3::WifiInformationElementId&')
+ typehandlers.add_type_alias('__gnu_cxx::__normal_iterator< ns3::WifiMode const *, std::vector< ns3::WifiMode, std::allocator< ns3::WifiMode > > >', 'ns3::WifiModeListIterator')
+ typehandlers.add_type_alias('__gnu_cxx::__normal_iterator< ns3::WifiMode const *, std::vector< ns3::WifiMode, std::allocator< ns3::WifiMode > > >*', 'ns3::WifiModeListIterator*')
+ typehandlers.add_type_alias('__gnu_cxx::__normal_iterator< ns3::WifiMode const *, std::vector< ns3::WifiMode, std::allocator< ns3::WifiMode > > >&', 'ns3::WifiModeListIterator&')
typehandlers.add_type_alias('std::vector< ns3::RateInfo, std::allocator< ns3::RateInfo > >', 'ns3::MinstrelRate')
typehandlers.add_type_alias('std::vector< ns3::RateInfo, std::allocator< ns3::RateInfo > >*', 'ns3::MinstrelRate*')
typehandlers.add_type_alias('std::vector< ns3::RateInfo, std::allocator< ns3::RateInfo > >&', 'ns3::MinstrelRate&')
@@ -348,7 +344,6 @@
register_Ns3YansWifiPhy_methods(root_module, root_module['ns3::YansWifiPhy'])
register_Ns3AarfWifiManager_methods(root_module, root_module['ns3::AarfWifiManager'])
register_Ns3AarfcdWifiManager_methods(root_module, root_module['ns3::AarfcdWifiManager'])
- register_Ns3AdhocWifiMac_methods(root_module, root_module['ns3::AdhocWifiMac'])
register_Ns3AmrrWifiManager_methods(root_module, root_module['ns3::AmrrWifiManager'])
register_Ns3AmsduSubframeHeader_methods(root_module, root_module['ns3::AmsduSubframeHeader'])
register_Ns3ArfWifiManager_methods(root_module, root_module['ns3::ArfWifiManager'])
@@ -366,16 +361,13 @@
register_Ns3MinstrelWifiManager_methods(root_module, root_module['ns3::MinstrelWifiManager'])
register_Ns3MsduAggregator_methods(root_module, root_module['ns3::MsduAggregator'])
register_Ns3NistErrorRateModel_methods(root_module, root_module['ns3::NistErrorRateModel'])
- register_Ns3NqapWifiMac_methods(root_module, root_module['ns3::NqapWifiMac'])
- register_Ns3NqstaWifiMac_methods(root_module, root_module['ns3::NqstaWifiMac'])
register_Ns3OnoeWifiManager_methods(root_module, root_module['ns3::OnoeWifiManager'])
- register_Ns3QadhocWifiMac_methods(root_module, root_module['ns3::QadhocWifiMac'])
- register_Ns3QapWifiMac_methods(root_module, root_module['ns3::QapWifiMac'])
- register_Ns3QstaWifiMac_methods(root_module, root_module['ns3::QstaWifiMac'])
+ register_Ns3RegularWifiMac_methods(root_module, root_module['ns3::RegularWifiMac'])
register_Ns3RraaWifiManager_methods(root_module, root_module['ns3::RraaWifiManager'])
register_Ns3Ssid_methods(root_module, root_module['ns3::Ssid'])
register_Ns3SsidChecker_methods(root_module, root_module['ns3::SsidChecker'])
register_Ns3SsidValue_methods(root_module, root_module['ns3::SsidValue'])
+ register_Ns3StaWifiMac_methods(root_module, root_module['ns3::StaWifiMac'])
register_Ns3SupportedRates_methods(root_module, root_module['ns3::SupportedRates'])
register_Ns3WifiChannel_methods(root_module, root_module['ns3::WifiChannel'])
register_Ns3WifiModeChecker_methods(root_module, root_module['ns3::WifiModeChecker'])
@@ -383,6 +375,8 @@
register_Ns3WifiNetDevice_methods(root_module, root_module['ns3::WifiNetDevice'])
register_Ns3YansErrorRateModel_methods(root_module, root_module['ns3::YansErrorRateModel'])
register_Ns3YansWifiChannel_methods(root_module, root_module['ns3::YansWifiChannel'])
+ register_Ns3AdhocWifiMac_methods(root_module, root_module['ns3::AdhocWifiMac'])
+ register_Ns3ApWifiMac_methods(root_module, root_module['ns3::ApWifiMac'])
register_Ns3DcaTxop_methods(root_module, root_module['ns3::DcaTxop'])
return
@@ -3799,156 +3793,6 @@
is_const=True, visibility='private', is_virtual=True)
return
-def register_Ns3AdhocWifiMac_methods(root_module, cls):
- ## adhoc-wifi-mac.h: static ns3::TypeId ns3::AdhocWifiMac::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
- ## adhoc-wifi-mac.h: ns3::AdhocWifiMac::AdhocWifiMac() [constructor]
- cls.add_constructor([])
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetSlot(ns3::Time slotTime) [member function]
- cls.add_method('SetSlot',
- 'void',
- [param('ns3::Time', 'slotTime')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetSifs(ns3::Time sifs) [member function]
- cls.add_method('SetSifs',
- 'void',
- [param('ns3::Time', 'sifs')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetEifsNoDifs(ns3::Time eifsNoDifs) [member function]
- cls.add_method('SetEifsNoDifs',
- 'void',
- [param('ns3::Time', 'eifsNoDifs')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetAckTimeout(ns3::Time ackTimeout) [member function]
- cls.add_method('SetAckTimeout',
- 'void',
- [param('ns3::Time', 'ackTimeout')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetCtsTimeout(ns3::Time ctsTimeout) [member function]
- cls.add_method('SetCtsTimeout',
- 'void',
- [param('ns3::Time', 'ctsTimeout')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetPifs(ns3::Time pifs) [member function]
- cls.add_method('SetPifs',
- 'void',
- [param('ns3::Time', 'pifs')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: ns3::Time ns3::AdhocWifiMac::GetSlot() const [member function]
- cls.add_method('GetSlot',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## adhoc-wifi-mac.h: ns3::Time ns3::AdhocWifiMac::GetSifs() const [member function]
- cls.add_method('GetSifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## adhoc-wifi-mac.h: ns3::Time ns3::AdhocWifiMac::GetEifsNoDifs() const [member function]
- cls.add_method('GetEifsNoDifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## adhoc-wifi-mac.h: ns3::Time ns3::AdhocWifiMac::GetAckTimeout() const [member function]
- cls.add_method('GetAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## adhoc-wifi-mac.h: ns3::Time ns3::AdhocWifiMac::GetCtsTimeout() const [member function]
- cls.add_method('GetCtsTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## adhoc-wifi-mac.h: ns3::Time ns3::AdhocWifiMac::GetPifs() const [member function]
- cls.add_method('GetPifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetWifiPhy(ns3::Ptr<ns3::WifiPhy> phy) [member function]
- cls.add_method('SetWifiPhy',
- 'void',
- [param('ns3::Ptr< ns3::WifiPhy >', 'phy')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetWifiRemoteStationManager(ns3::Ptr<ns3::WifiRemoteStationManager> stationManager) [member function]
- cls.add_method('SetWifiRemoteStationManager',
- 'void',
- [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: bool ns3::AdhocWifiMac::SupportsSendFrom() const [member function]
- cls.add_method('SupportsSendFrom',
- 'bool',
- [],
- is_const=True, is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetForwardUpCallback(ns3::Callback<void, ns3::Ptr<ns3::Packet>, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> upCallback) [member function]
- cls.add_method('SetForwardUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'upCallback')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
- cls.add_method('SetLinkUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetLinkDownCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkDown) [member function]
- cls.add_method('SetLinkDownCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkDown')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: ns3::Mac48Address ns3::AdhocWifiMac::GetAddress() const [member function]
- cls.add_method('GetAddress',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## adhoc-wifi-mac.h: ns3::Ssid ns3::AdhocWifiMac::GetSsid() const [member function]
- cls.add_method('GetSsid',
- 'ns3::Ssid',
- [],
- is_const=True, is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetAddress(ns3::Mac48Address address) [member function]
- cls.add_method('SetAddress',
- 'void',
- [param('ns3::Mac48Address', 'address')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetSsid(ns3::Ssid ssid) [member function]
- cls.add_method('SetSsid',
- 'void',
- [param('ns3::Ssid', 'ssid')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: ns3::Mac48Address ns3::AdhocWifiMac::GetBssid() const [member function]
- cls.add_method('GetBssid',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::DoDispose() [member function]
- cls.add_method('DoDispose',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::DoStart() [member function]
- cls.add_method('DoStart',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::FinishConfigureStandard(ns3::WifiPhyStandard standard) [member function]
- cls.add_method('FinishConfigureStandard',
- 'void',
- [param('ns3::WifiPhyStandard', 'standard')],
- visibility='private', is_virtual=True)
- return
-
def register_Ns3AmrrWifiManager_methods(root_module, cls):
## amrr-wifi-manager.h: ns3::AmrrWifiManager::AmrrWifiManager(ns3::AmrrWifiManager const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AmrrWifiManager const &', 'arg0')])
@@ -5181,335 +5025,6 @@
is_static=True)
return
-def register_Ns3NqapWifiMac_methods(root_module, cls):
- ## nqap-wifi-mac.h: static ns3::TypeId ns3::NqapWifiMac::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
- ## nqap-wifi-mac.h: ns3::NqapWifiMac::NqapWifiMac() [constructor]
- cls.add_constructor([])
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetSlot(ns3::Time slotTime) [member function]
- cls.add_method('SetSlot',
- 'void',
- [param('ns3::Time', 'slotTime')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetSifs(ns3::Time sifs) [member function]
- cls.add_method('SetSifs',
- 'void',
- [param('ns3::Time', 'sifs')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetEifsNoDifs(ns3::Time eifsNoDifs) [member function]
- cls.add_method('SetEifsNoDifs',
- 'void',
- [param('ns3::Time', 'eifsNoDifs')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetAckTimeout(ns3::Time ackTimeout) [member function]
- cls.add_method('SetAckTimeout',
- 'void',
- [param('ns3::Time', 'ackTimeout')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetCtsTimeout(ns3::Time ctsTimeout) [member function]
- cls.add_method('SetCtsTimeout',
- 'void',
- [param('ns3::Time', 'ctsTimeout')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetPifs(ns3::Time pifs) [member function]
- cls.add_method('SetPifs',
- 'void',
- [param('ns3::Time', 'pifs')],
- is_virtual=True)
- ## nqap-wifi-mac.h: ns3::Time ns3::NqapWifiMac::GetSlot() const [member function]
- cls.add_method('GetSlot',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqap-wifi-mac.h: ns3::Time ns3::NqapWifiMac::GetSifs() const [member function]
- cls.add_method('GetSifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqap-wifi-mac.h: ns3::Time ns3::NqapWifiMac::GetEifsNoDifs() const [member function]
- cls.add_method('GetEifsNoDifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqap-wifi-mac.h: ns3::Time ns3::NqapWifiMac::GetAckTimeout() const [member function]
- cls.add_method('GetAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqap-wifi-mac.h: ns3::Time ns3::NqapWifiMac::GetCtsTimeout() const [member function]
- cls.add_method('GetCtsTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqap-wifi-mac.h: ns3::Time ns3::NqapWifiMac::GetPifs() const [member function]
- cls.add_method('GetPifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetWifiPhy(ns3::Ptr<ns3::WifiPhy> phy) [member function]
- cls.add_method('SetWifiPhy',
- 'void',
- [param('ns3::Ptr< ns3::WifiPhy >', 'phy')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetWifiRemoteStationManager(ns3::Ptr<ns3::WifiRemoteStationManager> stationManager) [member function]
- cls.add_method('SetWifiRemoteStationManager',
- 'void',
- [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
- is_virtual=True)
- ## nqap-wifi-mac.h: bool ns3::NqapWifiMac::SupportsSendFrom() const [member function]
- cls.add_method('SupportsSendFrom',
- 'bool',
- [],
- is_const=True, is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetForwardUpCallback(ns3::Callback<void, ns3::Ptr<ns3::Packet>, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> upCallback) [member function]
- cls.add_method('SetForwardUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'upCallback')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
- cls.add_method('SetLinkUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetLinkDownCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkDown) [member function]
- cls.add_method('SetLinkDownCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkDown')],
- is_virtual=True)
- ## nqap-wifi-mac.h: ns3::Mac48Address ns3::NqapWifiMac::GetAddress() const [member function]
- cls.add_method('GetAddress',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## nqap-wifi-mac.h: ns3::Ssid ns3::NqapWifiMac::GetSsid() const [member function]
- cls.add_method('GetSsid',
- 'ns3::Ssid',
- [],
- is_const=True, is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetAddress(ns3::Mac48Address address) [member function]
- cls.add_method('SetAddress',
- 'void',
- [param('ns3::Mac48Address', 'address')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetSsid(ns3::Ssid ssid) [member function]
- cls.add_method('SetSsid',
- 'void',
- [param('ns3::Ssid', 'ssid')],
- is_virtual=True)
- ## nqap-wifi-mac.h: ns3::Mac48Address ns3::NqapWifiMac::GetBssid() const [member function]
- cls.add_method('GetBssid',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetBeaconInterval(ns3::Time interval) [member function]
- cls.add_method('SetBeaconInterval',
- 'void',
- [param('ns3::Time', 'interval')])
- ## nqap-wifi-mac.h: ns3::Time ns3::NqapWifiMac::GetBeaconInterval() const [member function]
- cls.add_method('GetBeaconInterval',
- 'ns3::Time',
- [],
- is_const=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::StartBeaconing() [member function]
- cls.add_method('StartBeaconing',
- 'void',
- [])
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::DoDispose() [member function]
- cls.add_method('DoDispose',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::DoStart() [member function]
- cls.add_method('DoStart',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::FinishConfigureStandard(ns3::WifiPhyStandard standard) [member function]
- cls.add_method('FinishConfigureStandard',
- 'void',
- [param('ns3::WifiPhyStandard', 'standard')],
- visibility='private', is_virtual=True)
- return
-
-def register_Ns3NqstaWifiMac_methods(root_module, cls):
- ## nqsta-wifi-mac.h: static ns3::TypeId ns3::NqstaWifiMac::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
- ## nqsta-wifi-mac.h: ns3::NqstaWifiMac::NqstaWifiMac() [constructor]
- cls.add_constructor([])
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetSlot(ns3::Time slotTime) [member function]
- cls.add_method('SetSlot',
- 'void',
- [param('ns3::Time', 'slotTime')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetSifs(ns3::Time sifs) [member function]
- cls.add_method('SetSifs',
- 'void',
- [param('ns3::Time', 'sifs')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetEifsNoDifs(ns3::Time eifsNoDifs) [member function]
- cls.add_method('SetEifsNoDifs',
- 'void',
- [param('ns3::Time', 'eifsNoDifs')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetAckTimeout(ns3::Time ackTimeout) [member function]
- cls.add_method('SetAckTimeout',
- 'void',
- [param('ns3::Time', 'ackTimeout')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetCtsTimeout(ns3::Time ctsTimeout) [member function]
- cls.add_method('SetCtsTimeout',
- 'void',
- [param('ns3::Time', 'ctsTimeout')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetPifs(ns3::Time pifs) [member function]
- cls.add_method('SetPifs',
- 'void',
- [param('ns3::Time', 'pifs')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: ns3::Time ns3::NqstaWifiMac::GetSlot() const [member function]
- cls.add_method('GetSlot',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqsta-wifi-mac.h: ns3::Time ns3::NqstaWifiMac::GetSifs() const [member function]
- cls.add_method('GetSifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqsta-wifi-mac.h: ns3::Time ns3::NqstaWifiMac::GetEifsNoDifs() const [member function]
- cls.add_method('GetEifsNoDifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqsta-wifi-mac.h: ns3::Time ns3::NqstaWifiMac::GetAckTimeout() const [member function]
- cls.add_method('GetAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqsta-wifi-mac.h: ns3::Time ns3::NqstaWifiMac::GetCtsTimeout() const [member function]
- cls.add_method('GetCtsTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqsta-wifi-mac.h: ns3::Time ns3::NqstaWifiMac::GetPifs() const [member function]
- cls.add_method('GetPifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetWifiPhy(ns3::Ptr<ns3::WifiPhy> phy) [member function]
- cls.add_method('SetWifiPhy',
- 'void',
- [param('ns3::Ptr< ns3::WifiPhy >', 'phy')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetWifiRemoteStationManager(ns3::Ptr<ns3::WifiRemoteStationManager> stationManager) [member function]
- cls.add_method('SetWifiRemoteStationManager',
- 'void',
- [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: bool ns3::NqstaWifiMac::SupportsSendFrom() const [member function]
- cls.add_method('SupportsSendFrom',
- 'bool',
- [],
- is_const=True, is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetForwardUpCallback(ns3::Callback<void, ns3::Ptr<ns3::Packet>, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> upCallback) [member function]
- cls.add_method('SetForwardUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'upCallback')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
- cls.add_method('SetLinkUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetLinkDownCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkDown) [member function]
- cls.add_method('SetLinkDownCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkDown')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: ns3::Mac48Address ns3::NqstaWifiMac::GetAddress() const [member function]
- cls.add_method('GetAddress',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## nqsta-wifi-mac.h: ns3::Ssid ns3::NqstaWifiMac::GetSsid() const [member function]
- cls.add_method('GetSsid',
- 'ns3::Ssid',
- [],
- is_const=True, is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetAddress(ns3::Mac48Address address) [member function]
- cls.add_method('SetAddress',
- 'void',
- [param('ns3::Mac48Address', 'address')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetSsid(ns3::Ssid ssid) [member function]
- cls.add_method('SetSsid',
- 'void',
- [param('ns3::Ssid', 'ssid')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: ns3::Mac48Address ns3::NqstaWifiMac::GetBssid() const [member function]
- cls.add_method('GetBssid',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetMaxMissedBeacons(uint32_t missed) [member function]
- cls.add_method('SetMaxMissedBeacons',
- 'void',
- [param('uint32_t', 'missed')])
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetProbeRequestTimeout(ns3::Time timeout) [member function]
- cls.add_method('SetProbeRequestTimeout',
- 'void',
- [param('ns3::Time', 'timeout')])
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetAssocRequestTimeout(ns3::Time timeout) [member function]
- cls.add_method('SetAssocRequestTimeout',
- 'void',
- [param('ns3::Time', 'timeout')])
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::StartActiveAssociation() [member function]
- cls.add_method('StartActiveAssociation',
- 'void',
- [])
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::DoStart() [member function]
- cls.add_method('DoStart',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::DoDispose() [member function]
- cls.add_method('DoDispose',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::FinishConfigureStandard(ns3::WifiPhyStandard standard) [member function]
- cls.add_method('FinishConfigureStandard',
- 'void',
- [param('ns3::WifiPhyStandard', 'standard')],
- visibility='private', is_virtual=True)
- return
-
def register_Ns3OnoeWifiManager_methods(root_module, cls):
## onoe-wifi-manager.h: ns3::OnoeWifiManager::OnoeWifiManager(ns3::OnoeWifiManager const & arg0) [copy constructor]
cls.add_constructor([param('ns3::OnoeWifiManager const &', 'arg0')])
@@ -5577,543 +5092,236 @@
is_const=True, visibility='private', is_virtual=True)
return
-def register_Ns3QadhocWifiMac_methods(root_module, cls):
- ## qadhoc-wifi-mac.h: static ns3::TypeId ns3::QadhocWifiMac::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
- ## qadhoc-wifi-mac.h: ns3::QadhocWifiMac::QadhocWifiMac() [constructor]
+def register_Ns3RegularWifiMac_methods(root_module, cls):
+ ## regular-wifi-mac.h: ns3::RegularWifiMac::RegularWifiMac(ns3::RegularWifiMac const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::RegularWifiMac const &', 'arg0')])
+ ## regular-wifi-mac.h: ns3::RegularWifiMac::RegularWifiMac() [constructor]
cls.add_constructor([])
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetSlot(ns3::Time slotTime) [member function]
- cls.add_method('SetSlot',
- 'void',
- [param('ns3::Time', 'slotTime')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetSifs(ns3::Time sifs) [member function]
- cls.add_method('SetSifs',
- 'void',
- [param('ns3::Time', 'sifs')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetEifsNoDifs(ns3::Time eifsNoDifs) [member function]
- cls.add_method('SetEifsNoDifs',
- 'void',
- [param('ns3::Time', 'eifsNoDifs')],
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
+ cls.add_method('Enqueue',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')],
is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetAckTimeout(ns3::Time ackTimeout) [member function]
- cls.add_method('SetAckTimeout',
- 'void',
- [param('ns3::Time', 'ackTimeout')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetCtsTimeout(ns3::Time ctsTimeout) [member function]
- cls.add_method('SetCtsTimeout',
- 'void',
- [param('ns3::Time', 'ctsTimeout')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetPifs(ns3::Time pifs) [member function]
- cls.add_method('SetPifs',
- 'void',
- [param('ns3::Time', 'pifs')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetSlot() const [member function]
- cls.add_method('GetSlot',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetSifs() const [member function]
- cls.add_method('GetSifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetEifsNoDifs() const [member function]
- cls.add_method('GetEifsNoDifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetAckTimeout() const [member function]
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
+ cls.add_method('Enqueue',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
+ is_pure_virtual=True, is_virtual=True)
+ ## regular-wifi-mac.h: ns3::Time ns3::RegularWifiMac::GetAckTimeout() const [member function]
cls.add_method('GetAckTimeout',
'ns3::Time',
[],
is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetCtsTimeout() const [member function]
+ ## regular-wifi-mac.h: ns3::Mac48Address ns3::RegularWifiMac::GetAddress() const [member function]
+ cls.add_method('GetAddress',
+ 'ns3::Mac48Address',
+ [],
+ is_const=True, is_virtual=True)
+ ## regular-wifi-mac.h: ns3::Time ns3::RegularWifiMac::GetBasicBlockAckTimeout() const [member function]
+ cls.add_method('GetBasicBlockAckTimeout',
+ 'ns3::Time',
+ [],
+ is_const=True, is_virtual=True)
+ ## regular-wifi-mac.h: ns3::Mac48Address ns3::RegularWifiMac::GetBssid() const [member function]
+ cls.add_method('GetBssid',
+ 'ns3::Mac48Address',
+ [],
+ is_const=True, is_virtual=True)
+ ## regular-wifi-mac.h: ns3::Time ns3::RegularWifiMac::GetCompressedBlockAckTimeout() const [member function]
+ cls.add_method('GetCompressedBlockAckTimeout',
+ 'ns3::Time',
+ [],
+ is_const=True, is_virtual=True)
+ ## regular-wifi-mac.h: ns3::Time ns3::RegularWifiMac::GetCtsTimeout() const [member function]
cls.add_method('GetCtsTimeout',
'ns3::Time',
[],
is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetPifs() const [member function]
+ ## regular-wifi-mac.h: ns3::Time ns3::RegularWifiMac::GetEifsNoDifs() const [member function]
+ cls.add_method('GetEifsNoDifs',
+ 'ns3::Time',
+ [],
+ is_const=True, is_virtual=True)
+ ## regular-wifi-mac.h: ns3::Time ns3::RegularWifiMac::GetPifs() const [member function]
cls.add_method('GetPifs',
'ns3::Time',
[],
is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetWifiPhy(ns3::Ptr<ns3::WifiPhy> phy) [member function]
- cls.add_method('SetWifiPhy',
- 'void',
- [param('ns3::Ptr< ns3::WifiPhy >', 'phy')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetWifiRemoteStationManager(ns3::Ptr<ns3::WifiRemoteStationManager> stationManager) [member function]
- cls.add_method('SetWifiRemoteStationManager',
- 'void',
- [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: bool ns3::QadhocWifiMac::SupportsSendFrom() const [member function]
- cls.add_method('SupportsSendFrom',
- 'bool',
+ ## regular-wifi-mac.h: ns3::Time ns3::RegularWifiMac::GetSifs() const [member function]
+ cls.add_method('GetSifs',
+ 'ns3::Time',
[],
is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetForwardUpCallback(ns3::Callback<void, ns3::Ptr<ns3::Packet>, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> upCallback) [member function]
- cls.add_method('SetForwardUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'upCallback')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
- cls.add_method('SetLinkUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetLinkDownCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkDown) [member function]
- cls.add_method('SetLinkDownCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkDown')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Mac48Address ns3::QadhocWifiMac::GetAddress() const [member function]
- cls.add_method('GetAddress',
- 'ns3::Mac48Address',
+ ## regular-wifi-mac.h: ns3::Time ns3::RegularWifiMac::GetSlot() const [member function]
+ cls.add_method('GetSlot',
+ 'ns3::Time',
[],
is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Ssid ns3::QadhocWifiMac::GetSsid() const [member function]
+ ## regular-wifi-mac.h: ns3::Ssid ns3::RegularWifiMac::GetSsid() const [member function]
cls.add_method('GetSsid',
'ns3::Ssid',
[],
is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetAddress(ns3::Mac48Address address) [member function]
+ ## regular-wifi-mac.h: static ns3::TypeId ns3::RegularWifiMac::GetTypeId() [member function]
+ cls.add_method('GetTypeId',
+ 'ns3::TypeId',
+ [],
+ is_static=True)
+ ## regular-wifi-mac.h: ns3::Ptr<ns3::WifiPhy> ns3::RegularWifiMac::GetWifiPhy() const [member function]
+ cls.add_method('GetWifiPhy',
+ 'ns3::Ptr< ns3::WifiPhy >',
+ [],
+ is_const=True, is_virtual=True)
+ ## regular-wifi-mac.h: ns3::Ptr<ns3::WifiRemoteStationManager> ns3::RegularWifiMac::GetWifiRemoteStationManager() const [member function]
+ cls.add_method('GetWifiRemoteStationManager',
+ 'ns3::Ptr< ns3::WifiRemoteStationManager >',
+ [],
+ is_const=True, is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetAckTimeout(ns3::Time ackTimeout) [member function]
+ cls.add_method('SetAckTimeout',
+ 'void',
+ [param('ns3::Time', 'ackTimeout')],
+ is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetAddress(ns3::Mac48Address address) [member function]
cls.add_method('SetAddress',
'void',
[param('ns3::Mac48Address', 'address')],
is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetSsid(ns3::Ssid ssid) [member function]
- cls.add_method('SetSsid',
- 'void',
- [param('ns3::Ssid', 'ssid')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Mac48Address ns3::QadhocWifiMac::GetBssid() const [member function]
- cls.add_method('GetBssid',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetBasicBlockAckTimeout(ns3::Time blockAckTimeout) [member function]
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetBasicBlockAckTimeout(ns3::Time blockAckTimeout) [member function]
cls.add_method('SetBasicBlockAckTimeout',
'void',
[param('ns3::Time', 'blockAckTimeout')],
is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetCompressedBlockAckTimeout(ns3::Time blockAckTimeout) [member function]
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetBssid(ns3::Mac48Address bssid) [member function]
+ cls.add_method('SetBssid',
+ 'void',
+ [param('ns3::Mac48Address', 'bssid')],
+ is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetCompressedBlockAckTimeout(ns3::Time blockAckTimeout) [member function]
cls.add_method('SetCompressedBlockAckTimeout',
'void',
[param('ns3::Time', 'blockAckTimeout')],
is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetBasicBlockAckTimeout() const [member function]
- cls.add_method('GetBasicBlockAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetCompressedBlockAckTimeout() const [member function]
- cls.add_method('GetCompressedBlockAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::DoDispose() [member function]
- cls.add_method('DoDispose',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::DoStart() [member function]
- cls.add_method('DoStart',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::FinishConfigureStandard(ns3::WifiPhyStandard standard) [member function]
- cls.add_method('FinishConfigureStandard',
- 'void',
- [param('ns3::WifiPhyStandard', 'standard')],
- visibility='private', is_virtual=True)
- return
-
-def register_Ns3QapWifiMac_methods(root_module, cls):
- ## qap-wifi-mac.h: static ns3::TypeId ns3::QapWifiMac::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
- ## qap-wifi-mac.h: ns3::QapWifiMac::QapWifiMac() [constructor]
- cls.add_constructor([])
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetSlot(ns3::Time slotTime) [member function]
- cls.add_method('SetSlot',
- 'void',
- [param('ns3::Time', 'slotTime')],
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetCtsTimeout(ns3::Time ctsTimeout) [member function]
+ cls.add_method('SetCtsTimeout',
+ 'void',
+ [param('ns3::Time', 'ctsTimeout')],
is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetSifs(ns3::Time sifs) [member function]
- cls.add_method('SetSifs',
- 'void',
- [param('ns3::Time', 'sifs')],
- is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetEifsNoDifs(ns3::Time eifsNoDifs) [member function]
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetEifsNoDifs(ns3::Time eifsNoDifs) [member function]
cls.add_method('SetEifsNoDifs',
'void',
[param('ns3::Time', 'eifsNoDifs')],
is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetAckTimeout(ns3::Time ackTimeout) [member function]
- cls.add_method('SetAckTimeout',
- 'void',
- [param('ns3::Time', 'ackTimeout')],
- is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetCtsTimeout(ns3::Time ctsTimeout) [member function]
- cls.add_method('SetCtsTimeout',
- 'void',
- [param('ns3::Time', 'ctsTimeout')],
- is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetPifs(ns3::Time pifs) [member function]
- cls.add_method('SetPifs',
- 'void',
- [param('ns3::Time', 'pifs')],
- is_virtual=True)
- ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetSlot() const [member function]
- cls.add_method('GetSlot',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetSifs() const [member function]
- cls.add_method('GetSifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetEifsNoDifs() const [member function]
- cls.add_method('GetEifsNoDifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetAckTimeout() const [member function]
- cls.add_method('GetAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetCtsTimeout() const [member function]
- cls.add_method('GetCtsTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetPifs() const [member function]
- cls.add_method('GetPifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetWifiPhy(ns3::Ptr<ns3::WifiPhy> phy) [member function]
- cls.add_method('SetWifiPhy',
- 'void',
- [param('ns3::Ptr< ns3::WifiPhy >', 'phy')],
- is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetWifiRemoteStationManager(ns3::Ptr<ns3::WifiRemoteStationManager> stationManager) [member function]
- cls.add_method('SetWifiRemoteStationManager',
- 'void',
- [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')],
- is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')],
- is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
- is_virtual=True)
- ## qap-wifi-mac.h: bool ns3::QapWifiMac::SupportsSendFrom() const [member function]
- cls.add_method('SupportsSendFrom',
- 'bool',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetForwardUpCallback(ns3::Callback<void, ns3::Ptr<ns3::Packet>, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> upCallback) [member function]
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetForwardUpCallback(ns3::Callback<void, ns3::Ptr<ns3::Packet>, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> upCallback) [member function]
cls.add_method('SetForwardUpCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'upCallback')],
is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
- cls.add_method('SetLinkUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
- is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetLinkDownCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkDown) [member function]
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetLinkDownCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkDown) [member function]
cls.add_method('SetLinkDownCallback',
'void',
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkDown')],
is_virtual=True)
- ## qap-wifi-mac.h: ns3::Mac48Address ns3::QapWifiMac::GetAddress() const [member function]
- cls.add_method('GetAddress',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: ns3::Ssid ns3::QapWifiMac::GetSsid() const [member function]
- cls.add_method('GetSsid',
- 'ns3::Ssid',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetAddress(ns3::Mac48Address address) [member function]
- cls.add_method('SetAddress',
- 'void',
- [param('ns3::Mac48Address', 'address')],
- is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetSsid(ns3::Ssid ssid) [member function]
- cls.add_method('SetSsid',
- 'void',
- [param('ns3::Ssid', 'ssid')],
- is_virtual=True)
- ## qap-wifi-mac.h: ns3::Mac48Address ns3::QapWifiMac::GetBssid() const [member function]
- cls.add_method('GetBssid',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetBasicBlockAckTimeout(ns3::Time blockAckTimeout) [member function]
- cls.add_method('SetBasicBlockAckTimeout',
- 'void',
- [param('ns3::Time', 'blockAckTimeout')],
- is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetCompressedBlockAckTimeout(ns3::Time blockAckTimeout) [member function]
- cls.add_method('SetCompressedBlockAckTimeout',
- 'void',
- [param('ns3::Time', 'blockAckTimeout')],
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
+ cls.add_method('SetLinkUpCallback',
+ 'void',
+ [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
is_virtual=True)
- ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetBasicBlockAckTimeout() const [member function]
- cls.add_method('GetBasicBlockAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetCompressedBlockAckTimeout() const [member function]
- cls.add_method('GetCompressedBlockAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetBeaconInterval(ns3::Time interval) [member function]
- cls.add_method('SetBeaconInterval',
- 'void',
- [param('ns3::Time', 'interval')])
- ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetBeaconInterval() const [member function]
- cls.add_method('GetBeaconInterval',
- 'ns3::Time',
- [],
- is_const=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::StartBeaconing() [member function]
- cls.add_method('StartBeaconing',
- 'void',
- [])
- ## qap-wifi-mac.h: void ns3::QapWifiMac::DoDispose() [member function]
- cls.add_method('DoDispose',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::DoStart() [member function]
- cls.add_method('DoStart',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::FinishConfigureStandard(ns3::WifiPhyStandard standard) [member function]
- cls.add_method('FinishConfigureStandard',
- 'void',
- [param('ns3::WifiPhyStandard', 'standard')],
- visibility='private', is_virtual=True)
- return
-
-def register_Ns3QstaWifiMac_methods(root_module, cls):
- ## qsta-wifi-mac.h: static ns3::TypeId ns3::QstaWifiMac::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
- ## qsta-wifi-mac.h: ns3::QstaWifiMac::QstaWifiMac() [constructor]
- cls.add_constructor([])
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetSlot(ns3::Time slotTime) [member function]
- cls.add_method('SetSlot',
- 'void',
- [param('ns3::Time', 'slotTime')],
- is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetSifs(ns3::Time sifs) [member function]
- cls.add_method('SetSifs',
- 'void',
- [param('ns3::Time', 'sifs')],
- is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetEifsNoDifs(ns3::Time eifsNoDifs) [member function]
- cls.add_method('SetEifsNoDifs',
- 'void',
- [param('ns3::Time', 'eifsNoDifs')],
- is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetAckTimeout(ns3::Time ackTimeout) [member function]
- cls.add_method('SetAckTimeout',
- 'void',
- [param('ns3::Time', 'ackTimeout')],
- is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetCtsTimeout(ns3::Time ctsTimeout) [member function]
- cls.add_method('SetCtsTimeout',
- 'void',
- [param('ns3::Time', 'ctsTimeout')],
- is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetPifs(ns3::Time pifs) [member function]
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetPifs(ns3::Time pifs) [member function]
cls.add_method('SetPifs',
'void',
[param('ns3::Time', 'pifs')],
is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetSlot() const [member function]
- cls.add_method('GetSlot',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetSifs() const [member function]
- cls.add_method('GetSifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetEifsNoDifs() const [member function]
- cls.add_method('GetEifsNoDifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetAckTimeout() const [member function]
- cls.add_method('GetAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetCtsTimeout() const [member function]
- cls.add_method('GetCtsTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetPifs() const [member function]
- cls.add_method('GetPifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetWifiPhy(ns3::Ptr<ns3::WifiPhy> phy) [member function]
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetSifs(ns3::Time sifs) [member function]
+ cls.add_method('SetSifs',
+ 'void',
+ [param('ns3::Time', 'sifs')],
+ is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetSlot(ns3::Time slotTime) [member function]
+ cls.add_method('SetSlot',
+ 'void',
+ [param('ns3::Time', 'slotTime')],
+ is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetSsid(ns3::Ssid ssid) [member function]
+ cls.add_method('SetSsid',
+ 'void',
+ [param('ns3::Ssid', 'ssid')],
+ is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetWifiPhy(ns3::Ptr<ns3::WifiPhy> phy) [member function]
cls.add_method('SetWifiPhy',
'void',
[param('ns3::Ptr< ns3::WifiPhy >', 'phy')],
is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetWifiRemoteStationManager(ns3::Ptr<ns3::WifiRemoteStationManager> stationManager) [member function]
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetWifiRemoteStationManager(ns3::Ptr<ns3::WifiRemoteStationManager> stationManager) [member function]
cls.add_method('SetWifiRemoteStationManager',
'void',
[param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')],
is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')],
- is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
- is_virtual=True)
- ## qsta-wifi-mac.h: bool ns3::QstaWifiMac::SupportsSendFrom() const [member function]
+ ## regular-wifi-mac.h: bool ns3::RegularWifiMac::SupportsSendFrom() const [member function]
cls.add_method('SupportsSendFrom',
'bool',
[],
is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetForwardUpCallback(ns3::Callback<void, ns3::Ptr<ns3::Packet>, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> upCallback) [member function]
- cls.add_method('SetForwardUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'upCallback')],
- is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
- cls.add_method('SetLinkUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
- is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetLinkDownCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkDown) [member function]
- cls.add_method('SetLinkDownCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkDown')],
- is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Mac48Address ns3::QstaWifiMac::GetAddress() const [member function]
- cls.add_method('GetAddress',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Ssid ns3::QstaWifiMac::GetSsid() const [member function]
- cls.add_method('GetSsid',
- 'ns3::Ssid',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetAddress(ns3::Mac48Address address) [member function]
- cls.add_method('SetAddress',
- 'void',
- [param('ns3::Mac48Address', 'address')],
- is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetSsid(ns3::Ssid ssid) [member function]
- cls.add_method('SetSsid',
- 'void',
- [param('ns3::Ssid', 'ssid')],
- is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Mac48Address ns3::QstaWifiMac::GetBssid() const [member function]
- cls.add_method('GetBssid',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetBasicBlockAckTimeout(ns3::Time blockAckTimeout) [member function]
- cls.add_method('SetBasicBlockAckTimeout',
- 'void',
- [param('ns3::Time', 'blockAckTimeout')],
- is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetCompressedBlockAckTimeout(ns3::Time blockAckTimeout) [member function]
- cls.add_method('SetCompressedBlockAckTimeout',
- 'void',
- [param('ns3::Time', 'blockAckTimeout')],
- is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetBasicBlockAckTimeout() const [member function]
- cls.add_method('GetBasicBlockAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetCompressedBlockAckTimeout() const [member function]
- cls.add_method('GetCompressedBlockAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetMaxMissedBeacons(uint32_t missed) [member function]
- cls.add_method('SetMaxMissedBeacons',
- 'void',
- [param('uint32_t', 'missed')])
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetProbeRequestTimeout(ns3::Time timeout) [member function]
- cls.add_method('SetProbeRequestTimeout',
- 'void',
- [param('ns3::Time', 'timeout')])
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetAssocRequestTimeout(ns3::Time timeout) [member function]
- cls.add_method('SetAssocRequestTimeout',
- 'void',
- [param('ns3::Time', 'timeout')])
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::StartActiveAssociation() [member function]
- cls.add_method('StartActiveAssociation',
- 'void',
- [])
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::DoStart() [member function]
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::DeaggregateAmsduAndForward(ns3::Ptr<ns3::Packet> aggregatedPacket, ns3::WifiMacHeader const * hdr) [member function]
+ cls.add_method('DeaggregateAmsduAndForward',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'aggregatedPacket'), param('ns3::WifiMacHeader const *', 'hdr')],
+ visibility='protected', is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::DoDispose() [member function]
+ cls.add_method('DoDispose',
+ 'void',
+ [],
+ visibility='protected', is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::DoStart() [member function]
cls.add_method('DoStart',
'void',
[],
- visibility='private', is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::DoDispose() [member function]
- cls.add_method('DoDispose',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::FinishConfigureStandard(ns3::WifiPhyStandard standard) [member function]
+ visibility='protected', is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::FinishConfigureStandard(ns3::WifiPhyStandard standard) [member function]
cls.add_method('FinishConfigureStandard',
'void',
[param('ns3::WifiPhyStandard', 'standard')],
- visibility='private', is_virtual=True)
+ visibility='protected', is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::ForwardUp(ns3::Ptr<ns3::Packet> packet, ns3::Mac48Address from, ns3::Mac48Address to) [member function]
+ cls.add_method('ForwardUp',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Mac48Address', 'from'), param('ns3::Mac48Address', 'to')],
+ visibility='protected')
+ ## regular-wifi-mac.h: bool ns3::RegularWifiMac::GetQosSupported() const [member function]
+ cls.add_method('GetQosSupported',
+ 'bool',
+ [],
+ is_const=True, visibility='protected')
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::Receive(ns3::Ptr<ns3::Packet> packet, ns3::WifiMacHeader const * hdr) [member function]
+ cls.add_method('Receive',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::WifiMacHeader const *', 'hdr')],
+ visibility='protected', is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SendAddBaResponse(ns3::MgtAddBaRequestHeader const * reqHdr, ns3::Mac48Address originator) [member function]
+ cls.add_method('SendAddBaResponse',
+ 'void',
+ [param('ns3::MgtAddBaRequestHeader const *', 'reqHdr'), param('ns3::Mac48Address', 'originator')],
+ visibility='protected', is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetQosSupported(bool enable) [member function]
+ cls.add_method('SetQosSupported',
+ 'void',
+ [param('bool', 'enable')],
+ visibility='protected')
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetTypeOfStation(ns3::TypeOfStation type) [member function]
+ cls.add_method('SetTypeOfStation',
+ 'void',
+ [param('ns3::TypeOfStation', 'type')],
+ visibility='protected')
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::TxFailed(ns3::WifiMacHeader const & hdr) [member function]
+ cls.add_method('TxFailed',
+ 'void',
+ [param('ns3::WifiMacHeader const &', 'hdr')],
+ visibility='protected', is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::TxOk(ns3::WifiMacHeader const & hdr) [member function]
+ cls.add_method('TxOk',
+ 'void',
+ [param('ns3::WifiMacHeader const &', 'hdr')],
+ visibility='protected', is_virtual=True)
return
def register_Ns3RraaWifiManager_methods(root_module, cls):
@@ -6275,6 +5483,44 @@
[param('ns3::Ssid const &', 'value')])
return
+def register_Ns3StaWifiMac_methods(root_module, cls):
+ ## sta-wifi-mac.h: ns3::StaWifiMac::StaWifiMac(ns3::StaWifiMac const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::StaWifiMac const &', 'arg0')])
+ ## sta-wifi-mac.h: ns3::StaWifiMac::StaWifiMac() [constructor]
+ cls.add_constructor([])
+ ## sta-wifi-mac.h: void ns3::StaWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
+ cls.add_method('Enqueue',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
+ is_virtual=True)
+ ## sta-wifi-mac.h: static ns3::TypeId ns3::StaWifiMac::GetTypeId() [member function]
+ cls.add_method('GetTypeId',
+ 'ns3::TypeId',
+ [],
+ is_static=True)
+ ## sta-wifi-mac.h: void ns3::StaWifiMac::SetAssocRequestTimeout(ns3::Time timeout) [member function]
+ cls.add_method('SetAssocRequestTimeout',
+ 'void',
+ [param('ns3::Time', 'timeout')])
+ ## sta-wifi-mac.h: void ns3::StaWifiMac::SetMaxMissedBeacons(uint32_t missed) [member function]
+ cls.add_method('SetMaxMissedBeacons',
+ 'void',
+ [param('uint32_t', 'missed')])
+ ## sta-wifi-mac.h: void ns3::StaWifiMac::SetProbeRequestTimeout(ns3::Time timeout) [member function]
+ cls.add_method('SetProbeRequestTimeout',
+ 'void',
+ [param('ns3::Time', 'timeout')])
+ ## sta-wifi-mac.h: void ns3::StaWifiMac::StartActiveAssociation() [member function]
+ cls.add_method('StartActiveAssociation',
+ 'void',
+ [])
+ ## sta-wifi-mac.h: void ns3::StaWifiMac::Receive(ns3::Ptr<ns3::Packet> packet, ns3::WifiMacHeader const * hdr) [member function]
+ cls.add_method('Receive',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::WifiMacHeader const *', 'hdr')],
+ visibility='private', is_virtual=True)
+ return
+
def register_Ns3SupportedRates_methods(root_module, cls):
cls.add_output_stream_operator()
## supported-rates.h: ns3::SupportedRates::SupportedRates(ns3::SupportedRates const & arg0) [copy constructor]
@@ -6610,6 +5856,123 @@
[param('ns3::Ptr< ns3::PropagationLossModel >', 'loss')])
return
+def register_Ns3AdhocWifiMac_methods(root_module, cls):
+ ## adhoc-wifi-mac.h: ns3::AdhocWifiMac::AdhocWifiMac(ns3::AdhocWifiMac const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::AdhocWifiMac const &', 'arg0')])
+ ## adhoc-wifi-mac.h: ns3::AdhocWifiMac::AdhocWifiMac() [constructor]
+ cls.add_constructor([])
+ ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
+ cls.add_method('Enqueue',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
+ is_virtual=True)
+ ## adhoc-wifi-mac.h: static ns3::TypeId ns3::AdhocWifiMac::GetTypeId() [member function]
+ cls.add_method('GetTypeId',
+ 'ns3::TypeId',
+ [],
+ is_static=True)
+ ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetAddress(ns3::Mac48Address address) [member function]
+ cls.add_method('SetAddress',
+ 'void',
+ [param('ns3::Mac48Address', 'address')],
+ is_virtual=True)
+ ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
+ cls.add_method('SetLinkUpCallback',
+ 'void',
+ [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
+ is_virtual=True)
+ ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::Receive(ns3::Ptr<ns3::Packet> packet, ns3::WifiMacHeader const * hdr) [member function]
+ cls.add_method('Receive',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::WifiMacHeader const *', 'hdr')],
+ visibility='private', is_virtual=True)
+ return
+
+def register_Ns3ApWifiMac_methods(root_module, cls):
+ ## ap-wifi-mac.h: ns3::ApWifiMac::ApWifiMac(ns3::ApWifiMac const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::ApWifiMac const &', 'arg0')])
+ ## ap-wifi-mac.h: ns3::ApWifiMac::ApWifiMac() [constructor]
+ cls.add_constructor([])
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
+ cls.add_method('Enqueue',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
+ is_virtual=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
+ cls.add_method('Enqueue',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')],
+ is_virtual=True)
+ ## ap-wifi-mac.h: ns3::Time ns3::ApWifiMac::GetBeaconInterval() const [member function]
+ cls.add_method('GetBeaconInterval',
+ 'ns3::Time',
+ [],
+ is_const=True)
+ ## ap-wifi-mac.h: static ns3::TypeId ns3::ApWifiMac::GetTypeId() [member function]
+ cls.add_method('GetTypeId',
+ 'ns3::TypeId',
+ [],
+ is_static=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::SetAddress(ns3::Mac48Address address) [member function]
+ cls.add_method('SetAddress',
+ 'void',
+ [param('ns3::Mac48Address', 'address')],
+ is_virtual=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::SetBeaconInterval(ns3::Time interval) [member function]
+ cls.add_method('SetBeaconInterval',
+ 'void',
+ [param('ns3::Time', 'interval')])
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
+ cls.add_method('SetLinkUpCallback',
+ 'void',
+ [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
+ is_virtual=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::SetWifiRemoteStationManager(ns3::Ptr<ns3::WifiRemoteStationManager> stationManager) [member function]
+ cls.add_method('SetWifiRemoteStationManager',
+ 'void',
+ [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')],
+ is_virtual=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::StartBeaconing() [member function]
+ cls.add_method('StartBeaconing',
+ 'void',
+ [])
+ ## ap-wifi-mac.h: bool ns3::ApWifiMac::SupportsSendFrom() const [member function]
+ cls.add_method('SupportsSendFrom',
+ 'bool',
+ [],
+ is_const=True, is_virtual=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::DeaggregateAmsduAndForward(ns3::Ptr<ns3::Packet> aggregatedPacket, ns3::WifiMacHeader const * hdr) [member function]
+ cls.add_method('DeaggregateAmsduAndForward',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'aggregatedPacket'), param('ns3::WifiMacHeader const *', 'hdr')],
+ visibility='private', is_virtual=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::DoDispose() [member function]
+ cls.add_method('DoDispose',
+ 'void',
+ [],
+ visibility='private', is_virtual=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::DoStart() [member function]
+ cls.add_method('DoStart',
+ 'void',
+ [],
+ visibility='private', is_virtual=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::Receive(ns3::Ptr<ns3::Packet> packet, ns3::WifiMacHeader const * hdr) [member function]
+ cls.add_method('Receive',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::WifiMacHeader const *', 'hdr')],
+ visibility='private', is_virtual=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::TxFailed(ns3::WifiMacHeader const & hdr) [member function]
+ cls.add_method('TxFailed',
+ 'void',
+ [param('ns3::WifiMacHeader const &', 'hdr')],
+ visibility='private', is_virtual=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::TxOk(ns3::WifiMacHeader const & hdr) [member function]
+ cls.add_method('TxOk',
+ 'void',
+ [param('ns3::WifiMacHeader const &', 'hdr')],
+ visibility='private', is_virtual=True)
+ return
+
def register_Ns3DcaTxop_methods(root_module, cls):
## dca-txop.h: static ns3::TypeId ns3::DcaTxop::GetTypeId() [member function]
cls.add_method('GetTypeId',
--- a/bindings/python/apidefs/gcc-ILP32/ns3modulegen_generated.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-ILP32/ns3modulegen_generated.py Tue Dec 21 17:46:35 2010 +0100
@@ -15,12 +15,14 @@
import ns3_module_core
import ns3_module_simulator
import ns3_module_test
+import ns3_module_visualizer
import ns3_module_mobility
import ns3_module_mpi
import ns3_module_common
import ns3_module_contrib
import ns3_module_node
import ns3_module_bridge
+import ns3_module_bulk_send
import ns3_module_csma
import ns3_module_emu
import ns3_module_energy
@@ -93,6 +95,17 @@
ns3_module_test__local.register_types(module)
root_module.end_section('ns3_module_test')
+ root_module.begin_section('ns3_module_visualizer')
+ ns3_module_visualizer.register_types(module)
+
+ try:
+ import ns3_module_visualizer__local
+ except ImportError:
+ pass
+ else:
+ ns3_module_visualizer__local.register_types(module)
+
+ root_module.end_section('ns3_module_visualizer')
root_module.begin_section('ns3_module_mobility')
ns3_module_mobility.register_types(module)
@@ -159,6 +172,17 @@
ns3_module_bridge__local.register_types(module)
root_module.end_section('ns3_module_bridge')
+ root_module.begin_section('ns3_module_bulk_send')
+ ns3_module_bulk_send.register_types(module)
+
+ try:
+ import ns3_module_bulk_send__local
+ except ImportError:
+ pass
+ else:
+ ns3_module_bulk_send__local.register_types(module)
+
+ root_module.end_section('ns3_module_bulk_send')
root_module.begin_section('ns3_module_csma')
ns3_module_csma.register_types(module)
@@ -540,8 +564,32 @@
module.add_class('OlsrHelper', parent=root_module['ns3::Ipv4RoutingHelper'])
## olsr-state.h: ns3::OlsrState [class]
module.add_class('OlsrState')
+ ## pyviz.h: ns3::PyViz [class]
+ module.add_class('PyViz')
+ ## pyviz.h: ns3::PyViz::PacketCaptureMode [enumeration]
+ module.add_enum('PacketCaptureMode', ['PACKET_CAPTURE_DISABLED', 'PACKET_CAPTURE_FILTER_HEADERS_OR', 'PACKET_CAPTURE_FILTER_HEADERS_AND'], outer_class=root_module['ns3::PyViz'])
+ ## pyviz.h: ns3::PyViz::LastPacketsSample [struct]
+ module.add_class('LastPacketsSample', outer_class=root_module['ns3::PyViz'])
+ ## pyviz.h: ns3::PyViz::NetDeviceStatistics [struct]
+ module.add_class('NetDeviceStatistics', outer_class=root_module['ns3::PyViz'])
+ ## pyviz.h: ns3::PyViz::NodeStatistics [struct]
+ module.add_class('NodeStatistics', outer_class=root_module['ns3::PyViz'])
+ ## pyviz.h: ns3::PyViz::PacketCaptureOptions [struct]
+ module.add_class('PacketCaptureOptions', outer_class=root_module['ns3::PyViz'])
+ ## pyviz.h: ns3::PyViz::PacketDropSample [struct]
+ module.add_class('PacketDropSample', outer_class=root_module['ns3::PyViz'])
+ ## pyviz.h: ns3::PyViz::PacketSample [struct]
+ module.add_class('PacketSample', outer_class=root_module['ns3::PyViz'])
+ ## pyviz.h: ns3::PyViz::RxPacketSample [struct]
+ module.add_class('RxPacketSample', parent=root_module['ns3::PyViz::PacketSample'], outer_class=root_module['ns3::PyViz'])
+ ## pyviz.h: ns3::PyViz::TransmissionSample [struct]
+ module.add_class('TransmissionSample', outer_class=root_module['ns3::PyViz'])
+ ## pyviz.h: ns3::PyViz::TxPacketSample [struct]
+ module.add_class('TxPacketSample', parent=root_module['ns3::PyViz::PacketSample'], outer_class=root_module['ns3::PyViz'])
## uan-mac-rc.h: ns3::Reservation [class]
module.add_class('Reservation')
+ ## rv-battery-model-helper.h: ns3::RvBatteryModelHelper [class]
+ module.add_class('RvBatteryModelHelper', parent=root_module['ns3::EnergySourceHelper'])
## uan-prop-model.h: ns3::Tap [class]
module.add_class('Tap')
## uan-address.h: ns3::UanAddress [class]
@@ -566,6 +614,8 @@
module.add_class('UanTxModeFactory')
## wifi-radio-energy-model-helper.h: ns3::WifiRadioEnergyModelHelper [class]
module.add_class('WifiRadioEnergyModelHelper', parent=root_module['ns3::DeviceEnergyModelHelper'])
+ ## wifi-radio-energy-model.h: ns3::WifiRadioEnergyModelPhyListener [class]
+ module.add_class('WifiRadioEnergyModelPhyListener', parent=root_module['ns3::WifiPhyListener'])
## basic-energy-source-helper.h: ns3::BasicEnergySourceHelper [class]
module.add_class('BasicEnergySourceHelper', parent=root_module['ns3::EnergySourceHelper'])
## ipv4-global-routing-helper.h: ns3::Ipv4GlobalRoutingHelper [class]
@@ -666,6 +716,8 @@
module.add_class('Ipv4StaticRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
## ipv6-static-routing.h: ns3::Ipv6StaticRouting [class]
module.add_class('Ipv6StaticRouting', parent=root_module['ns3::Ipv6RoutingProtocol'])
+ ## rv-battery-model.h: ns3::RvBatteryModel [class]
+ module.add_class('RvBatteryModel', parent=root_module['ns3::EnergySource'])
## uan-channel.h: ns3::UanChannel [class]
module.add_class('UanChannel', parent=root_module['ns3::Channel'])
## uan-tx-mode.h: ns3::UanModesListChecker [class]
@@ -678,8 +730,6 @@
module.add_class('VirtualNetDevice', parent=root_module['ns3::NetDevice'])
## wifi-radio-energy-model.h: ns3::WifiRadioEnergyModel [class]
module.add_class('WifiRadioEnergyModel', parent=root_module['ns3::DeviceEnergyModel'])
- ## wifi-radio-energy-model.h: ns3::WifiRadioEnergyModel::WifiRadioState [enumeration]
- module.add_enum('WifiRadioState', ['TX', 'RX', 'IDLE', 'SLEEP'], outer_class=root_module['ns3::WifiRadioEnergyModel'])
## basic-energy-source.h: ns3::BasicEnergySource [class]
module.add_class('BasicEnergySource', parent=root_module['ns3::EnergySource'])
## bridge-channel.h: ns3::BridgeChannel [class]
@@ -702,6 +752,15 @@
module.add_container('std::vector< ns3::olsr::IfaceAssocTuple >', 'ns3::olsr::IfaceAssocTuple', container_type='vector')
module.add_container('std::vector< ns3::olsr::AssociationTuple >', 'ns3::olsr::AssociationTuple', container_type='vector')
module.add_container('std::vector< ns3::olsr::Association >', 'ns3::olsr::Association', container_type='vector')
+ module.add_container('std::vector< ns3::PyViz::RxPacketSample >', 'ns3::PyViz::RxPacketSample', container_type='vector')
+ module.add_container('std::vector< ns3::PyViz::TxPacketSample >', 'ns3::PyViz::TxPacketSample', container_type='vector')
+ module.add_container('std::vector< ns3::PyViz::PacketSample >', 'ns3::PyViz::PacketSample', container_type='vector')
+ module.add_container('std::vector< ns3::PyViz::TransmissionSample >', 'ns3::PyViz::TransmissionSample', container_type='vector')
+ module.add_container('std::vector< ns3::PyViz::PacketDropSample >', 'ns3::PyViz::PacketDropSample', container_type='vector')
+ module.add_container('std::vector< ns3::PyViz::NetDeviceStatistics >', 'ns3::PyViz::NetDeviceStatistics', container_type='vector')
+ module.add_container('std::vector< std::string >', 'std::string', container_type='vector')
+ module.add_container('std::set< unsigned int >', 'unsigned int', container_type='set')
+ module.add_container('std::vector< ns3::PyViz::NodeStatistics >', 'ns3::PyViz::NodeStatistics', container_type='vector')
module.add_container('std::list< std::pair< ns3::Ptr< ns3::Packet >, ns3::UanAddress > >', 'std::pair< ns3::Ptr< ns3::Packet >, ns3::UanAddress >', container_type='list')
module.add_container('std::vector< ns3::ServiceFlow * >', 'ns3::ServiceFlow *', container_type='vector')
module.add_container('std::vector< ns3::Tap >', 'ns3::Tap', container_type='vector')
@@ -777,7 +836,6 @@
def register_types_ns3_Config(module):
root_module = module.get_root()
- module.add_container('std::vector< std::string >', 'std::string', container_type='vector')
def register_types_ns3_FatalImpl(module):
root_module = module.get_root()
@@ -854,7 +912,6 @@
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')
module.add_container('std::vector< ns3::olsr::RoutingTableEntry >', 'ns3::olsr::RoutingTableEntry', container_type='vector')
- module.add_container('std::set< unsigned int >', 'unsigned int', container_type='set')
typehandlers.add_type_alias('std::vector< ns3::olsr::TopologyTuple, std::allocator< ns3::olsr::TopologyTuple > >', 'ns3::olsr::TopologySet')
typehandlers.add_type_alias('std::vector< ns3::olsr::TopologyTuple, std::allocator< ns3::olsr::TopologyTuple > >*', 'ns3::olsr::TopologySet*')
typehandlers.add_type_alias('std::vector< ns3::olsr::TopologyTuple, std::allocator< ns3::olsr::TopologyTuple > >&', 'ns3::olsr::TopologySet&')
@@ -907,7 +964,18 @@
register_Ns3Ipv6StaticRoutingHelper_methods(root_module, root_module['ns3::Ipv6StaticRoutingHelper'])
register_Ns3OlsrHelper_methods(root_module, root_module['ns3::OlsrHelper'])
register_Ns3OlsrState_methods(root_module, root_module['ns3::OlsrState'])
+ register_Ns3PyViz_methods(root_module, root_module['ns3::PyViz'])
+ register_Ns3PyVizLastPacketsSample_methods(root_module, root_module['ns3::PyViz::LastPacketsSample'])
+ register_Ns3PyVizNetDeviceStatistics_methods(root_module, root_module['ns3::PyViz::NetDeviceStatistics'])
+ register_Ns3PyVizNodeStatistics_methods(root_module, root_module['ns3::PyViz::NodeStatistics'])
+ register_Ns3PyVizPacketCaptureOptions_methods(root_module, root_module['ns3::PyViz::PacketCaptureOptions'])
+ register_Ns3PyVizPacketDropSample_methods(root_module, root_module['ns3::PyViz::PacketDropSample'])
+ register_Ns3PyVizPacketSample_methods(root_module, root_module['ns3::PyViz::PacketSample'])
+ register_Ns3PyVizRxPacketSample_methods(root_module, root_module['ns3::PyViz::RxPacketSample'])
+ register_Ns3PyVizTransmissionSample_methods(root_module, root_module['ns3::PyViz::TransmissionSample'])
+ register_Ns3PyVizTxPacketSample_methods(root_module, root_module['ns3::PyViz::TxPacketSample'])
register_Ns3Reservation_methods(root_module, root_module['ns3::Reservation'])
+ register_Ns3RvBatteryModelHelper_methods(root_module, root_module['ns3::RvBatteryModelHelper'])
register_Ns3Tap_methods(root_module, root_module['ns3::Tap'])
register_Ns3UanAddress_methods(root_module, root_module['ns3::UanAddress'])
register_Ns3UanHelper_methods(root_module, root_module['ns3::UanHelper'])
@@ -918,6 +986,7 @@
register_Ns3UanTxMode_methods(root_module, root_module['ns3::UanTxMode'])
register_Ns3UanTxModeFactory_methods(root_module, root_module['ns3::UanTxModeFactory'])
register_Ns3WifiRadioEnergyModelHelper_methods(root_module, root_module['ns3::WifiRadioEnergyModelHelper'])
+ register_Ns3WifiRadioEnergyModelPhyListener_methods(root_module, root_module['ns3::WifiRadioEnergyModelPhyListener'])
register_Ns3BasicEnergySourceHelper_methods(root_module, root_module['ns3::BasicEnergySourceHelper'])
register_Ns3Ipv4GlobalRoutingHelper_methods(root_module, root_module['ns3::Ipv4GlobalRoutingHelper'])
register_Ns3Ipv4ListRoutingHelper_methods(root_module, root_module['ns3::Ipv4ListRoutingHelper'])
@@ -964,6 +1033,7 @@
register_Ns3Ipv4FlowProbe_methods(root_module, root_module['ns3::Ipv4FlowProbe'])
register_Ns3Ipv4StaticRouting_methods(root_module, root_module['ns3::Ipv4StaticRouting'])
register_Ns3Ipv6StaticRouting_methods(root_module, root_module['ns3::Ipv6StaticRouting'])
+ register_Ns3RvBatteryModel_methods(root_module, root_module['ns3::RvBatteryModel'])
register_Ns3UanChannel_methods(root_module, root_module['ns3::UanChannel'])
register_Ns3UanModesListChecker_methods(root_module, root_module['ns3::UanModesListChecker'])
register_Ns3UanModesListValue_methods(root_module, root_module['ns3::UanModesListValue'])
@@ -1029,6 +1099,17 @@
ns3_module_test__local.register_methods(root_module)
root_module.end_section('ns3_module_test')
+ root_module.begin_section('ns3_module_visualizer')
+ ns3_module_visualizer.register_methods(root_module)
+
+ try:
+ import ns3_module_visualizer__local
+ except ImportError:
+ pass
+ else:
+ ns3_module_visualizer__local.register_methods(root_module)
+
+ root_module.end_section('ns3_module_visualizer')
root_module.begin_section('ns3_module_mobility')
ns3_module_mobility.register_methods(root_module)
@@ -1095,6 +1176,17 @@
ns3_module_bridge__local.register_methods(root_module)
root_module.end_section('ns3_module_bridge')
+ root_module.begin_section('ns3_module_bulk_send')
+ ns3_module_bulk_send.register_methods(root_module)
+
+ try:
+ import ns3_module_bulk_send__local
+ except ImportError:
+ pass
+ else:
+ ns3_module_bulk_send__local.register_methods(root_module)
+
+ root_module.end_section('ns3_module_bulk_send')
root_module.begin_section('ns3_module_csma')
ns3_module_csma.register_methods(root_module)
@@ -2432,6 +2524,185 @@
[param('ns3::olsr::MprSet', 'mprSet')])
return
+def register_Ns3PyViz_methods(root_module, cls):
+ ## pyviz.h: ns3::PyViz::PyViz(ns3::PyViz const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PyViz const &', 'arg0')])
+ ## pyviz.h: ns3::PyViz::PyViz() [constructor]
+ cls.add_constructor([])
+ ## pyviz.h: ns3::PyViz::LastPacketsSample ns3::PyViz::GetLastPackets(uint32_t nodeId) const [member function]
+ cls.add_method('GetLastPackets',
+ 'ns3::PyViz::LastPacketsSample',
+ [param('uint32_t', 'nodeId')],
+ is_const=True)
+ ## pyviz.h: std::vector<ns3::PyViz::NodeStatistics,std::allocator<ns3::PyViz::NodeStatistics> > ns3::PyViz::GetNodesStatistics() const [member function]
+ cls.add_method('GetNodesStatistics',
+ 'std::vector< ns3::PyViz::NodeStatistics >',
+ [],
+ is_const=True)
+ ## pyviz.h: std::vector<ns3::PyViz::PacketDropSample,std::allocator<ns3::PyViz::PacketDropSample> > ns3::PyViz::GetPacketDropSamples() const [member function]
+ cls.add_method('GetPacketDropSamples',
+ 'std::vector< ns3::PyViz::PacketDropSample >',
+ [],
+ is_const=True)
+ ## pyviz.h: std::vector<std::string, std::allocator<std::string> > ns3::PyViz::GetPauseMessages() const [member function]
+ cls.add_method('GetPauseMessages',
+ 'std::vector< std::string >',
+ [],
+ is_const=True)
+ ## pyviz.h: std::vector<ns3::PyViz::TransmissionSample,std::allocator<ns3::PyViz::TransmissionSample> > ns3::PyViz::GetTransmissionSamples() const [member function]
+ cls.add_method('GetTransmissionSamples',
+ 'std::vector< ns3::PyViz::TransmissionSample >',
+ [],
+ is_const=True)
+ ## pyviz.h: static void ns3::PyViz::LineClipping(double boundsX1, double boundsY1, double boundsX2, double boundsY2, double & lineX1, double & lineY1, double & lineX2, double & lineY2) [member function]
+ cls.add_method('LineClipping',
+ 'void',
+ [param('double', 'boundsX1'), param('double', 'boundsY1'), param('double', 'boundsX2'), param('double', 'boundsY2'), param('double &', 'lineX1', direction=3), param('double &', 'lineY1', direction=3), param('double &', 'lineX2', direction=3), param('double &', 'lineY2', direction=3)],
+ is_static=True)
+ ## pyviz.h: static void ns3::PyViz::Pause(std::string const & message) [member function]
+ cls.add_method('Pause',
+ 'void',
+ [param('std::string const &', 'message')],
+ is_static=True)
+ ## pyviz.h: void ns3::PyViz::RegisterCsmaLikeDevice(std::string const & deviceTypeName) [member function]
+ cls.add_method('RegisterCsmaLikeDevice',
+ 'void',
+ [param('std::string const &', 'deviceTypeName')])
+ ## pyviz.h: void ns3::PyViz::RegisterDropTracePath(std::string const & tracePath) [member function]
+ cls.add_method('RegisterDropTracePath',
+ 'void',
+ [param('std::string const &', 'tracePath')])
+ ## pyviz.h: void ns3::PyViz::RegisterPointToPointLikeDevice(std::string const & deviceTypeName) [member function]
+ cls.add_method('RegisterPointToPointLikeDevice',
+ 'void',
+ [param('std::string const &', 'deviceTypeName')])
+ ## pyviz.h: void ns3::PyViz::RegisterWifiLikeDevice(std::string const & deviceTypeName) [member function]
+ cls.add_method('RegisterWifiLikeDevice',
+ 'void',
+ [param('std::string const &', 'deviceTypeName')])
+ ## pyviz.h: void ns3::PyViz::SetNodesOfInterest(std::set<unsigned int, std::less<unsigned int>, std::allocator<unsigned int> > nodes) [member function]
+ cls.add_method('SetNodesOfInterest',
+ 'void',
+ [param('std::set< unsigned int >', 'nodes')])
+ ## pyviz.h: void ns3::PyViz::SetPacketCaptureOptions(uint32_t nodeId, ns3::PyViz::PacketCaptureOptions options) [member function]
+ cls.add_method('SetPacketCaptureOptions',
+ 'void',
+ [param('uint32_t', 'nodeId'), param('ns3::PyViz::PacketCaptureOptions', 'options')])
+ ## pyviz.h: void ns3::PyViz::SimulatorRunUntil(ns3::Time time) [member function]
+ cls.add_method('SimulatorRunUntil',
+ 'void',
+ [param('ns3::Time', 'time')])
+ return
+
+def register_Ns3PyVizLastPacketsSample_methods(root_module, cls):
+ ## pyviz.h: ns3::PyViz::LastPacketsSample::LastPacketsSample() [constructor]
+ cls.add_constructor([])
+ ## pyviz.h: ns3::PyViz::LastPacketsSample::LastPacketsSample(ns3::PyViz::LastPacketsSample const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PyViz::LastPacketsSample const &', 'arg0')])
+ ## pyviz.h: ns3::PyViz::LastPacketsSample::lastDroppedPackets [variable]
+ cls.add_instance_attribute('lastDroppedPackets', 'std::vector< ns3::PyViz::PacketSample >', is_const=False)
+ ## pyviz.h: ns3::PyViz::LastPacketsSample::lastReceivedPackets [variable]
+ cls.add_instance_attribute('lastReceivedPackets', 'std::vector< ns3::PyViz::RxPacketSample >', is_const=False)
+ ## pyviz.h: ns3::PyViz::LastPacketsSample::lastTransmittedPackets [variable]
+ cls.add_instance_attribute('lastTransmittedPackets', 'std::vector< ns3::PyViz::TxPacketSample >', is_const=False)
+ return
+
+def register_Ns3PyVizNetDeviceStatistics_methods(root_module, cls):
+ ## pyviz.h: ns3::PyViz::NetDeviceStatistics::NetDeviceStatistics(ns3::PyViz::NetDeviceStatistics const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PyViz::NetDeviceStatistics const &', 'arg0')])
+ ## pyviz.h: ns3::PyViz::NetDeviceStatistics::NetDeviceStatistics() [constructor]
+ cls.add_constructor([])
+ ## pyviz.h: ns3::PyViz::NetDeviceStatistics::receivedBytes [variable]
+ cls.add_instance_attribute('receivedBytes', 'uint64_t', is_const=False)
+ ## pyviz.h: ns3::PyViz::NetDeviceStatistics::receivedPackets [variable]
+ cls.add_instance_attribute('receivedPackets', 'uint32_t', is_const=False)
+ ## pyviz.h: ns3::PyViz::NetDeviceStatistics::transmittedBytes [variable]
+ cls.add_instance_attribute('transmittedBytes', 'uint64_t', is_const=False)
+ ## pyviz.h: ns3::PyViz::NetDeviceStatistics::transmittedPackets [variable]
+ cls.add_instance_attribute('transmittedPackets', 'uint32_t', is_const=False)
+ return
+
+def register_Ns3PyVizNodeStatistics_methods(root_module, cls):
+ ## pyviz.h: ns3::PyViz::NodeStatistics::NodeStatistics() [constructor]
+ cls.add_constructor([])
+ ## pyviz.h: ns3::PyViz::NodeStatistics::NodeStatistics(ns3::PyViz::NodeStatistics const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PyViz::NodeStatistics const &', 'arg0')])
+ ## pyviz.h: ns3::PyViz::NodeStatistics::nodeId [variable]
+ cls.add_instance_attribute('nodeId', 'uint32_t', is_const=False)
+ ## pyviz.h: ns3::PyViz::NodeStatistics::statistics [variable]
+ cls.add_instance_attribute('statistics', 'std::vector< ns3::PyViz::NetDeviceStatistics >', is_const=False)
+ return
+
+def register_Ns3PyVizPacketCaptureOptions_methods(root_module, cls):
+ ## pyviz.h: ns3::PyViz::PacketCaptureOptions::PacketCaptureOptions() [constructor]
+ cls.add_constructor([])
+ ## pyviz.h: ns3::PyViz::PacketCaptureOptions::PacketCaptureOptions(ns3::PyViz::PacketCaptureOptions const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PyViz::PacketCaptureOptions const &', 'arg0')])
+ ## pyviz.h: ns3::PyViz::PacketCaptureOptions::headers [variable]
+ cls.add_instance_attribute('headers', 'std::set< ns3::TypeId >', is_const=False)
+ ## pyviz.h: ns3::PyViz::PacketCaptureOptions::mode [variable]
+ cls.add_instance_attribute('mode', 'ns3::PyViz::PacketCaptureMode', is_const=False)
+ ## pyviz.h: ns3::PyViz::PacketCaptureOptions::numLastPackets [variable]
+ cls.add_instance_attribute('numLastPackets', 'uint32_t', is_const=False)
+ return
+
+def register_Ns3PyVizPacketDropSample_methods(root_module, cls):
+ ## pyviz.h: ns3::PyViz::PacketDropSample::PacketDropSample() [constructor]
+ cls.add_constructor([])
+ ## pyviz.h: ns3::PyViz::PacketDropSample::PacketDropSample(ns3::PyViz::PacketDropSample const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PyViz::PacketDropSample const &', 'arg0')])
+ ## pyviz.h: ns3::PyViz::PacketDropSample::bytes [variable]
+ cls.add_instance_attribute('bytes', 'uint32_t', is_const=False)
+ ## pyviz.h: ns3::PyViz::PacketDropSample::transmitter [variable]
+ cls.add_instance_attribute('transmitter', 'ns3::Ptr< ns3::Node >', is_const=False)
+ return
+
+def register_Ns3PyVizPacketSample_methods(root_module, cls):
+ ## pyviz.h: ns3::PyViz::PacketSample::PacketSample() [constructor]
+ cls.add_constructor([])
+ ## pyviz.h: ns3::PyViz::PacketSample::PacketSample(ns3::PyViz::PacketSample const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PyViz::PacketSample const &', 'arg0')])
+ ## pyviz.h: ns3::PyViz::PacketSample::device [variable]
+ cls.add_instance_attribute('device', 'ns3::Ptr< ns3::NetDevice >', is_const=False)
+ ## pyviz.h: ns3::PyViz::PacketSample::packet [variable]
+ cls.add_instance_attribute('packet', 'ns3::Ptr< ns3::Packet >', is_const=False)
+ ## pyviz.h: ns3::PyViz::PacketSample::time [variable]
+ cls.add_instance_attribute('time', 'ns3::Time', is_const=False)
+ return
+
+def register_Ns3PyVizRxPacketSample_methods(root_module, cls):
+ ## pyviz.h: ns3::PyViz::RxPacketSample::RxPacketSample() [constructor]
+ cls.add_constructor([])
+ ## pyviz.h: ns3::PyViz::RxPacketSample::RxPacketSample(ns3::PyViz::RxPacketSample const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PyViz::RxPacketSample const &', 'arg0')])
+ ## pyviz.h: ns3::PyViz::RxPacketSample::from [variable]
+ cls.add_instance_attribute('from', 'ns3::Mac48Address', is_const=False)
+ return
+
+def register_Ns3PyVizTransmissionSample_methods(root_module, cls):
+ ## pyviz.h: ns3::PyViz::TransmissionSample::TransmissionSample() [constructor]
+ cls.add_constructor([])
+ ## pyviz.h: ns3::PyViz::TransmissionSample::TransmissionSample(ns3::PyViz::TransmissionSample const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PyViz::TransmissionSample const &', 'arg0')])
+ ## pyviz.h: ns3::PyViz::TransmissionSample::bytes [variable]
+ cls.add_instance_attribute('bytes', 'uint32_t', is_const=False)
+ ## pyviz.h: ns3::PyViz::TransmissionSample::channel [variable]
+ cls.add_instance_attribute('channel', 'ns3::Ptr< ns3::Channel >', is_const=False)
+ ## pyviz.h: ns3::PyViz::TransmissionSample::receiver [variable]
+ cls.add_instance_attribute('receiver', 'ns3::Ptr< ns3::Node >', is_const=False)
+ ## pyviz.h: ns3::PyViz::TransmissionSample::transmitter [variable]
+ cls.add_instance_attribute('transmitter', 'ns3::Ptr< ns3::Node >', is_const=False)
+ return
+
+def register_Ns3PyVizTxPacketSample_methods(root_module, cls):
+ ## pyviz.h: ns3::PyViz::TxPacketSample::TxPacketSample() [constructor]
+ cls.add_constructor([])
+ ## pyviz.h: ns3::PyViz::TxPacketSample::TxPacketSample(ns3::PyViz::TxPacketSample const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PyViz::TxPacketSample const &', 'arg0')])
+ ## pyviz.h: ns3::PyViz::TxPacketSample::to [variable]
+ cls.add_instance_attribute('to', 'ns3::Mac48Address', is_const=False)
+ return
+
def register_Ns3Reservation_methods(root_module, cls):
## uan-mac-rc.h: ns3::Reservation::Reservation(ns3::Reservation const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Reservation const &', 'arg0')])
@@ -2492,6 +2763,23 @@
[param('bool', 't', default_value='true')])
return
+def register_Ns3RvBatteryModelHelper_methods(root_module, cls):
+ ## rv-battery-model-helper.h: ns3::RvBatteryModelHelper::RvBatteryModelHelper(ns3::RvBatteryModelHelper const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::RvBatteryModelHelper const &', 'arg0')])
+ ## rv-battery-model-helper.h: ns3::RvBatteryModelHelper::RvBatteryModelHelper() [constructor]
+ cls.add_constructor([])
+ ## rv-battery-model-helper.h: void ns3::RvBatteryModelHelper::Set(std::string name, ns3::AttributeValue const & v) [member function]
+ cls.add_method('Set',
+ 'void',
+ [param('std::string', 'name'), param('ns3::AttributeValue const &', 'v')],
+ is_virtual=True)
+ ## rv-battery-model-helper.h: ns3::Ptr<ns3::EnergySource> ns3::RvBatteryModelHelper::DoInstall(ns3::Ptr<ns3::Node> node) const [member function]
+ cls.add_method('DoInstall',
+ 'ns3::Ptr< ns3::EnergySource >',
+ [param('ns3::Ptr< ns3::Node >', 'node')],
+ is_const=True, visibility='private', is_virtual=True)
+ return
+
def register_Ns3Tap_methods(root_module, cls):
## uan-prop-model.h: ns3::Tap::Tap(ns3::Tap const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Tap const &', 'arg0')])
@@ -2865,6 +3153,47 @@
is_const=True, visibility='private', is_virtual=True)
return
+def register_Ns3WifiRadioEnergyModelPhyListener_methods(root_module, cls):
+ ## wifi-radio-energy-model.h: ns3::WifiRadioEnergyModelPhyListener::WifiRadioEnergyModelPhyListener(ns3::WifiRadioEnergyModelPhyListener const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::WifiRadioEnergyModelPhyListener const &', 'arg0')])
+ ## wifi-radio-energy-model.h: ns3::WifiRadioEnergyModelPhyListener::WifiRadioEnergyModelPhyListener() [constructor]
+ cls.add_constructor([])
+ ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModelPhyListener::NotifyMaybeCcaBusyStart(ns3::Time duration) [member function]
+ cls.add_method('NotifyMaybeCcaBusyStart',
+ 'void',
+ [param('ns3::Time', 'duration')],
+ is_virtual=True)
+ ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModelPhyListener::NotifyRxEndError() [member function]
+ cls.add_method('NotifyRxEndError',
+ 'void',
+ [],
+ is_virtual=True)
+ ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModelPhyListener::NotifyRxEndOk() [member function]
+ cls.add_method('NotifyRxEndOk',
+ 'void',
+ [],
+ is_virtual=True)
+ ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModelPhyListener::NotifyRxStart(ns3::Time duration) [member function]
+ cls.add_method('NotifyRxStart',
+ 'void',
+ [param('ns3::Time', 'duration')],
+ is_virtual=True)
+ ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModelPhyListener::NotifySwitchingStart(ns3::Time duration) [member function]
+ cls.add_method('NotifySwitchingStart',
+ 'void',
+ [param('ns3::Time', 'duration')],
+ is_virtual=True)
+ ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModelPhyListener::NotifyTxStart(ns3::Time duration) [member function]
+ cls.add_method('NotifyTxStart',
+ 'void',
+ [param('ns3::Time', 'duration')],
+ is_virtual=True)
+ ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModelPhyListener::SetChangeStateCallback(ns3::Callback<void, int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
+ cls.add_method('SetChangeStateCallback',
+ 'void',
+ [param('ns3::Callback< void, int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')])
+ return
+
def register_Ns3BasicEnergySourceHelper_methods(root_module, cls):
## basic-energy-source-helper.h: ns3::BasicEnergySourceHelper::BasicEnergySourceHelper(ns3::BasicEnergySourceHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::BasicEnergySourceHelper const &', 'arg0')])
@@ -4743,11 +5072,6 @@
'double',
[],
is_const=True)
- ## device-energy-model.h: ns3::Ptr<ns3::Node> ns3::DeviceEnergyModel::GetNode() const [member function]
- cls.add_method('GetNode',
- 'ns3::Ptr< ns3::Node >',
- [],
- is_pure_virtual=True, is_const=True, is_virtual=True)
## device-energy-model.h: double ns3::DeviceEnergyModel::GetTotalEnergyConsumption() const [member function]
cls.add_method('GetTotalEnergyConsumption',
'double',
@@ -4768,11 +5092,6 @@
'void',
[param('ns3::Ptr< ns3::EnergySource >', 'source')],
is_pure_virtual=True, is_virtual=True)
- ## device-energy-model.h: void ns3::DeviceEnergyModel::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)
## device-energy-model.h: double ns3::DeviceEnergyModel::DoGetCurrentA() const [member function]
cls.add_method('DoGetCurrentA',
'double',
@@ -4789,11 +5108,10 @@
cls.add_method('AppendDeviceEnergyModel',
'void',
[param('ns3::Ptr< ns3::DeviceEnergyModel >', 'deviceEnergyModelPtr')])
- ## energy-source.h: void ns3::EnergySource::DecreaseRemainingEnergy(double energyJ) [member function]
- cls.add_method('DecreaseRemainingEnergy',
- 'void',
- [param('double', 'energyJ')],
- is_pure_virtual=True, is_virtual=True)
+ ## energy-source.h: void ns3::EnergySource::DisposeDeviceModels() [member function]
+ cls.add_method('DisposeDeviceModels',
+ 'void',
+ [])
## energy-source.h: ns3::DeviceEnergyModelContainer ns3::EnergySource::FindDeviceEnergyModels(ns3::TypeId tid) [member function]
cls.add_method('FindDeviceEnergyModels',
'ns3::DeviceEnergyModelContainer',
@@ -4832,15 +5150,14 @@
'ns3::TypeId',
[],
is_static=True)
- ## energy-source.h: void ns3::EnergySource::IncreaseRemainingEnergy(double energyJ) [member function]
- cls.add_method('IncreaseRemainingEnergy',
- 'void',
- [param('double', 'energyJ')],
- is_pure_virtual=True, is_virtual=True)
## energy-source.h: void ns3::EnergySource::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')])
+ ## energy-source.h: void ns3::EnergySource::StartDeviceModels() [member function]
+ cls.add_method('StartDeviceModels',
+ 'void',
+ [])
## energy-source.h: void ns3::EnergySource::UpdateEnergySource() [member function]
cls.add_method('UpdateEnergySource',
'void',
@@ -5269,14 +5586,16 @@
'uint32_t',
[],
is_const=True)
- ## ipv4-static-routing.h: uint32_t ns3::Ipv4StaticRouting::GetNRoutes() [member function]
+ ## ipv4-static-routing.h: uint32_t ns3::Ipv4StaticRouting::GetNRoutes() const [member function]
cls.add_method('GetNRoutes',
'uint32_t',
- [])
- ## ipv4-static-routing.h: ns3::Ipv4RoutingTableEntry ns3::Ipv4StaticRouting::GetRoute(uint32_t i) [member function]
+ [],
+ is_const=True)
+ ## ipv4-static-routing.h: ns3::Ipv4RoutingTableEntry ns3::Ipv4StaticRouting::GetRoute(uint32_t i) const [member function]
cls.add_method('GetRoute',
'ns3::Ipv4RoutingTableEntry',
- [param('uint32_t', 'i')])
+ [param('uint32_t', 'i')],
+ is_const=True)
## ipv4-static-routing.h: static ns3::TypeId ns3::Ipv4StaticRouting::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
@@ -5302,6 +5621,11 @@
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
is_virtual=True)
+ ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTable',
+ 'void',
+ [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True, is_virtual=True)
## ipv4-static-routing.h: bool ns3::Ipv4StaticRouting::RemoveMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface) [member function]
cls.add_method('RemoveMulticastRoute',
'bool',
@@ -5484,6 +5808,116 @@
visibility='protected', is_virtual=True)
return
+def register_Ns3RvBatteryModel_methods(root_module, cls):
+ ## rv-battery-model.h: ns3::RvBatteryModel::RvBatteryModel(ns3::RvBatteryModel const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::RvBatteryModel const &', 'arg0')])
+ ## rv-battery-model.h: ns3::RvBatteryModel::RvBatteryModel() [constructor]
+ cls.add_constructor([])
+ ## rv-battery-model.h: double ns3::RvBatteryModel::GetAlpha() const [member function]
+ cls.add_method('GetAlpha',
+ 'double',
+ [],
+ is_const=True)
+ ## rv-battery-model.h: double ns3::RvBatteryModel::GetBatteryLevel() [member function]
+ cls.add_method('GetBatteryLevel',
+ 'double',
+ [])
+ ## rv-battery-model.h: double ns3::RvBatteryModel::GetBeta() const [member function]
+ cls.add_method('GetBeta',
+ 'double',
+ [],
+ is_const=True)
+ ## rv-battery-model.h: double ns3::RvBatteryModel::GetCutoffVoltage() const [member function]
+ cls.add_method('GetCutoffVoltage',
+ 'double',
+ [],
+ is_const=True)
+ ## rv-battery-model.h: double ns3::RvBatteryModel::GetEnergyFraction() [member function]
+ cls.add_method('GetEnergyFraction',
+ 'double',
+ [],
+ is_virtual=True)
+ ## rv-battery-model.h: double ns3::RvBatteryModel::GetInitialEnergy() const [member function]
+ cls.add_method('GetInitialEnergy',
+ 'double',
+ [],
+ is_const=True, is_virtual=True)
+ ## rv-battery-model.h: ns3::Time ns3::RvBatteryModel::GetLifetime() const [member function]
+ cls.add_method('GetLifetime',
+ 'ns3::Time',
+ [],
+ is_const=True)
+ ## rv-battery-model.h: int ns3::RvBatteryModel::GetNumOfTerms() const [member function]
+ cls.add_method('GetNumOfTerms',
+ 'int',
+ [],
+ is_const=True)
+ ## rv-battery-model.h: double ns3::RvBatteryModel::GetOpenCircuitVoltage() const [member function]
+ cls.add_method('GetOpenCircuitVoltage',
+ 'double',
+ [],
+ is_const=True)
+ ## rv-battery-model.h: double ns3::RvBatteryModel::GetRemainingEnergy() [member function]
+ cls.add_method('GetRemainingEnergy',
+ 'double',
+ [],
+ is_virtual=True)
+ ## rv-battery-model.h: ns3::Time ns3::RvBatteryModel::GetSamplingInterval() const [member function]
+ cls.add_method('GetSamplingInterval',
+ 'ns3::Time',
+ [],
+ is_const=True)
+ ## rv-battery-model.h: double ns3::RvBatteryModel::GetSupplyVoltage() const [member function]
+ cls.add_method('GetSupplyVoltage',
+ 'double',
+ [],
+ is_const=True, is_virtual=True)
+ ## rv-battery-model.h: static ns3::TypeId ns3::RvBatteryModel::GetTypeId() [member function]
+ cls.add_method('GetTypeId',
+ 'ns3::TypeId',
+ [],
+ is_static=True)
+ ## rv-battery-model.h: void ns3::RvBatteryModel::SetAlpha(double alpha) [member function]
+ cls.add_method('SetAlpha',
+ 'void',
+ [param('double', 'alpha')])
+ ## rv-battery-model.h: void ns3::RvBatteryModel::SetBeta(double beta) [member function]
+ cls.add_method('SetBeta',
+ 'void',
+ [param('double', 'beta')])
+ ## rv-battery-model.h: void ns3::RvBatteryModel::SetCutoffVoltage(double voltage) [member function]
+ cls.add_method('SetCutoffVoltage',
+ 'void',
+ [param('double', 'voltage')])
+ ## rv-battery-model.h: void ns3::RvBatteryModel::SetNumOfTerms(int num) [member function]
+ cls.add_method('SetNumOfTerms',
+ 'void',
+ [param('int', 'num')])
+ ## rv-battery-model.h: void ns3::RvBatteryModel::SetOpenCircuitVoltage(double voltage) [member function]
+ cls.add_method('SetOpenCircuitVoltage',
+ 'void',
+ [param('double', 'voltage')])
+ ## rv-battery-model.h: void ns3::RvBatteryModel::SetSamplingInterval(ns3::Time interval) [member function]
+ cls.add_method('SetSamplingInterval',
+ 'void',
+ [param('ns3::Time', 'interval')])
+ ## rv-battery-model.h: void ns3::RvBatteryModel::UpdateEnergySource() [member function]
+ cls.add_method('UpdateEnergySource',
+ 'void',
+ [],
+ is_virtual=True)
+ ## rv-battery-model.h: void ns3::RvBatteryModel::DoDispose() [member function]
+ cls.add_method('DoDispose',
+ 'void',
+ [],
+ visibility='private', is_virtual=True)
+ ## rv-battery-model.h: void ns3::RvBatteryModel::DoStart() [member function]
+ cls.add_method('DoStart',
+ 'void',
+ [],
+ visibility='private', is_virtual=True)
+ return
+
def register_Ns3UanChannel_methods(root_module, cls):
## uan-channel.h: ns3::UanChannel::UanChannel(ns3::UanChannel const & arg0) [copy constructor]
cls.add_constructor([param('ns3::UanChannel const &', 'arg0')])
@@ -5919,9 +6353,14 @@
'void',
[param('int', 'newState')],
is_virtual=True)
- ## wifi-radio-energy-model.h: ns3::WifiRadioEnergyModel::WifiRadioState ns3::WifiRadioEnergyModel::GetCurrentState() const [member function]
+ ## wifi-radio-energy-model.h: double ns3::WifiRadioEnergyModel::GetCcaBusyCurrentA() const [member function]
+ cls.add_method('GetCcaBusyCurrentA',
+ 'double',
+ [],
+ is_const=True)
+ ## wifi-radio-energy-model.h: ns3::WifiPhy::State ns3::WifiRadioEnergyModel::GetCurrentState() const [member function]
cls.add_method('GetCurrentState',
- 'ns3::WifiRadioEnergyModel::WifiRadioState',
+ 'ns3::WifiPhy::State',
[],
is_const=True)
## wifi-radio-energy-model.h: double ns3::WifiRadioEnergyModel::GetIdleCurrentA() const [member function]
@@ -5929,18 +6368,17 @@
'double',
[],
is_const=True)
- ## wifi-radio-energy-model.h: ns3::Ptr<ns3::Node> ns3::WifiRadioEnergyModel::GetNode() const [member function]
- cls.add_method('GetNode',
- 'ns3::Ptr< ns3::Node >',
- [],
- is_const=True, is_virtual=True)
+ ## wifi-radio-energy-model.h: ns3::WifiRadioEnergyModelPhyListener * ns3::WifiRadioEnergyModel::GetPhyListener() [member function]
+ cls.add_method('GetPhyListener',
+ 'ns3::WifiRadioEnergyModelPhyListener *',
+ [])
## wifi-radio-energy-model.h: double ns3::WifiRadioEnergyModel::GetRxCurrentA() const [member function]
cls.add_method('GetRxCurrentA',
'double',
[],
is_const=True)
- ## wifi-radio-energy-model.h: double ns3::WifiRadioEnergyModel::GetSleepCurrentA() const [member function]
- cls.add_method('GetSleepCurrentA',
+ ## wifi-radio-energy-model.h: double ns3::WifiRadioEnergyModel::GetSwitchingCurrentA() const [member function]
+ cls.add_method('GetSwitchingCurrentA',
'double',
[],
is_const=True)
@@ -5964,6 +6402,10 @@
'void',
[],
is_virtual=True)
+ ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModel::SetCcaBusyCurrentA(double ccaBusyCurrentA) [member function]
+ cls.add_method('SetCcaBusyCurrentA',
+ 'void',
+ [param('double', 'ccaBusyCurrentA')])
## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModel::SetEnergyDepletionCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
cls.add_method('SetEnergyDepletionCallback',
'void',
@@ -5977,19 +6419,14 @@
cls.add_method('SetIdleCurrentA',
'void',
[param('double', 'idleCurrentA')])
- ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModel::SetNode(ns3::Ptr<ns3::Node> node) [member function]
- cls.add_method('SetNode',
- 'void',
- [param('ns3::Ptr< ns3::Node >', 'node')],
- is_virtual=True)
## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModel::SetRxCurrentA(double rxCurrentA) [member function]
cls.add_method('SetRxCurrentA',
'void',
[param('double', 'rxCurrentA')])
- ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModel::SetSleepCurrentA(double sleepCurrentA) [member function]
- cls.add_method('SetSleepCurrentA',
- 'void',
- [param('double', 'sleepCurrentA')])
+ ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModel::SetSwitchingCurrentA(double switchingCurrentA) [member function]
+ cls.add_method('SetSwitchingCurrentA',
+ 'void',
+ [param('double', 'switchingCurrentA')])
## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModel::SetTxCurrentA(double txCurrentA) [member function]
cls.add_method('SetTxCurrentA',
'void',
@@ -6011,11 +6448,6 @@
cls.add_constructor([param('ns3::BasicEnergySource const &', 'arg0')])
## basic-energy-source.h: ns3::BasicEnergySource::BasicEnergySource() [constructor]
cls.add_constructor([])
- ## basic-energy-source.h: void ns3::BasicEnergySource::DecreaseRemainingEnergy(double energyJ) [member function]
- cls.add_method('DecreaseRemainingEnergy',
- 'void',
- [param('double', 'energyJ')],
- is_virtual=True)
## basic-energy-source.h: double ns3::BasicEnergySource::GetEnergyFraction() [member function]
cls.add_method('GetEnergyFraction',
'double',
@@ -6046,11 +6478,6 @@
'ns3::TypeId',
[],
is_static=True)
- ## basic-energy-source.h: void ns3::BasicEnergySource::IncreaseRemainingEnergy(double energyJ) [member function]
- cls.add_method('IncreaseRemainingEnergy',
- 'void',
- [param('double', 'energyJ')],
- is_virtual=True)
## basic-energy-source.h: void ns3::BasicEnergySource::SetEnergyUpdateInterval(ns3::Time interval) [member function]
cls.add_method('SetEnergyUpdateInterval',
'void',
@@ -6307,14 +6734,16 @@
cls.add_method('AddNetworkRouteTo',
'void',
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')])
- ## ipv4-global-routing.h: uint32_t ns3::Ipv4GlobalRouting::GetNRoutes() [member function]
+ ## ipv4-global-routing.h: uint32_t ns3::Ipv4GlobalRouting::GetNRoutes() const [member function]
cls.add_method('GetNRoutes',
'uint32_t',
- [])
- ## ipv4-global-routing.h: ns3::Ipv4RoutingTableEntry * ns3::Ipv4GlobalRouting::GetRoute(uint32_t i) [member function]
+ [],
+ is_const=True)
+ ## ipv4-global-routing.h: ns3::Ipv4RoutingTableEntry * ns3::Ipv4GlobalRouting::GetRoute(uint32_t i) const [member function]
cls.add_method('GetRoute',
- retval('ns3::Ipv4RoutingTableEntry *', caller_owns_return=False),
- [param('uint32_t', 'i')])
+ 'ns3::Ipv4RoutingTableEntry *',
+ [param('uint32_t', 'i')],
+ is_const=True)
## ipv4-global-routing.h: static ns3::TypeId ns3::Ipv4GlobalRouting::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
@@ -6340,6 +6769,11 @@
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
is_virtual=True)
+ ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTable',
+ 'void',
+ [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True, is_virtual=True)
## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::RemoveRoute(uint32_t i) [member function]
cls.add_method('RemoveRoute',
'void',
@@ -6411,6 +6845,11 @@
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
is_virtual=True)
+ ## ipv4-list-routing.h: void ns3::Ipv4ListRouting::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTable',
+ 'void',
+ [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True, is_virtual=True)
## ipv4-list-routing.h: bool ns3::Ipv4ListRouting::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<ns3::Packet const>, ns3::Ipv4Header const&, 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<ns3::Packet const>, ns3::Ipv4Header const&, ns3::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> ecb) [member function]
cls.add_method('RouteInput',
'bool',
@@ -7037,6 +7476,11 @@
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
visibility='private', is_virtual=True)
+ ## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTable',
+ 'void',
+ [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True, visibility='private', is_virtual=True)
## 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<ns3::Packet const>, ns3::Ipv4Header const&, 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<ns3::Packet const>, ns3::Ipv4Header const&, ns3::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> ecb) [member function]
cls.add_method('RouteInput',
'bool',
@@ -7136,6 +7580,17 @@
ns3_module_test__local.register_functions(root_module)
root_module.end_section('ns3_module_test')
+ root_module.begin_section('ns3_module_visualizer')
+ ns3_module_visualizer.register_functions(root_module)
+
+ try:
+ import ns3_module_visualizer__local
+ except ImportError:
+ pass
+ else:
+ ns3_module_visualizer__local.register_functions(root_module)
+
+ root_module.end_section('ns3_module_visualizer')
root_module.begin_section('ns3_module_mobility')
ns3_module_mobility.register_functions(root_module)
@@ -7202,6 +7657,17 @@
ns3_module_bridge__local.register_functions(root_module)
root_module.end_section('ns3_module_bridge')
+ root_module.begin_section('ns3_module_bulk_send')
+ ns3_module_bulk_send.register_functions(root_module)
+
+ try:
+ import ns3_module_bulk_send__local
+ except ImportError:
+ pass
+ else:
+ ns3_module_bulk_send__local.register_functions(root_module)
+
+ root_module.end_section('ns3_module_bulk_send')
root_module.begin_section('ns3_module_csma')
ns3_module_csma.register_functions(root_module)
--- a/bindings/python/apidefs/gcc-LP64/callbacks_list.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-LP64/callbacks_list.py Tue Dec 21 17:46:35 2010 +0100
@@ -1,34 +1,35 @@
callback_classes = [
+ ['void', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::Packet const>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
- ['void', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::Packet>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
+ ['void', 'int', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['bool', 'ns3::Ptr<ns3::Packet>', 'ns3::Address const&', 'ns3::Address const&', 'unsigned short', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::Packet>', 'double', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::Packet>', 'double', 'ns3::UanTxMode', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::Packet>', 'ns3::UanAddress const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::PacketBurst const>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
- ['void', 'ns3::Ptr<ns3::Packet>', 'ns3::Mac48Address', 'ns3::Mac48Address', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Mac48Address', 'ns3::Mac48Address', 'unsigned int', 'bool', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'unsigned int', 'ns3::Mac48Address', 'ns3::Mac48Address', 'ns3::dot11s::PeerLink::PeerState', 'ns3::dot11s::PeerLink::PeerState', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['unsigned int', 'ns3::Mac48Address', 'ns3::Ptr<ns3::MeshWifiInterfaceMac>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::Packet>', 'ns3::WifiMacHeader const*', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['std::vector<ns3::Mac48Address, std::allocator<ns3::Mac48Address> >', 'unsigned int', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'bool', 'ns3::Ptr<ns3::Packet>', 'ns3::Mac48Address', 'ns3::Mac48Address', 'unsigned short', 'unsigned int', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
- ['void', 'ns3::WifiMacHeader const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['bool', 'std::string', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'bool', 'unsigned long', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
- ['void', 'ns3::Mac48Address', 'unsigned char', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
- ['void', 'ns3::Mac48Address', 'unsigned char', 'bool', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::Packet const>', 'ns3::Ipv4Header const&', 'ns3::Socket::SocketErrno', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['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'],
['void', 'ns3::Ptr<ns3::Socket>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::Socket>', 'unsigned int', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::Socket>', 'ns3::Address const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['bool', 'ns3::Ptr<ns3::Socket>', 'ns3::Address const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
+ ['void', 'ns3::WifiMacHeader const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ipv4Address', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::ArpCache const>', 'ns3::Ipv4Address', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['bool', 'ns3::Ptr<ns3::Packet>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['bool', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<ns3::Packet const>', 'unsigned short', 'ns3::Address const&', 'ns3::Address const&', 'ns3::NetDevice::PacketType', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['bool', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<ns3::Packet const>', 'unsigned short', 'ns3::Address const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
+ ['void', 'ns3::Ptr<ns3::Packet>', 'ns3::Mac48Address', 'ns3::Mac48Address', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
+ ['void', 'ns3::Mac48Address', 'unsigned char', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
+ ['void', 'ns3::Mac48Address', 'unsigned char', 'bool', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<ns3::Packet const>', 'unsigned short', 'ns3::Address const&', 'ns3::Address const&', 'ns3::NetDevice::PacketType', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
]
--- a/bindings/python/apidefs/gcc-LP64/ns3_module_aodv.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-LP64/ns3_module_aodv.py Tue Dec 21 17:46:35 2010 +0100
@@ -442,6 +442,16 @@
'bool',
[],
is_const=True)
+ ## aodv-routing-protocol.h: uint32_t ns3::aodv::RoutingProtocol::GetMaxQueueLen() const [member function]
+ cls.add_method('GetMaxQueueLen',
+ 'uint32_t',
+ [],
+ is_const=True)
+ ## aodv-routing-protocol.h: ns3::Time ns3::aodv::RoutingProtocol::GetMaxQueueTime() const [member function]
+ cls.add_method('GetMaxQueueTime',
+ 'ns3::Time',
+ [],
+ is_const=True)
## aodv-routing-protocol.h: static ns3::TypeId ns3::aodv::RoutingProtocol::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
@@ -467,6 +477,11 @@
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
is_virtual=True)
+ ## aodv-routing-protocol.h: void ns3::aodv::RoutingProtocol::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTable',
+ 'void',
+ [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True, is_virtual=True)
## aodv-routing-protocol.h: bool ns3::aodv::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<ns3::Packet const>, ns3::Ipv4Header const&, 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<ns3::Packet const>, ns3::Ipv4Header const&, ns3::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> ecb) [member function]
cls.add_method('RouteInput',
'bool',
@@ -498,6 +513,14 @@
'void',
[param('ns3::Ptr< ns3::Ipv4 >', 'ipv4')],
is_virtual=True)
+ ## aodv-routing-protocol.h: void ns3::aodv::RoutingProtocol::SetMaxQueueLen(uint32_t len) [member function]
+ cls.add_method('SetMaxQueueLen',
+ 'void',
+ [param('uint32_t', 'len')])
+ ## aodv-routing-protocol.h: void ns3::aodv::RoutingProtocol::SetMaxQueueTime(ns3::Time t) [member function]
+ cls.add_method('SetMaxQueueTime',
+ 'void',
+ [param('ns3::Time', 't')])
## aodv-routing-protocol.h: ns3::aodv::RoutingProtocol::AODV_PORT [variable]
cls.add_static_attribute('AODV_PORT', 'uint32_t const', is_const=True)
return
@@ -548,10 +571,11 @@
cls.add_method('MarkLinkAsUnidirectional',
'bool',
[param('ns3::Ipv4Address', 'neighbor'), param('ns3::Time', 'blacklistTimeout')])
- ## aodv-rtable.h: void ns3::aodv::RoutingTable::Print(std::ostream & os) [member function]
+ ## aodv-rtable.h: void ns3::aodv::RoutingTable::Print(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
cls.add_method('Print',
'void',
- [param('std::ostream &', 'os')])
+ [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True)
## aodv-rtable.h: void ns3::aodv::RoutingTable::Purge() [member function]
cls.add_method('Purge',
'void',
@@ -674,10 +698,10 @@
cls.add_method('LookupPrecursor',
'bool',
[param('ns3::Ipv4Address', 'id')])
- ## aodv-rtable.h: void ns3::aodv::RoutingTableEntry::Print(std::ostream & os) const [member function]
+ ## aodv-rtable.h: void ns3::aodv::RoutingTableEntry::Print(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
cls.add_method('Print',
'void',
- [param('std::ostream &', 'os')],
+ [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
is_const=True)
## aodv-rtable.h: void ns3::aodv::RoutingTableEntry::SetBalcklistTimeout(ns3::Time t) [member function]
cls.add_method('SetBalcklistTimeout',
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bindings/python/apidefs/gcc-LP64/ns3_module_bulk_send.py Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,164 @@
+from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
+
+def register_types(module):
+ root_module = module.get_root()
+
+ ## bulk-send-application.h: ns3::BulkSendApplication [class]
+ module.add_class('BulkSendApplication', parent=root_module['ns3::Application'])
+
+ ## Register a nested module for the namespace Config
+
+ nested_module = module.add_cpp_namespace('Config')
+ register_types_ns3_Config(nested_module)
+
+
+ ## Register a nested module for the namespace FatalImpl
+
+ nested_module = module.add_cpp_namespace('FatalImpl')
+ register_types_ns3_FatalImpl(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 aodv
+
+ nested_module = module.add_cpp_namespace('aodv')
+ register_types_ns3_aodv(nested_module)
+
+
+ ## Register a nested module for the namespace dot11s
+
+ nested_module = module.add_cpp_namespace('dot11s')
+ register_types_ns3_dot11s(nested_module)
+
+
+ ## Register a nested module for the namespace flame
+
+ nested_module = module.add_cpp_namespace('flame')
+ register_types_ns3_flame(nested_module)
+
+
+ ## Register a nested module for the namespace internal
+
+ nested_module = module.add_cpp_namespace('internal')
+ register_types_ns3_internal(nested_module)
+
+
+ ## Register a nested module for the namespace olsr
+
+ nested_module = module.add_cpp_namespace('olsr')
+ register_types_ns3_olsr(nested_module)
+
+
+def register_types_ns3_Config(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_FatalImpl(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_addressUtils(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_aodv(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_dot11s(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_flame(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_internal(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_olsr(module):
+ root_module = module.get_root()
+
+
+def register_methods(root_module):
+ register_Ns3BulkSendApplication_methods(root_module, root_module['ns3::BulkSendApplication'])
+ return
+
+def register_Ns3BulkSendApplication_methods(root_module, cls):
+ ## bulk-send-application.h: ns3::BulkSendApplication::BulkSendApplication(ns3::BulkSendApplication const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::BulkSendApplication const &', 'arg0')])
+ ## bulk-send-application.h: ns3::BulkSendApplication::BulkSendApplication() [constructor]
+ cls.add_constructor([])
+ ## bulk-send-application.h: ns3::Ptr<ns3::Socket> ns3::BulkSendApplication::GetSocket() const [member function]
+ cls.add_method('GetSocket',
+ 'ns3::Ptr< ns3::Socket >',
+ [],
+ is_const=True)
+ ## bulk-send-application.h: static ns3::TypeId ns3::BulkSendApplication::GetTypeId() [member function]
+ cls.add_method('GetTypeId',
+ 'ns3::TypeId',
+ [],
+ is_static=True)
+ ## bulk-send-application.h: void ns3::BulkSendApplication::SetMaxBytes(uint32_t maxBytes) [member function]
+ cls.add_method('SetMaxBytes',
+ 'void',
+ [param('uint32_t', 'maxBytes')])
+ ## bulk-send-application.h: void ns3::BulkSendApplication::DoDispose() [member function]
+ cls.add_method('DoDispose',
+ 'void',
+ [],
+ visibility='protected', is_virtual=True)
+ ## bulk-send-application.h: void ns3::BulkSendApplication::StartApplication() [member function]
+ cls.add_method('StartApplication',
+ 'void',
+ [],
+ visibility='private', is_virtual=True)
+ ## bulk-send-application.h: void ns3::BulkSendApplication::StopApplication() [member function]
+ cls.add_method('StopApplication',
+ 'void',
+ [],
+ visibility='private', is_virtual=True)
+ return
+
+def register_functions(root_module):
+ module = root_module
+ register_functions_ns3_Config(module.get_submodule('Config'), root_module)
+ register_functions_ns3_FatalImpl(module.get_submodule('FatalImpl'), root_module)
+ register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
+ register_functions_ns3_aodv(module.get_submodule('aodv'), root_module)
+ register_functions_ns3_dot11s(module.get_submodule('dot11s'), root_module)
+ register_functions_ns3_flame(module.get_submodule('flame'), root_module)
+ register_functions_ns3_internal(module.get_submodule('internal'), root_module)
+ register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
+ return
+
+def register_functions_ns3_Config(module, root_module):
+ return
+
+def register_functions_ns3_FatalImpl(module, root_module):
+ return
+
+def register_functions_ns3_addressUtils(module, root_module):
+ return
+
+def register_functions_ns3_aodv(module, root_module):
+ return
+
+def register_functions_ns3_dot11s(module, root_module):
+ return
+
+def register_functions_ns3_flame(module, root_module):
+ return
+
+def register_functions_ns3_internal(module, root_module):
+ return
+
+def register_functions_ns3_olsr(module, root_module):
+ return
+
--- a/bindings/python/apidefs/gcc-LP64/ns3_module_common.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-LP64/ns3_module_common.py Tue Dec 21 17:46:35 2010 +0100
@@ -2075,6 +2075,8 @@
cls.add_constructor([param('ns3::OutputStreamWrapper const &', 'arg0')])
## output-stream-wrapper.h: ns3::OutputStreamWrapper::OutputStreamWrapper(std::string filename, std::_Ios_Openmode filemode) [constructor]
cls.add_constructor([param('std::string', 'filename'), param('std::_Ios_Openmode', 'filemode')])
+ ## output-stream-wrapper.h: ns3::OutputStreamWrapper::OutputStreamWrapper(std::ostream * os) [constructor]
+ cls.add_constructor([param('std::ostream *', 'os')])
## output-stream-wrapper.h: std::ostream * ns3::OutputStreamWrapper::GetStream() [member function]
cls.add_method('GetStream',
'std::ostream *',
--- a/bindings/python/apidefs/gcc-LP64/ns3_module_core.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-LP64/ns3_module_core.py Tue Dec 21 17:46:35 2010 +0100
@@ -211,6 +211,7 @@
module.add_class('Vector3DChecker', parent=root_module['ns3::AttributeChecker'])
## vector.h: ns3::Vector3DValue [class]
module.add_class('Vector3DValue', parent=root_module['ns3::AttributeValue'])
+ module.add_container('std::set< ns3::TypeId >', 'ns3::TypeId', container_type='set')
module.add_container('std::list< ns3::Ptr< ns3::SpectrumPhy > >', 'ns3::Ptr< ns3::SpectrumPhy >', container_type='list')
module.add_container('std::list< ns3::Ptr< ns3::Packet > >', 'ns3::Ptr< ns3::Packet >', container_type='list')
module.add_container('std::list< ns3::Ptr< ns3::UanPhy > >', 'ns3::Ptr< ns3::UanPhy >', container_type='list')
@@ -350,6 +351,7 @@
register_Ns3TestRunner_methods(root_module, root_module['ns3::TestRunner'])
register_Ns3TestSuite_methods(root_module, root_module['ns3::TestSuite'])
register_Ns3TracedValue__Double_methods(root_module, root_module['ns3::TracedValue< double >'])
+ register_Ns3TracedValue__Ns3Time_methods(root_module, root_module['ns3::TracedValue< ns3::Time >'])
register_Ns3TriangularVariable_methods(root_module, root_module['ns3::TriangularVariable'])
register_Ns3TypeId_methods(root_module, root_module['ns3::TypeId'])
register_Ns3TypeIdAttributeInfo_methods(root_module, root_module['ns3::TypeId::AttributeInfo'])
@@ -1339,6 +1341,40 @@
[param('double const &', 'v')])
return
+def register_Ns3TracedValue__Ns3Time_methods(root_module, cls):
+ ## traced-value.h: ns3::TracedValue<ns3::Time>::TracedValue() [constructor]
+ cls.add_constructor([])
+ ## traced-value.h: ns3::TracedValue<ns3::Time>::TracedValue(ns3::TracedValue<ns3::Time> const & o) [copy constructor]
+ cls.add_constructor([param('ns3::TracedValue< ns3::Time > const &', 'o')])
+ ## traced-value.h: ns3::TracedValue<ns3::Time>::TracedValue(ns3::Time const & v) [constructor]
+ cls.add_constructor([param('ns3::Time const &', 'v')])
+ ## traced-value.h: void ns3::TracedValue<ns3::Time>::Connect(ns3::CallbackBase const & cb, std::basic_string<char,std::char_traits<char>,std::allocator<char> > path) [member function]
+ cls.add_method('Connect',
+ 'void',
+ [param('ns3::CallbackBase const &', 'cb'), param('std::string', 'path')])
+ ## traced-value.h: void ns3::TracedValue<ns3::Time>::ConnectWithoutContext(ns3::CallbackBase const & cb) [member function]
+ cls.add_method('ConnectWithoutContext',
+ 'void',
+ [param('ns3::CallbackBase const &', 'cb')])
+ ## traced-value.h: void ns3::TracedValue<ns3::Time>::Disconnect(ns3::CallbackBase const & cb, std::basic_string<char,std::char_traits<char>,std::allocator<char> > path) [member function]
+ cls.add_method('Disconnect',
+ 'void',
+ [param('ns3::CallbackBase const &', 'cb'), param('std::string', 'path')])
+ ## traced-value.h: void ns3::TracedValue<ns3::Time>::DisconnectWithoutContext(ns3::CallbackBase const & cb) [member function]
+ cls.add_method('DisconnectWithoutContext',
+ 'void',
+ [param('ns3::CallbackBase const &', 'cb')])
+ ## traced-value.h: ns3::Time ns3::TracedValue<ns3::Time>::Get() const [member function]
+ cls.add_method('Get',
+ 'ns3::Time',
+ [],
+ is_const=True)
+ ## traced-value.h: void ns3::TracedValue<ns3::Time>::Set(ns3::Time const & v) [member function]
+ cls.add_method('Set',
+ 'void',
+ [param('ns3::Time const &', 'v')])
+ return
+
def register_Ns3TriangularVariable_methods(root_module, cls):
## random-variable.h: ns3::TriangularVariable::TriangularVariable(ns3::TriangularVariable const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TriangularVariable const &', 'arg0')])
--- a/bindings/python/apidefs/gcc-LP64/ns3_module_helper.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-LP64/ns3_module_helper.py Tue Dec 21 17:46:35 2010 +0100
@@ -19,6 +19,8 @@
module.add_class('AsciiTraceHelperForIpv6', allow_subclassing=True)
## athstats-helper.h: ns3::AthstatsHelper [class]
module.add_class('AthstatsHelper')
+ ## bulk-send-helper.h: ns3::BulkSendHelper [class]
+ module.add_class('BulkSendHelper')
## csma-star-helper.h: ns3::CsmaStarHelper [class]
module.add_class('CsmaStarHelper')
## ipv4-address-helper.h: ns3::Ipv4AddressHelper [class]
@@ -229,6 +231,7 @@
register_Ns3AsciiTraceHelperForIpv4_methods(root_module, root_module['ns3::AsciiTraceHelperForIpv4'])
register_Ns3AsciiTraceHelperForIpv6_methods(root_module, root_module['ns3::AsciiTraceHelperForIpv6'])
register_Ns3AthstatsHelper_methods(root_module, root_module['ns3::AthstatsHelper'])
+ register_Ns3BulkSendHelper_methods(root_module, root_module['ns3::BulkSendHelper'])
register_Ns3CsmaStarHelper_methods(root_module, root_module['ns3::CsmaStarHelper'])
register_Ns3Ipv4AddressHelper_methods(root_module, root_module['ns3::Ipv4AddressHelper'])
register_Ns3Ipv4InterfaceContainer_methods(root_module, root_module['ns3::Ipv4InterfaceContainer'])
@@ -667,6 +670,32 @@
[param('std::string', 'filename'), param('ns3::NodeContainer', 'n')])
return
+def register_Ns3BulkSendHelper_methods(root_module, cls):
+ ## bulk-send-helper.h: ns3::BulkSendHelper::BulkSendHelper(ns3::BulkSendHelper const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::BulkSendHelper const &', 'arg0')])
+ ## bulk-send-helper.h: ns3::BulkSendHelper::BulkSendHelper(std::string protocol, ns3::Address address) [constructor]
+ cls.add_constructor([param('std::string', 'protocol'), param('ns3::Address', 'address')])
+ ## bulk-send-helper.h: ns3::ApplicationContainer ns3::BulkSendHelper::Install(ns3::NodeContainer c) const [member function]
+ cls.add_method('Install',
+ 'ns3::ApplicationContainer',
+ [param('ns3::NodeContainer', 'c')],
+ is_const=True)
+ ## bulk-send-helper.h: ns3::ApplicationContainer ns3::BulkSendHelper::Install(ns3::Ptr<ns3::Node> node) const [member function]
+ cls.add_method('Install',
+ 'ns3::ApplicationContainer',
+ [param('ns3::Ptr< ns3::Node >', 'node')],
+ is_const=True)
+ ## bulk-send-helper.h: ns3::ApplicationContainer ns3::BulkSendHelper::Install(std::string nodeName) const [member function]
+ cls.add_method('Install',
+ 'ns3::ApplicationContainer',
+ [param('std::string', 'nodeName')],
+ is_const=True)
+ ## bulk-send-helper.h: void ns3::BulkSendHelper::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
+ cls.add_method('SetAttribute',
+ 'void',
+ [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
+ return
+
def register_Ns3CsmaStarHelper_methods(root_module, cls):
## csma-star-helper.h: ns3::CsmaStarHelper::CsmaStarHelper(ns3::CsmaStarHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CsmaStarHelper const &', 'arg0')])
@@ -809,6 +838,26 @@
'ns3::Ptr< ns3::Ipv4RoutingProtocol >',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_pure_virtual=True, is_const=True, is_virtual=True)
+ ## ipv4-routing-helper.h: void ns3::Ipv4RoutingHelper::PrintRoutingTableAllAt(ns3::Time printTime, ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTableAllAt',
+ 'void',
+ [param('ns3::Time', 'printTime'), param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True)
+ ## ipv4-routing-helper.h: void ns3::Ipv4RoutingHelper::PrintRoutingTableAllEvery(ns3::Time printInterval, ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTableAllEvery',
+ 'void',
+ [param('ns3::Time', 'printInterval'), param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True)
+ ## ipv4-routing-helper.h: void ns3::Ipv4RoutingHelper::PrintRoutingTableAt(ns3::Time printTime, ns3::Ptr<ns3::Node> node, ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTableAt',
+ 'void',
+ [param('ns3::Time', 'printTime'), param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True)
+ ## ipv4-routing-helper.h: void ns3::Ipv4RoutingHelper::PrintRoutingTableEvery(ns3::Time printInterval, ns3::Ptr<ns3::Node> node, ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTableEvery',
+ 'void',
+ [param('ns3::Time', 'printInterval'), param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True)
return
def register_Ns3Ipv6AddressHelper_methods(root_module, cls):
--- a/bindings/python/apidefs/gcc-LP64/ns3_module_internet_stack.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-LP64/ns3_module_internet_stack.py Tue Dec 21 17:46:35 2010 +0100
@@ -3552,6 +3552,10 @@
cls.add_method('CreateSocket',
'ns3::Ptr< ns3::Socket >',
[])
+ ## tcp-l4-protocol.h: ns3::Ptr<ns3::Socket> ns3::TcpL4Protocol::CreateSocket(ns3::TypeId socketTypeId) [member function]
+ cls.add_method('CreateSocket',
+ 'ns3::Ptr< ns3::Socket >',
+ [param('ns3::TypeId', 'socketTypeId')])
## tcp-l4-protocol.h: ns3::Ipv4EndPoint * ns3::TcpL4Protocol::Allocate() [member function]
cls.add_method('Allocate',
'ns3::Ipv4EndPoint *',
--- a/bindings/python/apidefs/gcc-LP64/ns3_module_mesh.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-LP64/ns3_module_mesh.py Tue Dec 21 17:46:35 2010 +0100
@@ -11,12 +11,12 @@
module.add_class('MeshInformationElementVector', parent=root_module['ns3::WifiInformationElementVector'])
## mesh-l2-routing-protocol.h: ns3::MeshL2RoutingProtocol [class]
module.add_class('MeshL2RoutingProtocol', parent=root_module['ns3::Object'])
- ## mesh-wifi-interface-mac.h: ns3::MeshWifiInterfaceMac [class]
- module.add_class('MeshWifiInterfaceMac', parent=root_module['ns3::WifiMac'])
## mesh-wifi-interface-mac-plugin.h: ns3::MeshWifiInterfaceMacPlugin [class]
module.add_class('MeshWifiInterfaceMacPlugin', parent=root_module['ns3::SimpleRefCount< ns3::MeshWifiInterfaceMacPlugin, ns3::empty, ns3::DefaultDeleter<ns3::MeshWifiInterfaceMacPlugin> >'])
## mesh-point-device.h: ns3::MeshPointDevice [class]
module.add_class('MeshPointDevice', parent=root_module['ns3::NetDevice'])
+ ## mesh-wifi-interface-mac.h: ns3::MeshWifiInterfaceMac [class]
+ module.add_class('MeshWifiInterfaceMac', parent=root_module['ns3::RegularWifiMac'])
## Register a nested module for the namespace Config
@@ -102,9 +102,9 @@
register_Ns3MeshWifiBeacon_methods(root_module, root_module['ns3::MeshWifiBeacon'])
register_Ns3MeshInformationElementVector_methods(root_module, root_module['ns3::MeshInformationElementVector'])
register_Ns3MeshL2RoutingProtocol_methods(root_module, root_module['ns3::MeshL2RoutingProtocol'])
- register_Ns3MeshWifiInterfaceMac_methods(root_module, root_module['ns3::MeshWifiInterfaceMac'])
register_Ns3MeshWifiInterfaceMacPlugin_methods(root_module, root_module['ns3::MeshWifiInterfaceMacPlugin'])
register_Ns3MeshPointDevice_methods(root_module, root_module['ns3::MeshPointDevice'])
+ register_Ns3MeshWifiInterfaceMac_methods(root_module, root_module['ns3::MeshWifiInterfaceMac'])
return
def register_Ns3MeshWifiBeacon_methods(root_module, cls):
@@ -179,260 +179,6 @@
[param('ns3::Ptr< ns3::MeshPointDevice >', 'mp')])
return
-def register_Ns3MeshWifiInterfaceMac_methods(root_module, cls):
- ## mesh-wifi-interface-mac.h: ns3::MeshWifiInterfaceMac::MeshWifiInterfaceMac(ns3::MeshWifiInterfaceMac const & arg0) [copy constructor]
- cls.add_constructor([param('ns3::MeshWifiInterfaceMac const &', 'arg0')])
- ## mesh-wifi-interface-mac.h: ns3::MeshWifiInterfaceMac::MeshWifiInterfaceMac() [constructor]
- cls.add_constructor([])
- ## mesh-wifi-interface-mac.h: bool ns3::MeshWifiInterfaceMac::CheckSupportedRates(ns3::SupportedRates rates) const [member function]
- cls.add_method('CheckSupportedRates',
- 'bool',
- [param('ns3::SupportedRates', 'rates')],
- is_const=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::FinishConfigureStandard(ns3::WifiPhyStandard standard) [member function]
- cls.add_method('FinishConfigureStandard',
- 'void',
- [param('ns3::WifiPhyStandard', 'standard')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetAckTimeout() const [member function]
- cls.add_method('GetAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## mesh-wifi-interface-mac.h: ns3::Mac48Address ns3::MeshWifiInterfaceMac::GetAddress() const [member function]
- cls.add_method('GetAddress',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetBeaconInterval() const [member function]
- cls.add_method('GetBeaconInterval',
- 'ns3::Time',
- [],
- is_const=True)
- ## mesh-wifi-interface-mac.h: ns3::Mac48Address ns3::MeshWifiInterfaceMac::GetBssid() const [member function]
- cls.add_method('GetBssid',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetCtsTimeout() const [member function]
- cls.add_method('GetCtsTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetEifsNoDifs() const [member function]
- cls.add_method('GetEifsNoDifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## mesh-wifi-interface-mac.h: uint16_t ns3::MeshWifiInterfaceMac::GetFrequencyChannel() const [member function]
- cls.add_method('GetFrequencyChannel',
- 'uint16_t',
- [],
- is_const=True)
- ## mesh-wifi-interface-mac.h: uint32_t ns3::MeshWifiInterfaceMac::GetLinkMetric(ns3::Mac48Address peerAddress) [member function]
- cls.add_method('GetLinkMetric',
- 'uint32_t',
- [param('ns3::Mac48Address', 'peerAddress')])
- ## mesh-wifi-interface-mac.h: ns3::Mac48Address ns3::MeshWifiInterfaceMac::GetMeshPointAddress() const [member function]
- cls.add_method('GetMeshPointAddress',
- 'ns3::Mac48Address',
- [],
- is_const=True)
- ## mesh-wifi-interface-mac.h: ns3::WifiPhyStandard ns3::MeshWifiInterfaceMac::GetPhyStandard() const [member function]
- cls.add_method('GetPhyStandard',
- 'ns3::WifiPhyStandard',
- [],
- is_const=True)
- ## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetPifs() const [member function]
- cls.add_method('GetPifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetSifs() const [member function]
- cls.add_method('GetSifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetSlot() const [member function]
- cls.add_method('GetSlot',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## mesh-wifi-interface-mac.h: ns3::Ssid ns3::MeshWifiInterfaceMac::GetSsid() const [member function]
- cls.add_method('GetSsid',
- 'ns3::Ssid',
- [],
- is_const=True, is_virtual=True)
- ## mesh-wifi-interface-mac.h: ns3::Ptr<ns3::WifiRemoteStationManager> ns3::MeshWifiInterfaceMac::GetStationManager() [member function]
- cls.add_method('GetStationManager',
- 'ns3::Ptr< ns3::WifiRemoteStationManager >',
- [])
- ## mesh-wifi-interface-mac.h: ns3::SupportedRates ns3::MeshWifiInterfaceMac::GetSupportedRates() const [member function]
- cls.add_method('GetSupportedRates',
- 'ns3::SupportedRates',
- [],
- is_const=True)
- ## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetTbtt() const [member function]
- cls.add_method('GetTbtt',
- 'ns3::Time',
- [],
- is_const=True)
- ## mesh-wifi-interface-mac.h: static ns3::TypeId ns3::MeshWifiInterfaceMac::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
- ## mesh-wifi-interface-mac.h: ns3::Ptr<ns3::WifiPhy> ns3::MeshWifiInterfaceMac::GetWifiPhy() const [member function]
- cls.add_method('GetWifiPhy',
- 'ns3::Ptr< ns3::WifiPhy >',
- [],
- is_const=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::InstallPlugin(ns3::Ptr<ns3::MeshWifiInterfaceMacPlugin> plugin) [member function]
- cls.add_method('InstallPlugin',
- 'void',
- [param('ns3::Ptr< ns3::MeshWifiInterfaceMacPlugin >', 'plugin')])
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::Report(std::ostream & arg0) const [member function]
- cls.add_method('Report',
- 'void',
- [param('std::ostream &', 'arg0')],
- is_const=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::ResetStats() [member function]
- cls.add_method('ResetStats',
- 'void',
- [])
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SendManagementFrame(ns3::Ptr<ns3::Packet> frame, ns3::WifiMacHeader const & hdr) [member function]
- cls.add_method('SendManagementFrame',
- 'void',
- [param('ns3::Ptr< ns3::Packet >', 'frame'), param('ns3::WifiMacHeader const &', 'hdr')])
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetAckTimeout(ns3::Time ackTimeout) [member function]
- cls.add_method('SetAckTimeout',
- 'void',
- [param('ns3::Time', 'ackTimeout')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetAddress(ns3::Mac48Address address) [member function]
- cls.add_method('SetAddress',
- 'void',
- [param('ns3::Mac48Address', 'address')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetBeaconGeneration(bool enable) [member function]
- cls.add_method('SetBeaconGeneration',
- 'void',
- [param('bool', 'enable')])
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetBeaconInterval(ns3::Time interval) [member function]
- cls.add_method('SetBeaconInterval',
- 'void',
- [param('ns3::Time', 'interval')])
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetCtsTimeout(ns3::Time ctsTimeout) [member function]
- cls.add_method('SetCtsTimeout',
- 'void',
- [param('ns3::Time', 'ctsTimeout')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetEifsNoDifs(ns3::Time eifsNoDifs) [member function]
- cls.add_method('SetEifsNoDifs',
- 'void',
- [param('ns3::Time', 'eifsNoDifs')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetForwardUpCallback(ns3::Callback<void, ns3::Ptr<ns3::Packet>, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> upCallback) [member function]
- cls.add_method('SetForwardUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'upCallback')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetLinkDownCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkDown) [member function]
- cls.add_method('SetLinkDownCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkDown')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetLinkMetricCallback(ns3::Callback<unsigned int, ns3::Mac48Address, ns3::Ptr<ns3::MeshWifiInterfaceMac>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> cb) [member function]
- cls.add_method('SetLinkMetricCallback',
- 'void',
- [param('ns3::Callback< unsigned int, ns3::Mac48Address, ns3::Ptr< ns3::MeshWifiInterfaceMac >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')])
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
- cls.add_method('SetLinkUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetMeshPointAddress(ns3::Mac48Address arg0) [member function]
- cls.add_method('SetMeshPointAddress',
- 'void',
- [param('ns3::Mac48Address', 'arg0')])
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetPifs(ns3::Time pifs) [member function]
- cls.add_method('SetPifs',
- 'void',
- [param('ns3::Time', 'pifs')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetQueue(ns3::AcIndex ac) [member function]
- cls.add_method('SetQueue',
- 'void',
- [param('ns3::AcIndex', 'ac')])
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetRandomStartDelay(ns3::Time interval) [member function]
- cls.add_method('SetRandomStartDelay',
- 'void',
- [param('ns3::Time', 'interval')])
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetSifs(ns3::Time sifs) [member function]
- cls.add_method('SetSifs',
- 'void',
- [param('ns3::Time', 'sifs')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetSlot(ns3::Time slotTime) [member function]
- cls.add_method('SetSlot',
- 'void',
- [param('ns3::Time', 'slotTime')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetSsid(ns3::Ssid ssid) [member function]
- cls.add_method('SetSsid',
- 'void',
- [param('ns3::Ssid', 'ssid')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetWifiPhy(ns3::Ptr<ns3::WifiPhy> phy) [member function]
- cls.add_method('SetWifiPhy',
- 'void',
- [param('ns3::Ptr< ns3::WifiPhy >', 'phy')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetWifiRemoteStationManager(ns3::Ptr<ns3::WifiRemoteStationManager> stationManager) [member function]
- cls.add_method('SetWifiRemoteStationManager',
- 'void',
- [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')],
- is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::ShiftTbtt(ns3::Time shift) [member function]
- cls.add_method('ShiftTbtt',
- 'void',
- [param('ns3::Time', 'shift')])
- ## mesh-wifi-interface-mac.h: bool ns3::MeshWifiInterfaceMac::SupportsSendFrom() const [member function]
- cls.add_method('SupportsSendFrom',
- 'bool',
- [],
- is_const=True, is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SwitchFrequencyChannel(uint16_t new_id) [member function]
- cls.add_method('SwitchFrequencyChannel',
- 'void',
- [param('uint16_t', 'new_id')])
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::DoDispose() [member function]
- cls.add_method('DoDispose',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::DoStart() [member function]
- cls.add_method('DoStart',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::ForwardUp(ns3::Ptr<ns3::Packet> packet, ns3::Mac48Address src, ns3::Mac48Address dst) [member function]
- cls.add_method('ForwardUp',
- 'void',
- [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Mac48Address', 'src'), param('ns3::Mac48Address', 'dst')],
- visibility='private', is_virtual=True)
- return
-
def register_Ns3MeshWifiInterfaceMacPlugin_methods(root_module, cls):
## mesh-wifi-interface-mac-plugin.h: ns3::MeshWifiInterfaceMacPlugin::MeshWifiInterfaceMacPlugin() [constructor]
cls.add_constructor([])
@@ -634,6 +380,137 @@
is_const=True, is_virtual=True)
return
+def register_Ns3MeshWifiInterfaceMac_methods(root_module, cls):
+ ## mesh-wifi-interface-mac.h: ns3::MeshWifiInterfaceMac::MeshWifiInterfaceMac(ns3::MeshWifiInterfaceMac const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::MeshWifiInterfaceMac const &', 'arg0')])
+ ## mesh-wifi-interface-mac.h: ns3::MeshWifiInterfaceMac::MeshWifiInterfaceMac() [constructor]
+ cls.add_constructor([])
+ ## mesh-wifi-interface-mac.h: bool ns3::MeshWifiInterfaceMac::CheckSupportedRates(ns3::SupportedRates rates) const [member function]
+ cls.add_method('CheckSupportedRates',
+ 'bool',
+ [param('ns3::SupportedRates', 'rates')],
+ is_const=True)
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
+ cls.add_method('Enqueue',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')],
+ is_virtual=True)
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
+ cls.add_method('Enqueue',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
+ is_virtual=True)
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::FinishConfigureStandard(ns3::WifiPhyStandard standard) [member function]
+ cls.add_method('FinishConfigureStandard',
+ 'void',
+ [param('ns3::WifiPhyStandard', 'standard')],
+ is_virtual=True)
+ ## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetBeaconInterval() const [member function]
+ cls.add_method('GetBeaconInterval',
+ 'ns3::Time',
+ [],
+ is_const=True)
+ ## mesh-wifi-interface-mac.h: uint16_t ns3::MeshWifiInterfaceMac::GetFrequencyChannel() const [member function]
+ cls.add_method('GetFrequencyChannel',
+ 'uint16_t',
+ [],
+ is_const=True)
+ ## mesh-wifi-interface-mac.h: uint32_t ns3::MeshWifiInterfaceMac::GetLinkMetric(ns3::Mac48Address peerAddress) [member function]
+ cls.add_method('GetLinkMetric',
+ 'uint32_t',
+ [param('ns3::Mac48Address', 'peerAddress')])
+ ## mesh-wifi-interface-mac.h: ns3::Mac48Address ns3::MeshWifiInterfaceMac::GetMeshPointAddress() const [member function]
+ cls.add_method('GetMeshPointAddress',
+ 'ns3::Mac48Address',
+ [],
+ is_const=True)
+ ## mesh-wifi-interface-mac.h: ns3::WifiPhyStandard ns3::MeshWifiInterfaceMac::GetPhyStandard() const [member function]
+ cls.add_method('GetPhyStandard',
+ 'ns3::WifiPhyStandard',
+ [],
+ is_const=True)
+ ## mesh-wifi-interface-mac.h: ns3::SupportedRates ns3::MeshWifiInterfaceMac::GetSupportedRates() const [member function]
+ cls.add_method('GetSupportedRates',
+ 'ns3::SupportedRates',
+ [],
+ is_const=True)
+ ## mesh-wifi-interface-mac.h: ns3::Time ns3::MeshWifiInterfaceMac::GetTbtt() const [member function]
+ cls.add_method('GetTbtt',
+ 'ns3::Time',
+ [],
+ is_const=True)
+ ## mesh-wifi-interface-mac.h: static ns3::TypeId ns3::MeshWifiInterfaceMac::GetTypeId() [member function]
+ cls.add_method('GetTypeId',
+ 'ns3::TypeId',
+ [],
+ is_static=True)
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::InstallPlugin(ns3::Ptr<ns3::MeshWifiInterfaceMacPlugin> plugin) [member function]
+ cls.add_method('InstallPlugin',
+ 'void',
+ [param('ns3::Ptr< ns3::MeshWifiInterfaceMacPlugin >', 'plugin')])
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::Report(std::ostream & arg0) const [member function]
+ cls.add_method('Report',
+ 'void',
+ [param('std::ostream &', 'arg0')],
+ is_const=True)
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::ResetStats() [member function]
+ cls.add_method('ResetStats',
+ 'void',
+ [])
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SendManagementFrame(ns3::Ptr<ns3::Packet> frame, ns3::WifiMacHeader const & hdr) [member function]
+ cls.add_method('SendManagementFrame',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'frame'), param('ns3::WifiMacHeader const &', 'hdr')])
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetBeaconGeneration(bool enable) [member function]
+ cls.add_method('SetBeaconGeneration',
+ 'void',
+ [param('bool', 'enable')])
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetBeaconInterval(ns3::Time interval) [member function]
+ cls.add_method('SetBeaconInterval',
+ 'void',
+ [param('ns3::Time', 'interval')])
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetLinkMetricCallback(ns3::Callback<unsigned int, ns3::Mac48Address, ns3::Ptr<ns3::MeshWifiInterfaceMac>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> cb) [member function]
+ cls.add_method('SetLinkMetricCallback',
+ 'void',
+ [param('ns3::Callback< unsigned int, ns3::Mac48Address, ns3::Ptr< ns3::MeshWifiInterfaceMac >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')])
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
+ cls.add_method('SetLinkUpCallback',
+ 'void',
+ [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
+ is_virtual=True)
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetMeshPointAddress(ns3::Mac48Address arg0) [member function]
+ cls.add_method('SetMeshPointAddress',
+ 'void',
+ [param('ns3::Mac48Address', 'arg0')])
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SetRandomStartDelay(ns3::Time interval) [member function]
+ cls.add_method('SetRandomStartDelay',
+ 'void',
+ [param('ns3::Time', 'interval')])
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::ShiftTbtt(ns3::Time shift) [member function]
+ cls.add_method('ShiftTbtt',
+ 'void',
+ [param('ns3::Time', 'shift')])
+ ## mesh-wifi-interface-mac.h: bool ns3::MeshWifiInterfaceMac::SupportsSendFrom() const [member function]
+ cls.add_method('SupportsSendFrom',
+ 'bool',
+ [],
+ is_const=True, is_virtual=True)
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::SwitchFrequencyChannel(uint16_t new_id) [member function]
+ cls.add_method('SwitchFrequencyChannel',
+ 'void',
+ [param('uint16_t', 'new_id')])
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::DoDispose() [member function]
+ cls.add_method('DoDispose',
+ 'void',
+ [],
+ visibility='private', is_virtual=True)
+ ## mesh-wifi-interface-mac.h: void ns3::MeshWifiInterfaceMac::Receive(ns3::Ptr<ns3::Packet> packet, ns3::WifiMacHeader const * hdr) [member function]
+ cls.add_method('Receive',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::WifiMacHeader const *', 'hdr')],
+ visibility='private', is_virtual=True)
+ return
+
def register_functions(root_module):
module = root_module
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
--- a/bindings/python/apidefs/gcc-LP64/ns3_module_nix_vector_routing.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-LP64/ns3_module_nix_vector_routing.py Tue Dec 21 17:46:35 2010 +0100
@@ -139,6 +139,11 @@
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
visibility='private', is_virtual=True)
+ ## ipv4-nix-vector-routing.h: void ns3::Ipv4NixVectorRouting::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTable',
+ 'void',
+ [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True, visibility='private', is_virtual=True)
## ipv4-nix-vector-routing.h: bool ns3::Ipv4NixVectorRouting::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<ns3::Packet const>, ns3::Ipv4Header const&, 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<ns3::Packet const>, ns3::Ipv4Header const&, ns3::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> ecb) [member function]
cls.add_method('RouteInput',
'bool',
--- a/bindings/python/apidefs/gcc-LP64/ns3_module_node.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-LP64/ns3_module_node.py Tue Dec 21 17:46:35 2010 +0100
@@ -5,6 +5,8 @@
## packetbb.h: ns3::PbbAddressLength [enumeration]
module.add_enum('PbbAddressLength', ['IPV4', 'IPV6'])
+ ## tcp-socket.h: ns3::TcpStates_t [enumeration]
+ module.add_enum('TcpStates_t', ['CLOSED', 'LISTEN', 'SYN_SENT', 'SYN_RCVD', 'ESTABLISHED', 'CLOSE_WAIT', 'LAST_ACK', 'FIN_WAIT_1', 'FIN_WAIT_2', 'CLOSING', 'TIME_WAIT', 'LAST_STATE'])
## ethernet-header.h: ns3::ethernet_header_t [enumeration]
module.add_enum('ethernet_header_t', ['LENGTH', 'VLAN', 'QINQ'])
## address.h: ns3::Address [class]
@@ -103,6 +105,8 @@
module.add_class('Socket', parent=root_module['ns3::Object'])
## socket.h: ns3::Socket::SocketErrno [enumeration]
module.add_enum('SocketErrno', ['ERROR_NOTERROR', 'ERROR_ISCONN', 'ERROR_NOTCONN', 'ERROR_MSGSIZE', 'ERROR_AGAIN', 'ERROR_SHUTDOWN', 'ERROR_OPNOTSUPP', 'ERROR_AFNOSUPPORT', 'ERROR_INVAL', 'ERROR_BADF', 'ERROR_NOROUTETOHOST', 'ERROR_NODEV', 'ERROR_ADDRNOTAVAIL', 'SOCKET_ERRNO_LAST'], outer_class=root_module['ns3::Socket'])
+ ## socket.h: ns3::Socket::SocketType [enumeration]
+ module.add_enum('SocketType', ['NS3_SOCK_STREAM', 'NS3_SOCK_SEQPACKET', 'NS3_SOCK_DGRAM', 'NS3_SOCK_RAW'], outer_class=root_module['ns3::Socket'])
## socket.h: ns3::SocketAddressTag [class]
module.add_class('SocketAddressTag', parent=root_module['ns3::Tag'])
## socket-factory.h: ns3::SocketFactory [class]
@@ -212,12 +216,12 @@
module.add_container('ns3::olsr::MprSet', 'ns3::Ipv4Address', container_type='set')
module.add_container('std::vector< ns3::Ipv4Address >', 'ns3::Ipv4Address', container_type='vector')
module.add_container('std::vector< ns3::Ipv6Address >', 'ns3::Ipv6Address', container_type='vector')
+ typehandlers.add_type_alias('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ns3::PhyMacRxEndErrorCallback')
+ typehandlers.add_type_alias('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', 'ns3::PhyMacRxEndErrorCallback*')
+ typehandlers.add_type_alias('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', 'ns3::PhyMacRxEndErrorCallback&')
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ns3::PhyMacTxEndCallback')
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', 'ns3::PhyMacTxEndCallback*')
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', 'ns3::PhyMacTxEndCallback&')
- typehandlers.add_type_alias('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ns3::PhyMacRxEndErrorCallback')
- typehandlers.add_type_alias('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', 'ns3::PhyMacRxEndErrorCallback*')
- typehandlers.add_type_alias('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', 'ns3::PhyMacRxEndErrorCallback&')
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ns3::PhyMacRxEndOkCallback')
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', 'ns3::PhyMacRxEndOkCallback*')
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', 'ns3::PhyMacRxEndOkCallback&')
@@ -2217,6 +2221,11 @@
'int',
[param('ns3::Address &', 'address')],
is_pure_virtual=True, is_const=True, is_virtual=True)
+ ## socket.h: ns3::Socket::SocketType ns3::Socket::GetSocketType() const [member function]
+ cls.add_method('GetSocketType',
+ 'ns3::Socket::SocketType',
+ [],
+ is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h: uint32_t ns3::Socket::GetTxAvailable() const [member function]
cls.add_method('GetTxAvailable',
'uint32_t',
@@ -2586,6 +2595,8 @@
'ns3::TypeId',
[],
is_static=True)
+ ## tcp-socket.h: ns3::TcpSocket::TcpStateName [variable]
+ cls.add_static_attribute('TcpStateName', 'char const * [ 11 ] const', is_const=True)
## tcp-socket.h: uint32_t ns3::TcpSocket::GetConnCount() const [member function]
cls.add_method('GetConnCount',
'uint32_t',
@@ -2611,6 +2622,11 @@
'uint32_t',
[],
is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
+ ## tcp-socket.h: ns3::Time ns3::TcpSocket::GetPersistTimeout() const [member function]
+ cls.add_method('GetPersistTimeout',
+ 'ns3::Time',
+ [],
+ is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
## tcp-socket.h: uint32_t ns3::TcpSocket::GetRcvBufSize() const [member function]
cls.add_method('GetRcvBufSize',
'uint32_t',
@@ -2656,6 +2672,11 @@
'void',
[param('uint32_t', 'count')],
is_pure_virtual=True, visibility='private', is_virtual=True)
+ ## tcp-socket.h: void ns3::TcpSocket::SetPersistTimeout(ns3::Time timeout) [member function]
+ cls.add_method('SetPersistTimeout',
+ 'void',
+ [param('ns3::Time', 'timeout')],
+ is_pure_virtual=True, visibility='private', is_virtual=True)
## tcp-socket.h: void ns3::TcpSocket::SetRcvBufSize(uint32_t size) [member function]
cls.add_method('SetRcvBufSize',
'void',
@@ -3400,6 +3421,11 @@
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
is_pure_virtual=True, is_virtual=True)
+ ## ipv4-routing-protocol.h: void ns3::Ipv4RoutingProtocol::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTable',
+ 'void',
+ [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_pure_virtual=True, is_const=True, is_virtual=True)
## 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<ns3::Packet const>, ns3::Ipv4Header const&, 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<ns3::Packet const>, ns3::Ipv4Header const&, ns3::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> ecb) [member function]
cls.add_method('RouteInput',
'bool',
--- a/bindings/python/apidefs/gcc-LP64/ns3_module_simulator.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-LP64/ns3_module_simulator.py Tue Dec 21 17:46:35 2010 +0100
@@ -25,6 +25,10 @@
module.add_enum('State', ['RUNNING', 'EXPIRED', 'SUSPENDED'], outer_class=root_module['ns3::Timer'])
## timer-impl.h: ns3::TimerImpl [class]
module.add_class('TimerImpl', allow_subclassing=True)
+ ## traced-value.h: ns3::TracedValue<ns3::Time> [class]
+ module.add_class('TracedValue', template_parameters=['ns3::Time'])
+ ## traced-value.h: ns3::TracedValue<ns3::Time> [class]
+ root_module['ns3::TracedValue< ns3::Time >'].implicitly_converts_to(root_module['ns3::Time'])
## watchdog.h: ns3::Watchdog [class]
module.add_class('Watchdog')
## nstime.h: ns3::Scalar [class]
@@ -389,13 +393,13 @@
def register_Ns3Time_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_inplace_numeric_operator('*=', param('ns3::Time const &', 'right'))
+ cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', 'right'))
cls.add_inplace_numeric_operator('/=', param('ns3::Time const &', 'right'))
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('<=')
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('>=')
- cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bindings/python/apidefs/gcc-LP64/ns3_module_visualizer.py Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,125 @@
+from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
+
+def register_types(module):
+ root_module = module.get_root()
+
+
+ ## Register a nested module for the namespace Config
+
+ nested_module = module.add_cpp_namespace('Config')
+ register_types_ns3_Config(nested_module)
+
+
+ ## Register a nested module for the namespace FatalImpl
+
+ nested_module = module.add_cpp_namespace('FatalImpl')
+ register_types_ns3_FatalImpl(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 aodv
+
+ nested_module = module.add_cpp_namespace('aodv')
+ register_types_ns3_aodv(nested_module)
+
+
+ ## Register a nested module for the namespace dot11s
+
+ nested_module = module.add_cpp_namespace('dot11s')
+ register_types_ns3_dot11s(nested_module)
+
+
+ ## Register a nested module for the namespace flame
+
+ nested_module = module.add_cpp_namespace('flame')
+ register_types_ns3_flame(nested_module)
+
+
+ ## Register a nested module for the namespace internal
+
+ nested_module = module.add_cpp_namespace('internal')
+ register_types_ns3_internal(nested_module)
+
+
+ ## Register a nested module for the namespace olsr
+
+ nested_module = module.add_cpp_namespace('olsr')
+ register_types_ns3_olsr(nested_module)
+
+
+def register_types_ns3_Config(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_FatalImpl(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_addressUtils(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_aodv(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_dot11s(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_flame(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_internal(module):
+ root_module = module.get_root()
+
+
+def register_types_ns3_olsr(module):
+ root_module = module.get_root()
+
+
+def register_methods(root_module):
+ return
+
+def register_functions(root_module):
+ module = root_module
+ register_functions_ns3_Config(module.get_submodule('Config'), root_module)
+ register_functions_ns3_FatalImpl(module.get_submodule('FatalImpl'), root_module)
+ register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
+ register_functions_ns3_aodv(module.get_submodule('aodv'), root_module)
+ register_functions_ns3_dot11s(module.get_submodule('dot11s'), root_module)
+ register_functions_ns3_flame(module.get_submodule('flame'), root_module)
+ register_functions_ns3_internal(module.get_submodule('internal'), root_module)
+ register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
+ return
+
+def register_functions_ns3_Config(module, root_module):
+ return
+
+def register_functions_ns3_FatalImpl(module, root_module):
+ return
+
+def register_functions_ns3_addressUtils(module, root_module):
+ return
+
+def register_functions_ns3_aodv(module, root_module):
+ return
+
+def register_functions_ns3_dot11s(module, root_module):
+ return
+
+def register_functions_ns3_flame(module, root_module):
+ return
+
+def register_functions_ns3_internal(module, root_module):
+ return
+
+def register_functions_ns3_olsr(module, root_module):
+ return
+
--- a/bindings/python/apidefs/gcc-LP64/ns3_module_wifi.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-LP64/ns3_module_wifi.py Tue Dec 21 17:46:35 2010 +0100
@@ -20,7 +20,7 @@
## wifi-mode.h: ns3::WifiCodeRate [enumeration]
module.add_enum('WifiCodeRate', ['WIFI_CODE_RATE_UNDEFINED', 'WIFI_CODE_RATE_3_4', 'WIFI_CODE_RATE_2_3', 'WIFI_CODE_RATE_1_2'])
## edca-txop-n.h: ns3::TypeOfStation [enumeration]
- module.add_enum('TypeOfStation', ['STA', 'AP', 'ADHOC_STA'])
+ module.add_enum('TypeOfStation', ['STA', 'AP', 'ADHOC_STA', 'MESH'])
## block-ack-manager.h: ns3::Bar [struct]
module.add_class('Bar')
## block-ack-agreement.h: ns3::BlockAckAgreement [class]
@@ -135,8 +135,6 @@
module.add_class('AarfWifiManager', parent=root_module['ns3::WifiRemoteStationManager'])
## aarfcd-wifi-manager.h: ns3::AarfcdWifiManager [class]
module.add_class('AarfcdWifiManager', parent=root_module['ns3::WifiRemoteStationManager'])
- ## adhoc-wifi-mac.h: ns3::AdhocWifiMac [class]
- module.add_class('AdhocWifiMac', parent=root_module['ns3::WifiMac'])
## amrr-wifi-manager.h: ns3::AmrrWifiManager [class]
module.add_class('AmrrWifiManager', parent=root_module['ns3::WifiRemoteStationManager'])
## amsdu-subframe-header.h: ns3::AmsduSubframeHeader [class]
@@ -171,18 +169,10 @@
module.add_class('MsduAggregator', parent=root_module['ns3::Object'])
## nist-error-rate-model.h: ns3::NistErrorRateModel [class]
module.add_class('NistErrorRateModel', parent=root_module['ns3::ErrorRateModel'])
- ## nqap-wifi-mac.h: ns3::NqapWifiMac [class]
- module.add_class('NqapWifiMac', parent=root_module['ns3::WifiMac'])
- ## nqsta-wifi-mac.h: ns3::NqstaWifiMac [class]
- module.add_class('NqstaWifiMac', parent=root_module['ns3::WifiMac'])
## onoe-wifi-manager.h: ns3::OnoeWifiManager [class]
module.add_class('OnoeWifiManager', parent=root_module['ns3::WifiRemoteStationManager'])
- ## qadhoc-wifi-mac.h: ns3::QadhocWifiMac [class]
- module.add_class('QadhocWifiMac', parent=root_module['ns3::WifiMac'])
- ## qap-wifi-mac.h: ns3::QapWifiMac [class]
- module.add_class('QapWifiMac', parent=root_module['ns3::WifiMac'])
- ## qsta-wifi-mac.h: ns3::QstaWifiMac [class]
- module.add_class('QstaWifiMac', parent=root_module['ns3::WifiMac'])
+ ## regular-wifi-mac.h: ns3::RegularWifiMac [class]
+ module.add_class('RegularWifiMac', parent=root_module['ns3::WifiMac'])
## rraa-wifi-manager.h: ns3::RraaWifiManager [class]
module.add_class('RraaWifiManager', parent=root_module['ns3::WifiRemoteStationManager'])
## ssid.h: ns3::Ssid [class]
@@ -191,6 +181,8 @@
module.add_class('SsidChecker', parent=root_module['ns3::AttributeChecker'])
## ssid.h: ns3::SsidValue [class]
module.add_class('SsidValue', parent=root_module['ns3::AttributeValue'])
+ ## sta-wifi-mac.h: ns3::StaWifiMac [class]
+ module.add_class('StaWifiMac', parent=root_module['ns3::RegularWifiMac'])
## supported-rates.h: ns3::SupportedRates [class]
module.add_class('SupportedRates', parent=root_module['ns3::WifiInformationElement'])
## wifi-channel.h: ns3::WifiChannel [class]
@@ -205,18 +197,22 @@
module.add_class('YansErrorRateModel', parent=root_module['ns3::ErrorRateModel'])
## yans-wifi-channel.h: ns3::YansWifiChannel [class]
module.add_class('YansWifiChannel', parent=root_module['ns3::WifiChannel'])
+ ## adhoc-wifi-mac.h: ns3::AdhocWifiMac [class]
+ module.add_class('AdhocWifiMac', parent=root_module['ns3::RegularWifiMac'])
+ ## ap-wifi-mac.h: ns3::ApWifiMac [class]
+ module.add_class('ApWifiMac', parent=root_module['ns3::RegularWifiMac'])
## dca-txop.h: ns3::DcaTxop [class]
module.add_class('DcaTxop', parent=root_module['ns3::Dcf'])
module.add_container('ns3::WifiModeList', 'ns3::WifiMode', container_type='vector')
- typehandlers.add_type_alias('__gnu_cxx::__normal_iterator< ns3::WifiMode const *, std::vector< ns3::WifiMode, std::allocator< ns3::WifiMode > > >', 'ns3::WifiModeListIterator')
- typehandlers.add_type_alias('__gnu_cxx::__normal_iterator< ns3::WifiMode const *, std::vector< ns3::WifiMode, std::allocator< ns3::WifiMode > > >*', 'ns3::WifiModeListIterator*')
- typehandlers.add_type_alias('__gnu_cxx::__normal_iterator< ns3::WifiMode const *, std::vector< ns3::WifiMode, std::allocator< ns3::WifiMode > > >&', 'ns3::WifiModeListIterator&')
typehandlers.add_type_alias('std::vector< ns3::WifiMode, std::allocator< ns3::WifiMode > >', 'ns3::WifiModeList')
typehandlers.add_type_alias('std::vector< ns3::WifiMode, std::allocator< ns3::WifiMode > >*', 'ns3::WifiModeList*')
typehandlers.add_type_alias('std::vector< ns3::WifiMode, std::allocator< ns3::WifiMode > >&', 'ns3::WifiModeList&')
typehandlers.add_type_alias('uint8_t', 'ns3::WifiInformationElementId')
typehandlers.add_type_alias('uint8_t*', 'ns3::WifiInformationElementId*')
typehandlers.add_type_alias('uint8_t&', 'ns3::WifiInformationElementId&')
+ typehandlers.add_type_alias('__gnu_cxx::__normal_iterator< ns3::WifiMode const *, std::vector< ns3::WifiMode, std::allocator< ns3::WifiMode > > >', 'ns3::WifiModeListIterator')
+ typehandlers.add_type_alias('__gnu_cxx::__normal_iterator< ns3::WifiMode const *, std::vector< ns3::WifiMode, std::allocator< ns3::WifiMode > > >*', 'ns3::WifiModeListIterator*')
+ typehandlers.add_type_alias('__gnu_cxx::__normal_iterator< ns3::WifiMode const *, std::vector< ns3::WifiMode, std::allocator< ns3::WifiMode > > >&', 'ns3::WifiModeListIterator&')
typehandlers.add_type_alias('std::vector< ns3::RateInfo, std::allocator< ns3::RateInfo > >', 'ns3::MinstrelRate')
typehandlers.add_type_alias('std::vector< ns3::RateInfo, std::allocator< ns3::RateInfo > >*', 'ns3::MinstrelRate*')
typehandlers.add_type_alias('std::vector< ns3::RateInfo, std::allocator< ns3::RateInfo > >&', 'ns3::MinstrelRate&')
@@ -348,7 +344,6 @@
register_Ns3YansWifiPhy_methods(root_module, root_module['ns3::YansWifiPhy'])
register_Ns3AarfWifiManager_methods(root_module, root_module['ns3::AarfWifiManager'])
register_Ns3AarfcdWifiManager_methods(root_module, root_module['ns3::AarfcdWifiManager'])
- register_Ns3AdhocWifiMac_methods(root_module, root_module['ns3::AdhocWifiMac'])
register_Ns3AmrrWifiManager_methods(root_module, root_module['ns3::AmrrWifiManager'])
register_Ns3AmsduSubframeHeader_methods(root_module, root_module['ns3::AmsduSubframeHeader'])
register_Ns3ArfWifiManager_methods(root_module, root_module['ns3::ArfWifiManager'])
@@ -366,16 +361,13 @@
register_Ns3MinstrelWifiManager_methods(root_module, root_module['ns3::MinstrelWifiManager'])
register_Ns3MsduAggregator_methods(root_module, root_module['ns3::MsduAggregator'])
register_Ns3NistErrorRateModel_methods(root_module, root_module['ns3::NistErrorRateModel'])
- register_Ns3NqapWifiMac_methods(root_module, root_module['ns3::NqapWifiMac'])
- register_Ns3NqstaWifiMac_methods(root_module, root_module['ns3::NqstaWifiMac'])
register_Ns3OnoeWifiManager_methods(root_module, root_module['ns3::OnoeWifiManager'])
- register_Ns3QadhocWifiMac_methods(root_module, root_module['ns3::QadhocWifiMac'])
- register_Ns3QapWifiMac_methods(root_module, root_module['ns3::QapWifiMac'])
- register_Ns3QstaWifiMac_methods(root_module, root_module['ns3::QstaWifiMac'])
+ register_Ns3RegularWifiMac_methods(root_module, root_module['ns3::RegularWifiMac'])
register_Ns3RraaWifiManager_methods(root_module, root_module['ns3::RraaWifiManager'])
register_Ns3Ssid_methods(root_module, root_module['ns3::Ssid'])
register_Ns3SsidChecker_methods(root_module, root_module['ns3::SsidChecker'])
register_Ns3SsidValue_methods(root_module, root_module['ns3::SsidValue'])
+ register_Ns3StaWifiMac_methods(root_module, root_module['ns3::StaWifiMac'])
register_Ns3SupportedRates_methods(root_module, root_module['ns3::SupportedRates'])
register_Ns3WifiChannel_methods(root_module, root_module['ns3::WifiChannel'])
register_Ns3WifiModeChecker_methods(root_module, root_module['ns3::WifiModeChecker'])
@@ -383,6 +375,8 @@
register_Ns3WifiNetDevice_methods(root_module, root_module['ns3::WifiNetDevice'])
register_Ns3YansErrorRateModel_methods(root_module, root_module['ns3::YansErrorRateModel'])
register_Ns3YansWifiChannel_methods(root_module, root_module['ns3::YansWifiChannel'])
+ register_Ns3AdhocWifiMac_methods(root_module, root_module['ns3::AdhocWifiMac'])
+ register_Ns3ApWifiMac_methods(root_module, root_module['ns3::ApWifiMac'])
register_Ns3DcaTxop_methods(root_module, root_module['ns3::DcaTxop'])
return
@@ -3799,156 +3793,6 @@
is_const=True, visibility='private', is_virtual=True)
return
-def register_Ns3AdhocWifiMac_methods(root_module, cls):
- ## adhoc-wifi-mac.h: static ns3::TypeId ns3::AdhocWifiMac::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
- ## adhoc-wifi-mac.h: ns3::AdhocWifiMac::AdhocWifiMac() [constructor]
- cls.add_constructor([])
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetSlot(ns3::Time slotTime) [member function]
- cls.add_method('SetSlot',
- 'void',
- [param('ns3::Time', 'slotTime')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetSifs(ns3::Time sifs) [member function]
- cls.add_method('SetSifs',
- 'void',
- [param('ns3::Time', 'sifs')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetEifsNoDifs(ns3::Time eifsNoDifs) [member function]
- cls.add_method('SetEifsNoDifs',
- 'void',
- [param('ns3::Time', 'eifsNoDifs')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetAckTimeout(ns3::Time ackTimeout) [member function]
- cls.add_method('SetAckTimeout',
- 'void',
- [param('ns3::Time', 'ackTimeout')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetCtsTimeout(ns3::Time ctsTimeout) [member function]
- cls.add_method('SetCtsTimeout',
- 'void',
- [param('ns3::Time', 'ctsTimeout')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetPifs(ns3::Time pifs) [member function]
- cls.add_method('SetPifs',
- 'void',
- [param('ns3::Time', 'pifs')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: ns3::Time ns3::AdhocWifiMac::GetSlot() const [member function]
- cls.add_method('GetSlot',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## adhoc-wifi-mac.h: ns3::Time ns3::AdhocWifiMac::GetSifs() const [member function]
- cls.add_method('GetSifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## adhoc-wifi-mac.h: ns3::Time ns3::AdhocWifiMac::GetEifsNoDifs() const [member function]
- cls.add_method('GetEifsNoDifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## adhoc-wifi-mac.h: ns3::Time ns3::AdhocWifiMac::GetAckTimeout() const [member function]
- cls.add_method('GetAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## adhoc-wifi-mac.h: ns3::Time ns3::AdhocWifiMac::GetCtsTimeout() const [member function]
- cls.add_method('GetCtsTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## adhoc-wifi-mac.h: ns3::Time ns3::AdhocWifiMac::GetPifs() const [member function]
- cls.add_method('GetPifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetWifiPhy(ns3::Ptr<ns3::WifiPhy> phy) [member function]
- cls.add_method('SetWifiPhy',
- 'void',
- [param('ns3::Ptr< ns3::WifiPhy >', 'phy')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetWifiRemoteStationManager(ns3::Ptr<ns3::WifiRemoteStationManager> stationManager) [member function]
- cls.add_method('SetWifiRemoteStationManager',
- 'void',
- [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: bool ns3::AdhocWifiMac::SupportsSendFrom() const [member function]
- cls.add_method('SupportsSendFrom',
- 'bool',
- [],
- is_const=True, is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetForwardUpCallback(ns3::Callback<void, ns3::Ptr<ns3::Packet>, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> upCallback) [member function]
- cls.add_method('SetForwardUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'upCallback')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
- cls.add_method('SetLinkUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetLinkDownCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkDown) [member function]
- cls.add_method('SetLinkDownCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkDown')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: ns3::Mac48Address ns3::AdhocWifiMac::GetAddress() const [member function]
- cls.add_method('GetAddress',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## adhoc-wifi-mac.h: ns3::Ssid ns3::AdhocWifiMac::GetSsid() const [member function]
- cls.add_method('GetSsid',
- 'ns3::Ssid',
- [],
- is_const=True, is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetAddress(ns3::Mac48Address address) [member function]
- cls.add_method('SetAddress',
- 'void',
- [param('ns3::Mac48Address', 'address')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetSsid(ns3::Ssid ssid) [member function]
- cls.add_method('SetSsid',
- 'void',
- [param('ns3::Ssid', 'ssid')],
- is_virtual=True)
- ## adhoc-wifi-mac.h: ns3::Mac48Address ns3::AdhocWifiMac::GetBssid() const [member function]
- cls.add_method('GetBssid',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::DoDispose() [member function]
- cls.add_method('DoDispose',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::DoStart() [member function]
- cls.add_method('DoStart',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::FinishConfigureStandard(ns3::WifiPhyStandard standard) [member function]
- cls.add_method('FinishConfigureStandard',
- 'void',
- [param('ns3::WifiPhyStandard', 'standard')],
- visibility='private', is_virtual=True)
- return
-
def register_Ns3AmrrWifiManager_methods(root_module, cls):
## amrr-wifi-manager.h: ns3::AmrrWifiManager::AmrrWifiManager(ns3::AmrrWifiManager const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AmrrWifiManager const &', 'arg0')])
@@ -5181,335 +5025,6 @@
is_static=True)
return
-def register_Ns3NqapWifiMac_methods(root_module, cls):
- ## nqap-wifi-mac.h: static ns3::TypeId ns3::NqapWifiMac::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
- ## nqap-wifi-mac.h: ns3::NqapWifiMac::NqapWifiMac() [constructor]
- cls.add_constructor([])
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetSlot(ns3::Time slotTime) [member function]
- cls.add_method('SetSlot',
- 'void',
- [param('ns3::Time', 'slotTime')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetSifs(ns3::Time sifs) [member function]
- cls.add_method('SetSifs',
- 'void',
- [param('ns3::Time', 'sifs')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetEifsNoDifs(ns3::Time eifsNoDifs) [member function]
- cls.add_method('SetEifsNoDifs',
- 'void',
- [param('ns3::Time', 'eifsNoDifs')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetAckTimeout(ns3::Time ackTimeout) [member function]
- cls.add_method('SetAckTimeout',
- 'void',
- [param('ns3::Time', 'ackTimeout')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetCtsTimeout(ns3::Time ctsTimeout) [member function]
- cls.add_method('SetCtsTimeout',
- 'void',
- [param('ns3::Time', 'ctsTimeout')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetPifs(ns3::Time pifs) [member function]
- cls.add_method('SetPifs',
- 'void',
- [param('ns3::Time', 'pifs')],
- is_virtual=True)
- ## nqap-wifi-mac.h: ns3::Time ns3::NqapWifiMac::GetSlot() const [member function]
- cls.add_method('GetSlot',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqap-wifi-mac.h: ns3::Time ns3::NqapWifiMac::GetSifs() const [member function]
- cls.add_method('GetSifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqap-wifi-mac.h: ns3::Time ns3::NqapWifiMac::GetEifsNoDifs() const [member function]
- cls.add_method('GetEifsNoDifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqap-wifi-mac.h: ns3::Time ns3::NqapWifiMac::GetAckTimeout() const [member function]
- cls.add_method('GetAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqap-wifi-mac.h: ns3::Time ns3::NqapWifiMac::GetCtsTimeout() const [member function]
- cls.add_method('GetCtsTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqap-wifi-mac.h: ns3::Time ns3::NqapWifiMac::GetPifs() const [member function]
- cls.add_method('GetPifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetWifiPhy(ns3::Ptr<ns3::WifiPhy> phy) [member function]
- cls.add_method('SetWifiPhy',
- 'void',
- [param('ns3::Ptr< ns3::WifiPhy >', 'phy')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetWifiRemoteStationManager(ns3::Ptr<ns3::WifiRemoteStationManager> stationManager) [member function]
- cls.add_method('SetWifiRemoteStationManager',
- 'void',
- [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
- is_virtual=True)
- ## nqap-wifi-mac.h: bool ns3::NqapWifiMac::SupportsSendFrom() const [member function]
- cls.add_method('SupportsSendFrom',
- 'bool',
- [],
- is_const=True, is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetForwardUpCallback(ns3::Callback<void, ns3::Ptr<ns3::Packet>, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> upCallback) [member function]
- cls.add_method('SetForwardUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'upCallback')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
- cls.add_method('SetLinkUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetLinkDownCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkDown) [member function]
- cls.add_method('SetLinkDownCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkDown')],
- is_virtual=True)
- ## nqap-wifi-mac.h: ns3::Mac48Address ns3::NqapWifiMac::GetAddress() const [member function]
- cls.add_method('GetAddress',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## nqap-wifi-mac.h: ns3::Ssid ns3::NqapWifiMac::GetSsid() const [member function]
- cls.add_method('GetSsid',
- 'ns3::Ssid',
- [],
- is_const=True, is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetAddress(ns3::Mac48Address address) [member function]
- cls.add_method('SetAddress',
- 'void',
- [param('ns3::Mac48Address', 'address')],
- is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetSsid(ns3::Ssid ssid) [member function]
- cls.add_method('SetSsid',
- 'void',
- [param('ns3::Ssid', 'ssid')],
- is_virtual=True)
- ## nqap-wifi-mac.h: ns3::Mac48Address ns3::NqapWifiMac::GetBssid() const [member function]
- cls.add_method('GetBssid',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::SetBeaconInterval(ns3::Time interval) [member function]
- cls.add_method('SetBeaconInterval',
- 'void',
- [param('ns3::Time', 'interval')])
- ## nqap-wifi-mac.h: ns3::Time ns3::NqapWifiMac::GetBeaconInterval() const [member function]
- cls.add_method('GetBeaconInterval',
- 'ns3::Time',
- [],
- is_const=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::StartBeaconing() [member function]
- cls.add_method('StartBeaconing',
- 'void',
- [])
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::DoDispose() [member function]
- cls.add_method('DoDispose',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::DoStart() [member function]
- cls.add_method('DoStart',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## nqap-wifi-mac.h: void ns3::NqapWifiMac::FinishConfigureStandard(ns3::WifiPhyStandard standard) [member function]
- cls.add_method('FinishConfigureStandard',
- 'void',
- [param('ns3::WifiPhyStandard', 'standard')],
- visibility='private', is_virtual=True)
- return
-
-def register_Ns3NqstaWifiMac_methods(root_module, cls):
- ## nqsta-wifi-mac.h: static ns3::TypeId ns3::NqstaWifiMac::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
- ## nqsta-wifi-mac.h: ns3::NqstaWifiMac::NqstaWifiMac() [constructor]
- cls.add_constructor([])
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetSlot(ns3::Time slotTime) [member function]
- cls.add_method('SetSlot',
- 'void',
- [param('ns3::Time', 'slotTime')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetSifs(ns3::Time sifs) [member function]
- cls.add_method('SetSifs',
- 'void',
- [param('ns3::Time', 'sifs')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetEifsNoDifs(ns3::Time eifsNoDifs) [member function]
- cls.add_method('SetEifsNoDifs',
- 'void',
- [param('ns3::Time', 'eifsNoDifs')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetAckTimeout(ns3::Time ackTimeout) [member function]
- cls.add_method('SetAckTimeout',
- 'void',
- [param('ns3::Time', 'ackTimeout')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetCtsTimeout(ns3::Time ctsTimeout) [member function]
- cls.add_method('SetCtsTimeout',
- 'void',
- [param('ns3::Time', 'ctsTimeout')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetPifs(ns3::Time pifs) [member function]
- cls.add_method('SetPifs',
- 'void',
- [param('ns3::Time', 'pifs')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: ns3::Time ns3::NqstaWifiMac::GetSlot() const [member function]
- cls.add_method('GetSlot',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqsta-wifi-mac.h: ns3::Time ns3::NqstaWifiMac::GetSifs() const [member function]
- cls.add_method('GetSifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqsta-wifi-mac.h: ns3::Time ns3::NqstaWifiMac::GetEifsNoDifs() const [member function]
- cls.add_method('GetEifsNoDifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqsta-wifi-mac.h: ns3::Time ns3::NqstaWifiMac::GetAckTimeout() const [member function]
- cls.add_method('GetAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqsta-wifi-mac.h: ns3::Time ns3::NqstaWifiMac::GetCtsTimeout() const [member function]
- cls.add_method('GetCtsTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqsta-wifi-mac.h: ns3::Time ns3::NqstaWifiMac::GetPifs() const [member function]
- cls.add_method('GetPifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetWifiPhy(ns3::Ptr<ns3::WifiPhy> phy) [member function]
- cls.add_method('SetWifiPhy',
- 'void',
- [param('ns3::Ptr< ns3::WifiPhy >', 'phy')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetWifiRemoteStationManager(ns3::Ptr<ns3::WifiRemoteStationManager> stationManager) [member function]
- cls.add_method('SetWifiRemoteStationManager',
- 'void',
- [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: bool ns3::NqstaWifiMac::SupportsSendFrom() const [member function]
- cls.add_method('SupportsSendFrom',
- 'bool',
- [],
- is_const=True, is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetForwardUpCallback(ns3::Callback<void, ns3::Ptr<ns3::Packet>, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> upCallback) [member function]
- cls.add_method('SetForwardUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'upCallback')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
- cls.add_method('SetLinkUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetLinkDownCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkDown) [member function]
- cls.add_method('SetLinkDownCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkDown')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: ns3::Mac48Address ns3::NqstaWifiMac::GetAddress() const [member function]
- cls.add_method('GetAddress',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## nqsta-wifi-mac.h: ns3::Ssid ns3::NqstaWifiMac::GetSsid() const [member function]
- cls.add_method('GetSsid',
- 'ns3::Ssid',
- [],
- is_const=True, is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetAddress(ns3::Mac48Address address) [member function]
- cls.add_method('SetAddress',
- 'void',
- [param('ns3::Mac48Address', 'address')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetSsid(ns3::Ssid ssid) [member function]
- cls.add_method('SetSsid',
- 'void',
- [param('ns3::Ssid', 'ssid')],
- is_virtual=True)
- ## nqsta-wifi-mac.h: ns3::Mac48Address ns3::NqstaWifiMac::GetBssid() const [member function]
- cls.add_method('GetBssid',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetMaxMissedBeacons(uint32_t missed) [member function]
- cls.add_method('SetMaxMissedBeacons',
- 'void',
- [param('uint32_t', 'missed')])
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetProbeRequestTimeout(ns3::Time timeout) [member function]
- cls.add_method('SetProbeRequestTimeout',
- 'void',
- [param('ns3::Time', 'timeout')])
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::SetAssocRequestTimeout(ns3::Time timeout) [member function]
- cls.add_method('SetAssocRequestTimeout',
- 'void',
- [param('ns3::Time', 'timeout')])
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::StartActiveAssociation() [member function]
- cls.add_method('StartActiveAssociation',
- 'void',
- [])
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::DoStart() [member function]
- cls.add_method('DoStart',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::DoDispose() [member function]
- cls.add_method('DoDispose',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::FinishConfigureStandard(ns3::WifiPhyStandard standard) [member function]
- cls.add_method('FinishConfigureStandard',
- 'void',
- [param('ns3::WifiPhyStandard', 'standard')],
- visibility='private', is_virtual=True)
- return
-
def register_Ns3OnoeWifiManager_methods(root_module, cls):
## onoe-wifi-manager.h: ns3::OnoeWifiManager::OnoeWifiManager(ns3::OnoeWifiManager const & arg0) [copy constructor]
cls.add_constructor([param('ns3::OnoeWifiManager const &', 'arg0')])
@@ -5577,543 +5092,236 @@
is_const=True, visibility='private', is_virtual=True)
return
-def register_Ns3QadhocWifiMac_methods(root_module, cls):
- ## qadhoc-wifi-mac.h: static ns3::TypeId ns3::QadhocWifiMac::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
- ## qadhoc-wifi-mac.h: ns3::QadhocWifiMac::QadhocWifiMac() [constructor]
+def register_Ns3RegularWifiMac_methods(root_module, cls):
+ ## regular-wifi-mac.h: ns3::RegularWifiMac::RegularWifiMac(ns3::RegularWifiMac const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::RegularWifiMac const &', 'arg0')])
+ ## regular-wifi-mac.h: ns3::RegularWifiMac::RegularWifiMac() [constructor]
cls.add_constructor([])
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetSlot(ns3::Time slotTime) [member function]
- cls.add_method('SetSlot',
- 'void',
- [param('ns3::Time', 'slotTime')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetSifs(ns3::Time sifs) [member function]
- cls.add_method('SetSifs',
- 'void',
- [param('ns3::Time', 'sifs')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetEifsNoDifs(ns3::Time eifsNoDifs) [member function]
- cls.add_method('SetEifsNoDifs',
- 'void',
- [param('ns3::Time', 'eifsNoDifs')],
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
+ cls.add_method('Enqueue',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')],
is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetAckTimeout(ns3::Time ackTimeout) [member function]
- cls.add_method('SetAckTimeout',
- 'void',
- [param('ns3::Time', 'ackTimeout')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetCtsTimeout(ns3::Time ctsTimeout) [member function]
- cls.add_method('SetCtsTimeout',
- 'void',
- [param('ns3::Time', 'ctsTimeout')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetPifs(ns3::Time pifs) [member function]
- cls.add_method('SetPifs',
- 'void',
- [param('ns3::Time', 'pifs')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetSlot() const [member function]
- cls.add_method('GetSlot',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetSifs() const [member function]
- cls.add_method('GetSifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetEifsNoDifs() const [member function]
- cls.add_method('GetEifsNoDifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetAckTimeout() const [member function]
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
+ cls.add_method('Enqueue',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
+ is_pure_virtual=True, is_virtual=True)
+ ## regular-wifi-mac.h: ns3::Time ns3::RegularWifiMac::GetAckTimeout() const [member function]
cls.add_method('GetAckTimeout',
'ns3::Time',
[],
is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetCtsTimeout() const [member function]
+ ## regular-wifi-mac.h: ns3::Mac48Address ns3::RegularWifiMac::GetAddress() const [member function]
+ cls.add_method('GetAddress',
+ 'ns3::Mac48Address',
+ [],
+ is_const=True, is_virtual=True)
+ ## regular-wifi-mac.h: ns3::Time ns3::RegularWifiMac::GetBasicBlockAckTimeout() const [member function]
+ cls.add_method('GetBasicBlockAckTimeout',
+ 'ns3::Time',
+ [],
+ is_const=True, is_virtual=True)
+ ## regular-wifi-mac.h: ns3::Mac48Address ns3::RegularWifiMac::GetBssid() const [member function]
+ cls.add_method('GetBssid',
+ 'ns3::Mac48Address',
+ [],
+ is_const=True, is_virtual=True)
+ ## regular-wifi-mac.h: ns3::Time ns3::RegularWifiMac::GetCompressedBlockAckTimeout() const [member function]
+ cls.add_method('GetCompressedBlockAckTimeout',
+ 'ns3::Time',
+ [],
+ is_const=True, is_virtual=True)
+ ## regular-wifi-mac.h: ns3::Time ns3::RegularWifiMac::GetCtsTimeout() const [member function]
cls.add_method('GetCtsTimeout',
'ns3::Time',
[],
is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetPifs() const [member function]
+ ## regular-wifi-mac.h: ns3::Time ns3::RegularWifiMac::GetEifsNoDifs() const [member function]
+ cls.add_method('GetEifsNoDifs',
+ 'ns3::Time',
+ [],
+ is_const=True, is_virtual=True)
+ ## regular-wifi-mac.h: ns3::Time ns3::RegularWifiMac::GetPifs() const [member function]
cls.add_method('GetPifs',
'ns3::Time',
[],
is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetWifiPhy(ns3::Ptr<ns3::WifiPhy> phy) [member function]
- cls.add_method('SetWifiPhy',
- 'void',
- [param('ns3::Ptr< ns3::WifiPhy >', 'phy')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetWifiRemoteStationManager(ns3::Ptr<ns3::WifiRemoteStationManager> stationManager) [member function]
- cls.add_method('SetWifiRemoteStationManager',
- 'void',
- [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: bool ns3::QadhocWifiMac::SupportsSendFrom() const [member function]
- cls.add_method('SupportsSendFrom',
- 'bool',
+ ## regular-wifi-mac.h: ns3::Time ns3::RegularWifiMac::GetSifs() const [member function]
+ cls.add_method('GetSifs',
+ 'ns3::Time',
[],
is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetForwardUpCallback(ns3::Callback<void, ns3::Ptr<ns3::Packet>, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> upCallback) [member function]
- cls.add_method('SetForwardUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'upCallback')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
- cls.add_method('SetLinkUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetLinkDownCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkDown) [member function]
- cls.add_method('SetLinkDownCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkDown')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Mac48Address ns3::QadhocWifiMac::GetAddress() const [member function]
- cls.add_method('GetAddress',
- 'ns3::Mac48Address',
+ ## regular-wifi-mac.h: ns3::Time ns3::RegularWifiMac::GetSlot() const [member function]
+ cls.add_method('GetSlot',
+ 'ns3::Time',
[],
is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Ssid ns3::QadhocWifiMac::GetSsid() const [member function]
+ ## regular-wifi-mac.h: ns3::Ssid ns3::RegularWifiMac::GetSsid() const [member function]
cls.add_method('GetSsid',
'ns3::Ssid',
[],
is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetAddress(ns3::Mac48Address address) [member function]
+ ## regular-wifi-mac.h: static ns3::TypeId ns3::RegularWifiMac::GetTypeId() [member function]
+ cls.add_method('GetTypeId',
+ 'ns3::TypeId',
+ [],
+ is_static=True)
+ ## regular-wifi-mac.h: ns3::Ptr<ns3::WifiPhy> ns3::RegularWifiMac::GetWifiPhy() const [member function]
+ cls.add_method('GetWifiPhy',
+ 'ns3::Ptr< ns3::WifiPhy >',
+ [],
+ is_const=True, is_virtual=True)
+ ## regular-wifi-mac.h: ns3::Ptr<ns3::WifiRemoteStationManager> ns3::RegularWifiMac::GetWifiRemoteStationManager() const [member function]
+ cls.add_method('GetWifiRemoteStationManager',
+ 'ns3::Ptr< ns3::WifiRemoteStationManager >',
+ [],
+ is_const=True, is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetAckTimeout(ns3::Time ackTimeout) [member function]
+ cls.add_method('SetAckTimeout',
+ 'void',
+ [param('ns3::Time', 'ackTimeout')],
+ is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetAddress(ns3::Mac48Address address) [member function]
cls.add_method('SetAddress',
'void',
[param('ns3::Mac48Address', 'address')],
is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetSsid(ns3::Ssid ssid) [member function]
- cls.add_method('SetSsid',
- 'void',
- [param('ns3::Ssid', 'ssid')],
- is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Mac48Address ns3::QadhocWifiMac::GetBssid() const [member function]
- cls.add_method('GetBssid',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetBasicBlockAckTimeout(ns3::Time blockAckTimeout) [member function]
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetBasicBlockAckTimeout(ns3::Time blockAckTimeout) [member function]
cls.add_method('SetBasicBlockAckTimeout',
'void',
[param('ns3::Time', 'blockAckTimeout')],
is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetCompressedBlockAckTimeout(ns3::Time blockAckTimeout) [member function]
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetBssid(ns3::Mac48Address bssid) [member function]
+ cls.add_method('SetBssid',
+ 'void',
+ [param('ns3::Mac48Address', 'bssid')],
+ is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetCompressedBlockAckTimeout(ns3::Time blockAckTimeout) [member function]
cls.add_method('SetCompressedBlockAckTimeout',
'void',
[param('ns3::Time', 'blockAckTimeout')],
is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetBasicBlockAckTimeout() const [member function]
- cls.add_method('GetBasicBlockAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetCompressedBlockAckTimeout() const [member function]
- cls.add_method('GetCompressedBlockAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::DoDispose() [member function]
- cls.add_method('DoDispose',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::DoStart() [member function]
- cls.add_method('DoStart',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::FinishConfigureStandard(ns3::WifiPhyStandard standard) [member function]
- cls.add_method('FinishConfigureStandard',
- 'void',
- [param('ns3::WifiPhyStandard', 'standard')],
- visibility='private', is_virtual=True)
- return
-
-def register_Ns3QapWifiMac_methods(root_module, cls):
- ## qap-wifi-mac.h: static ns3::TypeId ns3::QapWifiMac::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
- ## qap-wifi-mac.h: ns3::QapWifiMac::QapWifiMac() [constructor]
- cls.add_constructor([])
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetSlot(ns3::Time slotTime) [member function]
- cls.add_method('SetSlot',
- 'void',
- [param('ns3::Time', 'slotTime')],
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetCtsTimeout(ns3::Time ctsTimeout) [member function]
+ cls.add_method('SetCtsTimeout',
+ 'void',
+ [param('ns3::Time', 'ctsTimeout')],
is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetSifs(ns3::Time sifs) [member function]
- cls.add_method('SetSifs',
- 'void',
- [param('ns3::Time', 'sifs')],
- is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetEifsNoDifs(ns3::Time eifsNoDifs) [member function]
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetEifsNoDifs(ns3::Time eifsNoDifs) [member function]
cls.add_method('SetEifsNoDifs',
'void',
[param('ns3::Time', 'eifsNoDifs')],
is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetAckTimeout(ns3::Time ackTimeout) [member function]
- cls.add_method('SetAckTimeout',
- 'void',
- [param('ns3::Time', 'ackTimeout')],
- is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetCtsTimeout(ns3::Time ctsTimeout) [member function]
- cls.add_method('SetCtsTimeout',
- 'void',
- [param('ns3::Time', 'ctsTimeout')],
- is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetPifs(ns3::Time pifs) [member function]
- cls.add_method('SetPifs',
- 'void',
- [param('ns3::Time', 'pifs')],
- is_virtual=True)
- ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetSlot() const [member function]
- cls.add_method('GetSlot',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetSifs() const [member function]
- cls.add_method('GetSifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetEifsNoDifs() const [member function]
- cls.add_method('GetEifsNoDifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetAckTimeout() const [member function]
- cls.add_method('GetAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetCtsTimeout() const [member function]
- cls.add_method('GetCtsTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetPifs() const [member function]
- cls.add_method('GetPifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetWifiPhy(ns3::Ptr<ns3::WifiPhy> phy) [member function]
- cls.add_method('SetWifiPhy',
- 'void',
- [param('ns3::Ptr< ns3::WifiPhy >', 'phy')],
- is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetWifiRemoteStationManager(ns3::Ptr<ns3::WifiRemoteStationManager> stationManager) [member function]
- cls.add_method('SetWifiRemoteStationManager',
- 'void',
- [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')],
- is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')],
- is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
- is_virtual=True)
- ## qap-wifi-mac.h: bool ns3::QapWifiMac::SupportsSendFrom() const [member function]
- cls.add_method('SupportsSendFrom',
- 'bool',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetForwardUpCallback(ns3::Callback<void, ns3::Ptr<ns3::Packet>, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> upCallback) [member function]
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetForwardUpCallback(ns3::Callback<void, ns3::Ptr<ns3::Packet>, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> upCallback) [member function]
cls.add_method('SetForwardUpCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'upCallback')],
is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
- cls.add_method('SetLinkUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
- is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetLinkDownCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkDown) [member function]
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetLinkDownCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkDown) [member function]
cls.add_method('SetLinkDownCallback',
'void',
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkDown')],
is_virtual=True)
- ## qap-wifi-mac.h: ns3::Mac48Address ns3::QapWifiMac::GetAddress() const [member function]
- cls.add_method('GetAddress',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: ns3::Ssid ns3::QapWifiMac::GetSsid() const [member function]
- cls.add_method('GetSsid',
- 'ns3::Ssid',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetAddress(ns3::Mac48Address address) [member function]
- cls.add_method('SetAddress',
- 'void',
- [param('ns3::Mac48Address', 'address')],
- is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetSsid(ns3::Ssid ssid) [member function]
- cls.add_method('SetSsid',
- 'void',
- [param('ns3::Ssid', 'ssid')],
- is_virtual=True)
- ## qap-wifi-mac.h: ns3::Mac48Address ns3::QapWifiMac::GetBssid() const [member function]
- cls.add_method('GetBssid',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetBasicBlockAckTimeout(ns3::Time blockAckTimeout) [member function]
- cls.add_method('SetBasicBlockAckTimeout',
- 'void',
- [param('ns3::Time', 'blockAckTimeout')],
- is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetCompressedBlockAckTimeout(ns3::Time blockAckTimeout) [member function]
- cls.add_method('SetCompressedBlockAckTimeout',
- 'void',
- [param('ns3::Time', 'blockAckTimeout')],
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
+ cls.add_method('SetLinkUpCallback',
+ 'void',
+ [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
is_virtual=True)
- ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetBasicBlockAckTimeout() const [member function]
- cls.add_method('GetBasicBlockAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetCompressedBlockAckTimeout() const [member function]
- cls.add_method('GetCompressedBlockAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::SetBeaconInterval(ns3::Time interval) [member function]
- cls.add_method('SetBeaconInterval',
- 'void',
- [param('ns3::Time', 'interval')])
- ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetBeaconInterval() const [member function]
- cls.add_method('GetBeaconInterval',
- 'ns3::Time',
- [],
- is_const=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::StartBeaconing() [member function]
- cls.add_method('StartBeaconing',
- 'void',
- [])
- ## qap-wifi-mac.h: void ns3::QapWifiMac::DoDispose() [member function]
- cls.add_method('DoDispose',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::DoStart() [member function]
- cls.add_method('DoStart',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## qap-wifi-mac.h: void ns3::QapWifiMac::FinishConfigureStandard(ns3::WifiPhyStandard standard) [member function]
- cls.add_method('FinishConfigureStandard',
- 'void',
- [param('ns3::WifiPhyStandard', 'standard')],
- visibility='private', is_virtual=True)
- return
-
-def register_Ns3QstaWifiMac_methods(root_module, cls):
- ## qsta-wifi-mac.h: static ns3::TypeId ns3::QstaWifiMac::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
- ## qsta-wifi-mac.h: ns3::QstaWifiMac::QstaWifiMac() [constructor]
- cls.add_constructor([])
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetSlot(ns3::Time slotTime) [member function]
- cls.add_method('SetSlot',
- 'void',
- [param('ns3::Time', 'slotTime')],
- is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetSifs(ns3::Time sifs) [member function]
- cls.add_method('SetSifs',
- 'void',
- [param('ns3::Time', 'sifs')],
- is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetEifsNoDifs(ns3::Time eifsNoDifs) [member function]
- cls.add_method('SetEifsNoDifs',
- 'void',
- [param('ns3::Time', 'eifsNoDifs')],
- is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetAckTimeout(ns3::Time ackTimeout) [member function]
- cls.add_method('SetAckTimeout',
- 'void',
- [param('ns3::Time', 'ackTimeout')],
- is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetCtsTimeout(ns3::Time ctsTimeout) [member function]
- cls.add_method('SetCtsTimeout',
- 'void',
- [param('ns3::Time', 'ctsTimeout')],
- is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetPifs(ns3::Time pifs) [member function]
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetPifs(ns3::Time pifs) [member function]
cls.add_method('SetPifs',
'void',
[param('ns3::Time', 'pifs')],
is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetSlot() const [member function]
- cls.add_method('GetSlot',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetSifs() const [member function]
- cls.add_method('GetSifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetEifsNoDifs() const [member function]
- cls.add_method('GetEifsNoDifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetAckTimeout() const [member function]
- cls.add_method('GetAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetCtsTimeout() const [member function]
- cls.add_method('GetCtsTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetPifs() const [member function]
- cls.add_method('GetPifs',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetWifiPhy(ns3::Ptr<ns3::WifiPhy> phy) [member function]
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetSifs(ns3::Time sifs) [member function]
+ cls.add_method('SetSifs',
+ 'void',
+ [param('ns3::Time', 'sifs')],
+ is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetSlot(ns3::Time slotTime) [member function]
+ cls.add_method('SetSlot',
+ 'void',
+ [param('ns3::Time', 'slotTime')],
+ is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetSsid(ns3::Ssid ssid) [member function]
+ cls.add_method('SetSsid',
+ 'void',
+ [param('ns3::Ssid', 'ssid')],
+ is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetWifiPhy(ns3::Ptr<ns3::WifiPhy> phy) [member function]
cls.add_method('SetWifiPhy',
'void',
[param('ns3::Ptr< ns3::WifiPhy >', 'phy')],
is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetWifiRemoteStationManager(ns3::Ptr<ns3::WifiRemoteStationManager> stationManager) [member function]
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetWifiRemoteStationManager(ns3::Ptr<ns3::WifiRemoteStationManager> stationManager) [member function]
cls.add_method('SetWifiRemoteStationManager',
'void',
[param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')],
is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')],
- is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
- cls.add_method('Enqueue',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
- is_virtual=True)
- ## qsta-wifi-mac.h: bool ns3::QstaWifiMac::SupportsSendFrom() const [member function]
+ ## regular-wifi-mac.h: bool ns3::RegularWifiMac::SupportsSendFrom() const [member function]
cls.add_method('SupportsSendFrom',
'bool',
[],
is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetForwardUpCallback(ns3::Callback<void, ns3::Ptr<ns3::Packet>, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> upCallback) [member function]
- cls.add_method('SetForwardUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'upCallback')],
- is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
- cls.add_method('SetLinkUpCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
- is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetLinkDownCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkDown) [member function]
- cls.add_method('SetLinkDownCallback',
- 'void',
- [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkDown')],
- is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Mac48Address ns3::QstaWifiMac::GetAddress() const [member function]
- cls.add_method('GetAddress',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Ssid ns3::QstaWifiMac::GetSsid() const [member function]
- cls.add_method('GetSsid',
- 'ns3::Ssid',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetAddress(ns3::Mac48Address address) [member function]
- cls.add_method('SetAddress',
- 'void',
- [param('ns3::Mac48Address', 'address')],
- is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetSsid(ns3::Ssid ssid) [member function]
- cls.add_method('SetSsid',
- 'void',
- [param('ns3::Ssid', 'ssid')],
- is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Mac48Address ns3::QstaWifiMac::GetBssid() const [member function]
- cls.add_method('GetBssid',
- 'ns3::Mac48Address',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetBasicBlockAckTimeout(ns3::Time blockAckTimeout) [member function]
- cls.add_method('SetBasicBlockAckTimeout',
- 'void',
- [param('ns3::Time', 'blockAckTimeout')],
- is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetCompressedBlockAckTimeout(ns3::Time blockAckTimeout) [member function]
- cls.add_method('SetCompressedBlockAckTimeout',
- 'void',
- [param('ns3::Time', 'blockAckTimeout')],
- is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetBasicBlockAckTimeout() const [member function]
- cls.add_method('GetBasicBlockAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetCompressedBlockAckTimeout() const [member function]
- cls.add_method('GetCompressedBlockAckTimeout',
- 'ns3::Time',
- [],
- is_const=True, is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetMaxMissedBeacons(uint32_t missed) [member function]
- cls.add_method('SetMaxMissedBeacons',
- 'void',
- [param('uint32_t', 'missed')])
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetProbeRequestTimeout(ns3::Time timeout) [member function]
- cls.add_method('SetProbeRequestTimeout',
- 'void',
- [param('ns3::Time', 'timeout')])
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetAssocRequestTimeout(ns3::Time timeout) [member function]
- cls.add_method('SetAssocRequestTimeout',
- 'void',
- [param('ns3::Time', 'timeout')])
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::StartActiveAssociation() [member function]
- cls.add_method('StartActiveAssociation',
- 'void',
- [])
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::DoStart() [member function]
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::DeaggregateAmsduAndForward(ns3::Ptr<ns3::Packet> aggregatedPacket, ns3::WifiMacHeader const * hdr) [member function]
+ cls.add_method('DeaggregateAmsduAndForward',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'aggregatedPacket'), param('ns3::WifiMacHeader const *', 'hdr')],
+ visibility='protected', is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::DoDispose() [member function]
+ cls.add_method('DoDispose',
+ 'void',
+ [],
+ visibility='protected', is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::DoStart() [member function]
cls.add_method('DoStart',
'void',
[],
- visibility='private', is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::DoDispose() [member function]
- cls.add_method('DoDispose',
- 'void',
- [],
- visibility='private', is_virtual=True)
- ## qsta-wifi-mac.h: void ns3::QstaWifiMac::FinishConfigureStandard(ns3::WifiPhyStandard standard) [member function]
+ visibility='protected', is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::FinishConfigureStandard(ns3::WifiPhyStandard standard) [member function]
cls.add_method('FinishConfigureStandard',
'void',
[param('ns3::WifiPhyStandard', 'standard')],
- visibility='private', is_virtual=True)
+ visibility='protected', is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::ForwardUp(ns3::Ptr<ns3::Packet> packet, ns3::Mac48Address from, ns3::Mac48Address to) [member function]
+ cls.add_method('ForwardUp',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Mac48Address', 'from'), param('ns3::Mac48Address', 'to')],
+ visibility='protected')
+ ## regular-wifi-mac.h: bool ns3::RegularWifiMac::GetQosSupported() const [member function]
+ cls.add_method('GetQosSupported',
+ 'bool',
+ [],
+ is_const=True, visibility='protected')
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::Receive(ns3::Ptr<ns3::Packet> packet, ns3::WifiMacHeader const * hdr) [member function]
+ cls.add_method('Receive',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::WifiMacHeader const *', 'hdr')],
+ visibility='protected', is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SendAddBaResponse(ns3::MgtAddBaRequestHeader const * reqHdr, ns3::Mac48Address originator) [member function]
+ cls.add_method('SendAddBaResponse',
+ 'void',
+ [param('ns3::MgtAddBaRequestHeader const *', 'reqHdr'), param('ns3::Mac48Address', 'originator')],
+ visibility='protected', is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetQosSupported(bool enable) [member function]
+ cls.add_method('SetQosSupported',
+ 'void',
+ [param('bool', 'enable')],
+ visibility='protected')
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::SetTypeOfStation(ns3::TypeOfStation type) [member function]
+ cls.add_method('SetTypeOfStation',
+ 'void',
+ [param('ns3::TypeOfStation', 'type')],
+ visibility='protected')
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::TxFailed(ns3::WifiMacHeader const & hdr) [member function]
+ cls.add_method('TxFailed',
+ 'void',
+ [param('ns3::WifiMacHeader const &', 'hdr')],
+ visibility='protected', is_virtual=True)
+ ## regular-wifi-mac.h: void ns3::RegularWifiMac::TxOk(ns3::WifiMacHeader const & hdr) [member function]
+ cls.add_method('TxOk',
+ 'void',
+ [param('ns3::WifiMacHeader const &', 'hdr')],
+ visibility='protected', is_virtual=True)
return
def register_Ns3RraaWifiManager_methods(root_module, cls):
@@ -6275,6 +5483,44 @@
[param('ns3::Ssid const &', 'value')])
return
+def register_Ns3StaWifiMac_methods(root_module, cls):
+ ## sta-wifi-mac.h: ns3::StaWifiMac::StaWifiMac(ns3::StaWifiMac const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::StaWifiMac const &', 'arg0')])
+ ## sta-wifi-mac.h: ns3::StaWifiMac::StaWifiMac() [constructor]
+ cls.add_constructor([])
+ ## sta-wifi-mac.h: void ns3::StaWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
+ cls.add_method('Enqueue',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
+ is_virtual=True)
+ ## sta-wifi-mac.h: static ns3::TypeId ns3::StaWifiMac::GetTypeId() [member function]
+ cls.add_method('GetTypeId',
+ 'ns3::TypeId',
+ [],
+ is_static=True)
+ ## sta-wifi-mac.h: void ns3::StaWifiMac::SetAssocRequestTimeout(ns3::Time timeout) [member function]
+ cls.add_method('SetAssocRequestTimeout',
+ 'void',
+ [param('ns3::Time', 'timeout')])
+ ## sta-wifi-mac.h: void ns3::StaWifiMac::SetMaxMissedBeacons(uint32_t missed) [member function]
+ cls.add_method('SetMaxMissedBeacons',
+ 'void',
+ [param('uint32_t', 'missed')])
+ ## sta-wifi-mac.h: void ns3::StaWifiMac::SetProbeRequestTimeout(ns3::Time timeout) [member function]
+ cls.add_method('SetProbeRequestTimeout',
+ 'void',
+ [param('ns3::Time', 'timeout')])
+ ## sta-wifi-mac.h: void ns3::StaWifiMac::StartActiveAssociation() [member function]
+ cls.add_method('StartActiveAssociation',
+ 'void',
+ [])
+ ## sta-wifi-mac.h: void ns3::StaWifiMac::Receive(ns3::Ptr<ns3::Packet> packet, ns3::WifiMacHeader const * hdr) [member function]
+ cls.add_method('Receive',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::WifiMacHeader const *', 'hdr')],
+ visibility='private', is_virtual=True)
+ return
+
def register_Ns3SupportedRates_methods(root_module, cls):
cls.add_output_stream_operator()
## supported-rates.h: ns3::SupportedRates::SupportedRates(ns3::SupportedRates const & arg0) [copy constructor]
@@ -6610,6 +5856,123 @@
[param('ns3::Ptr< ns3::PropagationLossModel >', 'loss')])
return
+def register_Ns3AdhocWifiMac_methods(root_module, cls):
+ ## adhoc-wifi-mac.h: ns3::AdhocWifiMac::AdhocWifiMac(ns3::AdhocWifiMac const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::AdhocWifiMac const &', 'arg0')])
+ ## adhoc-wifi-mac.h: ns3::AdhocWifiMac::AdhocWifiMac() [constructor]
+ cls.add_constructor([])
+ ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
+ cls.add_method('Enqueue',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
+ is_virtual=True)
+ ## adhoc-wifi-mac.h: static ns3::TypeId ns3::AdhocWifiMac::GetTypeId() [member function]
+ cls.add_method('GetTypeId',
+ 'ns3::TypeId',
+ [],
+ is_static=True)
+ ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetAddress(ns3::Mac48Address address) [member function]
+ cls.add_method('SetAddress',
+ 'void',
+ [param('ns3::Mac48Address', 'address')],
+ is_virtual=True)
+ ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
+ cls.add_method('SetLinkUpCallback',
+ 'void',
+ [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
+ is_virtual=True)
+ ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::Receive(ns3::Ptr<ns3::Packet> packet, ns3::WifiMacHeader const * hdr) [member function]
+ cls.add_method('Receive',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::WifiMacHeader const *', 'hdr')],
+ visibility='private', is_virtual=True)
+ return
+
+def register_Ns3ApWifiMac_methods(root_module, cls):
+ ## ap-wifi-mac.h: ns3::ApWifiMac::ApWifiMac(ns3::ApWifiMac const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::ApWifiMac const &', 'arg0')])
+ ## ap-wifi-mac.h: ns3::ApWifiMac::ApWifiMac() [constructor]
+ cls.add_constructor([])
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to) [member function]
+ cls.add_method('Enqueue',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')],
+ is_virtual=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::Enqueue(ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
+ cls.add_method('Enqueue',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')],
+ is_virtual=True)
+ ## ap-wifi-mac.h: ns3::Time ns3::ApWifiMac::GetBeaconInterval() const [member function]
+ cls.add_method('GetBeaconInterval',
+ 'ns3::Time',
+ [],
+ is_const=True)
+ ## ap-wifi-mac.h: static ns3::TypeId ns3::ApWifiMac::GetTypeId() [member function]
+ cls.add_method('GetTypeId',
+ 'ns3::TypeId',
+ [],
+ is_static=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::SetAddress(ns3::Mac48Address address) [member function]
+ cls.add_method('SetAddress',
+ 'void',
+ [param('ns3::Mac48Address', 'address')],
+ is_virtual=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::SetBeaconInterval(ns3::Time interval) [member function]
+ cls.add_method('SetBeaconInterval',
+ 'void',
+ [param('ns3::Time', 'interval')])
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::SetLinkUpCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> linkUp) [member function]
+ cls.add_method('SetLinkUpCallback',
+ 'void',
+ [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')],
+ is_virtual=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::SetWifiRemoteStationManager(ns3::Ptr<ns3::WifiRemoteStationManager> stationManager) [member function]
+ cls.add_method('SetWifiRemoteStationManager',
+ 'void',
+ [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')],
+ is_virtual=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::StartBeaconing() [member function]
+ cls.add_method('StartBeaconing',
+ 'void',
+ [])
+ ## ap-wifi-mac.h: bool ns3::ApWifiMac::SupportsSendFrom() const [member function]
+ cls.add_method('SupportsSendFrom',
+ 'bool',
+ [],
+ is_const=True, is_virtual=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::DeaggregateAmsduAndForward(ns3::Ptr<ns3::Packet> aggregatedPacket, ns3::WifiMacHeader const * hdr) [member function]
+ cls.add_method('DeaggregateAmsduAndForward',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'aggregatedPacket'), param('ns3::WifiMacHeader const *', 'hdr')],
+ visibility='private', is_virtual=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::DoDispose() [member function]
+ cls.add_method('DoDispose',
+ 'void',
+ [],
+ visibility='private', is_virtual=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::DoStart() [member function]
+ cls.add_method('DoStart',
+ 'void',
+ [],
+ visibility='private', is_virtual=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::Receive(ns3::Ptr<ns3::Packet> packet, ns3::WifiMacHeader const * hdr) [member function]
+ cls.add_method('Receive',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::WifiMacHeader const *', 'hdr')],
+ visibility='private', is_virtual=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::TxFailed(ns3::WifiMacHeader const & hdr) [member function]
+ cls.add_method('TxFailed',
+ 'void',
+ [param('ns3::WifiMacHeader const &', 'hdr')],
+ visibility='private', is_virtual=True)
+ ## ap-wifi-mac.h: void ns3::ApWifiMac::TxOk(ns3::WifiMacHeader const & hdr) [member function]
+ cls.add_method('TxOk',
+ 'void',
+ [param('ns3::WifiMacHeader const &', 'hdr')],
+ visibility='private', is_virtual=True)
+ return
+
def register_Ns3DcaTxop_methods(root_module, cls):
## dca-txop.h: static ns3::TypeId ns3::DcaTxop::GetTypeId() [member function]
cls.add_method('GetTypeId',
--- a/bindings/python/apidefs/gcc-LP64/ns3modulegen_generated.py Tue Dec 21 17:39:54 2010 +0100
+++ b/bindings/python/apidefs/gcc-LP64/ns3modulegen_generated.py Tue Dec 21 17:46:35 2010 +0100
@@ -15,12 +15,14 @@
import ns3_module_core
import ns3_module_simulator
import ns3_module_test
+import ns3_module_visualizer
import ns3_module_mobility
import ns3_module_mpi
import ns3_module_common
import ns3_module_contrib
import ns3_module_node
import ns3_module_bridge
+import ns3_module_bulk_send
import ns3_module_csma
import ns3_module_emu
import ns3_module_energy
@@ -93,6 +95,17 @@
ns3_module_test__local.register_types(module)
root_module.end_section('ns3_module_test')
+ root_module.begin_section('ns3_module_visualizer')
+ ns3_module_visualizer.register_types(module)
+
+ try:
+ import ns3_module_visualizer__local
+ except ImportError:
+ pass
+ else:
+ ns3_module_visualizer__local.register_types(module)
+
+ root_module.end_section('ns3_module_visualizer')
root_module.begin_section('ns3_module_mobility')
ns3_module_mobility.register_types(module)
@@ -159,6 +172,17 @@
ns3_module_bridge__local.register_types(module)
root_module.end_section('ns3_module_bridge')
+ root_module.begin_section('ns3_module_bulk_send')
+ ns3_module_bulk_send.register_types(module)
+
+ try:
+ import ns3_module_bulk_send__local
+ except ImportError:
+ pass
+ else:
+ ns3_module_bulk_send__local.register_types(module)
+
+ root_module.end_section('ns3_module_bulk_send')
root_module.begin_section('ns3_module_csma')
ns3_module_csma.register_types(module)
@@ -540,8 +564,32 @@
module.add_class('OlsrHelper', parent=root_module['ns3::Ipv4RoutingHelper'])
## olsr-state.h: ns3::OlsrState [class]
module.add_class('OlsrState')
+ ## pyviz.h: ns3::PyViz [class]
+ module.add_class('PyViz')
+ ## pyviz.h: ns3::PyViz::PacketCaptureMode [enumeration]
+ module.add_enum('PacketCaptureMode', ['PACKET_CAPTURE_DISABLED', 'PACKET_CAPTURE_FILTER_HEADERS_OR', 'PACKET_CAPTURE_FILTER_HEADERS_AND'], outer_class=root_module['ns3::PyViz'])
+ ## pyviz.h: ns3::PyViz::LastPacketsSample [struct]
+ module.add_class('LastPacketsSample', outer_class=root_module['ns3::PyViz'])
+ ## pyviz.h: ns3::PyViz::NetDeviceStatistics [struct]
+ module.add_class('NetDeviceStatistics', outer_class=root_module['ns3::PyViz'])
+ ## pyviz.h: ns3::PyViz::NodeStatistics [struct]
+ module.add_class('NodeStatistics', outer_class=root_module['ns3::PyViz'])
+ ## pyviz.h: ns3::PyViz::PacketCaptureOptions [struct]
+ module.add_class('PacketCaptureOptions', outer_class=root_module['ns3::PyViz'])
+ ## pyviz.h: ns3::PyViz::PacketDropSample [struct]
+ module.add_class('PacketDropSample', outer_class=root_module['ns3::PyViz'])
+ ## pyviz.h: ns3::PyViz::PacketSample [struct]
+ module.add_class('PacketSample', outer_class=root_module['ns3::PyViz'])
+ ## pyviz.h: ns3::PyViz::RxPacketSample [struct]
+ module.add_class('RxPacketSample', parent=root_module['ns3::PyViz::PacketSample'], outer_class=root_module['ns3::PyViz'])
+ ## pyviz.h: ns3::PyViz::TransmissionSample [struct]
+ module.add_class('TransmissionSample', outer_class=root_module['ns3::PyViz'])
+ ## pyviz.h: ns3::PyViz::TxPacketSample [struct]
+ module.add_class('TxPacketSample', parent=root_module['ns3::PyViz::PacketSample'], outer_class=root_module['ns3::PyViz'])
## uan-mac-rc.h: ns3::Reservation [class]
module.add_class('Reservation')
+ ## rv-battery-model-helper.h: ns3::RvBatteryModelHelper [class]
+ module.add_class('RvBatteryModelHelper', parent=root_module['ns3::EnergySourceHelper'])
## uan-prop-model.h: ns3::Tap [class]
module.add_class('Tap')
## uan-address.h: ns3::UanAddress [class]
@@ -566,6 +614,8 @@
module.add_class('UanTxModeFactory')
## wifi-radio-energy-model-helper.h: ns3::WifiRadioEnergyModelHelper [class]
module.add_class('WifiRadioEnergyModelHelper', parent=root_module['ns3::DeviceEnergyModelHelper'])
+ ## wifi-radio-energy-model.h: ns3::WifiRadioEnergyModelPhyListener [class]
+ module.add_class('WifiRadioEnergyModelPhyListener', parent=root_module['ns3::WifiPhyListener'])
## basic-energy-source-helper.h: ns3::BasicEnergySourceHelper [class]
module.add_class('BasicEnergySourceHelper', parent=root_module['ns3::EnergySourceHelper'])
## ipv4-global-routing-helper.h: ns3::Ipv4GlobalRoutingHelper [class]
@@ -666,6 +716,8 @@
module.add_class('Ipv4StaticRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
## ipv6-static-routing.h: ns3::Ipv6StaticRouting [class]
module.add_class('Ipv6StaticRouting', parent=root_module['ns3::Ipv6RoutingProtocol'])
+ ## rv-battery-model.h: ns3::RvBatteryModel [class]
+ module.add_class('RvBatteryModel', parent=root_module['ns3::EnergySource'])
## uan-channel.h: ns3::UanChannel [class]
module.add_class('UanChannel', parent=root_module['ns3::Channel'])
## uan-tx-mode.h: ns3::UanModesListChecker [class]
@@ -678,8 +730,6 @@
module.add_class('VirtualNetDevice', parent=root_module['ns3::NetDevice'])
## wifi-radio-energy-model.h: ns3::WifiRadioEnergyModel [class]
module.add_class('WifiRadioEnergyModel', parent=root_module['ns3::DeviceEnergyModel'])
- ## wifi-radio-energy-model.h: ns3::WifiRadioEnergyModel::WifiRadioState [enumeration]
- module.add_enum('WifiRadioState', ['TX', 'RX', 'IDLE', 'SLEEP'], outer_class=root_module['ns3::WifiRadioEnergyModel'])
## basic-energy-source.h: ns3::BasicEnergySource [class]
module.add_class('BasicEnergySource', parent=root_module['ns3::EnergySource'])
## bridge-channel.h: ns3::BridgeChannel [class]
@@ -702,6 +752,15 @@
module.add_container('std::vector< ns3::olsr::IfaceAssocTuple >', 'ns3::olsr::IfaceAssocTuple', container_type='vector')
module.add_container('std::vector< ns3::olsr::AssociationTuple >', 'ns3::olsr::AssociationTuple', container_type='vector')
module.add_container('std::vector< ns3::olsr::Association >', 'ns3::olsr::Association', container_type='vector')
+ module.add_container('std::vector< ns3::PyViz::RxPacketSample >', 'ns3::PyViz::RxPacketSample', container_type='vector')
+ module.add_container('std::vector< ns3::PyViz::TxPacketSample >', 'ns3::PyViz::TxPacketSample', container_type='vector')
+ module.add_container('std::vector< ns3::PyViz::PacketSample >', 'ns3::PyViz::PacketSample', container_type='vector')
+ module.add_container('std::vector< ns3::PyViz::TransmissionSample >', 'ns3::PyViz::TransmissionSample', container_type='vector')
+ module.add_container('std::vector< ns3::PyViz::PacketDropSample >', 'ns3::PyViz::PacketDropSample', container_type='vector')
+ module.add_container('std::vector< ns3::PyViz::NetDeviceStatistics >', 'ns3::PyViz::NetDeviceStatistics', container_type='vector')
+ module.add_container('std::vector< std::string >', 'std::string', container_type='vector')
+ module.add_container('std::set< unsigned int >', 'unsigned int', container_type='set')
+ module.add_container('std::vector< ns3::PyViz::NodeStatistics >', 'ns3::PyViz::NodeStatistics', container_type='vector')
module.add_container('std::list< std::pair< ns3::Ptr< ns3::Packet >, ns3::UanAddress > >', 'std::pair< ns3::Ptr< ns3::Packet >, ns3::UanAddress >', container_type='list')
module.add_container('std::vector< ns3::ServiceFlow * >', 'ns3::ServiceFlow *', container_type='vector')
module.add_container('std::vector< ns3::Tap >', 'ns3::Tap', container_type='vector')
@@ -777,7 +836,6 @@
def register_types_ns3_Config(module):
root_module = module.get_root()
- module.add_container('std::vector< std::string >', 'std::string', container_type='vector')
def register_types_ns3_FatalImpl(module):
root_module = module.get_root()
@@ -854,7 +912,6 @@
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')
module.add_container('std::vector< ns3::olsr::RoutingTableEntry >', 'ns3::olsr::RoutingTableEntry', container_type='vector')
- module.add_container('std::set< unsigned int >', 'unsigned int', container_type='set')
typehandlers.add_type_alias('std::vector< ns3::olsr::TopologyTuple, std::allocator< ns3::olsr::TopologyTuple > >', 'ns3::olsr::TopologySet')
typehandlers.add_type_alias('std::vector< ns3::olsr::TopologyTuple, std::allocator< ns3::olsr::TopologyTuple > >*', 'ns3::olsr::TopologySet*')
typehandlers.add_type_alias('std::vector< ns3::olsr::TopologyTuple, std::allocator< ns3::olsr::TopologyTuple > >&', 'ns3::olsr::TopologySet&')
@@ -907,7 +964,18 @@
register_Ns3Ipv6StaticRoutingHelper_methods(root_module, root_module['ns3::Ipv6StaticRoutingHelper'])
register_Ns3OlsrHelper_methods(root_module, root_module['ns3::OlsrHelper'])
register_Ns3OlsrState_methods(root_module, root_module['ns3::OlsrState'])
+ register_Ns3PyViz_methods(root_module, root_module['ns3::PyViz'])
+ register_Ns3PyVizLastPacketsSample_methods(root_module, root_module['ns3::PyViz::LastPacketsSample'])
+ register_Ns3PyVizNetDeviceStatistics_methods(root_module, root_module['ns3::PyViz::NetDeviceStatistics'])
+ register_Ns3PyVizNodeStatistics_methods(root_module, root_module['ns3::PyViz::NodeStatistics'])
+ register_Ns3PyVizPacketCaptureOptions_methods(root_module, root_module['ns3::PyViz::PacketCaptureOptions'])
+ register_Ns3PyVizPacketDropSample_methods(root_module, root_module['ns3::PyViz::PacketDropSample'])
+ register_Ns3PyVizPacketSample_methods(root_module, root_module['ns3::PyViz::PacketSample'])
+ register_Ns3PyVizRxPacketSample_methods(root_module, root_module['ns3::PyViz::RxPacketSample'])
+ register_Ns3PyVizTransmissionSample_methods(root_module, root_module['ns3::PyViz::TransmissionSample'])
+ register_Ns3PyVizTxPacketSample_methods(root_module, root_module['ns3::PyViz::TxPacketSample'])
register_Ns3Reservation_methods(root_module, root_module['ns3::Reservation'])
+ register_Ns3RvBatteryModelHelper_methods(root_module, root_module['ns3::RvBatteryModelHelper'])
register_Ns3Tap_methods(root_module, root_module['ns3::Tap'])
register_Ns3UanAddress_methods(root_module, root_module['ns3::UanAddress'])
register_Ns3UanHelper_methods(root_module, root_module['ns3::UanHelper'])
@@ -918,6 +986,7 @@
register_Ns3UanTxMode_methods(root_module, root_module['ns3::UanTxMode'])
register_Ns3UanTxModeFactory_methods(root_module, root_module['ns3::UanTxModeFactory'])
register_Ns3WifiRadioEnergyModelHelper_methods(root_module, root_module['ns3::WifiRadioEnergyModelHelper'])
+ register_Ns3WifiRadioEnergyModelPhyListener_methods(root_module, root_module['ns3::WifiRadioEnergyModelPhyListener'])
register_Ns3BasicEnergySourceHelper_methods(root_module, root_module['ns3::BasicEnergySourceHelper'])
register_Ns3Ipv4GlobalRoutingHelper_methods(root_module, root_module['ns3::Ipv4GlobalRoutingHelper'])
register_Ns3Ipv4ListRoutingHelper_methods(root_module, root_module['ns3::Ipv4ListRoutingHelper'])
@@ -964,6 +1033,7 @@
register_Ns3Ipv4FlowProbe_methods(root_module, root_module['ns3::Ipv4FlowProbe'])
register_Ns3Ipv4StaticRouting_methods(root_module, root_module['ns3::Ipv4StaticRouting'])
register_Ns3Ipv6StaticRouting_methods(root_module, root_module['ns3::Ipv6StaticRouting'])
+ register_Ns3RvBatteryModel_methods(root_module, root_module['ns3::RvBatteryModel'])
register_Ns3UanChannel_methods(root_module, root_module['ns3::UanChannel'])
register_Ns3UanModesListChecker_methods(root_module, root_module['ns3::UanModesListChecker'])
register_Ns3UanModesListValue_methods(root_module, root_module['ns3::UanModesListValue'])
@@ -1029,6 +1099,17 @@
ns3_module_test__local.register_methods(root_module)
root_module.end_section('ns3_module_test')
+ root_module.begin_section('ns3_module_visualizer')
+ ns3_module_visualizer.register_methods(root_module)
+
+ try:
+ import ns3_module_visualizer__local
+ except ImportError:
+ pass
+ else:
+ ns3_module_visualizer__local.register_methods(root_module)
+
+ root_module.end_section('ns3_module_visualizer')
root_module.begin_section('ns3_module_mobility')
ns3_module_mobility.register_methods(root_module)
@@ -1095,6 +1176,17 @@
ns3_module_bridge__local.register_methods(root_module)
root_module.end_section('ns3_module_bridge')
+ root_module.begin_section('ns3_module_bulk_send')
+ ns3_module_bulk_send.register_methods(root_module)
+
+ try:
+ import ns3_module_bulk_send__local
+ except ImportError:
+ pass
+ else:
+ ns3_module_bulk_send__local.register_methods(root_module)
+
+ root_module.end_section('ns3_module_bulk_send')
root_module.begin_section('ns3_module_csma')
ns3_module_csma.register_methods(root_module)
@@ -2432,6 +2524,185 @@
[param('ns3::olsr::MprSet', 'mprSet')])
return
+def register_Ns3PyViz_methods(root_module, cls):
+ ## pyviz.h: ns3::PyViz::PyViz(ns3::PyViz const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PyViz const &', 'arg0')])
+ ## pyviz.h: ns3::PyViz::PyViz() [constructor]
+ cls.add_constructor([])
+ ## pyviz.h: ns3::PyViz::LastPacketsSample ns3::PyViz::GetLastPackets(uint32_t nodeId) const [member function]
+ cls.add_method('GetLastPackets',
+ 'ns3::PyViz::LastPacketsSample',
+ [param('uint32_t', 'nodeId')],
+ is_const=True)
+ ## pyviz.h: std::vector<ns3::PyViz::NodeStatistics,std::allocator<ns3::PyViz::NodeStatistics> > ns3::PyViz::GetNodesStatistics() const [member function]
+ cls.add_method('GetNodesStatistics',
+ 'std::vector< ns3::PyViz::NodeStatistics >',
+ [],
+ is_const=True)
+ ## pyviz.h: std::vector<ns3::PyViz::PacketDropSample,std::allocator<ns3::PyViz::PacketDropSample> > ns3::PyViz::GetPacketDropSamples() const [member function]
+ cls.add_method('GetPacketDropSamples',
+ 'std::vector< ns3::PyViz::PacketDropSample >',
+ [],
+ is_const=True)
+ ## pyviz.h: std::vector<std::string, std::allocator<std::string> > ns3::PyViz::GetPauseMessages() const [member function]
+ cls.add_method('GetPauseMessages',
+ 'std::vector< std::string >',
+ [],
+ is_const=True)
+ ## pyviz.h: std::vector<ns3::PyViz::TransmissionSample,std::allocator<ns3::PyViz::TransmissionSample> > ns3::PyViz::GetTransmissionSamples() const [member function]
+ cls.add_method('GetTransmissionSamples',
+ 'std::vector< ns3::PyViz::TransmissionSample >',
+ [],
+ is_const=True)
+ ## pyviz.h: static void ns3::PyViz::LineClipping(double boundsX1, double boundsY1, double boundsX2, double boundsY2, double & lineX1, double & lineY1, double & lineX2, double & lineY2) [member function]
+ cls.add_method('LineClipping',
+ 'void',
+ [param('double', 'boundsX1'), param('double', 'boundsY1'), param('double', 'boundsX2'), param('double', 'boundsY2'), param('double &', 'lineX1', direction=3), param('double &', 'lineY1', direction=3), param('double &', 'lineX2', direction=3), param('double &', 'lineY2', direction=3)],
+ is_static=True)
+ ## pyviz.h: static void ns3::PyViz::Pause(std::string const & message) [member function]
+ cls.add_method('Pause',
+ 'void',
+ [param('std::string const &', 'message')],
+ is_static=True)
+ ## pyviz.h: void ns3::PyViz::RegisterCsmaLikeDevice(std::string const & deviceTypeName) [member function]
+ cls.add_method('RegisterCsmaLikeDevice',
+ 'void',
+ [param('std::string const &', 'deviceTypeName')])
+ ## pyviz.h: void ns3::PyViz::RegisterDropTracePath(std::string const & tracePath) [member function]
+ cls.add_method('RegisterDropTracePath',
+ 'void',
+ [param('std::string const &', 'tracePath')])
+ ## pyviz.h: void ns3::PyViz::RegisterPointToPointLikeDevice(std::string const & deviceTypeName) [member function]
+ cls.add_method('RegisterPointToPointLikeDevice',
+ 'void',
+ [param('std::string const &', 'deviceTypeName')])
+ ## pyviz.h: void ns3::PyViz::RegisterWifiLikeDevice(std::string const & deviceTypeName) [member function]
+ cls.add_method('RegisterWifiLikeDevice',
+ 'void',
+ [param('std::string const &', 'deviceTypeName')])
+ ## pyviz.h: void ns3::PyViz::SetNodesOfInterest(std::set<unsigned int, std::less<unsigned int>, std::allocator<unsigned int> > nodes) [member function]
+ cls.add_method('SetNodesOfInterest',
+ 'void',
+ [param('std::set< unsigned int >', 'nodes')])
+ ## pyviz.h: void ns3::PyViz::SetPacketCaptureOptions(uint32_t nodeId, ns3::PyViz::PacketCaptureOptions options) [member function]
+ cls.add_method('SetPacketCaptureOptions',
+ 'void',
+ [param('uint32_t', 'nodeId'), param('ns3::PyViz::PacketCaptureOptions', 'options')])
+ ## pyviz.h: void ns3::PyViz::SimulatorRunUntil(ns3::Time time) [member function]
+ cls.add_method('SimulatorRunUntil',
+ 'void',
+ [param('ns3::Time', 'time')])
+ return
+
+def register_Ns3PyVizLastPacketsSample_methods(root_module, cls):
+ ## pyviz.h: ns3::PyViz::LastPacketsSample::LastPacketsSample() [constructor]
+ cls.add_constructor([])
+ ## pyviz.h: ns3::PyViz::LastPacketsSample::LastPacketsSample(ns3::PyViz::LastPacketsSample const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PyViz::LastPacketsSample const &', 'arg0')])
+ ## pyviz.h: ns3::PyViz::LastPacketsSample::lastDroppedPackets [variable]
+ cls.add_instance_attribute('lastDroppedPackets', 'std::vector< ns3::PyViz::PacketSample >', is_const=False)
+ ## pyviz.h: ns3::PyViz::LastPacketsSample::lastReceivedPackets [variable]
+ cls.add_instance_attribute('lastReceivedPackets', 'std::vector< ns3::PyViz::RxPacketSample >', is_const=False)
+ ## pyviz.h: ns3::PyViz::LastPacketsSample::lastTransmittedPackets [variable]
+ cls.add_instance_attribute('lastTransmittedPackets', 'std::vector< ns3::PyViz::TxPacketSample >', is_const=False)
+ return
+
+def register_Ns3PyVizNetDeviceStatistics_methods(root_module, cls):
+ ## pyviz.h: ns3::PyViz::NetDeviceStatistics::NetDeviceStatistics(ns3::PyViz::NetDeviceStatistics const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PyViz::NetDeviceStatistics const &', 'arg0')])
+ ## pyviz.h: ns3::PyViz::NetDeviceStatistics::NetDeviceStatistics() [constructor]
+ cls.add_constructor([])
+ ## pyviz.h: ns3::PyViz::NetDeviceStatistics::receivedBytes [variable]
+ cls.add_instance_attribute('receivedBytes', 'uint64_t', is_const=False)
+ ## pyviz.h: ns3::PyViz::NetDeviceStatistics::receivedPackets [variable]
+ cls.add_instance_attribute('receivedPackets', 'uint32_t', is_const=False)
+ ## pyviz.h: ns3::PyViz::NetDeviceStatistics::transmittedBytes [variable]
+ cls.add_instance_attribute('transmittedBytes', 'uint64_t', is_const=False)
+ ## pyviz.h: ns3::PyViz::NetDeviceStatistics::transmittedPackets [variable]
+ cls.add_instance_attribute('transmittedPackets', 'uint32_t', is_const=False)
+ return
+
+def register_Ns3PyVizNodeStatistics_methods(root_module, cls):
+ ## pyviz.h: ns3::PyViz::NodeStatistics::NodeStatistics() [constructor]
+ cls.add_constructor([])
+ ## pyviz.h: ns3::PyViz::NodeStatistics::NodeStatistics(ns3::PyViz::NodeStatistics const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PyViz::NodeStatistics const &', 'arg0')])
+ ## pyviz.h: ns3::PyViz::NodeStatistics::nodeId [variable]
+ cls.add_instance_attribute('nodeId', 'uint32_t', is_const=False)
+ ## pyviz.h: ns3::PyViz::NodeStatistics::statistics [variable]
+ cls.add_instance_attribute('statistics', 'std::vector< ns3::PyViz::NetDeviceStatistics >', is_const=False)
+ return
+
+def register_Ns3PyVizPacketCaptureOptions_methods(root_module, cls):
+ ## pyviz.h: ns3::PyViz::PacketCaptureOptions::PacketCaptureOptions() [constructor]
+ cls.add_constructor([])
+ ## pyviz.h: ns3::PyViz::PacketCaptureOptions::PacketCaptureOptions(ns3::PyViz::PacketCaptureOptions const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PyViz::PacketCaptureOptions const &', 'arg0')])
+ ## pyviz.h: ns3::PyViz::PacketCaptureOptions::headers [variable]
+ cls.add_instance_attribute('headers', 'std::set< ns3::TypeId >', is_const=False)
+ ## pyviz.h: ns3::PyViz::PacketCaptureOptions::mode [variable]
+ cls.add_instance_attribute('mode', 'ns3::PyViz::PacketCaptureMode', is_const=False)
+ ## pyviz.h: ns3::PyViz::PacketCaptureOptions::numLastPackets [variable]
+ cls.add_instance_attribute('numLastPackets', 'uint32_t', is_const=False)
+ return
+
+def register_Ns3PyVizPacketDropSample_methods(root_module, cls):
+ ## pyviz.h: ns3::PyViz::PacketDropSample::PacketDropSample() [constructor]
+ cls.add_constructor([])
+ ## pyviz.h: ns3::PyViz::PacketDropSample::PacketDropSample(ns3::PyViz::PacketDropSample const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PyViz::PacketDropSample const &', 'arg0')])
+ ## pyviz.h: ns3::PyViz::PacketDropSample::bytes [variable]
+ cls.add_instance_attribute('bytes', 'uint32_t', is_const=False)
+ ## pyviz.h: ns3::PyViz::PacketDropSample::transmitter [variable]
+ cls.add_instance_attribute('transmitter', 'ns3::Ptr< ns3::Node >', is_const=False)
+ return
+
+def register_Ns3PyVizPacketSample_methods(root_module, cls):
+ ## pyviz.h: ns3::PyViz::PacketSample::PacketSample() [constructor]
+ cls.add_constructor([])
+ ## pyviz.h: ns3::PyViz::PacketSample::PacketSample(ns3::PyViz::PacketSample const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PyViz::PacketSample const &', 'arg0')])
+ ## pyviz.h: ns3::PyViz::PacketSample::device [variable]
+ cls.add_instance_attribute('device', 'ns3::Ptr< ns3::NetDevice >', is_const=False)
+ ## pyviz.h: ns3::PyViz::PacketSample::packet [variable]
+ cls.add_instance_attribute('packet', 'ns3::Ptr< ns3::Packet >', is_const=False)
+ ## pyviz.h: ns3::PyViz::PacketSample::time [variable]
+ cls.add_instance_attribute('time', 'ns3::Time', is_const=False)
+ return
+
+def register_Ns3PyVizRxPacketSample_methods(root_module, cls):
+ ## pyviz.h: ns3::PyViz::RxPacketSample::RxPacketSample() [constructor]
+ cls.add_constructor([])
+ ## pyviz.h: ns3::PyViz::RxPacketSample::RxPacketSample(ns3::PyViz::RxPacketSample const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PyViz::RxPacketSample const &', 'arg0')])
+ ## pyviz.h: ns3::PyViz::RxPacketSample::from [variable]
+ cls.add_instance_attribute('from', 'ns3::Mac48Address', is_const=False)
+ return
+
+def register_Ns3PyVizTransmissionSample_methods(root_module, cls):
+ ## pyviz.h: ns3::PyViz::TransmissionSample::TransmissionSample() [constructor]
+ cls.add_constructor([])
+ ## pyviz.h: ns3::PyViz::TransmissionSample::TransmissionSample(ns3::PyViz::TransmissionSample const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PyViz::TransmissionSample const &', 'arg0')])
+ ## pyviz.h: ns3::PyViz::TransmissionSample::bytes [variable]
+ cls.add_instance_attribute('bytes', 'uint32_t', is_const=False)
+ ## pyviz.h: ns3::PyViz::TransmissionSample::channel [variable]
+ cls.add_instance_attribute('channel', 'ns3::Ptr< ns3::Channel >', is_const=False)
+ ## pyviz.h: ns3::PyViz::TransmissionSample::receiver [variable]
+ cls.add_instance_attribute('receiver', 'ns3::Ptr< ns3::Node >', is_const=False)
+ ## pyviz.h: ns3::PyViz::TransmissionSample::transmitter [variable]
+ cls.add_instance_attribute('transmitter', 'ns3::Ptr< ns3::Node >', is_const=False)
+ return
+
+def register_Ns3PyVizTxPacketSample_methods(root_module, cls):
+ ## pyviz.h: ns3::PyViz::TxPacketSample::TxPacketSample() [constructor]
+ cls.add_constructor([])
+ ## pyviz.h: ns3::PyViz::TxPacketSample::TxPacketSample(ns3::PyViz::TxPacketSample const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::PyViz::TxPacketSample const &', 'arg0')])
+ ## pyviz.h: ns3::PyViz::TxPacketSample::to [variable]
+ cls.add_instance_attribute('to', 'ns3::Mac48Address', is_const=False)
+ return
+
def register_Ns3Reservation_methods(root_module, cls):
## uan-mac-rc.h: ns3::Reservation::Reservation(ns3::Reservation const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Reservation const &', 'arg0')])
@@ -2492,6 +2763,23 @@
[param('bool', 't', default_value='true')])
return
+def register_Ns3RvBatteryModelHelper_methods(root_module, cls):
+ ## rv-battery-model-helper.h: ns3::RvBatteryModelHelper::RvBatteryModelHelper(ns3::RvBatteryModelHelper const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::RvBatteryModelHelper const &', 'arg0')])
+ ## rv-battery-model-helper.h: ns3::RvBatteryModelHelper::RvBatteryModelHelper() [constructor]
+ cls.add_constructor([])
+ ## rv-battery-model-helper.h: void ns3::RvBatteryModelHelper::Set(std::string name, ns3::AttributeValue const & v) [member function]
+ cls.add_method('Set',
+ 'void',
+ [param('std::string', 'name'), param('ns3::AttributeValue const &', 'v')],
+ is_virtual=True)
+ ## rv-battery-model-helper.h: ns3::Ptr<ns3::EnergySource> ns3::RvBatteryModelHelper::DoInstall(ns3::Ptr<ns3::Node> node) const [member function]
+ cls.add_method('DoInstall',
+ 'ns3::Ptr< ns3::EnergySource >',
+ [param('ns3::Ptr< ns3::Node >', 'node')],
+ is_const=True, visibility='private', is_virtual=True)
+ return
+
def register_Ns3Tap_methods(root_module, cls):
## uan-prop-model.h: ns3::Tap::Tap(ns3::Tap const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Tap const &', 'arg0')])
@@ -2865,6 +3153,47 @@
is_const=True, visibility='private', is_virtual=True)
return
+def register_Ns3WifiRadioEnergyModelPhyListener_methods(root_module, cls):
+ ## wifi-radio-energy-model.h: ns3::WifiRadioEnergyModelPhyListener::WifiRadioEnergyModelPhyListener(ns3::WifiRadioEnergyModelPhyListener const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::WifiRadioEnergyModelPhyListener const &', 'arg0')])
+ ## wifi-radio-energy-model.h: ns3::WifiRadioEnergyModelPhyListener::WifiRadioEnergyModelPhyListener() [constructor]
+ cls.add_constructor([])
+ ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModelPhyListener::NotifyMaybeCcaBusyStart(ns3::Time duration) [member function]
+ cls.add_method('NotifyMaybeCcaBusyStart',
+ 'void',
+ [param('ns3::Time', 'duration')],
+ is_virtual=True)
+ ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModelPhyListener::NotifyRxEndError() [member function]
+ cls.add_method('NotifyRxEndError',
+ 'void',
+ [],
+ is_virtual=True)
+ ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModelPhyListener::NotifyRxEndOk() [member function]
+ cls.add_method('NotifyRxEndOk',
+ 'void',
+ [],
+ is_virtual=True)
+ ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModelPhyListener::NotifyRxStart(ns3::Time duration) [member function]
+ cls.add_method('NotifyRxStart',
+ 'void',
+ [param('ns3::Time', 'duration')],
+ is_virtual=True)
+ ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModelPhyListener::NotifySwitchingStart(ns3::Time duration) [member function]
+ cls.add_method('NotifySwitchingStart',
+ 'void',
+ [param('ns3::Time', 'duration')],
+ is_virtual=True)
+ ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModelPhyListener::NotifyTxStart(ns3::Time duration) [member function]
+ cls.add_method('NotifyTxStart',
+ 'void',
+ [param('ns3::Time', 'duration')],
+ is_virtual=True)
+ ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModelPhyListener::SetChangeStateCallback(ns3::Callback<void, int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
+ cls.add_method('SetChangeStateCallback',
+ 'void',
+ [param('ns3::Callback< void, int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')])
+ return
+
def register_Ns3BasicEnergySourceHelper_methods(root_module, cls):
## basic-energy-source-helper.h: ns3::BasicEnergySourceHelper::BasicEnergySourceHelper(ns3::BasicEnergySourceHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::BasicEnergySourceHelper const &', 'arg0')])
@@ -4743,11 +5072,6 @@
'double',
[],
is_const=True)
- ## device-energy-model.h: ns3::Ptr<ns3::Node> ns3::DeviceEnergyModel::GetNode() const [member function]
- cls.add_method('GetNode',
- 'ns3::Ptr< ns3::Node >',
- [],
- is_pure_virtual=True, is_const=True, is_virtual=True)
## device-energy-model.h: double ns3::DeviceEnergyModel::GetTotalEnergyConsumption() const [member function]
cls.add_method('GetTotalEnergyConsumption',
'double',
@@ -4768,11 +5092,6 @@
'void',
[param('ns3::Ptr< ns3::EnergySource >', 'source')],
is_pure_virtual=True, is_virtual=True)
- ## device-energy-model.h: void ns3::DeviceEnergyModel::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)
## device-energy-model.h: double ns3::DeviceEnergyModel::DoGetCurrentA() const [member function]
cls.add_method('DoGetCurrentA',
'double',
@@ -4789,11 +5108,10 @@
cls.add_method('AppendDeviceEnergyModel',
'void',
[param('ns3::Ptr< ns3::DeviceEnergyModel >', 'deviceEnergyModelPtr')])
- ## energy-source.h: void ns3::EnergySource::DecreaseRemainingEnergy(double energyJ) [member function]
- cls.add_method('DecreaseRemainingEnergy',
- 'void',
- [param('double', 'energyJ')],
- is_pure_virtual=True, is_virtual=True)
+ ## energy-source.h: void ns3::EnergySource::DisposeDeviceModels() [member function]
+ cls.add_method('DisposeDeviceModels',
+ 'void',
+ [])
## energy-source.h: ns3::DeviceEnergyModelContainer ns3::EnergySource::FindDeviceEnergyModels(ns3::TypeId tid) [member function]
cls.add_method('FindDeviceEnergyModels',
'ns3::DeviceEnergyModelContainer',
@@ -4832,15 +5150,14 @@
'ns3::TypeId',
[],
is_static=True)
- ## energy-source.h: void ns3::EnergySource::IncreaseRemainingEnergy(double energyJ) [member function]
- cls.add_method('IncreaseRemainingEnergy',
- 'void',
- [param('double', 'energyJ')],
- is_pure_virtual=True, is_virtual=True)
## energy-source.h: void ns3::EnergySource::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')])
+ ## energy-source.h: void ns3::EnergySource::StartDeviceModels() [member function]
+ cls.add_method('StartDeviceModels',
+ 'void',
+ [])
## energy-source.h: void ns3::EnergySource::UpdateEnergySource() [member function]
cls.add_method('UpdateEnergySource',
'void',
@@ -5269,14 +5586,16 @@
'uint32_t',
[],
is_const=True)
- ## ipv4-static-routing.h: uint32_t ns3::Ipv4StaticRouting::GetNRoutes() [member function]
+ ## ipv4-static-routing.h: uint32_t ns3::Ipv4StaticRouting::GetNRoutes() const [member function]
cls.add_method('GetNRoutes',
'uint32_t',
- [])
- ## ipv4-static-routing.h: ns3::Ipv4RoutingTableEntry ns3::Ipv4StaticRouting::GetRoute(uint32_t i) [member function]
+ [],
+ is_const=True)
+ ## ipv4-static-routing.h: ns3::Ipv4RoutingTableEntry ns3::Ipv4StaticRouting::GetRoute(uint32_t i) const [member function]
cls.add_method('GetRoute',
'ns3::Ipv4RoutingTableEntry',
- [param('uint32_t', 'i')])
+ [param('uint32_t', 'i')],
+ is_const=True)
## ipv4-static-routing.h: static ns3::TypeId ns3::Ipv4StaticRouting::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
@@ -5302,6 +5621,11 @@
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
is_virtual=True)
+ ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTable',
+ 'void',
+ [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True, is_virtual=True)
## ipv4-static-routing.h: bool ns3::Ipv4StaticRouting::RemoveMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface) [member function]
cls.add_method('RemoveMulticastRoute',
'bool',
@@ -5484,6 +5808,116 @@
visibility='protected', is_virtual=True)
return
+def register_Ns3RvBatteryModel_methods(root_module, cls):
+ ## rv-battery-model.h: ns3::RvBatteryModel::RvBatteryModel(ns3::RvBatteryModel const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::RvBatteryModel const &', 'arg0')])
+ ## rv-battery-model.h: ns3::RvBatteryModel::RvBatteryModel() [constructor]
+ cls.add_constructor([])
+ ## rv-battery-model.h: double ns3::RvBatteryModel::GetAlpha() const [member function]
+ cls.add_method('GetAlpha',
+ 'double',
+ [],
+ is_const=True)
+ ## rv-battery-model.h: double ns3::RvBatteryModel::GetBatteryLevel() [member function]
+ cls.add_method('GetBatteryLevel',
+ 'double',
+ [])
+ ## rv-battery-model.h: double ns3::RvBatteryModel::GetBeta() const [member function]
+ cls.add_method('GetBeta',
+ 'double',
+ [],
+ is_const=True)
+ ## rv-battery-model.h: double ns3::RvBatteryModel::GetCutoffVoltage() const [member function]
+ cls.add_method('GetCutoffVoltage',
+ 'double',
+ [],
+ is_const=True)
+ ## rv-battery-model.h: double ns3::RvBatteryModel::GetEnergyFraction() [member function]
+ cls.add_method('GetEnergyFraction',
+ 'double',
+ [],
+ is_virtual=True)
+ ## rv-battery-model.h: double ns3::RvBatteryModel::GetInitialEnergy() const [member function]
+ cls.add_method('GetInitialEnergy',
+ 'double',
+ [],
+ is_const=True, is_virtual=True)
+ ## rv-battery-model.h: ns3::Time ns3::RvBatteryModel::GetLifetime() const [member function]
+ cls.add_method('GetLifetime',
+ 'ns3::Time',
+ [],
+ is_const=True)
+ ## rv-battery-model.h: int ns3::RvBatteryModel::GetNumOfTerms() const [member function]
+ cls.add_method('GetNumOfTerms',
+ 'int',
+ [],
+ is_const=True)
+ ## rv-battery-model.h: double ns3::RvBatteryModel::GetOpenCircuitVoltage() const [member function]
+ cls.add_method('GetOpenCircuitVoltage',
+ 'double',
+ [],
+ is_const=True)
+ ## rv-battery-model.h: double ns3::RvBatteryModel::GetRemainingEnergy() [member function]
+ cls.add_method('GetRemainingEnergy',
+ 'double',
+ [],
+ is_virtual=True)
+ ## rv-battery-model.h: ns3::Time ns3::RvBatteryModel::GetSamplingInterval() const [member function]
+ cls.add_method('GetSamplingInterval',
+ 'ns3::Time',
+ [],
+ is_const=True)
+ ## rv-battery-model.h: double ns3::RvBatteryModel::GetSupplyVoltage() const [member function]
+ cls.add_method('GetSupplyVoltage',
+ 'double',
+ [],
+ is_const=True, is_virtual=True)
+ ## rv-battery-model.h: static ns3::TypeId ns3::RvBatteryModel::GetTypeId() [member function]
+ cls.add_method('GetTypeId',
+ 'ns3::TypeId',
+ [],
+ is_static=True)
+ ## rv-battery-model.h: void ns3::RvBatteryModel::SetAlpha(double alpha) [member function]
+ cls.add_method('SetAlpha',
+ 'void',
+ [param('double', 'alpha')])
+ ## rv-battery-model.h: void ns3::RvBatteryModel::SetBeta(double beta) [member function]
+ cls.add_method('SetBeta',
+ 'void',
+ [param('double', 'beta')])
+ ## rv-battery-model.h: void ns3::RvBatteryModel::SetCutoffVoltage(double voltage) [member function]
+ cls.add_method('SetCutoffVoltage',
+ 'void',
+ [param('double', 'voltage')])
+ ## rv-battery-model.h: void ns3::RvBatteryModel::SetNumOfTerms(int num) [member function]
+ cls.add_method('SetNumOfTerms',
+ 'void',
+ [param('int', 'num')])
+ ## rv-battery-model.h: void ns3::RvBatteryModel::SetOpenCircuitVoltage(double voltage) [member function]
+ cls.add_method('SetOpenCircuitVoltage',
+ 'void',
+ [param('double', 'voltage')])
+ ## rv-battery-model.h: void ns3::RvBatteryModel::SetSamplingInterval(ns3::Time interval) [member function]
+ cls.add_method('SetSamplingInterval',
+ 'void',
+ [param('ns3::Time', 'interval')])
+ ## rv-battery-model.h: void ns3::RvBatteryModel::UpdateEnergySource() [member function]
+ cls.add_method('UpdateEnergySource',
+ 'void',
+ [],
+ is_virtual=True)
+ ## rv-battery-model.h: void ns3::RvBatteryModel::DoDispose() [member function]
+ cls.add_method('DoDispose',
+ 'void',
+ [],
+ visibility='private', is_virtual=True)
+ ## rv-battery-model.h: void ns3::RvBatteryModel::DoStart() [member function]
+ cls.add_method('DoStart',
+ 'void',
+ [],
+ visibility='private', is_virtual=True)
+ return
+
def register_Ns3UanChannel_methods(root_module, cls):
## uan-channel.h: ns3::UanChannel::UanChannel(ns3::UanChannel const & arg0) [copy constructor]
cls.add_constructor([param('ns3::UanChannel const &', 'arg0')])
@@ -5919,9 +6353,14 @@
'void',
[param('int', 'newState')],
is_virtual=True)
- ## wifi-radio-energy-model.h: ns3::WifiRadioEnergyModel::WifiRadioState ns3::WifiRadioEnergyModel::GetCurrentState() const [member function]
+ ## wifi-radio-energy-model.h: double ns3::WifiRadioEnergyModel::GetCcaBusyCurrentA() const [member function]
+ cls.add_method('GetCcaBusyCurrentA',
+ 'double',
+ [],
+ is_const=True)
+ ## wifi-radio-energy-model.h: ns3::WifiPhy::State ns3::WifiRadioEnergyModel::GetCurrentState() const [member function]
cls.add_method('GetCurrentState',
- 'ns3::WifiRadioEnergyModel::WifiRadioState',
+ 'ns3::WifiPhy::State',
[],
is_const=True)
## wifi-radio-energy-model.h: double ns3::WifiRadioEnergyModel::GetIdleCurrentA() const [member function]
@@ -5929,18 +6368,17 @@
'double',
[],
is_const=True)
- ## wifi-radio-energy-model.h: ns3::Ptr<ns3::Node> ns3::WifiRadioEnergyModel::GetNode() const [member function]
- cls.add_method('GetNode',
- 'ns3::Ptr< ns3::Node >',
- [],
- is_const=True, is_virtual=True)
+ ## wifi-radio-energy-model.h: ns3::WifiRadioEnergyModelPhyListener * ns3::WifiRadioEnergyModel::GetPhyListener() [member function]
+ cls.add_method('GetPhyListener',
+ 'ns3::WifiRadioEnergyModelPhyListener *',
+ [])
## wifi-radio-energy-model.h: double ns3::WifiRadioEnergyModel::GetRxCurrentA() const [member function]
cls.add_method('GetRxCurrentA',
'double',
[],
is_const=True)
- ## wifi-radio-energy-model.h: double ns3::WifiRadioEnergyModel::GetSleepCurrentA() const [member function]
- cls.add_method('GetSleepCurrentA',
+ ## wifi-radio-energy-model.h: double ns3::WifiRadioEnergyModel::GetSwitchingCurrentA() const [member function]
+ cls.add_method('GetSwitchingCurrentA',
'double',
[],
is_const=True)
@@ -5964,6 +6402,10 @@
'void',
[],
is_virtual=True)
+ ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModel::SetCcaBusyCurrentA(double ccaBusyCurrentA) [member function]
+ cls.add_method('SetCcaBusyCurrentA',
+ 'void',
+ [param('double', 'ccaBusyCurrentA')])
## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModel::SetEnergyDepletionCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
cls.add_method('SetEnergyDepletionCallback',
'void',
@@ -5977,19 +6419,14 @@
cls.add_method('SetIdleCurrentA',
'void',
[param('double', 'idleCurrentA')])
- ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModel::SetNode(ns3::Ptr<ns3::Node> node) [member function]
- cls.add_method('SetNode',
- 'void',
- [param('ns3::Ptr< ns3::Node >', 'node')],
- is_virtual=True)
## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModel::SetRxCurrentA(double rxCurrentA) [member function]
cls.add_method('SetRxCurrentA',
'void',
[param('double', 'rxCurrentA')])
- ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModel::SetSleepCurrentA(double sleepCurrentA) [member function]
- cls.add_method('SetSleepCurrentA',
- 'void',
- [param('double', 'sleepCurrentA')])
+ ## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModel::SetSwitchingCurrentA(double switchingCurrentA) [member function]
+ cls.add_method('SetSwitchingCurrentA',
+ 'void',
+ [param('double', 'switchingCurrentA')])
## wifi-radio-energy-model.h: void ns3::WifiRadioEnergyModel::SetTxCurrentA(double txCurrentA) [member function]
cls.add_method('SetTxCurrentA',
'void',
@@ -6011,11 +6448,6 @@
cls.add_constructor([param('ns3::BasicEnergySource const &', 'arg0')])
## basic-energy-source.h: ns3::BasicEnergySource::BasicEnergySource() [constructor]
cls.add_constructor([])
- ## basic-energy-source.h: void ns3::BasicEnergySource::DecreaseRemainingEnergy(double energyJ) [member function]
- cls.add_method('DecreaseRemainingEnergy',
- 'void',
- [param('double', 'energyJ')],
- is_virtual=True)
## basic-energy-source.h: double ns3::BasicEnergySource::GetEnergyFraction() [member function]
cls.add_method('GetEnergyFraction',
'double',
@@ -6046,11 +6478,6 @@
'ns3::TypeId',
[],
is_static=True)
- ## basic-energy-source.h: void ns3::BasicEnergySource::IncreaseRemainingEnergy(double energyJ) [member function]
- cls.add_method('IncreaseRemainingEnergy',
- 'void',
- [param('double', 'energyJ')],
- is_virtual=True)
## basic-energy-source.h: void ns3::BasicEnergySource::SetEnergyUpdateInterval(ns3::Time interval) [member function]
cls.add_method('SetEnergyUpdateInterval',
'void',
@@ -6307,14 +6734,16 @@
cls.add_method('AddNetworkRouteTo',
'void',
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')])
- ## ipv4-global-routing.h: uint32_t ns3::Ipv4GlobalRouting::GetNRoutes() [member function]
+ ## ipv4-global-routing.h: uint32_t ns3::Ipv4GlobalRouting::GetNRoutes() const [member function]
cls.add_method('GetNRoutes',
'uint32_t',
- [])
- ## ipv4-global-routing.h: ns3::Ipv4RoutingTableEntry * ns3::Ipv4GlobalRouting::GetRoute(uint32_t i) [member function]
+ [],
+ is_const=True)
+ ## ipv4-global-routing.h: ns3::Ipv4RoutingTableEntry * ns3::Ipv4GlobalRouting::GetRoute(uint32_t i) const [member function]
cls.add_method('GetRoute',
- retval('ns3::Ipv4RoutingTableEntry *', caller_owns_return=False),
- [param('uint32_t', 'i')])
+ 'ns3::Ipv4RoutingTableEntry *',
+ [param('uint32_t', 'i')],
+ is_const=True)
## ipv4-global-routing.h: static ns3::TypeId ns3::Ipv4GlobalRouting::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
@@ -6340,6 +6769,11 @@
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
is_virtual=True)
+ ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTable',
+ 'void',
+ [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True, is_virtual=True)
## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::RemoveRoute(uint32_t i) [member function]
cls.add_method('RemoveRoute',
'void',
@@ -6411,6 +6845,11 @@
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
is_virtual=True)
+ ## ipv4-list-routing.h: void ns3::Ipv4ListRouting::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTable',
+ 'void',
+ [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True, is_virtual=True)
## ipv4-list-routing.h: bool ns3::Ipv4ListRouting::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<ns3::Packet const>, ns3::Ipv4Header const&, 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<ns3::Packet const>, ns3::Ipv4Header const&, ns3::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> ecb) [member function]
cls.add_method('RouteInput',
'bool',
@@ -7037,6 +7476,11 @@
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
visibility='private', is_virtual=True)
+ ## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
+ cls.add_method('PrintRoutingTable',
+ 'void',
+ [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
+ is_const=True, visibility='private', is_virtual=True)
## 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<ns3::Packet const>, ns3::Ipv4Header const&, 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<ns3::Packet const>, ns3::Ipv4Header const&, ns3::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> ecb) [member function]
cls.add_method('RouteInput',
'bool',
@@ -7136,6 +7580,17 @@
ns3_module_test__local.register_functions(root_module)
root_module.end_section('ns3_module_test')
+ root_module.begin_section('ns3_module_visualizer')
+ ns3_module_visualizer.register_functions(root_module)
+
+ try:
+ import ns3_module_visualizer__local
+ except ImportError:
+ pass
+ else:
+ ns3_module_visualizer__local.register_functions(root_module)
+
+ root_module.end_section('ns3_module_visualizer')
root_module.begin_section('ns3_module_mobility')
ns3_module_mobility.register_functions(root_module)
@@ -7202,6 +7657,17 @@
ns3_module_bridge__local.register_functions(root_module)
root_module.end_section('ns3_module_bridge')
+ root_module.begin_section('ns3_module_bulk_send')
+ ns3_module_bulk_send.register_functions(root_module)
+
+ try:
+ import ns3_module_bulk_send__local
+ except ImportError:
+ pass
+ else:
+ ns3_module_bulk_send__local.register_functions(root_module)
+
+ root_module.end_section('ns3_module_bulk_send')
root_module.begin_section('ns3_module_csma')
ns3_module_csma.register_functions(root_module)
Binary file doc/WifiArchitecture.png has changed
Binary file doc/WimaxArchitecture.png has changed
--- a/doc/doxygen.conf Tue Dec 21 17:39:54 2010 +0100
+++ b/doc/doxygen.conf Tue Dec 21 17:46:35 2010 +0100
@@ -607,7 +607,9 @@
src/routing/olsr/olsr-repositories.h \
src/simulator/high-precision.h \
src/simulator/high-precision-128.h \
- src/simulator/high-precision-double.h
+ src/simulator/high-precision-double.h \
+ src/tools/visualizer/model/visual-simulator-impl.h \
+ src/tools/visualizer/model/pyviz.h
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
# directories that are symbolic links (a Unix filesystem feature) are excluded
--- a/doc/manual/Makefile Tue Dec 21 17:39:54 2010 +0100
+++ b/doc/manual/Makefile Tue Dec 21 17:46:35 2010 +0100
@@ -26,6 +26,18 @@
$(DOC_FIGURES)/WifiArchitecture.eps \
$(DOC_FIGURES)/WimaxArchitecture.eps
+$(FIGURES)/node.pdf_width = 5in
+$(FIGURES)/testbed.pdf_width = 5in
+$(FIGURES)/emulated-channel.pdf_width = 6in
+$(FIGURES)/internet-node-send.pdf_width = 5in
+$(FIGURES)/internet-node-recv.pdf_width = 5in
+$(FIGURES)/software-organization.pdf_width = 5in
+$(FIGURES)/packet.pdf_width = 4in
+$(FIGURES)/buffer.pdf_width = 15cm
+$(FIGURES)/routing.pdf_width = 6in
+$(FIGURES)/routing-specialization.pdf_width = 5in
+$(FIGURES)/sockets-overview.pdf_width = 10cm
+$(FIGURES)/snir.pdf_width = 3in
IMAGES_PNG = ${IMAGES_EPS:.eps=.png}
IMAGES_PDF = ${IMAGES_EPS:.eps=.pdf}
@@ -72,7 +84,7 @@
%.eps : %.dia; $(DIA) -t eps $< -e $@
%.png : %.dia; $(DIA) -t png $< -e $@
-%.pdf : %.eps; $(EPSTOPDF) $< -o=$@
+%.pdf : %.eps; $(EPSTOPDF) $< -o=$@; if test x$($@_width) != x; then TMPFILE=`mktemp`; ./rescale-pdf.sh $($@_width) $@ $${TMPFILE} && mv $${TMPFILE} $@; fi
all: $(IMAGES) version manual.pdf manual.html manual/manual.html
--- a/doc/manual/applications.texi Tue Dec 21 17:39:54 2010 +0100
+++ b/doc/manual/applications.texi Tue Dec 21 17:46:35 2010 +0100
@@ -1,5 +1,5 @@
-@node Applications
-@chapter Applications
+@node Applications Overview
+@chapter Applications Overview
@cartouche
Placeholder chapter
--- a/doc/manual/attributes.texi Tue Dec 21 17:39:54 2010 +0100
+++ b/doc/manual/attributes.texi Tue Dec 21 17:46:35 2010 +0100
@@ -117,7 +117,7 @@
@verbatim
class Node : public Object
-{
+@{
public:
static TypeId GetTypeId (void);
...
@@ -129,7 +129,7 @@
@example
TypeId
Node::GetTypeId (void)
-{
+@{
static TypeId tid = TypeId ("ns3::Node")
.SetParent<Object> ()
.AddConstructor<Node> ()
@@ -148,7 +148,7 @@
MakeUintegerChecker<uint32_t> ())
;
return tid;
-}
+@}
@end example
@end smallformat
@@ -266,7 +266,7 @@
NS_OBJECT_ENSURE_REGISTERED (DropTailQueue);
TypeId DropTailQueue::GetTypeId (void)
-{
+@{
static TypeId tid = TypeId ("ns3::DropTailQueue")
.SetParent<Queue> ()
.AddConstructor<DropTailQueue> ()
@@ -278,7 +278,7 @@
;
return tid;
-}
+@}
@end example
@end smallformat
@@ -325,7 +325,7 @@
int
main (int argc, char *argv[])
-{
+@{
// By default, the MaxPackets attribute has a value of 100 packets
// (this default can be observed in the function DropTailQueue::GetTypeId)
@@ -542,10 +542,10 @@
@verbatim
ConfigStore::ConfigStore ()
-{
+@{
ObjectBase::ConstructSelf (AttributeList ());
// continue on with constructor.
-}
+@}
@end verbatim
@node Extending attributes
@@ -591,7 +591,7 @@
@example
TypeId
RandomWalk2dMobilityModel::GetTypeId (void)
-{
+@{
static TypeId tid = TypeId ("ns3::RandomWalk2dMobilityModel")
.SetParent<MobilityModel> ()
.SetGroupName ("Mobility")
@@ -609,7 +609,7 @@
// etc (more parameters).
;
return tid;
-}
+@}
@end example
@end smallformat
@@ -649,14 +649,14 @@
* \brief a 2d rectangle
*/
class Rectangle
-{
+@{
...
double xMin;
double xMax;
double yMin;
double yMax;
-};
+@};
@end example
@end smallformat
@@ -682,25 +682,25 @@
std::ostream &
operator << (std::ostream &os, const Rectangle &rectangle)
-{
+@{
os << rectangle.xMin << "|" << rectangle.xMax << "|" << rectangle.yMin << "|"
<< rectangle.yMax;
return os;
-}
+@}
std::istream &
operator >> (std::istream &is, Rectangle &rectangle)
- {
+@{
char c1, c2, c3;
is >> rectangle.xMin >> c1 >> rectangle.xMax >> c2 >> rectangle.yMin >> c3
>> rectangle.yMax;
if (c1 != '|' ||
c2 != '|' ||
c3 != '|')
- {
+ @{
is.setstate (std::ios_base::failbit);
- }
+ @}
return is;
-}
+@}
@end example
@end smallformat
@@ -737,7 +737,7 @@
#include "contrib-module.h"
...
int main (...)
-{
+@{
// setup topology
// Invoke just before entering Simulator::Run ()
@@ -746,7 +746,7 @@
config.ConfigureAttributes ();
Simulator::Run ();
-}
+@}
@end example
@end smallformat
@@ -777,10 +777,10 @@
<default name="ns3::EdcaTxopN::MinCw" value="31"/>
<default name="ns3::EdcaTxopN::MaxCw" value="1023"/>
<default name="ns3::EdcaTxopN::Aifsn" value="3"/>
- <default name="ns3::QstaWifiMac::ProbeRequestTimeout" value="50000000ns"/>
- <default name="ns3::QstaWifiMac::AssocRequestTimeout" value="500000000ns"/>
- <default name="ns3::QstaWifiMac::MaxMissedBeacons" value="10"/>
- <default name="ns3::QstaWifiMac::ActiveProbing" value="false"/>
+ <default name="ns3::StaWifiMac::ProbeRequestTimeout" value="50000000ns"/>
+ <default name="ns3::StaWifiMac::AssocRequestTimeout" value="500000000ns"/>
+ <default name="ns3::StaWifiMac::MaxMissedBeacons" value="10"/>
+ <default name="ns3::StaWifiMac::ActiveProbing" value="false"/>
...
@end example
@end smallformat
@@ -815,7 +815,7 @@
#include "contrib-module.h"
...
int main (...)
-{
+@{
Config::SetDefault ("ns3::ConfigStore::Filename", StringValue ("input-defaults.xml"));
Config::SetDefault ("ns3::ConfigStore::Mode", StringValue ("Load"));
@@ -839,7 +839,7 @@
ConfigStore outputConfig;
outputConfig.ConfigureAttributes ();
Simulator::Run ();
-}
+@}
@end example
@end smallformat
--- a/doc/manual/callbacks.texi Tue Dec 21 17:39:54 2010 +0100
+++ b/doc/manual/callbacks.texi Tue Dec 21 17:46:35 2010 +0100
@@ -11,8 +11,8 @@
* Callbacks Background::
* Using the Callback API::
* Bound Callbacks::
+* Traced Callbacks::
* Callback locations in ns-3::
-* Traced Callbacks::
* Implementation details::
@end menu
@@ -597,7 +597,7 @@
@cartouche
Placeholder subsection
@end cartouche
-@section Callback locations in @command{ns-3}
+
@node Callback locations in ns-3
@section Callback locations in @command{ns-3}
--- a/doc/manual/csma.texi Tue Dec 21 17:39:54 2010 +0100
+++ b/doc/manual/csma.texi Tue Dec 21 17:46:35 2010 +0100
@@ -6,6 +6,8 @@
@menu
* Overview of the CSMA model::
+* CSMA Channel Model::
+* CSMA Net Device Model::
* Using the CsmaNetDevice::
* CSMA Tracing::
@end menu
@@ -88,6 +90,7 @@
reception of a packet by the net device in order to forward the packet up
the protocol stack.
+@node CSMA Channel Model
@section CSMA Channel Model
The class CsmaChannel models the actual transmission medium.
@@ -157,6 +160,7 @@
@item Delay: The speed of light transmission delay for the channel.
@end itemize
+@node CSMA Net Device Model
@section CSMA Net Device Model
The CSMA network device appears somewhat like an Ethernet device. The
--- a/doc/manual/emulation.texi Tue Dec 21 17:39:54 2010 +0100
+++ b/doc/manual/emulation.texi Tue Dec 21 17:46:35 2010 +0100
@@ -1,5 +1,5 @@
-@node Emulation
-@chapter Emulation
+@node Emulation Overview
+@chapter Emulation Overview
ns-3 has been designed for integration into testbed and virtual machine
environments. We have addressed this need by providing two kinds of
--- a/doc/manual/internet.texi Tue Dec 21 17:39:54 2010 +0100
+++ b/doc/manual/internet.texi Tue Dec 21 17:46:35 2010 +0100
@@ -19,13 +19,13 @@
@example
void
InternetStackHelper::Install (Ptr<Node> node) const
-{
+@{
if (node->GetObject<Ipv4> () != 0)
- {
+ @{
NS_FATAL_ERROR ("InternetStackHelper::Install(): Aggregating "
"an InternetStack to a node with an existing Ipv4 object");
return;
- }
+ @}
CreateAndAggregateObjectFromTypeId (node, "ns3::ArpL3Protocol");
CreateAndAggregateObjectFromTypeId (node, "ns3::Ipv4L3Protocol");
@@ -38,7 +38,7 @@
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
Ptr<Ipv4RoutingProtocol> ipv4Routing = m_routing->Create (node);
ipv4->SetRoutingProtocol (ipv4Routing);
-}
+@}
@end example
@end smallformat
--- a/doc/manual/manual.texi Tue Dec 21 17:39:54 2010 +0100
+++ b/doc/manual/manual.texi Tue Dec 21 17:46:35 2010 +0100
@@ -88,6 +88,25 @@
@menu
* Organization::
+* Core::
+* Node and NetDevices::
+* Emulation::
+* Internet Models::
+* Applications::
+* Support::
+@end menu
+
+@setchapternewpage odd
+@headings off
+@everyheading @thischapter @| @| ns-3 manual
+@everyfooting ns-3 @| @thispage @| @today
+@include organization.texi
+
+@node Core
+@chapter Core
+
+@lowersections
+@menu
* Random variables::
* Callbacks::
* Object model::
@@ -100,39 +119,9 @@
* Packets::
* Helpers::
* Python::
-* Node and NetDevices::
-* Simple NetDevice::
-* PointToPoint NetDevice::
-* CSMA NetDevice::
-* Wifi NetDevice::
-* Mesh NetDevice::
-* Bridge NetDevice::
* LTE Module::
-* Wimax NetDevice::
-* Emulation::
-* Emu NetDevice::
-* Tap NetDevice::
-* Sockets APIs::
-* Internet Stack::
-* IPv4::
-* IPv6::
-* Routing overview::
-* TCP::
-* Applications::
-* Flow Monitor::
-* Animation::
-* Statistics::
-* Creating a new ns-3 model::
-* Troubleshooting::
@end menu
-@setchapternewpage odd
-@headings off
-@everyheading @thischapter @| @| ns-3 manual
-@everyfooting ns-3 @| @thispage @| @today
-@include organization.texi
-
-@unnumbered Part 1: ns-3 core
@setchapternewpage off
@include random.texi
@setchapternewpage odd
@@ -147,8 +136,23 @@
@include packets.texi
@include helpers.texi
@include python.texi
+@raisesections
-@unnumbered Part 2: Nodes and NetDevices
+@node Node and NetDevices
+@chapter Node and NetDevices
+
+@lowersections
+@menu
+* Node and NetDevices Overview::
+* Simple NetDevice::
+* PointToPoint NetDevice::
+* CSMA NetDevice::
+* Wifi NetDevice::
+* Mesh NetDevice::
+* Bridge NetDevice::
+* Wimax NetDevice::
+@end menu
+
@setchapternewpage off
@include node.texi
@setchapternewpage odd
@@ -160,15 +164,38 @@
@include bridge.texi
@include lte.texi
@include wimax.texi
+@raisesections
-@unnumbered Part 3: Emulation
+@node Emulation
+@chapter Emulation
+
+@menu
+* Emulation Overview::
+* Emu NetDevice::
+* Tap NetDevice::
+@end menu
+
+@lowersections
@setchapternewpage off
@include emulation.texi
@setchapternewpage odd
@include emu.texi
@include tap.texi
+@raisesections
-@unnumbered Part 4: Internet Models
+@node Internet Models
+@chapter Internet Models
+
+@menu
+* Sockets APIs::
+* Internet Stack::
+* IPv4::
+* IPv6::
+* Routing overview::
+* TCP::
+@end menu
+
+@lowersections
@setchapternewpage off
@include sockets.texi
@setchapternewpage odd
@@ -177,13 +204,33 @@
@include ipv6.texi
@include routing.texi
@include tcp.texi
+@raisesections
-@unnumbered Part 5: Applications
+@node Applications
+@chapter Applications
+
+@menu
+* Applications Overview::
+@end menu
+
+@lowersections
@setchapternewpage off
@include applications.texi
@setchapternewpage odd
+@raisesections
-@unnumbered Part 6: Support
+@node Support
+@chapter Support
+
+@menu
+* Flow Monitor::
+* Animation::
+* Statistics::
+* Creating a new ns-3 model::
+* Troubleshooting::
+@end menu
+
+@lowersections
@setchapternewpage off
@include flow-monitor.texi
@setchapternewpage odd
@@ -191,6 +238,7 @@
@include statistics.texi
@include new-models.texi
@include troubleshoot.texi
+@raisesections
@printindex cp
--- a/doc/manual/new-models.texi Tue Dec 21 17:39:54 2010 +0100
+++ b/doc/manual/new-models.texi Tue Dec 21 17:46:35 2010 +0100
@@ -6,6 +6,7 @@
* Scaffolding::
* Initial Implementation::
* Adding-a-sample-script::
+* Add subclass::
* Build-core-functions-and-unit-tests::
@end menu
@@ -453,10 +454,10 @@
@example
void
PointToPointNetDevice::SetReceiveErrorModel (Ptr<ErrorModel> em)
-{
+@{
NS_LOG_FUNCTION (this << em);
m_receiveErrorModel = em;
-}
+@}
.AddAttribute ("ReceiveErrorModel",
"The receiver error model used to simulate packet loss",
@@ -471,20 +472,20 @@
@smallformat
@example
void PointToPointNetDevice::Receive (Ptr<Packet> packet)
-{
+@{
NS_LOG_FUNCTION (this << packet);
uint16_t protocol = 0;
if (m_receiveErrorModel && m_receiveErrorModel->IsCorrupt (packet) )
- {
+ @{
//
// If we have an error model and it indicates that it is time to lose a
// corrupted packet, don't forward this packet up, let it go.
//
m_dropTrace (packet);
- }
+ @}
else
- {
+ @{
//
// Hit the receive trace hook, strip off the point-to-point protocol header
// and forward this packet up the protocol stack.
@@ -493,11 +494,11 @@
ProcessHeader(packet, protocol);
m_rxCallback (this, packet, protocol, GetRemote ());
if (!m_promiscCallback.IsNull ())
- { m_promiscCallback (this, packet, protocol, GetRemote (),
+ @{ m_promiscCallback (this, packet, protocol, GetRemote (),
GetAddress (), NetDevice::PACKET_HOST);
- }
- }
-}
+ @}
+ @}
+@}
@end example
@end smallformat
@@ -519,11 +520,11 @@
bool
ErrorModel::DoCorrupt (Packet& p)
-{
+@{
NS_LOG_FUNCTION;
NS_LOG_UNCOND("Corrupt!");
return false;
-}
+@}
@end example
@end smallformat
@@ -533,6 +534,7 @@
node n3. Next, we return to the error model to add in a subclass
that performs more interesting error modeling.
+@node Add subclass
@section Add subclass
The trivial base class ErrorModel does not do anything interesting,
@@ -564,7 +566,7 @@
@smallformat
@example
class BasicErrorModel : public ErrorModel
-{
+@{
public:
static TypeId GetTypeId (void);
...
@@ -573,7 +575,7 @@
virtual bool DoCorrupt (Ptr<Packet> p);
virtual bool DoReset (void);
...
-}
+@}
@end example
@end smallformat
@@ -582,7 +584,7 @@
@verbatim
TypeId RateErrorModel::GetTypeId (void)
-{
+@{
static TypeId tid = TypeId ("ns3::RateErrorModel")
.SetParent<ErrorModel> ()
.AddConstructor<RateErrorModel> ()
--- a/doc/manual/node.texi Tue Dec 21 17:39:54 2010 +0100
+++ b/doc/manual/node.texi Tue Dec 21 17:46:35 2010 +0100
@@ -1,7 +1,11 @@
-@node Node and NetDevices
-@chapter Node and NetDevices
+@node Node and NetDevices Overview
+@chapter Node and NetDevices Overview
@anchor{chap:Node}
+@menu
+* NodeList::
+@end menu
+
This chapter describes how ns-3 nodes are put together, and provides
a walk-through of how packets traverse an internet-based Node.
@@ -102,6 +106,7 @@
@end verbatim
and likewise for Ipv6, ARP, etc.
+@node NodeList
@section NodeList
Every Node created is automatically added to the ns-3 @code{NodeList}.
--- a/doc/manual/objects.texi Tue Dec 21 17:39:54 2010 +0100
+++ b/doc/manual/objects.texi Tue Dec 21 17:46:35 2010 +0100
@@ -6,7 +6,6 @@
@chapter Object model
@menu
-* Object model::
* Object-oriented behavior::
* Object base classes::
* Memory management and class Ptr::
--- a/doc/manual/point-to-point.texi Tue Dec 21 17:39:54 2010 +0100
+++ b/doc/manual/point-to-point.texi Tue Dec 21 17:46:35 2010 +0100
@@ -6,6 +6,7 @@
@menu
* Overview of the PointToPoint model::
+* Point-to-Point Channel Model::
* Using the PointToPointNetDevice::
* PointToPoint Tracing::
@end menu
@@ -58,6 +59,7 @@
model." This is an ErrorModel object that is used to simulate data
corruption on the link.
+@node Point-to-Point Channel Model
@section Point-to-Point Channel Model
The point to point net devices are connected via an
--- a/doc/manual/random.texi Tue Dec 21 17:39:54 2010 +0100
+++ b/doc/manual/random.texi Tue Dec 21 17:46:35 2010 +0100
@@ -259,7 +259,7 @@
@example
TypeId
RandomPropagationDelayModel::GetTypeId (void)
-{
+@{
static TypeId tid = TypeId ("ns3::RandomPropagationDelayModel")
.SetParent<PropagationDelayModel> ()
.AddConstructor<RandomPropagationDelayModel> ()
@@ -270,7 +270,7 @@
MakeRandomVariableChecker ())
;
return tid;
-}
+@}
@end example
@end smallformat
Here, the ns-3 user can change the default random variable for this
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/manual/rescale-pdf.sh Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,12 @@
+#!/usr/bin/env sh
+
+TMPFILE=`mktemp`
+
+echo "\documentclass{book}
+\usepackage{pdfpages}
+\begin{document}
+\includepdf[width=${1},fitpaper]{${2}}
+\end{document}" >${TMPFILE}.tex
+pdflatex -output-directory /tmp ${TMPFILE}.tex >/dev/null 2>/dev/null
+cp ${TMPFILE}.pdf ${3}
+
--- a/doc/manual/tracing.texi Tue Dec 21 17:39:54 2010 +0100
+++ b/doc/manual/tracing.texi Tue Dec 21 17:46:35 2010 +0100
@@ -146,10 +146,10 @@
@smallformat
@example
class MyObject : public Object
- {
+ @{
public:
static TypeId GetTypeId (void)
- {
+ @{
static TypeId tid = TypeId ("MyObject")
.SetParent (Object::GetTypeId ())
.AddConstructor<MyObject> ()
@@ -158,11 +158,11 @@
MakeTraceSourceAccessor (&MyObject::m_myInt))
;
return tid;
- }
+ @}
- MyObject () {}
+ MyObject () @{@}
TracedValue<uint32_t> m_myInt;
- };
+ @};
@end example
@end smallformat
@@ -180,9 +180,9 @@
@example
void
IntTrace (Int oldValue, Int newValue)
- {
+ @{
std::cout << ``Traced `` << oldValue << `` to `` << newValue << std::endl;
- }
+ @}
@end example
@end smallformat
@@ -194,13 +194,13 @@
@example
int
main (int argc, char *argv[])
- {
+ @{
Ptr<MyObject> myObject = CreateObject<MyObject> ();
myObject->TraceConnectWithoutContext ("MyInteger", MakeCallback(&IntTrace));
myObject->m_myInt = 1234;
- }
+ @}
@end example
@end smallformat
@@ -250,7 +250,7 @@
@smallformat
@example
- void CwndTracer (uint32_t oldval, uint32_t newval) {}
+ void CwndTracer (uint32_t oldval, uint32_t newval) @{@}
...
@@ -272,7 +272,7 @@
@smallformat
@example
- void CwndTracer (uint32_t oldval, uint32_t newval) {}
+ void CwndTracer (uint32_t oldval, uint32_t newval) @{@}
...
@@ -476,7 +476,7 @@
You can enable pcap tracing on a particular node/net-device pair by providing a
@code{std::string} representing an object name service string to an
@code{EnablePcap} method. The @code{Ptr<NetDevice>} is looked up from the name
-string. Again, the @code<Node> is implicit since the named net device must
+string. Again, the @code{Node} is implicit since the named net device must
belong to exactly one @code{Node}. For example,
@verbatim
@@ -489,7 +489,7 @@
You can enable pcap tracing on a collection of node/net-device pairs by
providing a @code{NetDeviceContainer}. For each @code{NetDevice} in the container
the type is checked. For each device of the proper type (the same type as is
-managed by the device helper), tracing is enabled. Again, the @code<Node> is
+managed by the device helper), tracing is enabled. Again, the @code{Node} is
implicit since the found net device must belong to exactly one @code{Node}.
For example,
@@ -676,7 +676,7 @@
You can enable ascii tracing on a particular node/net-device pair by providing a
@code{std::string} representing an object name service string to an
@code{EnablePcap} method. The @code{Ptr<NetDevice>} is looked up from the name
-string. Again, the @code<Node> is implicit since the named net device must
+string. Again, the @code{Node} is implicit since the named net device must
belong to exactly one @code{Node}. For example,
@verbatim
@@ -713,7 +713,7 @@
You can enable ascii tracing on a collection of node/net-device pairs by
providing a @code{NetDeviceContainer}. For each @code{NetDevice} in the container
the type is checked. For each device of the proper type (the same type as is
-managed by the device helper), tracing is enabled. Again, the @code<Node> is
+managed by the device helper), tracing is enabled. Again, the @code{Node} is
implicit since the found net device must belong to exactly one @code{Node}.
For example,
@@ -1062,7 +1062,7 @@
You can enable ascii tracing on a particular protocol by providing a
@code{std::string} representing an object name service string to an
@code{EnablePcap} method. The @code{Ptr<Ipv4>} is looked up from the name
-string. The @code<Node> in the resulting filenames is implicit since there
+string. The @code{Node} in the resulting filenames is implicit since there
is a one-to-one correspondence between protocol instances and nodes,
For example,
@@ -1096,7 +1096,7 @@
You can enable ascii tracing on a collection of protocol/interface pairs by
providing an @code{Ipv4InterfaceContainer}. For each protocol of the proper
type (the same type as is managed by the device helper), tracing is enabled
-for the corresponding interface. Again, the @code<Node> is implicit since
+for the corresponding interface. Again, the @code{Node} is implicit since
there is a one-to-one correspondence between each protocol and its node.
For example,
--- a/doc/manual/troubleshoot.texi Tue Dec 21 17:39:54 2010 +0100
+++ b/doc/manual/troubleshoot.texi Tue Dec 21 17:46:35 2010 +0100
@@ -62,9 +62,9 @@
at ../examples/tcp-point-to-point.cc:136
136 Ptr<Socket> localSocket = socketFactory->CreateSocket ();
(gdb) p localSocket
-$1 = {m_ptr = 0x3c5d65}
+$1 = @{m_ptr = 0x3c5d65@}
(gdb) p socketFactory
-$2 = {m_ptr = 0x0}
+$2 = @{m_ptr = 0x0@}
(gdb) quit
The program is running. Exit anyway? (y or n) y
@end example
--- a/doc/manual/wifi.texi Tue Dec 21 17:39:54 2010 +0100
+++ b/doc/manual/wifi.texi Tue Dec 21 17:46:35 2010 +0100
@@ -46,49 +46,46 @@
@item a set of @strong{Rate control algorithms} used by the MAC low models
@end itemize
-There are presently six @strong{MAC high models}, three for non-QoS MACs and three
-for QoS MACs.
-@itemize @bullet
-@item @strong{non-QoS MACs:}
-@enumerate
-@item a simple adhoc state machine that does not perform any
-kind of beacon generation, probing, or association. This
-state machine is implemented by the @code{ns3::AdhocWifiMac} class.
-@item an active probing and association state machine that handles
-automatic re-association whenever too many beacons are missed
-is implemented by the @code{ns3::NqstaWifiMac} class.
-@item an access point that generates periodic beacons, and that
-accepts every attempt to associate. This AP state machine
-is implemented by the @code{ns3::NqapWifiMac} class.
-@end enumerate
-@item @strong{QoS MACs:}
-@enumerate
-@item a simple adhoc state machine like above but also able to manage QoS traffic.
-This state machine is implemented by @code{ns3::QadhocWifiMac} class.
-@item a station state machine like above but also able to manage QoS traffic.
-Implemented by @code{ns3::QstaWifiMac}.
-@item a QoS access point state machine like above implemented by @code{ns3::QapWifiMac}.
-@end enumerate
-@end itemize
+There are presently three @strong{MAC high models} that provide for
+the three (non-mesh; the mesh equivalent, which is a sibling of these
+with common parent @code{ns3::RegularWifiMac}, is not discussed here)
+Wi-Fi topological elements - Access Point (AP) (implemented in class
+@code{ns3::ApWifiMac}), non-AP Station (STA) (@code{ns3::StaWifiMac}),
+and STA in an Independent Basic Service Set (IBSS - also commonly
+referred to as an ad hoc network) (@code{ns3::AdhocWifiMac}).
-With QoS MAC models is possible to work with traffic belonging to
-four different access classes: @strong{AC_VO} for voice traffic, @strong{AC_VI}
-for video traffic, @strong{AC_BE} for best-effort traffic and @strong{AC_BK}
-for background traffic.
-In order to determine MSDU's access class, every packet forwarded down
-to these MAC layers should be marked using @code{ns3::QosTag} in order to set
-a TID (traffic id) for that packet otherwise it will be considered
-belonging to @strong{AC_BE} access class.
+The simplest of these is @code{ns3::AdhocWifiMac}, which implements a
+Wi-Fi MAC that does not perform any kind of beacon generation,
+probing, or association. The @code{ns3::StaWifiMac} class implements
+an active probing and association state machine that handles automatic
+re-association whenever too many beacons are missed. Finally,
+@code{ns3::ApWifiMac} implements an AP that generates periodic
+beacons, and that accepts every attempt to associate.
+
+These three MAC high models share a common parent in
+@code{ns3::RegularWifiMac}, which exposes, among other MAC
+configuration, an attribute (@code{QosSupported}) that allows
+configuration of 802.11e/WMM-style QoS support. With QoS-enabled MAC
+models it is possible to work with traffic belonging to four different
+Access Categories (ACs): @strong{AC_VO} for voice traffic,
+@strong{AC_VI} for video traffic, @strong{AC_BE} for best-effort
+traffic and @strong{AC_BK} for background traffic. In order for the
+MAC to determine the appropriate AC for an MSDU, packets forwarded
+down to these MAC layers should be marked using @code{ns3::QosTag} in
+order to set a TID (traffic id) for that packet otherwise it will be
+considered belonging to @strong{AC_BE}.
The @strong{MAC low layer} is split into three components:
@enumerate
@item @code{ns3::MacLow} which takes care of RTS/CTS/DATA/ACK transactions.
@item @code{ns3::DcfManager} and @code{ns3::DcfState} which implements the DCF and EDCAF functions.
-@item @code{ns3::DcaTxop} or @code{ns3::EdcaTxopN} which handle the packet queue,
+@item @code{ns3::DcaTxop} and @code{ns3::EdcaTxopN} which handle the packet queue,
packet fragmentation, and packet retransmissions if they are needed.
-@code{ns3::DcaTxop} object is used by non-QoS high MACs. @code{ns3::EdcaTxopN} is
-used by QoS high MACs and performs also QoS operations like 802.11n MSDU
-aggregation.
+The @code{ns3::DcaTxop} object is used by high MACs that are not
+QoS-enabled, and for transmission of frames (e.g., of type Management)
+that the standard says should access the medium using the
+DCF. @code{ns3::EdcaTxopN} is used by QoS-enabled high MACs and also
+performs QoS operations like 802.11n-style MSDU aggregation.
@end enumerate
There are also several @strong{rate control algorithms} that can be used by the Mac low layer:
@@ -198,37 +195,50 @@
@subsection NqosWifiMacHelper and QosWifiMacHelper
-The @code{ns3::NqosWifiMacHelper} and @code{ns3::QosWifiMacHelper} configure an
-object factory to create instances of a @code{ns3::WifiMac}. They are used to
-configure MAC parameters like type of MAC.
-Setting up a non-QoS MAC layers the object we use is @code{ns3::NqosWifiMacHelper}.
-For example the following user code configures a non-QoS MAC sta:
+The @code{ns3::NqosWifiMacHelper} and @code{ns3::QosWifiMacHelper}
+configure an object factory to create instances of a
+@code{ns3::WifiMac}. They are used to configure MAC parameters like
+type of MAC.
+
+The former, @code{ns3::NqosWifiMacHelper}, supports creation of MAC
+instances that do not have 802.11e/WMM-style QoS support enabled.
+
+For example, the following user code configures a non-QoS MAC that
+will be a non-AP STA in an infrastructure network where the AP has
+SSID ``ns-3-ssid''.
+
@smallformat
@example
NqosWifiMacHelper wifiMacHelper = NqosWifiMacHelper::Default ();
Ssid ssid = Ssid ("ns-3-ssid");
- wifiMacHelper.SetType ("ns3::NqstaWifiMac", "Ssid", SsidValue (ssid),
-"ActiveProbing", BooleanValue (false));
+ wifiMacHelper.SetType ("ns3::StaWifiMac",
+ "Ssid", SsidValue (ssid),
+ "ActiveProbing", BooleanValue (false));
@end example
@end smallformat
-Setting up a QoS MACs we use a @code{ns3::QosWifiMacHelper} instead.
-This object could be also used to set:
+To create MAC instances with QoS support enabled,
+@code{ns3::QosWifiMacHelper} is used in place of
+@code{ns3::NqosWifiMacHelper}. This object can be also used to set:
+
@itemize @bullet
-@item a MSDU aggregator for a particular access class in order to use 802.11n MSDU aggregation feature;
+@item a MSDU aggregator for a particular Access Category (AC) in order to use 802.11n MSDU aggregation feature;
@item block ack parameters like threshold (number of packets for which block ack mechanism should be used) and inactivity timeout.
@end itemize
-A possible user code:
+The following code shows an example use of
+@code{ns3::QosWifiMacHelper} to create an AP with QoS enabled,
+aggregation on AC_VO, and Block Ack on AC_BE:
+
@smallformat
@example
QosWifiMacHelper wifiMacHelper = QosWifiMacHelper::Default ();
- wifiMacHelper.SetType ("ns3::QapWifiMac",
- "Ssid", SsidValue (ssid),
- "BeaconGeneration", BooleanValue (true),
- "BeaconInterval", TimeValue (Seconds (2.5)));
- wifiMacHelper.SetMsduAggregatorForAc (AC_VO, "ns3::MsduStandardAggregator",
- "MaxAmsduSize", UintegerValue (3839));
+ wifiMacHelper.SetType ("ns3::ApWifiMac",
+ "Ssid", SsidValue (ssid),
+ "BeaconGeneration", BooleanValue (true),
+ "BeaconInterval", TimeValue (Seconds (2.5)));
+ wifiMacHelper.SetMsduAggregatorForAc (AC_VO, "ns3::MsduStandardAggregator",
+ "MaxAmsduSize", UintegerValue (3839));
wifiMacHelper.SetBlockAckThresholdForAc (AC_BE, 10);
wifiMacHelper.SetBlockAckInactivityTimeoutForAc (AC_BE, 5);
@end example
--- a/doc/manual/wimax.texi Tue Dec 21 17:39:54 2010 +0100
+++ b/doc/manual/wimax.texi Tue Dec 21 17:46:35 2010 +0100
@@ -34,6 +34,8 @@
* Wimax Tracing::
* Wimax MAC model::
* WimaxChannel and WimaxPhy models::
+* Channel model::
+* Physical model::
@end menu
@node Scope of the model
@@ -87,7 +89,7 @@
interact with the Wimax models is through the helper API and through
the publicly visible attributes of the model.
-The helper API is defined in @code{src/helper/wimax-helper.{cc,h}}.
+The helper API is defined in @code{src/helper/wimax-helper.@{cc,h@}}.
The example @code{examples/wimax/wimax-simple.cc} contains some basic
code that shows how to set up the model:
@@ -95,7 +97,7 @@
@smallformat
@example
switch (schedType)
- {
+ @{
case 0:
scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
break;
@@ -107,7 +109,7 @@
break;
default:
scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
- }
+ @}
NodeContainer ssNodes;
NodeContainer bsNodes;
@@ -460,6 +462,7 @@
It supports all the seven modulation and coding schemes specified by Wireless
MAN-OFDM. It is composed of two parts: the channel model and the physical model.
+@node Channel model
@section Channel model
The channel model we propose is implemented by the @code{class SimpleOFDMWimaxChannel} which
@@ -472,6 +475,7 @@
entities according to their 3D coordinates. The delay is computed as @code{delay = distance/C}, where C
is the speed of the light.
+@node Physical model
@section Physical model
The physical layer performs two main operations: (i) It receives a burst from a channel and forwards it to the
--- a/doc/tutorial/building-topologies.texi Tue Dec 21 17:39:54 2010 +0100
+++ b/doc/tutorial/building-topologies.texi Tue Dec 21 17:46:35 2010 +0100
@@ -996,18 +996,23 @@
@verbatim
Ssid ssid = Ssid ("ns-3-ssid");
- mac.SetType ("ns3::NqstaWifiMac",
+ mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false));
@end verbatim
-This code first creates an 802.11 service set identifier (SSID) object that
-will be used to set the value of the ``Ssid'' @code{Attribute} of the MAC
-layer implementation. The particular kind of MAC layer is specified by
-@code{Attribute} as being of the "ns3::NqstaWifiMac" type. This means that
-the MAC will use a ``non-QoS station'' (nqsta) state machine. Finally, the
-``ActiveProbing'' @code{Attribute} is set to false. This means that probe
-requests will not be sent by MACs created by this helper.
+This code first creates an 802.11 service set identifier (SSID) object
+that will be used to set the value of the ``Ssid'' @code{Attribute} of
+the MAC layer implementation. The particular kind of MAC layer that
+will be created by the helper is specified by @code{Attribute} as
+being of the "ns3::StaWifiMac" type. The use of
+@code{NqosWifiMacHelper} will ensure that the ''QosSupported''
+@code{Attribute} for created MAC objects is set false. The combination
+of these two configurations means that the MAC instance next created
+will be a non-QoS non-AP station (STA) in an infrastructure BSS (i.e.,
+a BSS with an AP). Finally, the ``ActiveProbing'' @code{Attribute} is
+set to false. This means that probe requests will not be sent by MACs
+created by this helper.
Once all the station-specific parameters are fully configured, both at the
MAC and PHY layers, we can invoke our now-familiar @code{Install} method to
@@ -1024,16 +1029,19 @@
requirements of the AP.
@verbatim
- mac.SetType ("ns3::NqapWifiMac",
+ mac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true),
"BeaconInterval", TimeValue (Seconds (2.5)));
@end verbatim
-In this case, the @code{NqosWifiMacHelper} is going to create MAC layers of the
-``ns3::NqapWifiMac'' (Non-Qos Access Point) type. We set the
-``BeaconGeneration'' @code{Attribute} to true and also set an interval between
-beacons of 2.5 seconds.
+In this case, the @code{NqosWifiMacHelper} is going to create MAC
+layers of the ``ns3::ApWifiMac'', the latter specifying that a MAC
+instance configured as an AP should be created, with the helper type
+implying that the ''QosSupported'' @code{Attribute} should be set to
+false - disabling 802.11e/WMM-style QoS support at created APs. We
+set the ``BeaconGeneration'' @code{Attribute} to true and also set an
+interval between beacons of 2.5 seconds.
The next lines create the single AP which shares the same set of PHY-level
@code{Attributes} (and channel) as the stations:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/energy/energy-model-example.cc Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,262 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Network Security Lab, University of Washington, Seattle.
+ *
+ * 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: Sidharth Nabar <snabar@uw.edu>, He Wu <mdzz@u.washington.edu>
+ */
+
+#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 "ns3/wifi-module.h"
+#include "ns3/energy-module.h"
+
+#include <iostream>
+#include <fstream>
+#include <vector>
+#include <string>
+
+NS_LOG_COMPONENT_DEFINE ("EnergyExample");
+
+using namespace ns3;
+
+/**
+ * \param socket Pointer to socket.
+ *
+ * Packet receiving sink.
+ */
+void
+ReceivePacket (Ptr<Socket> socket)
+{
+ Ptr<Packet> packet;
+ Address from;
+ while (packet = socket->RecvFrom (from))
+ {
+ if (packet->GetSize () > 0)
+ {
+ InetSocketAddress iaddr = InetSocketAddress::ConvertFrom (from);
+ NS_LOG_UNCOND ("--\nReceived one packet! Socket: "<< iaddr.GetIpv4 ()
+ << " port: " << iaddr.GetPort () << " at time = " <<
+ Simulator::Now ().GetSeconds () << "\n--");
+ }
+ }
+}
+
+/**
+ * \param socket Pointer to socket.
+ * \param pktSize Packet size.
+ * \param n Pointer to node.
+ * \param pktCount Number of packets to generate.
+ * \param pktInterval Packet sending interval.
+ *
+ * Traffic generator.
+ */
+static void
+GenerateTraffic (Ptr<Socket> socket, uint32_t pktSize, Ptr<Node> n,
+ uint32_t pktCount, Time pktInterval)
+{
+ if (pktCount > 0)
+ {
+ socket->Send (Create<Packet> (pktSize));
+ Simulator::Schedule (pktInterval, &GenerateTraffic, socket, pktSize, n,
+ pktCount - 1, pktInterval);
+ }
+ else
+ {
+ socket->Close ();
+ }
+}
+
+/// Trace function for remaining energy at node.
+void
+RemainingEnergy (double oldValue, double remainingEnergy)
+{
+ NS_LOG_UNCOND (Simulator::Now ().GetSeconds ()
+ << "s Current remaining energy = " << remainingEnergy << "J");
+}
+
+/// Trace function for total energy consumption at node.
+void
+TotalEnergy (double oldValue, double totalEnergy)
+{
+ NS_LOG_UNCOND (Simulator::Now ().GetSeconds ()
+ << "s Total energy consumed by radio = " << totalEnergy << "J");
+}
+
+int
+main (int argc, char *argv[])
+{
+ /*
+ LogComponentEnable ("EnergySource", LOG_LEVEL_DEBUG);
+ LogComponentEnable ("BasicEnergySource", LOG_LEVEL_DEBUG);
+ LogComponentEnable ("DeviceEnergyModel", LOG_LEVEL_DEBUG);
+ LogComponentEnable ("WifiRadioEnergyModel", LOG_LEVEL_DEBUG);
+ */
+
+ std::string phyMode ("DsssRate1Mbps");
+ double Prss = -80; // dBm
+ uint32_t PpacketSize = 200; // bytes
+ bool verbose = false;
+
+ // simulation parameters
+ uint32_t numPackets = 10000; // number of packets to send
+ double interval = 1; // seconds
+ double startTime = 0.0; // seconds
+ double distanceToRx = 100.0; // meters
+ /*
+ * This is a magic number used to set the transmit power, based on other
+ * configuration.
+ */
+ double offset = 81;
+
+ CommandLine cmd;
+ cmd.AddValue ("phyMode", "Wifi Phy mode", phyMode);
+ cmd.AddValue ("Prss", "Intended primary RSS (dBm)", Prss);
+ cmd.AddValue ("PpacketSize", "size of application packet sent", PpacketSize);
+ cmd.AddValue ("numPackets", "Total number of packets to send", numPackets);
+ cmd.AddValue ("startTime", "Simulation start time", startTime);
+ cmd.AddValue ("distanceToRx", "X-Axis distance between nodes", distanceToRx);
+ cmd.AddValue ("verbose", "Turn on all device log components", verbose);
+ cmd.Parse (argc, argv);
+
+ // Convert to time object
+ Time interPacketInterval = Seconds (interval);
+
+ // disable fragmentation for frames below 2200 bytes
+ Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold",
+ StringValue ("2200"));
+ // turn off RTS/CTS for frames below 2200 bytes
+ Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold",
+ StringValue ("2200"));
+ // Fix non-unicast data rate to be the same as that of unicast
+ Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode",
+ StringValue (phyMode));
+
+ NodeContainer c;
+ c.Create (2); // create 2 nodes
+ NodeContainer networkNodes;
+ networkNodes.Add (c.Get (0));
+ networkNodes.Add (c.Get (1));
+
+ // The below set of helpers will help us to put together the wifi NICs we want
+ WifiHelper wifi;
+ if (verbose)
+ {
+ wifi.EnableLogComponents ();
+ }
+ wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
+
+ /** Wifi PHY **/
+ /***************************************************************************/
+ YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
+ wifiPhy.Set ("RxGain", DoubleValue (-10));
+ wifiPhy.Set ("TxGain", DoubleValue (offset + Prss));
+ wifiPhy.Set ("CcaMode1Threshold", DoubleValue (0.0));
+ /***************************************************************************/
+
+ /** wifi channel **/
+ YansWifiChannelHelper wifiChannel;
+ wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
+ wifiChannel.AddPropagationLoss ("ns3::FriisPropagationLossModel");
+ // create wifi channel
+ Ptr<YansWifiChannel> wifiChannelPtr = wifiChannel.Create ();
+ wifiPhy.SetChannel (wifiChannelPtr);
+
+ /** MAC layer **/
+ // Add a non-QoS upper MAC, and disable rate control
+ NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
+ wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode",
+ StringValue (phyMode), "ControlMode",
+ StringValue (phyMode));
+ // Set it to ad-hoc mode
+ wifiMac.SetType ("ns3::AdhocWifiMac");
+
+ /** install PHY + MAC **/
+ NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, networkNodes);
+
+ /** mobility **/
+ MobilityHelper mobility;
+ Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
+ positionAlloc->Add (Vector (0.0, 0.0, 0.0));
+ positionAlloc->Add (Vector (2 * distanceToRx, 0.0, 0.0));
+ mobility.SetPositionAllocator (positionAlloc);
+ mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
+ mobility.Install (c);
+
+ /** Energy Model **/
+ /***************************************************************************/
+ /* energy source */
+ BasicEnergySourceHelper basicSourceHelper;
+ // configure energy source
+ basicSourceHelper.Set ("BasicEnergySourceInitialEnergyJ", DoubleValue (0.1));
+ // install source
+ EnergySourceContainer sources = basicSourceHelper.Install (c);
+ /* device energy model */
+ WifiRadioEnergyModelHelper radioEnergyHelper;
+ // configure radio energy model
+ radioEnergyHelper.Set ("TxCurrentA", DoubleValue (0.0174));
+ // install device model
+ DeviceEnergyModelContainer deviceModels = radioEnergyHelper.Install (devices, sources);
+ /***************************************************************************/
+
+ /** Internet stack **/
+ InternetStackHelper internet;
+ internet.Install (networkNodes);
+
+ Ipv4AddressHelper ipv4;
+ NS_LOG_INFO ("Assign IP Addresses.");
+ ipv4.SetBase ("10.1.1.0", "255.255.255.0");
+ Ipv4InterfaceContainer i = ipv4.Assign (devices);
+
+ TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
+ Ptr<Socket> recvSink = Socket::CreateSocket (networkNodes.Get (1), tid); // node 1, receiver
+ InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (), 80);
+ recvSink->Bind (local);
+ recvSink->SetRecvCallback (MakeCallback (&ReceivePacket));
+
+ Ptr<Socket> source = Socket::CreateSocket (networkNodes.Get (0), tid); // node 0, sender
+ InetSocketAddress remote = InetSocketAddress (Ipv4Address::GetBroadcast (), 80);
+ source->SetAllowBroadcast (true);
+ source->Connect (remote);
+
+ /** connect trace sources **/
+ /***************************************************************************/
+ // all sources are connected to node 1
+ // energy source
+ Ptr<BasicEnergySource> basicSourcePtr = DynamicCast<BasicEnergySource> (sources.Get (1));
+ basicSourcePtr->TraceConnectWithoutContext ("RemainingEnergy", MakeCallback (&RemainingEnergy));
+ // device energy model
+ Ptr<DeviceEnergyModel> basicRadioModelPtr =
+ basicSourcePtr->FindDeviceEnergyModels ("ns3::WifiRadioEnergyModel").Get (0);
+ NS_ASSERT (basicRadioModelPtr != NULL);
+ basicRadioModelPtr->TraceConnectWithoutContext ("TotalEnergyConsumption", MakeCallback (&TotalEnergy));
+ /***************************************************************************/
+
+
+ /** simulation setup **/
+ // start traffic
+ Simulator::Schedule (Seconds (startTime), &GenerateTraffic, source, PpacketSize,
+ networkNodes.Get (0), numPackets, interPacketInterval);
+
+ Simulator::Stop (Seconds (10.0));
+ Simulator::Run ();
+ Simulator::Destroy ();
+
+ return 0;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/energy/waf Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,1 @@
+exec "`dirname "$0"`"/../../waf "$@"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/energy/wscript Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,5 @@
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+def build(bld):
+ obj = bld.create_ns3_program('energy-model-example', ['core', 'simulator', 'mobility', 'wifi', 'energy', 'internet-stack'])
+ obj.source = 'energy-model-example.cc'
\ No newline at end of file
--- a/examples/mpi/third-distributed.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/examples/mpi/third-distributed.cc Tue Dec 21 17:46:35 2010 +0100
@@ -32,7 +32,7 @@
// Number of wifi or csma nodes can be increased up to 250
//
// Wifi 10.1.3.0
-// AP
+// AP
// * * * *
// | | | | 10.1.1.0
// n5 n6 n7 n0 -------------- n1 n2 n3 n4
@@ -54,7 +54,7 @@
// Distributed simulation setup
MpiInterface::Enable (&argc, &argv);
GlobalValue::Bind ("SimulatorImplementationType",
- StringValue ("ns3::DistributedSimulatorImpl"));
+ StringValue ("ns3::DistributedSimulatorImpl"));
uint32_t systemId = MpiInterface::GetSystemId ();
uint32_t systemCount = MpiInterface::GetSize ();
@@ -109,7 +109,7 @@
NodeContainer csmaNodes;
csmaNodes.Add (p2pNodes.Get (1));
- csmaNodes.Create (nCsma , 1); // Create csma nodes with rank 1
+ csmaNodes.Create (nCsma, 1); // Create csma nodes with rank 1
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", StringValue ("100Mbps"));
@@ -130,17 +130,17 @@
wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
NqosWifiMacHelper mac = NqosWifiMacHelper::Default ();
-
+
Ssid ssid = Ssid ("ns-3-ssid");
- mac.SetType ("ns3::NqstaWifiMac",
- "Ssid", SsidValue (ssid),
- "ActiveProbing", BooleanValue (false));
+ mac.SetType ("ns3::StaWifiMac",
+ "Ssid", SsidValue (ssid),
+ "ActiveProbing", BooleanValue (false));
NetDeviceContainer staDevices;
staDevices = wifi.Install (phy, mac, wifiStaNodes);
- mac.SetType ("ns3::NqapWifiMac",
- "Ssid", SsidValue (ssid));
+ mac.SetType ("ns3::ApWifiMac",
+ "Ssid", SsidValue (ssid));
NetDeviceContainer apDevices;
apDevices = wifi.Install (phy, mac, wifiApNode);
@@ -148,15 +148,15 @@
MobilityHelper mobility;
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
- "MinX", DoubleValue (0.0),
- "MinY", DoubleValue (0.0),
- "DeltaX", DoubleValue (5.0),
- "DeltaY", DoubleValue (5.0),
- "GridWidth", UintegerValue (10),
- "LayoutType", StringValue ("RowFirst"));
+ "MinX", DoubleValue (0.0),
+ "MinY", DoubleValue (0.0),
+ "DeltaX", DoubleValue (5.0),
+ "DeltaY", DoubleValue (5.0),
+ "GridWidth", UintegerValue (10),
+ "LayoutType", StringValue ("RowFirst"));
mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel",
- "Bounds", RectangleValue (Rectangle (-250, 250, -250, 250)));
+ "Bounds", RectangleValue (Rectangle (-250, 250, -250, 250)));
mobility.Install (wifiStaNodes);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
--- a/examples/routing/aodv.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/examples/routing/aodv.cc Tue Dec 21 17:46:35 2010 +0100
@@ -65,6 +65,8 @@
double totalTime;
/// Write per-device PCAP traces if true
bool pcap;
+ /// Print routes if true
+ bool printRoutes;
//\}
///\name network
@@ -97,7 +99,8 @@
size (10),
step (100),
totalTime (10),
- pcap (true)
+ pcap (true),
+ printRoutes (true)
{
}
@@ -111,6 +114,7 @@
CommandLine cmd;
cmd.AddValue ("pcap", "Write PCAP traces.", pcap);
+ cmd.AddValue ("printRoutes", "Print routing table dumps.", printRoutes);
cmd.AddValue ("size", "Number of nodes.", size);
cmd.AddValue ("time", "Simulation time, s.", totalTime);
cmd.AddValue ("step", "Grid step, m", step);
@@ -194,6 +198,12 @@
Ipv4AddressHelper address;
address.SetBase ("10.0.0.0", "255.0.0.0");
interfaces = address.Assign (devices);
+
+ if (printRoutes)
+ {
+ Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper> ("aodv.routes", std::ios::out);
+ aodv.PrintRoutingTableAllAt (Seconds (8), routingStream);
+ }
}
void
--- a/examples/routing/dynamic-global-routing.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/examples/routing/dynamic-global-routing.cc Tue Dec 21 17:46:35 2010 +0100
@@ -214,6 +214,11 @@
Simulator::Schedule (Seconds (12),&Ipv4::SetDown,ipv41, ipv4ifIndex1);
Simulator::Schedule (Seconds (14),&Ipv4::SetUp,ipv41, ipv4ifIndex1);
+ // Trace routing tables
+ Ipv4GlobalRoutingHelper g;
+ Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper> ("dynamic-global-routing.routes", std::ios::out);
+ g.PrintRoutingTableAllAt (Seconds (12), routingStream);
+
NS_LOG_INFO ("Run Simulation.");
Simulator::Run ();
Simulator::Destroy ();
--- a/examples/routing/nix-simple.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/examples/routing/nix-simple.cc Tue Dec 21 17:46:35 2010 +0100
@@ -109,6 +109,9 @@
clientApps.Start (Seconds (2.0));
clientApps.Stop (Seconds (10.0));
+ // Trace routing tables
+ Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper> ("nix-simple.routes", std::ios::out);
+ nixRouting.PrintRoutingTableAllAt (Seconds (8), routingStream);
Simulator::Run ();
Simulator::Destroy ();
--- a/examples/tap/tap-wifi-dumbbell.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/examples/tap/tap-wifi-dumbbell.cc Tue Dec 21 17:46:35 2010 +0100
@@ -16,13 +16,13 @@
// Network topology
//
-// +----------+
-// | external |
-// | Linux |
-// | Host |
+// +----------+
+// | external |
+// | Linux |
+// | Host |
// | |
-// | "mytap" |
-// +----------+
+// | "mytap" |
+// +----------+
// | n0 n3 n4
// | +--------+ +------------+ +------------+
// +-------| tap | | | | |
@@ -31,8 +31,8 @@
// | Wifi | | Wifi | P2P |-----| P2P | CSMA |
// +--------+ +------+-----+ +-----+------+
// | | ^ |
-// ((*)) ((*)) | |
-// P2P 10.1.2 |
+// ((*)) ((*)) | |
+// P2P 10.1.2 |
// ((*)) ((*)) | n5 n6 n7
// | | | | | |
// n1 n2 ================
@@ -140,13 +140,13 @@
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
wifi.SetRemoteStationManager ("ns3::ArfWifiManager");
- wifiMac.SetType ("ns3::NqapWifiMac",
+ wifiMac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid));
NetDeviceContainer devicesLeft = wifi.Install (wifiPhy, wifiMac, nodesLeft.Get (0));
- wifiMac.SetType ("ns3::NqstaWifiMac",
- "Ssid", SsidValue (ssid),
+ wifiMac.SetType ("ns3::StaWifiMac",
+ "Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false));
devicesLeft.Add (wifi.Install (wifiPhy, wifiMac, NodeContainer (nodesLeft.Get (1), nodesLeft.Get (2), nodesLeft.Get (3))));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/tcp/tcp-bulk-send.cc Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,135 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+// Network topology
+//
+// n0 ----------- n1
+// 500 Kbps
+// 5 ms
+//
+// - Flow from n0 to n1 using BulkSendApplication.
+// - Tracing of queues and packet receptions to file "tcp-bulk-send.tr"
+// and pcap tracing available when tracing is turned on.
+
+#include <string>
+#include <fstream>
+#include "ns3/core-module.h"
+#include "ns3/simulator-module.h"
+#include "ns3/helper-module.h"
+#include "ns3/node-module.h"
+#include "ns3/packet-sink.h"
+
+using namespace ns3;
+
+NS_LOG_COMPONENT_DEFINE ("TcpBulkSendExample");
+
+int
+main (int argc, char *argv[])
+{
+
+ bool tracing = false;
+ uint32_t maxBytes = 0;
+
+//
+// Allow the user to override any of the defaults at
+// run-time, via command-line arguments
+//
+ CommandLine cmd;
+ cmd.AddValue ("tracing", "Flag to enable/disable tracing", tracing);
+ cmd.AddValue ("maxBytes",
+ "Total number of bytes for application to send", maxBytes);
+ cmd.Parse (argc, argv);
+
+//
+// Explicitly create the nodes required by the topology (shown above).
+//
+ NS_LOG_INFO ("Create nodes.");
+ NodeContainer nodes;
+ nodes.Create (2);
+
+ NS_LOG_INFO ("Create channels.");
+
+//
+// Explicitly create the point-to-point link required by the topology (shown above).
+//
+ PointToPointHelper pointToPoint;
+ pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("500Kbps"));
+ pointToPoint.SetChannelAttribute ("Delay", StringValue ("5ms"));
+
+ NetDeviceContainer devices;
+ devices = pointToPoint.Install (nodes);
+
+//
+// Install the internet stack on the nodes
+//
+ InternetStackHelper internet;
+ internet.Install (nodes);
+
+//
+// We've got the "hardware" in place. Now we need to add IP addresses.
+//
+ NS_LOG_INFO ("Assign IP Addresses.");
+ Ipv4AddressHelper ipv4;
+ ipv4.SetBase ("10.1.1.0", "255.255.255.0");
+ Ipv4InterfaceContainer i = ipv4.Assign (devices);
+
+ NS_LOG_INFO ("Create Applications.");
+
+//
+// Create a BulkSendApplication and install it on node 0
+//
+ uint16_t port = 9; // well-known echo port number
+
+
+ BulkSendHelper source ("ns3::TcpSocketFactory",
+ InetSocketAddress (i.GetAddress (1), port));
+ // Set the amount of data to send in bytes. Zero is unlimited.
+ source.SetAttribute ("MaxBytes", UintegerValue (maxBytes));
+ ApplicationContainer sourceApps = source.Install (nodes.Get (0));
+ sourceApps.Start (Seconds (0.0));
+ sourceApps.Stop (Seconds (10.0));
+
+//
+// Create a PacketSinkApplication and install it on node 1
+//
+ PacketSinkHelper sink ("ns3::TcpSocketFactory",
+ InetSocketAddress (Ipv4Address::GetAny (), port));
+ ApplicationContainer sinkApps = sink.Install (nodes.Get (1));
+ sinkApps.Start (Seconds (0.0));
+ sinkApps.Stop (Seconds (10.0));
+
+//
+// Set up tracing if enabled
+//
+ if (tracing)
+ {
+ AsciiTraceHelper ascii;
+ pointToPoint.EnableAsciiAll (ascii.CreateFileStream ("tcp-bulk-send.tr"));
+ pointToPoint.EnablePcapAll ("tcp-bulk-send", false);
+ }
+
+//
+// Now, do the actual simulation.
+//
+ NS_LOG_INFO ("Run Simulation.");
+ Simulator::Stop (Seconds (10.0));
+ Simulator::Run ();
+ Simulator::Destroy ();
+ NS_LOG_INFO ("Done.");
+
+ Ptr<PacketSink> sink1 = DynamicCast<PacketSink> (sinkApps.Get (0));
+ std::cout << "Total Bytes Received: " << sink1->GetTotalRx () << std::endl;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/tcp/tcp-loss-response.cc Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,292 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+//
+// Network topology
+//
+// 8Mb/s, 0.1ms 0.8Mb/s, 100ms
+// s1-----------------r1-----------------k1
+//
+// Example corresponding to simulations in the paper "Simulation-based
+// Comparisons of Tahoe, Reno, and SACK TCP"
+//
+// To look at the time-sequence plots corresponding to the packet traces,
+// the tcptrace tool (www.tcptrace.org) with the -S option can produce
+// xplot plots (a2b.xpl, b2a.xpl) which can be viewed using xplot
+//
+// - Tracing of queues and packet receptions to file
+// "tcp-loss-response.tr
+// - pcap traces also generated in the following files
+// "tcp-loss-response-s1-0.pcap" and "tcp-loss-response-k1-0.pcap"
+//
+// Usage (e.g.): ./waf --run tcp-loss-response
+//
+
+
+#include <ctype.h>
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+#include <string>
+#include <cassert>
+
+#include "ns3/core-module.h"
+#include "ns3/common-module.h"
+#include "ns3/helper-module.h"
+#include "ns3/node-module.h"
+#include "ns3/simulator-module.h"
+#include "ns3/ipv4-global-routing-helper.h"
+
+using namespace ns3;
+
+NS_LOG_COMPONENT_DEFINE ("TcpLossResponse");
+
+// The number of bytes to send in this simulation.
+static const uint32_t totalTxBytes = 200000;
+static uint32_t currentTxBytes = 0;
+// Perform series of 26*40=1040 byte writes (this is a multiple of 26 since
+// we want to detect data splicing in the output stream)
+static const uint32_t writeSize = 1040;
+uint8_t data[writeSize];
+// Need to invoke Socket::Close() on sender?
+bool needToClose = true;
+
+// These are for starting the writing process, and handling the sending
+// socket's notification upcalls (events). These two together more or less
+// implement a sending "Application", although not a proper ns3::Application
+// subclass.
+
+void StartFlow (Ptr<Socket>, Ipv4Address, uint16_t);
+void WriteUntilBufferFull (Ptr<Socket>, uint32_t);
+
+static void
+CwndTracer (uint32_t oldval, uint32_t newval)
+{
+ NS_LOG_INFO ("Moving cwnd from " << oldval << " to " << newval << " at time " << Simulator::Now ().GetSeconds () << " seconds");
+}
+
+int main (int argc, char *argv[])
+{
+ std::string tcpModel ("ns3::TcpNewReno");
+ uint32_t losses = 1;
+ bool verbose = false;
+ bool tracing = true;
+
+ // Configuration and command line parameter parsing
+ CommandLine cmd;
+ cmd.AddValue ("tcpModel", "Tcp congestion control model", tcpModel);
+ cmd.AddValue ("losses", "number of packet losses", losses);
+ cmd.AddValue ("verbose", "turn on selected log components", verbose);
+ cmd.AddValue ("tracing", "turn on ascii and pcap tracing", tracing);
+ cmd.Parse (argc, argv);
+
+ Config::SetDefault ("ns3::TcpL4Protocol::SocketType", StringValue (tcpModel));
+ Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (1000)); // 1000-byte packet for easier reading
+ Config::SetDefault ("ns3::TcpSocket::DelAckCount", UintegerValue (1));
+
+ LogComponentEnableAll (LOG_PREFIX_FUNC);
+ LogComponentEnable ("TcpLossResponse", LOG_LEVEL_ALL);
+ if (verbose)
+ {
+ //LogComponentEnableAll (LOG_PREFIX_TIME);
+ LogComponentEnable ("ErrorModel", LOG_LEVEL_DEBUG);
+ LogComponentEnable ("TcpLossResponse", LOG_LEVEL_ALL);
+ LogComponentEnable ("TcpNewReno", LOG_LEVEL_INFO);
+ LogComponentEnable ("TcpReno", LOG_LEVEL_INFO);
+ LogComponentEnable ("TcpTahoe", LOG_LEVEL_INFO);
+ LogComponentEnable ("TcpSocketBase", LOG_LEVEL_INFO);
+ }
+
+ // initialize the tx buffer (fill with lowercase a to z)
+ for (uint32_t i = 0; i < writeSize; ++i)
+ {
+ char m = toascii (97 + i % 26);
+ data[i] = m;
+ }
+
+ ////////////////////////////////////////////////////////
+ // Topology construction
+ //
+
+ // Create three nodes: s1, r1, and k1
+ NodeContainer s1r1;
+ s1r1.Create (2);
+ Names::Add ("s1", s1r1.Get (0));
+ Names::Add ("r1", s1r1.Get (1));
+
+ NodeContainer r1k1;
+ r1k1.Add (s1r1.Get (1));
+ r1k1.Create (1);
+ Names::Add ("k1", r1k1.Get (1));
+
+ // Set up TCP/IP stack to all nodes (and create loopback device at device 0)
+ InternetStackHelper internet;
+ internet.InstallAll ();
+
+ // Connect the nodes
+ PointToPointHelper p2p;
+ p2p.SetDeviceAttribute ("DataRate", DataRateValue (DataRate (8000000)));
+ p2p.SetChannelAttribute ("Delay", TimeValue (Seconds (0.0001)));
+ NetDeviceContainer dev0 = p2p.Install (s1r1);
+ p2p.SetDeviceAttribute ("DataRate", DataRateValue (DataRate (800000)));
+ p2p.SetChannelAttribute ("Delay", TimeValue (Seconds (0.1)));
+ NetDeviceContainer dev1 = p2p.Install (r1k1);
+
+ // Add IP addresses to each network interfaces
+ Ipv4AddressHelper ipv4;
+ ipv4.SetBase ("10.1.3.0", "255.255.255.0");
+ ipv4.Assign (dev0);
+ ipv4.SetBase ("10.1.2.0", "255.255.255.0");
+ Ipv4InterfaceContainer ipInterfs = ipv4.Assign (dev1);
+
+ // Set up routes to all nodes
+ Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
+
+ ////////////////////////////////////////////////////////
+ // Send 20000 (totalTxBytes) bytes from node s1 to node k1
+ //
+
+ // Create a packet sink to receive packets on node k1
+ uint16_t servPort = 50000; // Destination port number
+ PacketSinkHelper sink ("ns3::TcpSocketFactory",
+ InetSocketAddress (Ipv4Address::GetAny (), servPort));
+ ApplicationContainer apps = sink.Install (r1k1.Get (1));
+ apps.Start (Seconds (0.0));
+ apps.Stop (Seconds (100.0));
+
+ // Create a data source to send packets on node s0.
+ // Instead of full application, here use the socket directly by
+ // registering callbacks in function StarFlow().
+ Ptr<Socket> localSocket = Socket::CreateSocket (s1r1.Get (0), TcpSocketFactory::GetTypeId ());
+ localSocket->Bind ();
+ Simulator::ScheduleNow (&StartFlow, localSocket, ipInterfs.GetAddress (1), servPort);
+
+ // Trace changes to the congestion window (available in Tahoe and descendents)
+ Config::ConnectWithoutContext ("/NodeList/0/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow", MakeCallback (&CwndTracer));
+
+ ////////////////////////////////////////////////////////
+ // Set up loss model at node k1
+ //
+
+ std::list<uint32_t> sampleList;
+ switch (losses)
+ {
+ case 0:
+ break;
+ case 1:
+ // Force a loss for 15th data packet. TCP cwnd will be at 14 segments
+ // (14000 bytes) when duplicate acknowledgments start to come.
+ sampleList.push_back (16);
+ break;
+ case 2:
+ sampleList.push_back (16);
+ sampleList.push_back (17);
+ break;
+ case 3:
+ sampleList.push_back (16);
+ sampleList.push_back (17);
+ sampleList.push_back (18);
+ break;
+ case 4:
+ sampleList.push_back (16);
+ sampleList.push_back (17);
+ sampleList.push_back (18);
+ sampleList.push_back (19);
+ break;
+ default:
+ NS_FATAL_ERROR ("Program fatal error: loss value " << losses << " not supported.");
+ break;
+ }
+
+ Ptr<ReceiveListErrorModel> pem = CreateObject<ReceiveListErrorModel> ();
+ pem->SetList (sampleList);
+ dev1.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (pem));
+
+ // One can toggle the comment for the following line on or off to see the
+ // effects of finite send buffer modelling. One can also change the size of
+ // that buffer.
+ // localSocket->SetAttribute("SndBufSize", UintegerValue(4096));
+
+ /////////////////////////////////////////////////////////
+ // Set up trace and run the simulation
+ //
+
+ if (tracing)
+ {
+ // Ask for ASCII and pcap traces of network traffic
+ AsciiTraceHelper ascii;
+ //Ptr<OutputStreamWrapper> osw = ascii.CreateFileStream ("tcp-loss-response.tr");
+ Ptr<OutputStreamWrapper> osw = Create<OutputStreamWrapper> (&std::clog);
+ *(osw->GetStream ()) << std::setprecision(9) << std::fixed;
+ p2p.EnableAsciiAll (osw);
+// p2p.EnablePcap ("tcp-loss-response", 0, 0);
+// p2p.EnablePcap ("tcp-loss-response", 2, 0);
+ }
+
+ // Finally, set up the simulator to run. The 1000 second hard limit is a
+ // failsafe in case some change above causes the simulation to never end
+ Simulator::Stop (Seconds (1000));
+ Simulator::Run ();
+ Simulator::Destroy ();
+}
+
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+// begin implementation of sending "Application"
+void StartFlow (Ptr<Socket> localSocket,
+ Ipv4Address servAddress,
+ uint16_t servPort)
+{
+ NS_LOG_LOGIC ("Starting flow at time " << Simulator::Now ().GetSeconds ());
+ localSocket->Connect (InetSocketAddress (servAddress, servPort)); // connect
+
+ // tell the tcp implementation to call WriteUntilBufferFull again
+ // if we blocked and new tx buffer space becomes available
+ localSocket->SetSendCallback (MakeCallback (&WriteUntilBufferFull));
+ WriteUntilBufferFull (localSocket, localSocket->GetTxAvailable ());
+}
+
+void WriteUntilBufferFull (Ptr<Socket> localSocket, uint32_t txSpace)
+{
+ while (currentTxBytes < totalTxBytes)
+ {
+ uint32_t left = totalTxBytes - currentTxBytes;
+ uint32_t dataOffset = currentTxBytes % writeSize;
+ uint32_t toWrite = writeSize - dataOffset;
+ uint32_t txAvail = localSocket->GetTxAvailable ();
+ toWrite = std::min (toWrite, left);
+ toWrite = std::min (toWrite, txAvail);
+ if (txAvail == 0)
+ {
+ NS_LOG_LOGIC ("TCP socket buffer full at " << Simulator::Now ().GetSeconds ());
+ return;
+ };
+ NS_LOG_LOGIC ("Submitting " << toWrite << " bytes to TCP socket");
+ int amountSent = localSocket->Send (&data[dataOffset], toWrite, 0);
+ NS_ASSERT (amountSent > 0); // Given GetTxAvailable() non-zero, amountSent should not be zero
+ currentTxBytes += amountSent;
+ }
+ if (needToClose)
+ {
+ NS_LOG_LOGIC ("Close socket at " << Simulator::Now ().GetSeconds ());
+ localSocket->Close ();
+ needToClose = false;
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/tcp/tcp-testcases.cc Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,283 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+//
+// Network topology
+//
+// 10Mb/s, 0.1ms 10Mb/s, 0.1ms
+// n0-----------------n1-----------------n2
+//
+// Testcases for the correctness of TCP operations.
+//
+// Usage (e.g.): ./waf --run="tcp-testcases --case=1"
+//
+
+
+#include <ctype.h>
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+#include <string>
+#include <cassert>
+
+#include "ns3/core-module.h"
+#include "ns3/common-module.h"
+#include "ns3/helper-module.h"
+#include "ns3/node-module.h"
+#include "ns3/simulator-module.h"
+#include "ns3/ipv4-global-routing-helper.h"
+
+using namespace ns3;
+
+NS_LOG_COMPONENT_DEFINE ("TcpTestCases");
+
+// The number of bytes to send in this simulation.
+static uint32_t totalTxBytes = 200000;
+static uint32_t currentTxBytes = 0;
+// Perform series of 26*40=1040 byte writes (this is a multiple of 26 since
+// we want to detect data splicing in the output stream)
+static const uint32_t writeSize = 1040;
+uint8_t data[writeSize];
+// Need to close the socket on node 0 upon finishing sending data
+static bool needToClose = true;
+
+////////////////////////////////////////////////////////////////////
+// Implementing an "application" to send bytes over a TCP connection
+void WriteUntilBufferFull (Ptr<Socket> localSocket, uint32_t txSpace)
+{
+ while (currentTxBytes < totalTxBytes)
+ {
+ uint32_t left = totalTxBytes - currentTxBytes;
+ uint32_t dataOffset = currentTxBytes % writeSize;
+ uint32_t toWrite = writeSize - dataOffset;
+ uint32_t txAvail = localSocket->GetTxAvailable ();
+ toWrite = std::min (toWrite, left);
+ toWrite = std::min (toWrite, txAvail);
+ if (txAvail == 0)
+ {
+ return;
+ };
+ NS_LOG_LOGIC ("Submitting " << toWrite << " bytes to TCP socket");
+ int amountSent = localSocket->Send (&data[dataOffset], toWrite, 0);
+ NS_ASSERT (amountSent > 0); // Given GetTxAvailable() non-zero, amountSent should not be zero
+ currentTxBytes += amountSent;
+ }
+ if (needToClose)
+ {
+ NS_LOG_LOGIC ("Close socket at " << Simulator::Now ().GetSeconds ());
+ localSocket->Close ();
+ needToClose = false;
+ }
+}
+
+void StartFlow (Ptr<Socket> localSocket,
+ Ipv4Address servAddress,
+ uint16_t servPort)
+{
+ NS_LOG_LOGIC ("Starting flow at time " << Simulator::Now ().GetSeconds ());
+ localSocket->Connect (InetSocketAddress (servAddress, servPort)); // connect
+
+ // tell the tcp implementation to call WriteUntilBufferFull again
+ // if we blocked and new tx buffer space becomes available
+ localSocket->SetSendCallback (MakeCallback (&WriteUntilBufferFull));
+ WriteUntilBufferFull (localSocket, localSocket->GetTxAvailable ());
+}
+
+// cwnd tracer
+static void
+CwndTracer (uint32_t oldval, uint32_t newval)
+{
+ NS_LOG_INFO ("Moving cwnd from " << oldval << " to " << newval << " at time " << Simulator::Now ().GetSeconds () << " seconds");
+}
+
+int main (int argc, char *argv[])
+{
+ std::string tcpModel ("ns3::TcpNewReno");
+ uint32_t testcase = 1;
+ uint32_t verbose = 0;
+ bool tracing = true;
+
+ // Configuration and command line parameter parsing
+ CommandLine cmd;
+ cmd.AddValue ("tcpModel", "TCP congestion control model", tcpModel);
+ cmd.AddValue ("testcase", "test case", testcase);
+ cmd.AddValue ("verbose", "turn on selected log components", verbose);
+ cmd.Parse (argc, argv);
+
+ Config::SetDefault ("ns3::TcpL4Protocol::SocketType", StringValue (tcpModel));
+ Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (1000)); // 1000-byte packet for easier reading
+ Config::SetDefault ("ns3::TcpSocket::DelAckCount", UintegerValue (1));
+ Config::SetDefault ("ns3::DropTailQueue::MaxPackets", UintegerValue (20));
+
+ LogComponentEnableAll (LOG_PREFIX_FUNC);
+ LogComponentEnable ("TcpTestCases", LOG_LEVEL_ALL);
+ if (verbose)
+ {
+ //LogComponentEnableAll (LOG_PREFIX_TIME);
+ LogComponentEnable ("ErrorModel", LOG_LEVEL_DEBUG);
+ LogComponentEnable ("TcpTestCases", LOG_LEVEL_ALL);
+ LogComponentEnable ("TcpNewReno", LOG_LEVEL_INFO);
+ LogComponentEnable ("TcpReno", LOG_LEVEL_INFO);
+ LogComponentEnable ("TcpTahoe", LOG_LEVEL_INFO);
+ LogComponentEnable ("TcpSocketBase", (verbose>1)?LOG_LEVEL_ALL:LOG_LEVEL_INFO);
+ //LogComponentEnable ("TcpTxBuffer", LOG_LEVEL_ALL);
+ //LogComponentEnable ("TcpRxBuffer", LOG_LEVEL_ALL);
+ }
+
+ // initialize the tx buffer (fill with lowercase a to z)
+ for (uint32_t i = 0; i < writeSize; ++i)
+ {
+ char m = toascii (97 + i % 26);
+ data[i] = m;
+ }
+
+ ////////////////////////////////////////////////////////
+ // Topology construction
+ //
+
+ // Create three nodes
+ NodeContainer n0n1;
+ n0n1.Create (2);
+ Names::Add ("n0", n0n1.Get (0));
+ Names::Add ("n1", n0n1.Get (1));
+
+ NodeContainer n1n2;
+ n1n2.Add (n0n1.Get (1));
+ n1n2.Create (1);
+ Names::Add ("n2", n1n2.Get (1));
+
+ // Set up TCP/IP stack to all nodes (and create loopback device at device 0)
+ InternetStackHelper internet;
+ internet.InstallAll ();
+
+ // Connect the nodes
+ PointToPointHelper p2p;
+ p2p.SetDeviceAttribute ("DataRate", DataRateValue (DataRate (1000000)));
+ p2p.SetChannelAttribute ("Delay", TimeValue (Seconds (0.0001)));
+ NetDeviceContainer dev0 = p2p.Install (n0n1);
+ NetDeviceContainer dev1 = p2p.Install (n1n2);
+
+ // Add IP addresses to each network interfaces
+ Ipv4AddressHelper ipv4;
+ ipv4.SetBase ("10.1.3.0", "255.255.255.0");
+ ipv4.Assign (dev0);
+ ipv4.SetBase ("10.1.2.0", "255.255.255.0");
+ Ipv4InterfaceContainer ipInterfs = ipv4.Assign (dev1);
+
+ // Set up routes to all nodes
+ Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
+
+ ////////////////////////////////////////////////////////
+ // A flow from node n0 to node n2
+ //
+
+ // Create a packet sink to receive packets on node n2
+ uint16_t servPort = 50000; // Destination port number
+ PacketSinkHelper sink ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), servPort));
+ ApplicationContainer apps = sink.Install (n1n2.Get (1));
+ apps.Start (Seconds (0.0));
+ apps.Stop (Seconds (100.0));
+
+ // Create a data source to send packets on node n0
+ // Instead of full application, here use the socket directly by
+ // registering callbacks in function StarFlow().
+ Ptr<Socket> localSocket = Socket::CreateSocket (n0n1.Get (0), TcpSocketFactory::GetTypeId ());
+ localSocket->Bind ();
+ Simulator::ScheduleNow (&StartFlow, localSocket, ipInterfs.GetAddress (1), servPort);
+
+ // Trace changes to the congestion window (available in Tahoe and descendents)
+ Config::ConnectWithoutContext ("/NodeList/0/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow", MakeCallback (&CwndTracer));
+
+ ////////////////////////////////////////////////////////
+ // Set up different test cases: Lost model at node n1, different file size
+ //
+
+ std::list<uint32_t> dropListN0;
+ std::list<uint32_t> dropListN1;
+ switch (testcase)
+ {
+ case 0: // Verify connection establishment
+ totalTxBytes = 1000;
+ break;
+ case 1: // Verify a bigger (100 pkts) transfer: Sliding window operation, etc.
+ totalTxBytes = 100*1000;
+ break;
+ case 2: // Survive a SYN lost
+ totalTxBytes = 1000;
+ dropListN0.push_back (0);
+ break;
+ case 3: // Survive a SYN+ACK lost
+ totalTxBytes = 2000;
+ dropListN1.push_back (0);
+ break;
+ case 4: // Survive a ACK (last packet in 3-way handshake) lost
+ totalTxBytes = 2000;
+ dropListN0.push_back (1);
+ break;
+ case 5: // Immediate FIN upon SYN_RCVD
+ totalTxBytes = 0;
+ needToClose = false;
+ dropListN0.push_back (1); // Hide the ACK in 3WHS
+ Simulator::Schedule (Seconds(0.002), &Socket::Close, localSocket);
+ break;
+ case 6: // Simulated simultaneous close
+ totalTxBytes = 5000;
+ dropListN1.push_back (5); // Hide the ACK-to-FIN from n2
+ break;
+ case 7: // FIN check 1: Lost of initiator's FIN. Shall wait until application close.
+ needToClose = false;
+ totalTxBytes = 5000;
+ dropListN0.push_back (7); // Hide the FIN from n0
+ Simulator::Schedule (Seconds(0.04), &Socket::Close, localSocket);
+ break;
+ case 8: // FIN check 2: Lost of responder's FIN. The FIN will resent after last ack timeout
+ totalTxBytes = 5000;
+ dropListN1.push_back (6); // Hide the FIN from n2
+ break;
+ default:
+ NS_FATAL_ERROR ("Program fatal error: specified test case not supported: " << testcase);
+ break;
+ }
+
+ Ptr<ReceiveListErrorModel> errN0 = CreateObject<ReceiveListErrorModel> ();
+ errN0->SetList (dropListN0);
+ dev0.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (errN0));
+
+ Ptr<ReceiveListErrorModel> errN1 = CreateObject<ReceiveListErrorModel> ();
+ errN1->SetList (dropListN1);
+ dev1.Get (0)->SetAttribute ("ReceiveErrorModel", PointerValue (errN1));
+
+ /////////////////////////////////////////////////////////
+ // Set up trace and run the simulation
+ //
+
+ if (tracing)
+ {
+ // Ask for ASCII and pcap traces of network traffic
+ AsciiTraceHelper ascii;
+ //Ptr<OutputStreamWrapper> osw = ascii.CreateFileStream ("tcp-loss-response.tr");
+ Ptr<OutputStreamWrapper> osw = Create<OutputStreamWrapper> (&std::clog);
+ *(osw->GetStream ()) << std::setprecision(9) << std::fixed;
+ p2p.EnableAsciiAll (osw);
+ }
+
+ // Finally, set up the simulator to run. The 1000 second hard limit is a
+ // failsafe in case some change above causes the simulation to never end
+ Simulator::Stop (Seconds (1000));
+ Simulator::Run ();
+ Simulator::Destroy ();
+}
--- a/examples/tcp/wscript Tue Dec 21 17:39:54 2010 +0100
+++ b/examples/tcp/wscript Tue Dec 21 17:46:35 2010 +0100
@@ -20,3 +20,15 @@
obj = bld.create_ns3_program('star',
['point-to-point', 'internet-stack'])
obj.source = 'star.cc'
+
+ obj = bld.create_ns3_program('tcp-loss-response',
+ ['point-to-point', 'internet-stack'])
+ obj.source = 'tcp-loss-response.cc'
+
+ obj = bld.create_ns3_program('tcp-testcases',
+ ['point-to-point', 'internet-stack'])
+ obj.source = 'tcp-testcases.cc'
+
+ obj = bld.create_ns3_program('tcp-bulk-send',
+ ['point-to-point', 'internet-stack'])
+ obj.source = 'tcp-bulk-send.cc'
--- a/examples/tutorial/third.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/examples/tutorial/third.cc Tue Dec 21 17:46:35 2010 +0100
@@ -25,7 +25,7 @@
// Default Network Topology
//
// Wifi 10.1.3.0
-// AP
+// AP
// * * * *
// | | | | 10.1.1.0
// n5 n6 n7 n0 -------------- n1 n2 n3 n4
@@ -90,17 +90,17 @@
wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
NqosWifiMacHelper mac = NqosWifiMacHelper::Default ();
-
+
Ssid ssid = Ssid ("ns-3-ssid");
- mac.SetType ("ns3::NqstaWifiMac",
- "Ssid", SsidValue (ssid),
- "ActiveProbing", BooleanValue (false));
+ mac.SetType ("ns3::StaWifiMac",
+ "Ssid", SsidValue (ssid),
+ "ActiveProbing", BooleanValue (false));
NetDeviceContainer staDevices;
staDevices = wifi.Install (phy, mac, wifiStaNodes);
- mac.SetType ("ns3::NqapWifiMac",
- "Ssid", SsidValue (ssid));
+ mac.SetType ("ns3::ApWifiMac",
+ "Ssid", SsidValue (ssid));
NetDeviceContainer apDevices;
apDevices = wifi.Install (phy, mac, wifiApNode);
@@ -108,15 +108,15 @@
MobilityHelper mobility;
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
- "MinX", DoubleValue (0.0),
- "MinY", DoubleValue (0.0),
- "DeltaX", DoubleValue (5.0),
- "DeltaY", DoubleValue (10.0),
- "GridWidth", UintegerValue (3),
- "LayoutType", StringValue ("RowFirst"));
+ "MinX", DoubleValue (0.0),
+ "MinY", DoubleValue (0.0),
+ "DeltaX", DoubleValue (5.0),
+ "DeltaY", DoubleValue (10.0),
+ "GridWidth", UintegerValue (3),
+ "LayoutType", StringValue ("RowFirst"));
mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel",
- "Bounds", RectangleValue (Rectangle (-50, 50, -50, 50)));
+ "Bounds", RectangleValue (Rectangle (-50, 50, -50, 50)));
mobility.Install (wifiStaNodes);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
--- a/examples/wireless/mixed-wireless.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/examples/wireless/mixed-wireless.cc Tue Dec 21 17:46:35 2010 +0100
@@ -17,7 +17,7 @@
//
// This ns-3 example demonstrates the use of helper functions to ease
-// the construction of simulation scenarios.
+// the construction of simulation scenarios.
//
// The simulation topology consists of a mixed wired and wireless
// scenario in which a hierarchical mobility model is used.
@@ -27,7 +27,7 @@
// Each backbone router also has a local 802.11 network and is connected
// to a local LAN. An additional set of (K-1) nodes are connected to
// this backbone. Finally, a local LAN is connected to each router
-// on the backbone, with L-1 additional hosts.
+// on the backbone, with L-1 additional hosts.
//
// The nodes are populated with TCP/IP stacks, and OLSR unicast routing
// on the backbone. An example UDP transfer is shown. The simulator
@@ -178,7 +178,7 @@
//
// The ad-hoc network nodes need a mobility model so we aggregate one to
- // each of the nodes we just finished building.
+ // each of the nodes we just finished building.
//
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc =
@@ -225,7 +225,7 @@
//
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate",
- DataRateValue (DataRate (5000000)));
+ DataRateValue (DataRate (5000000)));
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
NetDeviceContainer lanDevices = csma.Install (lan);
//
@@ -280,12 +280,13 @@
Ssid ssid = Ssid (ssidString);
wifiInfra.SetRemoteStationManager ("ns3::ArfWifiManager");
// setup stas
- macInfra.SetType ("ns3::NqstaWifiMac",
- "Ssid", SsidValue (ssid),
- "ActiveProbing", BooleanValue (false));
+ macInfra.SetType ("ns3::StaWifiMac",
+ "Ssid", SsidValue (ssid),
+ "ActiveProbing", BooleanValue (false));
NetDeviceContainer staDevices = wifiInfra.Install (wifiPhy, macInfra, stas);
// setup ap.
- macInfra.SetType ("ns3::NqapWifiMac", "Ssid", SsidValue (ssid));
+ macInfra.SetType ("ns3::ApWifiMac",
+ "Ssid", SsidValue (ssid));
NetDeviceContainer apDevices = wifiInfra.Install (wifiPhy, macInfra, backbone.Get (i));
// Collect all of these new devices
NetDeviceContainer infraDevices (apDevices, staDevices);
@@ -329,7 +330,7 @@
// The below global routing does not take into account wireless effects.
// However, it is useful for setting default routes for all of the nodes
- // such as the LAN nodes.
+ // such as the LAN nodes.
NS_LOG_INFO ("Enabling global routing on all nodes");
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
@@ -353,10 +354,10 @@
NS_ASSERT (lanNodes > 1 && infraNodes > 1);
// We want the source to be the first node created outside of the backbone
// Conveniently, the variable "backboneNodes" holds this node index value
- Ptr<Node> appSource = NodeList::GetNode (backboneNodes);
- // We want the sink to be the last node created in the topology.
+ Ptr<Node> appSource = NodeList::GetNode (backboneNodes);
+ // We want the sink to be the last node created in the topology.
uint32_t lastNodeIndex = backboneNodes + backboneNodes*(lanNodes - 1) + backboneNodes*(infraNodes - 1) - 1;
- Ptr<Node> appSink = NodeList::GetNode (lastNodeIndex);
+ Ptr<Node> appSink = NodeList::GetNode (lastNodeIndex);
// Let's fetch the IP address of the last node, which is on Ipv4Interface 1
Ipv4Address remoteAddr = appSink->GetObject<Ipv4> ()->GetAddress(1, 0).GetLocal ();
@@ -382,17 +383,17 @@
NS_LOG_INFO ("Configure Tracing.");
if (enableTracing == true)
- {
+ {
CsmaHelper csma;
- //
- // Let's set up some ns-2-like ascii traces, using another helper class
- //
- AsciiTraceHelper ascii;
- Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream ("mixed-wireless.tr");
- wifiPhy.EnableAsciiAll (stream);
- csma.EnableAsciiAll (stream);
- internet.EnableAsciiIpv4All (stream);
+ //
+ // Let's set up some ns-2-like ascii traces, using another helper class
+ //
+ AsciiTraceHelper ascii;
+ Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream ("mixed-wireless.tr");
+ wifiPhy.EnableAsciiAll (stream);
+ csma.EnableAsciiAll (stream);
+ internet.EnableAsciiIpv4All (stream);
// Let's do a pcap trace on the application source and sink, ifIndex 0
// Csma captures in non-promiscuous mode
@@ -419,6 +420,6 @@
NS_LOG_INFO ("Run Simulation.");
Simulator::Stop (Seconds (stopTime));
- Simulator::Run ();
+ Simulator::Run ();
Simulator::Destroy ();
}
--- a/examples/wireless/mixed-wireless.py Tue Dec 21 17:39:54 2010 +0100
+++ b/examples/wireless/mixed-wireless.py Tue Dec 21 17:46:35 2010 +0100
@@ -230,16 +230,17 @@
wifiPhy.SetChannel(wifiChannel.Create())
wifiInfra.SetRemoteStationManager('ns3::ArfWifiManager')
macInfra = ns3.NqosWifiMacHelper.Default();
- macInfra.SetType("ns3::NqstaWifiMac",
- "Ssid", ns3.SsidValue(ssid),
- "ActiveProbing", ns3.BooleanValue(False))
+ macInfra.SetType("ns3::StaWifiMac",
+ "Ssid", ns3.SsidValue(ssid),
+ "ActiveProbing", ns3.BooleanValue(False))
# setup stas
staDevices = wifiInfra.Install(wifiPhy, macInfra, stas)
# setup ap.
- macInfra.SetType("ns3::NqapWifiMac", "Ssid", ns3.SsidValue(ssid),
- "BeaconGeneration", ns3.BooleanValue(True),
- "BeaconInterval", ns3.TimeValue(ns3.Seconds(2.5)))
+ macInfra.SetType("ns3::ApWifiMac",
+ "Ssid", ns3.SsidValue(ssid),
+ "BeaconGeneration", ns3.BooleanValue(True),
+ "BeaconInterval", ns3.TimeValue(ns3.Seconds(2.5)))
apDevices = wifiInfra.Install(wifiPhy, macInfra, backbone.Get(i))
# Collect all of these new devices
infraDevices = ns3.NetDeviceContainer(apDevices, staDevices)
--- a/examples/wireless/multirate.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/examples/wireless/multirate.cc Tue Dec 21 17:46:35 2010 +0100
@@ -78,15 +78,15 @@
const NqosWifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel, const MobilityHelper &mobility);
bool CommandSetup (int argc, char **argv);
- bool IsRouting () { return (enableRouting == 1) ? 1:0; }
- bool IsMobility () { return (enableMobility == 1) ? 1:0; }
+ bool IsRouting () { return (enableRouting == 1) ? 1 : 0; }
+ bool IsMobility () { return (enableMobility == 1) ? 1 : 0; }
- uint32_t GetScenario () {return scenario; }
+ uint32_t GetScenario () { return scenario; }
std::string GetRtsThreshold () { return rtsThreshold; }
std::string GetOutputFileName () { return outputFileName; }
std::string GetRateManager () { return rateManager; }
-
+
private:
Vector GetPosition (Ptr<Node> node);
@@ -123,19 +123,20 @@
};
Experiment::Experiment ()
-{}
+{
+}
-Experiment::Experiment (std::string name) :
+Experiment::Experiment (std::string name) :
m_output (name),
- totalTime (0.3),
+ totalTime (0.3),
expMean (0.1), //flows being exponentially distributed
bytesTotal(0),
packetSize (2000),
gridSize (10), //10x10 grid for a total of 100 nodes
nodeDistance (30),
port (5000),
- scenario (4),
- enablePcap (false),
+ scenario (4),
+ enablePcap (false),
enableTracing (true),
enableFlowMon (false),
enableRouting (false),
@@ -164,9 +165,9 @@
{
Ptr<Packet> packet;
while (packet = socket->Recv ())
- {
- bytesTotal += packet->GetSize();
- }
+ {
+ bytesTotal += packet->GetSize();
+ }
}
void
@@ -202,31 +203,31 @@
if ( (i % gridSize) <= (gridSize/2 - 1))
{
//lower left quadrant
- if ( i < totalNodes/2 )
- {
- containerA.Add(c.Get(i));
+ if ( i < totalNodes/2 )
+ {
+ containerA.Add(c.Get(i));
}
-
+
//upper left quadrant
if ( i >= (uint32_t)(4*totalNodes)/10 )
- {
- containerC.Add(c.Get(i));
+ {
+ containerC.Add(c.Get(i));
}
- }
+ }
if ( (i % gridSize) >= (gridSize/2 - 1))
{
//lower right quadrant
- if ( i < totalNodes/2 )
- {
- containerB.Add(c.Get(i));
+ if ( i < totalNodes/2 )
+ {
+ containerB.Add(c.Get(i));
}
//upper right quadrant
if ( i >= (uint32_t)(4*totalNodes)/10 )
- {
- containerD.Add(c.Get(i));
+ {
+ containerD.Add(c.Get(i));
}
- }
+ }
}
}
@@ -238,7 +239,7 @@
Experiment::GenerateNeighbors (NodeContainer c, uint32_t senderId)
{
NodeContainer nc;
- uint32_t limit = senderId + 2;
+ uint32_t limit = senderId + 2;
for (uint32_t i= senderId - 2; i <= limit; i++)
{
//must ensure the boundaries for other topologies
@@ -265,7 +266,7 @@
for (uint32_t i=0; i < totalNodes/3; i++)
{
- ApplicationSetup (c.Get(uvSrc.RandomVariable::GetInteger()), c.Get(uvDest.RandomVariable::GetInteger()) , 0, totalTime);
+ ApplicationSetup (c.Get(uvSrc.RandomVariable::GetInteger()), c.Get(uvDest.RandomVariable::GetInteger()), 0, totalTime);
}
}
@@ -295,9 +296,9 @@
do {
destIndex = (uint32_t) uv.GetValue();
- } while ( (c.Get(destIndex))->GetId () == sender->GetId ());
-
- ApplicationSetup (sender, c.Get(destIndex) , start, stop);
+ } while ( (c.Get(destIndex))->GetId () == sender->GetId ());
+
+ ApplicationSetup (sender, c.Get(destIndex), start, stop);
start = stop;
@@ -325,15 +326,15 @@
Ipv4Address ipv4AddrClient = iaddrClient.GetLocal ();
NS_LOG_DEBUG("Set up Server Device " << (server->GetDevice(0))->GetAddress ()
- << " with ip " << ipv4AddrServer
- << " position (" << serverPos.x << "," << serverPos.y << "," << serverPos.z << ")");
+ << " with ip " << ipv4AddrServer
+ << " position (" << serverPos.x << "," << serverPos.y << "," << serverPos.z << ")");
NS_LOG_DEBUG("Set up Client Device " << (client->GetDevice(0))->GetAddress ()
- << " with ip " << ipv4AddrClient
- << " position (" << clientPos.x << "," << clientPos.y << "," << clientPos.z << ")"
- << "\n");
+ << " with ip " << ipv4AddrClient
+ << " position (" << clientPos.x << "," << clientPos.y << "," << clientPos.z << ")"
+ << "\n");
-
+
// Equipping the source node with OnOff Application used for sending
OnOffHelper onoff ("ns3::UdpSocketFactory", Address(InetSocketAddress(Ipv4Address("10.0.0.1"), port)));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
@@ -371,7 +372,7 @@
Ipv4StaticRoutingHelper staticRouting;
Ipv4ListRoutingHelper list;
-
+
if (enableRouting)
{
list.Add (staticRouting, 0);
@@ -392,15 +393,15 @@
Ipv4InterfaceContainer ipInterfaces;
ipInterfaces = address.Assign(devices);
-
+
MobilityHelper mobil= mobility;
mobil.SetPositionAllocator ("ns3::GridPositionAllocator",
- "MinX", DoubleValue (0.0),
- "MinY", DoubleValue (0.0),
- "DeltaX", DoubleValue (nodeDistance),
- "DeltaY", DoubleValue (nodeDistance),
- "GridWidth", UintegerValue (gridSize),
- "LayoutType", StringValue ("RowFirst"));
+ "MinX", DoubleValue (0.0),
+ "MinY", DoubleValue (0.0),
+ "DeltaX", DoubleValue (nodeDistance),
+ "DeltaY", DoubleValue (nodeDistance),
+ "GridWidth", UintegerValue (gridSize),
+ "LayoutType", StringValue ("RowFirst"));
mobil.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
@@ -506,7 +507,7 @@
}
Simulator::Destroy ();
-
+
return m_output;
}
@@ -552,8 +553,9 @@
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
Ssid ssid = Ssid ("Testbed");
-
- wifiMac.SetType ("ns3::AdhocWifiMac", "Ssid", SsidValue(ssid));
+
+ wifiMac.SetType ("ns3::AdhocWifiMac",
+ "Ssid", SsidValue(ssid));
wifi.SetStandard (WIFI_PHY_STANDARD_holland);
wifi.SetRemoteStationManager (experiment.GetRateManager());
--- a/examples/wireless/simple-wifi-frame-aggregation.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/examples/wireless/simple-wifi-frame-aggregation.cc Tue Dec 21 17:46:35 2010 +0100
@@ -49,7 +49,7 @@
LogComponentEnable ("MsduAggregator", LOG_LEVEL_INFO);
LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO);
LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO);
-
+
uint32_t nWifi = 1;
CommandLine cmd;
cmd.AddValue ("nWifi", "Number of wifi STA devices", nWifi);
@@ -69,19 +69,19 @@
wifi.SetRemoteStationManager ("ns3::AarfWifiManager", "FragmentationThreshold", UintegerValue (2500));
Ssid ssid = Ssid ("ns-3-802.11n");
- mac.SetType ("ns3::QstaWifiMac",
- "Ssid", SsidValue (ssid),
- "ActiveProbing", BooleanValue (false));
+ mac.SetType ("ns3::StaWifiMac",
+ "Ssid", SsidValue (ssid),
+ "ActiveProbing", BooleanValue (false));
mac.SetMsduAggregatorForAc (AC_BE, "ns3::MsduStandardAggregator",
- "MaxAmsduSize", UintegerValue (3839));
-
+ "MaxAmsduSize", UintegerValue (3839));
+
NetDeviceContainer staDevices;
staDevices = wifi.Install (phy, mac, wifiNodes);
-
- mac.SetType ("ns3::QapWifiMac",
- "Ssid", SsidValue (ssid));
+
+ mac.SetType ("ns3::ApWifiMac",
+ "Ssid", SsidValue (ssid));
mac.SetMsduAggregatorForAc (AC_BE, "ns3::MsduStandardAggregator",
- "MaxAmsduSize", UintegerValue (7935));
+ "MaxAmsduSize", UintegerValue (7935));
NetDeviceContainer apDevice;
apDevice = wifi.Install (phy, mac, wifiApNode);
@@ -90,20 +90,20 @@
MobilityHelper mobility;
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
- "MinX", DoubleValue (0.0),
- "MinY", DoubleValue (0.0),
- "DeltaX", DoubleValue (5.0),
- "DeltaY", DoubleValue (10.0),
- "GridWidth", UintegerValue (3),
- "LayoutType", StringValue ("RowFirst"));
+ "MinX", DoubleValue (0.0),
+ "MinY", DoubleValue (0.0),
+ "DeltaX", DoubleValue (5.0),
+ "DeltaY", DoubleValue (10.0),
+ "GridWidth", UintegerValue (3),
+ "LayoutType", StringValue ("RowFirst"));
mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel",
- "Bounds", RectangleValue (Rectangle (-50, 50, -50, 50)));
+ "Bounds", RectangleValue (Rectangle (-50, 50, -50, 50)));
mobility.Install (wifiNodes);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (wifiApNode);
-
+
/* Internet stack*/
InternetStackHelper stack;
stack.Install (wifiApNode);
@@ -114,10 +114,10 @@
address.SetBase ("192.168.1.0", "255.255.255.0");
Ipv4InterfaceContainer wifiNodesInterfaces;
Ipv4InterfaceContainer apNodeInterface;
-
+
wifiNodesInterfaces = address.Assign (staDevices);
apNodeInterface = address.Assign (apDevice);
-
+
/* Setting applications */
UdpEchoServerHelper echoServer (9);
@@ -138,12 +138,12 @@
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
Simulator::Stop (Seconds (10.0));
-
+
phy.EnablePcap ("test-802.11n",
- wifiNodes.Get (nWifi - 1)->GetId (), 0);
+ wifiNodes.Get (nWifi - 1)->GetId (), 0);
Simulator::Run ();
Simulator::Destroy ();
-
+
return 0;
}
--- a/examples/wireless/wifi-ap.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/examples/wireless/wifi-ap.cc Tue Dec 21 17:46:35 2010 +0100
@@ -121,7 +121,7 @@
cmd.AddValue ("verbose", "Print trace information if true", g_verbose);
cmd.Parse (argc, argv);
-
+
Packet::EnablePrinting ();
// enable rts cts all the time.
@@ -150,12 +150,13 @@
Ssid ssid = Ssid ("wifi-default");
wifi.SetRemoteStationManager ("ns3::ArfWifiManager");
// setup stas.
- wifiMac.SetType ("ns3::NqstaWifiMac",
- "Ssid", SsidValue (ssid),
- "ActiveProbing", BooleanValue (false));
+ wifiMac.SetType ("ns3::StaWifiMac",
+ "Ssid", SsidValue (ssid),
+ "ActiveProbing", BooleanValue (false));
staDevs = wifi.Install (wifiPhy, wifiMac, stas);
// setup ap.
- wifiMac.SetType ("ns3::NqapWifiMac", "Ssid", SsidValue (ssid));
+ wifiMac.SetType ("ns3::ApWifiMac",
+ "Ssid", SsidValue (ssid));
wifi.Install (wifiPhy, wifiMac, ap);
// mobility.
@@ -185,7 +186,7 @@
Config::Connect ("/NodeList/*/DeviceList/*/Phy/State/RxError", MakeCallback (&PhyRxErrorTrace));
Config::Connect ("/NodeList/*/DeviceList/*/Phy/State/Tx", MakeCallback (&PhyTxTrace));
Config::Connect ("/NodeList/*/DeviceList/*/Phy/State/State", MakeCallback (&PhyStateTrace));
-
+
AthstatsHelper athstats;
athstats.EnableAthstats("athstats-sta", stas);
athstats.EnableAthstats("athstats-ap", ap);
--- a/examples/wireless/wifi-ap.py Tue Dec 21 17:39:54 2010 +0100
+++ b/examples/wireless/wifi-ap.py Tue Dec 21 17:46:35 2010 +0100
@@ -118,14 +118,15 @@
wifiMac = ns3.NqosWifiMacHelper.Default()
# setup stas.
- wifiMac.SetType("ns3::NqstaWifiMac",
- "Ssid", ns3.SsidValue(ssid),
- "ActiveProbing", ns3.BooleanValue(False))
+ wifiMac.SetType("ns3::StaWifiMac",
+ "Ssid", ns3.SsidValue(ssid),
+ "ActiveProbing", ns3.BooleanValue(False))
staDevs = wifi.Install(wifiPhy, wifiMac, stas)
# setup ap.
- wifiMac.SetType("ns3::NqapWifiMac", "Ssid", ns3.SsidValue(ssid),
- "BeaconGeneration", ns3.BooleanValue(True),
- "BeaconInterval", ns3.TimeValue(ns3.Seconds(2.5)))
+ wifiMac.SetType("ns3::ApWifiMac",
+ "Ssid", ns3.SsidValue(ssid),
+ "BeaconGeneration", ns3.BooleanValue(True),
+ "BeaconInterval", ns3.TimeValue(ns3.Seconds(2.5)))
wifi.Install(wifiPhy, wifiMac, ap)
# mobility.
--- a/examples/wireless/wifi-blockack.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/examples/wireless/wifi-blockack.cc Tue Dec 21 17:46:35 2010 +0100
@@ -58,7 +58,7 @@
Ptr<Node> sta = CreateObject<Node> ();
Ptr<Node> ap = CreateObject<Node> ();
-
+
YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
phy.SetChannel (channel.Create ());
@@ -69,31 +69,34 @@
wifi.SetRemoteStationManager ("ns3::AarfWifiManager", "FragmentationThreshold", UintegerValue (2500));
Ssid ssid ("My-network");
-
- mac.SetType ("ns3::QstaWifiMac", "Ssid" , SsidValue (ssid), "ActiveProbing", BooleanValue (false));
+
+ mac.SetType ("ns3::StaWifiMac",
+ "Ssid", SsidValue (ssid),
+ "ActiveProbing", BooleanValue (false));
/* setting blockack threshold for sta's BE queue */
mac.SetBlockAckThresholdForAc (AC_BE, 2);
/* setting block inactivity timeout to 3*1024 = 3072 microseconds */
//mac.SetBlockAckInactivityTimeoutForAc (AC_BE, 3);
NetDeviceContainer staDevice = wifi.Install (phy, mac, sta);
- mac.SetType ("ns3::QapWifiMac", "Ssid", SsidValue (ssid));
+ mac.SetType ("ns3::ApWifiMac",
+ "Ssid", SsidValue (ssid));
mac.SetBlockAckThresholdForAc (AC_BE, 0);
NetDeviceContainer apDevice = wifi.Install (phy, mac, ap);
-
+
/* Setting mobility model */
MobilityHelper mobility;
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
- "MinX", DoubleValue (0.0),
- "MinY", DoubleValue (0.0),
- "DeltaX", DoubleValue (5.0),
- "DeltaY", DoubleValue (10.0),
- "GridWidth", UintegerValue (3),
- "LayoutType", StringValue ("RowFirst"));
+ "MinX", DoubleValue (0.0),
+ "MinY", DoubleValue (0.0),
+ "DeltaX", DoubleValue (5.0),
+ "DeltaY", DoubleValue (10.0),
+ "GridWidth", UintegerValue (3),
+ "LayoutType", StringValue ("RowFirst"));
mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel",
- "Bounds", RectangleValue (Rectangle (-50, 50, -50, 50)));
+ "Bounds", RectangleValue (Rectangle (-50, 50, -50, 50)));
mobility.Install (sta);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
@@ -103,7 +106,7 @@
InternetStackHelper stack;
stack.Install (sta);
stack.Install (ap);
-
+
Ipv4AddressHelper address;
address.SetBase ("192.168.1.0", "255.255.255.0");
@@ -113,7 +116,7 @@
apIf = address.Assign (apDevice);
/* Setting applications */
-
+
uint16_t port = 9;
DataRate dataRate ("1Mb/s");
--- a/examples/wireless/wifi-simple-adhoc-grid.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/examples/wireless/wifi-simple-adhoc-grid.cc Tue Dec 21 17:46:35 2010 +0100
@@ -223,6 +223,9 @@
AsciiTraceHelper ascii;
wifiPhy.EnableAsciiAll (ascii.CreateFileStream ("wifi-simple-adhoc-grid.tr"));
wifiPhy.EnablePcap ("wifi-simple-adhoc-grid", devices);
+ // Trace routing tables
+ Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper> ("wifi-simple-adhoc-grid.routes", std::ios::out);
+ olsr.PrintRoutingTableAllEvery (Seconds (2), routingStream);
// To do-- enable an IP-level trace that shows forwarding events only
}
--- a/examples/wireless/wifi-simple-infra.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/examples/wireless/wifi-simple-infra.cc Tue Dec 21 17:46:35 2010 +0100
@@ -107,7 +107,7 @@
cmd.AddValue ("numPackets", "number of packets generated", numPackets);
cmd.AddValue ("interval", "interval (seconds) between packets", interval);
cmd.AddValue ("verbose", "turn on all WifiNetDevice log components", verbose);
-
+
cmd.Parse (argc, argv);
// Convert to time object
Time interPacketInterval = Seconds (interval);
@@ -149,18 +149,19 @@
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode",StringValue(phyMode),
- "ControlMode",StringValue(phyMode));
+ "ControlMode",StringValue(phyMode));
// Setup the rest of the upper mac
Ssid ssid = Ssid ("wifi-default");
// setup sta.
- wifiMac.SetType ("ns3::NqstaWifiMac",
+ wifiMac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false));
NetDeviceContainer staDevice = wifi.Install (wifiPhy, wifiMac, c.Get(0));
NetDeviceContainer devices = staDevice;
// setup ap.
- wifiMac.SetType ("ns3::NqapWifiMac", "Ssid", SsidValue (ssid));
+ wifiMac.SetType ("ns3::ApWifiMac",
+ "Ssid", SsidValue (ssid));
NetDeviceContainer apDevice = wifi.Install (wifiPhy, wifiMac, c.Get(1));
devices.Add (apDevice);
@@ -195,7 +196,7 @@
// Tracing
wifiPhy.EnablePcap ("wifi-simple-infra", devices);
-
+
// Output what we are doing
NS_LOG_UNCOND ("Testing " << numPackets << " packets sent with receiver rss " << rss );
--- a/examples/wireless/wifi-wired-bridging.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/examples/wireless/wifi-wired-bridging.cc Tue Dec 21 17:46:35 2010 +0100
@@ -29,7 +29,7 @@
// WIFI STA WIFI STA WIFI STA WIFI STA
// -------- -------- -------- --------
// ((*)) ((*)) | ((*)) ((*))
-// |
+// |
// ((*)) | ((*))
// ------- -------
// WIFI AP CSMA ========= CSMA WIFI AP
@@ -38,9 +38,9 @@
// BRIDGE BRIDGE
// ############## ##############
// 192.168.0.1 192.168.0.2
-// +---------+ +---------+
+// +---------+ +---------+
// | AP Node | | AP Node |
-// +---------+ +---------+
+// +---------+ +---------+
//
#include "ns3/core-module.h"
@@ -116,19 +116,19 @@
sta.Create (nStas);
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
- "MinX", DoubleValue (wifiX),
- "MinY", DoubleValue (0.0),
- "DeltaX", DoubleValue (5.0),
- "DeltaY", DoubleValue (5.0),
- "GridWidth", UintegerValue (1),
- "LayoutType", StringValue ("RowFirst"));
+ "MinX", DoubleValue (wifiX),
+ "MinY", DoubleValue (0.0),
+ "DeltaX", DoubleValue (5.0),
+ "DeltaY", DoubleValue (5.0),
+ "GridWidth", UintegerValue (1),
+ "LayoutType", StringValue ("RowFirst"));
// setup the AP.
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (backboneNodes.Get (i));
- wifiMac.SetType ("ns3::NqapWifiMac",
- "Ssid", SsidValue (ssid));
+ wifiMac.SetType ("ns3::ApWifiMac",
+ "Ssid", SsidValue (ssid));
apDev = wifi.Install (wifiPhy, wifiMac, backboneNodes.Get (i));
NetDeviceContainer bridgeDev;
@@ -140,14 +140,14 @@
// setup the STAs
stack.Install (sta);
mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel",
- "Mode", StringValue ("Time"),
- "Time", StringValue ("2s"),
- "Speed", StringValue ("Constant:1.0"),
- "Bounds", RectangleValue (Rectangle (wifiX, wifiX+5.0,0.0, (nStas+1)*5.0)));
+ "Mode", StringValue ("Time"),
+ "Time", StringValue ("2s"),
+ "Speed", StringValue ("Constant:1.0"),
+ "Bounds", RectangleValue (Rectangle (wifiX, wifiX+5.0,0.0, (nStas+1)*5.0)));
mobility.Install (sta);
- wifiMac.SetType ("ns3::NqstaWifiMac",
- "Ssid", SsidValue (ssid),
- "ActiveProbing", BooleanValue (false));
+ wifiMac.SetType ("ns3::StaWifiMac",
+ "Ssid", SsidValue (ssid),
+ "ActiveProbing", BooleanValue (false));
staDev = wifi.Install (wifiPhy, wifiMac, sta);
staInterface = ip.Assign (staDev);
@@ -184,7 +184,7 @@
ApplicationContainer apps = onoff.Install (staNodes[0].Get (0));
apps.Start (Seconds (0.5));
apps.Stop (Seconds (3.0));
-
+
wifiPhy.EnablePcap ("wifi-wired-bridging", apDevices[0]);
wifiPhy.EnablePcap ("wifi-wired-bridging", apDevices[1]);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/applications/bulk-send/bulk-send-application.cc Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,224 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Georgia Institute of Technology
+ *
+ * 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/log.h"
+#include "ns3/address.h"
+#include "ns3/node.h"
+#include "ns3/nstime.h"
+#include "ns3/socket.h"
+#include "ns3/simulator.h"
+#include "ns3/socket-factory.h"
+#include "ns3/packet.h"
+#include "ns3/uinteger.h"
+#include "ns3/trace-source-accessor.h"
+#include "ns3/tcp-socket-factory.h"
+#include "bulk-send-application.h"
+
+NS_LOG_COMPONENT_DEFINE ("BulkSendApplication");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (BulkSendApplication);
+
+TypeId
+BulkSendApplication::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::BulkSendApplication")
+ .SetParent<Application> ()
+ .AddConstructor<BulkSendApplication> ()
+ .AddAttribute ("SendSize", "The amount of data to send each time.",
+ UintegerValue (512),
+ MakeUintegerAccessor (&BulkSendApplication::m_sendSize),
+ MakeUintegerChecker<uint32_t> (1))
+ .AddAttribute ("Remote", "The address of the destination",
+ AddressValue (),
+ MakeAddressAccessor (&BulkSendApplication::m_peer),
+ MakeAddressChecker ())
+ .AddAttribute ("MaxBytes",
+ "The total number of bytes to send. "
+ "Once these bytes are sent, "
+ "no data is sent again. The value zero means "
+ "that there is no limit.",
+ UintegerValue (0),
+ MakeUintegerAccessor (&BulkSendApplication::m_maxBytes),
+ MakeUintegerChecker<uint32_t> ())
+ .AddAttribute ("Protocol", "The type of protocol to use.",
+ TypeIdValue (TcpSocketFactory::GetTypeId ()),
+ MakeTypeIdAccessor (&BulkSendApplication::m_tid),
+ MakeTypeIdChecker ())
+ .AddTraceSource ("Tx", "A new packet is created and is sent",
+ MakeTraceSourceAccessor (&BulkSendApplication::m_txTrace))
+ ;
+ return tid;
+}
+
+
+BulkSendApplication::BulkSendApplication ()
+ : m_socket (0),
+ m_connected (false),
+ m_totBytes (0)
+{
+ NS_LOG_FUNCTION (this);
+}
+
+BulkSendApplication::~BulkSendApplication ()
+{
+ NS_LOG_FUNCTION (this);
+}
+
+void
+BulkSendApplication::SetMaxBytes (uint32_t maxBytes)
+{
+ NS_LOG_FUNCTION (this << maxBytes);
+ m_maxBytes = maxBytes;
+}
+
+Ptr<Socket>
+BulkSendApplication::GetSocket (void) const
+{
+ NS_LOG_FUNCTION (this);
+ return m_socket;
+}
+
+void
+BulkSendApplication::DoDispose (void)
+{
+ NS_LOG_FUNCTION (this);
+
+ m_socket = 0;
+ // chain up
+ Application::DoDispose ();
+}
+
+// Application Methods
+void BulkSendApplication::StartApplication (void) // Called at time specified by Start
+{
+ NS_LOG_FUNCTION (this);
+
+ // Create the socket if not already
+ if (!m_socket)
+ {
+ m_socket = Socket::CreateSocket (GetNode (), m_tid);
+
+ // Fatal error if socket type is not NS3_SOCK_STREAM or NS3_SOCK_SEQPACKET
+ if (m_socket->GetSocketType () != Socket::NS3_SOCK_STREAM &&
+ m_socket->GetSocketType () != Socket::NS3_SOCK_SEQPACKET)
+ {
+ NS_FATAL_ERROR ("Using BulkSend with an incompatible socket type. "
+ "BulkSend requires SOCK_STREAM or SOCK_SEQPACKET. "
+ "In other words, use TCP instead of UDP.");
+ }
+
+ m_socket->Bind ();
+ m_socket->Connect (m_peer);
+ m_socket->ShutdownRecv ();
+ m_socket->SetConnectCallback (
+ MakeCallback (&BulkSendApplication::ConnectionSucceeded, this),
+ MakeCallback (&BulkSendApplication::ConnectionFailed, this));
+ m_socket->SetSendCallback (
+ MakeCallback (&BulkSendApplication::DataSend, this));
+ }
+ if (m_connected)
+ {
+ SendData ();
+ }
+}
+
+void BulkSendApplication::StopApplication (void) // Called at time specified by Stop
+{
+ NS_LOG_FUNCTION (this);
+
+ if (m_socket != 0)
+ {
+ m_socket->Close ();
+ m_connected = false;
+ }
+ else
+ {
+ NS_LOG_WARN ("BulkSendApplication found null socket to close in StopApplication");
+ }
+}
+
+
+// Private helpers
+
+void BulkSendApplication::SendData (void)
+{
+ NS_LOG_FUNCTION (this);
+
+ while (m_maxBytes == 0 || m_totBytes < m_maxBytes)
+ { // Time to send more
+ uint32_t toSend = m_sendSize;
+ // Make sure we don't send too many
+ if (m_maxBytes > 0)
+ {
+ toSend = std::min (m_sendSize, m_maxBytes - m_totBytes);
+ }
+ NS_LOG_LOGIC ("sending packet at " << Simulator::Now ());
+ Ptr<Packet> packet = Create<Packet> (toSend);
+ m_txTrace (packet);
+ int actual = m_socket->Send (packet);
+ if (actual > 0)
+ {
+ m_totBytes += actual;
+ }
+ // We exit this loop when actual < toSend as the send side
+ // buffer is full. The "DataSent" callback will pop when
+ // some buffer space has freed ip.
+ if ((unsigned)actual != toSend)
+ {
+ break;
+ }
+ }
+ // Check if time to close (all sent)
+ if (m_totBytes == m_maxBytes && m_connected)
+ {
+ m_socket->Close ();
+ m_connected = false;
+ }
+}
+
+void BulkSendApplication::ConnectionSucceeded (Ptr<Socket> socket)
+{
+ NS_LOG_FUNCTION (this << socket);
+ NS_LOG_LOGIC ("BulkSendApplication Connection succeeded");
+ m_connected = true;
+ SendData ();
+}
+
+void BulkSendApplication::ConnectionFailed (Ptr<Socket> socket)
+{
+ NS_LOG_FUNCTION (this << socket);
+ NS_LOG_LOGIC ("BulkSendApplication, Connection Failed");
+}
+
+void BulkSendApplication::DataSend (Ptr<Socket>, uint32_t)
+{
+ NS_LOG_FUNCTION (this);
+
+ if (m_connected)
+ { // Only send new data if the connection has completed
+ Simulator::ScheduleNow (&BulkSendApplication::SendData, this);
+ }
+}
+
+
+
+} // Namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/applications/bulk-send/bulk-send-application.h Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Georgia Institute of Technology
+ *
+ * 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 __bulksend_application_h__
+#define __bulksend_application_h__
+
+#include "ns3/address.h"
+#include "ns3/application.h"
+#include "ns3/event-id.h"
+#include "ns3/ptr.h"
+#include "ns3/traced-callback.h"
+
+namespace ns3 {
+
+class Address;
+class RandomVariable;
+class Socket;
+
+/**
+ * \ingroup applications
+ * \defgroup bulksend BulkSendApplication
+ *
+ * This traffic generator simply sends data
+ * as fast as possible up to MaxBytes or until
+ * the appplication is stopped if MaxBytes is
+ * zero. Once the lower layer send buffer is
+ * filled, it waits until space is free to
+ * send more data, essentially keeping a
+ * constant flow of data. Only SOCK_STREAM
+ * and SOCK_SEQPACKET sockets are supported.
+ * For example, TCP sockets can be used, but
+ * UDP sockets can not be used.
+ */
+class BulkSendApplication : public Application
+{
+public:
+ static TypeId GetTypeId (void);
+
+ BulkSendApplication ();
+
+ virtual ~BulkSendApplication ();
+
+ /**
+ * \param maxBytes the upper bound of bytes to send
+ *
+ * Set the upper bound for the total number of bytes to send. Once
+ * this bound is reached, no more application bytes are sent. If the
+ * application is stopped during the simulation and restarted, the
+ * total number of bytes sent is not reset; however, the maxBytes
+ * bound is still effective and the application will continue sending
+ * up to maxBytes. The value zero for maxBytes means that
+ * there is no upper bound; i.e. data is sent until the application
+ * or simulation is stopped.
+ */
+ void SetMaxBytes (uint32_t maxBytes);
+
+ /**
+ * \return pointer to associated socket
+ */
+ Ptr<Socket> GetSocket (void) const;
+
+protected:
+ virtual void DoDispose (void);
+private:
+ // inherited from Application base class.
+ virtual void StartApplication (void); // Called at time specified by Start
+ virtual void StopApplication (void); // Called at time specified by Stop
+
+ void SendData ();
+
+ Ptr<Socket> m_socket; // Associated socket
+ Address m_peer; // Peer address
+ bool m_connected; // True if connected
+ uint32_t m_sendSize; // Size of data to send each time
+ uint32_t m_maxBytes; // Limit total number of bytes sent
+ uint32_t m_totBytes; // Total bytes sent so far
+ TypeId m_tid;
+ TracedCallback<Ptr<const Packet> > m_txTrace;
+
+private:
+ void ConnectionSucceeded (Ptr<Socket> socket);
+ void ConnectionFailed (Ptr<Socket> socket);
+ void DataSend (Ptr<Socket>, uint32_t); // for socket's SetSendCallback
+ void Ignore (Ptr<Socket> socket);
+};
+
+} // namespace ns3
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/applications/bulk-send/wscript Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,13 @@
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+def build(bld):
+ module = bld.create_ns3_module('bulk-send', ['core', 'simulator', 'node'])
+ module.source = [
+ 'bulk-send-application.cc',
+ ]
+ headers = bld.new_task_gen('ns3header')
+ headers.module = 'bulk-send'
+ headers.source = [
+ 'bulk-send-application.h',
+ ]
+
--- a/src/common/output-stream-wrapper.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/common/output-stream-wrapper.cc Tue Dec 21 17:46:35 2010 +0100
@@ -27,18 +27,27 @@
namespace ns3 {
OutputStreamWrapper::OutputStreamWrapper (std::string filename, std::ios::openmode filemode)
- : m_ostream (new std::ofstream ())
+ : m_destroyable (true)
+{
+ std::ofstream* os = new std::ofstream ();
+ os->open (filename.c_str (), filemode);
+ m_ostream = os;
+ FatalImpl::RegisterStream (m_ostream);
+ NS_ABORT_MSG_UNLESS (os->is_open (), "AsciiTraceHelper::CreateFileStream(): " <<
+ "Unable to Open " << filename << " for mode " << filemode);
+}
+
+OutputStreamWrapper::OutputStreamWrapper (std::ostream* os)
+ : m_ostream (os), m_destroyable (false)
{
FatalImpl::RegisterStream (m_ostream);
- m_ostream->open (filename.c_str (), filemode);
- NS_ABORT_MSG_UNLESS (m_ostream->is_open (), "AsciiTraceHelper::CreateFileStream(): " <<
- "Unable to Open " << filename << " for mode " << filemode);
+ NS_ABORT_MSG_UNLESS (m_ostream->good (), "Output stream is not vaild for writing.");
}
OutputStreamWrapper::~OutputStreamWrapper ()
{
FatalImpl::UnregisterStream (m_ostream);
- delete m_ostream;
+ if (m_destroyable) delete m_ostream;
m_ostream = 0;
}
--- a/src/common/output-stream-wrapper.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/common/output-stream-wrapper.h Tue Dec 21 17:46:35 2010 +0100
@@ -71,6 +71,7 @@
{
public:
OutputStreamWrapper (std::string filename, std::ios::openmode filemode);
+ OutputStreamWrapper (std::ostream* os);
~OutputStreamWrapper ();
/**
@@ -83,7 +84,8 @@
std::ostream *GetStream (void);
private:
- std::ofstream *m_ostream;
+ std::ostream *m_ostream;
+ bool m_destroyable;
};
} //namespace ns3
--- a/src/contrib/energy/helper/energy-model-helper.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/contrib/energy/helper/energy-model-helper.cc Tue Dec 21 17:46:35 2010 +0100
@@ -93,6 +93,7 @@
{
NS_ASSERT (device != NULL);
NS_ASSERT (source != NULL);
+ // check to make sure source and net device are on the same node
NS_ASSERT (device->GetNode () == source->GetNode ());
DeviceEnergyModelContainer container (DoInstall (device, source));
return container;
@@ -108,6 +109,7 @@
EnergySourceContainer::Iterator src = sourceContainer.Begin ();
while (dev != deviceContainer.End ())
{
+ // check to make sure source and net device are on the same node
NS_ASSERT ((*dev)->GetNode () == (*src)->GetNode ());
Ptr<DeviceEnergyModel> model = DoInstall (*dev, *src);
container.Add (model);
--- a/src/contrib/energy/helper/energy-source-container.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/contrib/energy/helper/energy-source-container.cc Tue Dec 21 17:46:35 2010 +0100
@@ -118,6 +118,13 @@
void
EnergySourceContainer::DoDispose (void)
{
+ // call Object::Dispose for all EnergySource objects
+ for (std::vector< Ptr<EnergySource> >::iterator i = m_sources.begin ();
+ i != m_sources.end (); i++)
+ {
+ (*i)->DisposeDeviceModels ();
+ (*i)->Dispose ();
+ }
m_sources.clear ();
}
@@ -126,9 +133,10 @@
{
// call Object::Start for all EnergySource objects
for (std::vector< Ptr<EnergySource> >::iterator i = m_sources.begin ();
- i != m_sources.end (); i++)
+ i != m_sources.end (); i++)
{
(*i)->Start ();
+ (*i)->StartDeviceModels ();
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/contrib/energy/helper/rv-battery-model-helper.cc Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Network Security Lab, University of Washington, Seattle.
+ *
+ * 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: Sidharth Nabar <snabar@uw.edu>, He Wu <mdzz@u.washington.edu>
+ */
+
+#include "rv-battery-model-helper.h"
+#include "ns3/energy-source.h"
+
+namespace ns3 {
+
+RvBatteryModelHelper::RvBatteryModelHelper ()
+{
+ m_rvBatteryModel.SetTypeId ("ns3::RvBatteryModel");
+}
+
+RvBatteryModelHelper::~RvBatteryModelHelper ()
+{
+}
+
+void
+RvBatteryModelHelper::Set (std::string name, const AttributeValue &v)
+{
+ m_rvBatteryModel.Set (name, v);
+}
+
+Ptr<EnergySource>
+RvBatteryModelHelper::DoInstall (Ptr<Node> node) const
+{
+ NS_ASSERT (node != NULL);
+ // check if energy source already exists
+ Ptr<EnergySource> source = node->GetObject<EnergySource> ();
+ if (source != NULL)
+ {
+ NS_FATAL_ERROR ("Energy source already installed!");
+ }
+ source = m_rvBatteryModel.Create<EnergySource> ();
+ NS_ASSERT (source != NULL);
+ source->SetNode (node);
+ return source;
+}
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/contrib/energy/helper/rv-battery-model-helper.h Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Network Security Lab, University of Washington, Seattle.
+ *
+ * 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: Sidharth Nabar <snabar@uw.edu>, He Wu <mdzz@u.washington.edu>
+ */
+
+#ifndef RV_BATTERY_MODEL_HELPER_H
+#define RV_BATTERY_MODEL_HELPER_H
+
+#include "energy-model-helper.h"
+#include "ns3/node.h"
+
+namespace ns3 {
+
+/**
+ * \brief Creates a RvBatteryModel object.
+ */
+class RvBatteryModelHelper : public EnergySourceHelper
+{
+public:
+ RvBatteryModelHelper ();
+ ~RvBatteryModelHelper ();
+
+ void Set (std::string name, const AttributeValue &v);
+
+private:
+ virtual Ptr<EnergySource> DoInstall (Ptr<Node> node) const;
+
+private:
+ ObjectFactory m_rvBatteryModel;
+
+};
+
+} // namespace ns3
+
+#endif /* RV_BATTERY_MODEL_HELPER_H */
--- a/src/contrib/energy/helper/wifi-radio-energy-model-helper.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/contrib/energy/helper/wifi-radio-energy-model-helper.cc Tue Dec 21 17:46:35 2010 +0100
@@ -67,23 +67,18 @@
NS_FATAL_ERROR ("NetDevice type is not WifiNetDevice!");
}
Ptr<Node> node = device->GetNode ();
- Ptr<WifiRadioEnergyModel> model = m_radioEnergy.Create ()->
- GetObject<WifiRadioEnergyModel> ();
+ Ptr<WifiRadioEnergyModel> model = m_radioEnergy.Create ()->GetObject<WifiRadioEnergyModel> ();
NS_ASSERT (model != NULL);
- // set node pointer
- model->SetNode (node);
// set energy source pointer
model->SetEnergySource (source);
// set energy depletion callback
model->SetEnergyDepletionCallback (m_depletionCallback);
// add model to device model list in energy source
source->AppendDeviceEnergyModel (model);
- // create and install energy model callback
+ // create and register energy model phy listener
Ptr<WifiNetDevice> wifiDevice = DynamicCast<WifiNetDevice> (device);
Ptr<WifiPhy> wifiPhy = wifiDevice->GetPhy ();
- DeviceEnergyModel::ChangeStateCallback callback;
- callback = MakeCallback (&DeviceEnergyModel::ChangeState, model);
- //wifiPhy->SetEnergyModelCallback (callback);
+ wifiPhy->RegisterListener (model->GetPhyListener ());
return model;
}
--- a/src/contrib/energy/model/basic-energy-source.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/contrib/energy/model/basic-energy-source.cc Tue Dec 21 17:46:35 2010 +0100
@@ -90,28 +90,25 @@
void
BasicEnergySource::SetEnergyUpdateInterval (Time interval)
{
- NS_LOG_FUNCTION (this);
+ NS_LOG_FUNCTION (this << interval);
m_energyUpdateInterval = interval;
}
Time
BasicEnergySource::GetEnergyUpdateInterval (void) const
{
- NS_LOG_FUNCTION (this);
return m_energyUpdateInterval;
}
double
BasicEnergySource::GetSupplyVoltage (void) const
{
- NS_LOG_FUNCTION (this);
return m_supplyVoltageV;
}
double
BasicEnergySource::GetInitialEnergy (void) const
{
- NS_LOG_FUNCTION (this);
return m_initialEnergyJ;
}
@@ -134,32 +131,10 @@
}
void
-BasicEnergySource::DecreaseRemainingEnergy (double energyJ)
-{
- NS_LOG_FUNCTION (this << energyJ);
- NS_ASSERT (energyJ >= 0);
- m_remainingEnergyJ -= energyJ;
- // check if remaining energy is 0
- if (m_remainingEnergyJ <= 0)
- {
- HandleEnergyDrainedEvent ();
- }
-}
-
-void
-BasicEnergySource::IncreaseRemainingEnergy (double energyJ)
-{
- NS_LOG_FUNCTION (this << energyJ);
- NS_ASSERT (energyJ >= 0);
- m_remainingEnergyJ += energyJ;
-}
-
-void
BasicEnergySource::UpdateEnergySource (void)
{
NS_LOG_FUNCTION (this);
- NS_LOG_DEBUG ("BasicEnergySource:Updating remaining energy at node #" <<
- GetNode ()->GetId ());
+ NS_LOG_DEBUG ("BasicEnergySource:Updating remaining energy.");
// do not update if simulation has finished
if (Simulator::IsFinished ())
@@ -208,8 +183,7 @@
BasicEnergySource::HandleEnergyDrainedEvent (void)
{
NS_LOG_FUNCTION (this);
- NS_LOG_DEBUG ("BasicEnergySource:Energy depleted at node #" <<
- GetNode ()->GetId ());
+ NS_LOG_DEBUG ("BasicEnergySource:Energy depleted!");
NotifyEnergyDrained (); // notify DeviceEnergyModel objects
m_remainingEnergyJ = 0; // energy never goes below 0
}
--- a/src/contrib/energy/model/basic-energy-source.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/contrib/energy/model/basic-energy-source.h Tue Dec 21 17:46:35 2010 +0100
@@ -68,20 +68,6 @@
virtual double GetEnergyFraction (void);
/**
- * \param energyJ Amount of energy (in Joules) to decrease from energy source.
- *
- * Implements DecreaseRemainingEnergy.
- */
- virtual void DecreaseRemainingEnergy (double energyJ);
-
- /**
- * \param energyJ Amount of energy (in Joules) to increase from energy source.
- *
- * Implements IncreaseRemainingEnergy.
- */
- virtual void IncreaseRemainingEnergy (double energyJ);
-
- /**
* Implements UpdateEnergySource.
*/
virtual void UpdateEnergySource (void);
@@ -116,7 +102,10 @@
private:
+ /// Defined in ns3::Object
void DoStart (void);
+
+ /// Defined in ns3::Object
void DoDispose (void);
/**
--- a/src/contrib/energy/model/device-energy-model.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/contrib/energy/model/device-energy-model.h Tue Dec 21 17:46:35 2010 +0100
@@ -53,20 +53,6 @@
virtual ~DeviceEnergyModel ();
/**
- * \brief Sets pointer to node containing this EnergySource.
- *
- * \param node Pointer to node containing this EnergySource.
- */
- virtual void SetNode (Ptr<Node> node) = 0;
-
- /**
- * \brief Gets pointer to node containing this EnergySource.
- *
- * \returns Pointer to node containing this EnergySource.
- */
- virtual Ptr<Node> GetNode (void) const = 0;
-
- /**
* \param source Pointer to energy source installed on node.
*
* This function sets the pointer to energy source installed on node. Should
--- a/src/contrib/energy/model/energy-source.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/contrib/energy/model/energy-source.cc Tue Dec 21 17:46:35 2010 +0100
@@ -47,7 +47,6 @@
void
EnergySource::SetNode (Ptr<Node> node)
{
- NS_LOG_FUNCTION (this << node);
NS_ASSERT (node != NULL);
m_node = node;
}
@@ -55,7 +54,6 @@
Ptr<Node>
EnergySource::GetNode (void) const
{
- NS_LOG_FUNCTION (this);
return m_node;
}
@@ -99,6 +97,34 @@
return container;
}
+void
+EnergySource::StartDeviceModels (void)
+{
+ /*
+ * Device models are not aggregated to the node, hence we have to manually
+ * call dispose method here.
+ */
+ DeviceEnergyModelContainer::Iterator i;
+ for (i = m_models.Begin (); i != m_models.End (); i++)
+ {
+ (*i)->Start ();
+ }
+}
+
+void
+EnergySource::DisposeDeviceModels (void)
+{
+ /*
+ * Device models are not aggregated to the node, hence we have to manually
+ * call dispose method here.
+ */
+ DeviceEnergyModelContainer::Iterator i;
+ for (i = m_models.Begin (); i != m_models.End (); i++)
+ {
+ (*i)->Dispose ();
+ }
+}
+
/*
* Private function starts here.
*/
@@ -107,7 +133,7 @@
EnergySource::DoDispose (void)
{
NS_LOG_FUNCTION (this);
- m_models.Clear ();
+ BreakDeviceEnergyModelRefCycle ();
}
/*
--- a/src/contrib/energy/model/energy-source.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/contrib/energy/model/energy-source.h Tue Dec 21 17:46:35 2010 +0100
@@ -97,22 +97,6 @@
virtual double GetEnergyFraction (void) = 0;
/**
- * \param energyJ Amount of energy to decrease (in Joules)
- *
- * This function decreases the remaining energy in the energy source by the
- * specified amount. Provides linear interface for direct energy deduction.
- */
- virtual void DecreaseRemainingEnergy (double energyJ) = 0;
-
- /**
- * \param energyJ Amount of energy to increase (in Joules)
- *
- * This function increases the remaining energy in the energy source by the
- * specified amount. Provides linear interface for direct energy increase.
- */
- virtual void IncreaseRemainingEnergy (double energyJ) = 0;
-
- /**
* This function goes through the list of DeviceEnergyModels to obtain total
* current draw at the energy source and updates remaining energy. Called by
* DeviceEnergyModels to inform EnergySource of a state change.
@@ -154,11 +138,27 @@
*/
DeviceEnergyModelContainer FindDeviceEnergyModels (std::string name);
+ /**
+ * Calls Start () method of the device energy models. Device energy models are
+ * not aggregated to the node, therefore we need to manually start them here.
+ * Called by EnergySourceContainer, which is aggregated to the node.
+ */
+ void StartDeviceModels (void);
+
+ /**
+ * Calls Dispose () method of the device energy models. Device energy models
+ * are not aggregated to the node, therefore we need to manually start them
+ * here. Called by EnergySourceContainer, which is aggregated to the node.
+ */
+ void DisposeDeviceModels (void);
+
private:
/**
* All child's implementation must call BreakDeviceEnergyModelRefCycle to
* ensure reference cycles to DeviceEnergyModel objects are broken.
+ *
+ * Defined in ns3::Object
*/
virtual void DoDispose (void);
@@ -169,7 +169,8 @@
DeviceEnergyModelContainer m_models;
/**
- * Pointer to node containing this EnergySource.
+ * Pointer to node containing this EnergySource. Used by helper class to make
+ * sure device models are installed onto the corresponding node.
*/
Ptr<Node> m_node;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/contrib/energy/model/rv-battery-model.cc Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,367 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Network Security Lab, University of Washington, Seattle.
+ *
+ * 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: Sidharth Nabar <snabar@uw.edu>, He Wu <mdzz@u.washington.edu>
+ */
+
+#include "rv-battery-model.h"
+#include "ns3/log.h"
+#include "ns3/assert.h"
+#include "ns3/double.h"
+#include "ns3/trace-source-accessor.h"
+#include "ns3/simulator.h"
+#include <math.h>
+
+NS_LOG_COMPONENT_DEFINE ("RvBatteryModel");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (RvBatteryModel);
+
+TypeId
+RvBatteryModel::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::RvBatteryModel")
+ .SetParent<EnergySource> ()
+ .AddConstructor<RvBatteryModel> ()
+ .AddAttribute ("RvBatteryModelPeriodicEnergyUpdateInterval",
+ "RV battery model sampling interval.",
+ TimeValue (Seconds (1.0)),
+ MakeTimeAccessor (&RvBatteryModel::SetSamplingInterval,
+ &RvBatteryModel::GetSamplingInterval),
+ MakeTimeChecker ())
+ .AddAttribute ("RvBatteryModelOpenCircuitVoltage",
+ "RV battery model open circuit voltage.",
+ DoubleValue (4.1),
+ MakeDoubleAccessor (&RvBatteryModel::SetOpenCircuitVoltage,
+ &RvBatteryModel::GetOpenCircuitVoltage),
+ MakeDoubleChecker<double> ())
+ .AddAttribute ("RvBatteryModelCutoffVoltage",
+ "RV battery model cutoff voltage.",
+ DoubleValue (3.0),
+ MakeDoubleAccessor (&RvBatteryModel::SetCutoffVoltage,
+ &RvBatteryModel::GetCutoffVoltage),
+ MakeDoubleChecker<double> ())
+ .AddAttribute ("RvBatteryModelAlphaValue",
+ "RV battery model alpha value.",
+ DoubleValue (35220.0),
+ MakeDoubleAccessor (&RvBatteryModel::SetAlpha,
+ &RvBatteryModel::GetAlpha),
+ MakeDoubleChecker<double> ())
+ .AddAttribute ("RvBatteryModelBetaValue",
+ "RV battery model beta value.",
+ DoubleValue (0.637),
+ MakeDoubleAccessor (&RvBatteryModel::SetBeta,
+ &RvBatteryModel::GetBeta),
+ MakeDoubleChecker<double> ())
+ .AddAttribute ("RvBatteryModelNumOfTerms",
+ "The number of terms of the infinite sum for estimating battery level.",
+ IntegerValue (10), // value used in paper
+ MakeIntegerAccessor (&RvBatteryModel::SetNumOfTerms,
+ &RvBatteryModel::GetNumOfTerms),
+ MakeIntegerChecker<int> ())
+ .AddTraceSource ("RvBatteryModelBatteryLevel",
+ "RV battery model battery level.",
+ MakeTraceSourceAccessor (&RvBatteryModel::m_batteryLevel))
+ .AddTraceSource ("RvBatteryModelBatteryLifetime",
+ "RV battery model battery lifetime.",
+ MakeTraceSourceAccessor (&RvBatteryModel::m_lifetime))
+ ;
+ return tid;
+}
+
+RvBatteryModel::RvBatteryModel ()
+{
+ m_lastSampleTime = Seconds (0.0);
+ m_previousLoad = 0.0;
+ m_batteryLevel = 1; // fully charged
+ m_lifetime = Seconds (0.0);
+}
+
+RvBatteryModel::~RvBatteryModel ()
+{
+}
+
+double
+RvBatteryModel::GetInitialEnergy (void) const
+{
+ return m_alpha * GetSupplyVoltage ();
+}
+
+double
+RvBatteryModel::GetSupplyVoltage (void) const
+{
+ // average of Voc and Vcutoff
+ return (m_openCircuitVoltage - m_cutoffVoltage) / 2 + m_cutoffVoltage;
+}
+
+double
+RvBatteryModel::GetRemainingEnergy (void)
+{
+ NS_LOG_FUNCTION (this);
+ UpdateEnergySource ();
+ return m_alpha * GetSupplyVoltage () * m_batteryLevel;
+}
+
+double
+RvBatteryModel::GetEnergyFraction (void)
+{
+ return GetBatteryLevel ();
+}
+
+void
+RvBatteryModel::UpdateEnergySource (void)
+{
+ NS_LOG_FUNCTION (this);
+
+ // do not update if battery is already dead
+ if (m_batteryLevel <= 0)
+ {
+ NS_LOG_DEBUG ("RvBatteryModel:Battery is dead!");
+ return;
+ }
+
+ // do not update if simulation has finished
+ if (Simulator::IsFinished ())
+ {
+ return;
+ }
+
+ NS_LOG_DEBUG ("RvBatteryModel:Updating remaining energy!");
+
+ m_currentSampleEvent.Cancel ();
+
+ double currentLoad = CalculateTotalCurrent () * 1000; // must be in mA
+ double calculatedAlpha = Discharge (currentLoad, Simulator::Now ());
+
+ NS_LOG_DEBUG ("RvBatteryModel:Calculated alpha = " << calculatedAlpha <<
+ " time = " << Simulator::Now ().GetSeconds ());
+
+ // calculate battery level
+ m_batteryLevel = 1 - (calculatedAlpha / m_alpha);
+ if (m_batteryLevel < 0)
+ {
+ m_batteryLevel = 0;
+ }
+
+ // check if battery is dead.
+ if (calculatedAlpha >= m_alpha)
+ {
+ m_lifetime = Simulator::Now ();
+ NS_LOG_DEBUG ("RvBatteryModel:Battery is dead!");
+ HandleEnergyDrainedEvent ();
+ return; // stop periodic sampling
+ }
+
+ m_previousLoad = currentLoad;
+ m_lastSampleTime = Simulator::Now ();
+ m_currentSampleEvent = Simulator::Schedule (m_samplingInterval,
+ &RvBatteryModel::UpdateEnergySource,
+ this);
+}
+
+void
+RvBatteryModel::SetSamplingInterval (Time interval)
+{
+ NS_LOG_FUNCTION (this << interval);
+ m_samplingInterval = interval;
+}
+
+Time
+RvBatteryModel::GetSamplingInterval (void) const
+{
+ return m_samplingInterval;
+}
+
+void
+RvBatteryModel::SetOpenCircuitVoltage (double voltage)
+{
+ NS_LOG_FUNCTION (this << voltage);
+ NS_ASSERT (voltage >= 0);
+ m_openCircuitVoltage = voltage;
+}
+
+double
+RvBatteryModel::GetOpenCircuitVoltage (void) const
+{
+ return m_openCircuitVoltage;
+}
+
+void
+RvBatteryModel::SetCutoffVoltage (double voltage)
+{
+ NS_LOG_FUNCTION (this << voltage);
+ NS_ASSERT (voltage <= m_openCircuitVoltage);
+ m_cutoffVoltage = voltage;
+}
+
+double
+RvBatteryModel::GetCutoffVoltage (void) const
+{
+ return m_cutoffVoltage;
+}
+
+void
+RvBatteryModel::SetAlpha (double alpha)
+{
+ NS_LOG_FUNCTION (this << alpha);
+ NS_ASSERT (alpha >= 0);
+ m_alpha = alpha;
+}
+
+double
+RvBatteryModel::GetAlpha (void) const
+{
+ return m_alpha;
+}
+
+void
+RvBatteryModel::SetBeta (double beta)
+{
+ NS_LOG_FUNCTION (this << beta);
+ NS_ASSERT (beta >= 0);
+ m_beta = beta;
+}
+
+double
+RvBatteryModel::GetBeta (void) const
+{
+ return m_beta;
+}
+
+double
+RvBatteryModel::GetBatteryLevel (void)
+{
+ NS_LOG_FUNCTION (this);
+ UpdateEnergySource ();
+ return m_batteryLevel;
+}
+
+Time
+RvBatteryModel::GetLifetime (void) const
+{
+ return m_lifetime;
+}
+
+void
+RvBatteryModel::SetNumOfTerms (int num)
+{
+ NS_LOG_FUNCTION (this << num);
+ m_numOfTerms = num;
+}
+
+int
+RvBatteryModel::GetNumOfTerms (void) const
+{
+ return m_numOfTerms;
+}
+
+/*
+ * Private functions start here.
+ */
+
+void
+RvBatteryModel::DoStart (void)
+{
+ NS_LOG_DEBUG ("RvBatteryModel:Starting battery level update!");
+ UpdateEnergySource (); // start periodic sampling of load (total current)
+}
+
+void
+RvBatteryModel::DoDispose (void)
+{
+ BreakDeviceEnergyModelRefCycle (); // break reference cycle
+}
+
+void
+RvBatteryModel::HandleEnergyDrainedEvent (void)
+{
+ NS_LOG_FUNCTION (this);
+ NS_LOG_DEBUG ("RvBatteryModel:Energy depleted!");
+ NotifyEnergyDrained (); // notify DeviceEnergyModel objects
+}
+
+double
+RvBatteryModel::Discharge (double load, Time t)
+{
+ NS_LOG_FUNCTION (this << load << t);
+
+ // record only when load changes
+ if (load != m_previousLoad)
+ {
+ m_load.push_back (load);
+ m_previousLoad = load;
+ if (t != Seconds (0.0))
+ {
+ m_timeStamps[m_timeStamps.size () - 1] = m_lastSampleTime;
+ }
+ else
+ {
+ m_timeStamps.push_back (Seconds (0.0));
+ }
+ m_timeStamps.push_back (t);
+ }
+ else
+ {
+ m_timeStamps[m_timeStamps.size () - 1] = t;
+ }
+
+ m_lastSampleTime = t;
+
+ // calculate alpha for new t
+ NS_ASSERT (m_load.size () == m_timeStamps.size () - 1); // size must be equal
+ double calculatedAlpha = 0.0;
+ if (m_timeStamps.size () == 1)
+ {
+ // constant load
+ calculatedAlpha = m_load[0] * RvModelAFunction (t, t, Seconds(0.0),
+ m_beta);
+ }
+ else
+ {
+ // changing load
+ for (uint64_t i = 1; i < m_timeStamps.size (); i++)
+ {
+ calculatedAlpha += m_load[i - 1] * RvModelAFunction (t, m_timeStamps[i],
+ m_timeStamps[i - 1],
+ m_beta);
+ }
+ }
+
+ return calculatedAlpha;
+}
+
+double
+RvBatteryModel::RvModelAFunction (Time t, Time sk, Time sk_1, double beta)
+{
+ NS_LOG_FUNCTION (this << t << sk << sk_1 << beta);
+
+ // everything is in minutes
+ double firstDelta = (t.GetSeconds () - sk.GetSeconds ()) / 60;
+ double secondDelta = (t.GetSeconds () - sk_1.GetSeconds ()) / 60;
+ double delta = (sk.GetSeconds () - sk_1.GetSeconds ()) / 60;
+
+ double sum = 0.0;
+ for (int m = 1; m <= m_numOfTerms; m++)
+ {
+ double square = beta * beta * m * m;
+ sum += (exp (- square * (firstDelta)) - exp (- square * (secondDelta))) / square;
+ }
+ return delta + 2 * sum;
+}
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/contrib/energy/model/rv-battery-model.h Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,259 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Network Security Lab, University of Washington, Seattle.
+ *
+ * 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: Sidharth Nabar <snabar@uw.edu>, He Wu <mdzz@u.washington.edu>
+ */
+
+#ifndef RV_BATTERY_MODEL_H
+#define RV_BATTERY_MODEL_H
+
+#include "ns3/traced-value.h"
+#include "ns3/nstime.h"
+#include "ns3/event-id.h"
+#include "energy-source.h"
+
+namespace ns3 {
+
+/**
+ * \brief Rakhmatov Vrudhula non-linear battery model.
+ *
+ * This (energy source) model implements an analytical non-linear battery model.
+ * It is capable of capturing load capacity and recovery effects of batteries.
+ * Batteries are characterized by 2 parameters, alpha and beta, which can both
+ * be obtained from the discharge curve of the batteries.
+ *
+ * The model is developed by Daler Rakhmatov & Sarma Vrudhula in: "Battery
+ * Lifetime Prediction for Energy-Aware Computing" and "An Analytical High-Level
+ * Battery Model for Use in Energy Management of Portable Electronic Systems".
+ *
+ * The real-time algorithm is developed by Matthias Handy & Dirk Timmermann in:
+ * "Simulation of Mobile Wireless Networks with Accurate Modeling of non-linear
+ * battery effects". The real-time algorithm is modified by the authors of this
+ * code for improved accuracy and reduced computation (sampling) overhead.
+ */
+class RvBatteryModel : public EnergySource
+{
+public:
+ static TypeId GetTypeId (void);
+ RvBatteryModel ();
+ virtual ~RvBatteryModel ();
+
+ /**
+ * \return Initial energy stored (theoretical capacity) in the battery.
+ *
+ * Implements GetInitialEnergy.
+ */
+ virtual double GetInitialEnergy (void) const;
+
+ /**
+ * \returns Supply voltage at the energy source.
+ *
+ * Implements GetSupplyVoltage.
+ */
+ virtual double GetSupplyVoltage (void) const;
+
+ /**
+ * \return Remaining energy in energy source, in Joules
+ *
+ * Implements GetRemainingEnergy.
+ */
+ virtual double GetRemainingEnergy (void);
+
+ /**
+ * \returns Energy fraction.
+ *
+ * Implements GetEnergyFraction. For the RV battery model, energy fraction is
+ * equivalent to battery level.
+ */
+ virtual double GetEnergyFraction (void);
+
+ /**
+ * Implements UpdateEnergySource. This function samples the total load (total
+ * current) from all devices to discharge the battery.
+ */
+ virtual void UpdateEnergySource (void);
+
+ /**
+ * \param interval Energy update interval.
+ *
+ * This function sets the interval between each energy update.
+ */
+ void SetSamplingInterval (Time interval);
+
+ /**
+ * \returns The interval between each energy update.
+ */
+ Time GetSamplingInterval (void) const;
+
+ /**
+ * \brief Sets open circuit voltage of battery.
+ *
+ * \param voltage Open circuit voltage.
+ */
+ void SetOpenCircuitVoltage (double voltage);
+
+ /**
+ * \return Open circuit voltage of battery.
+ */
+ double GetOpenCircuitVoltage (void) const;
+
+ /**
+ * \brief Sets cutoff voltage of battery.
+ *
+ * \param voltage Cutoff voltage.
+ */
+ void SetCutoffVoltage (double voltage);
+
+ /**
+ * \returns Cutoff voltage of battery.
+ */
+ double GetCutoffVoltage (void) const;
+
+ /**
+ * \brief Sets the alpha value for the battery model.
+ *
+ * \param alpha Alpha.
+ */
+ void SetAlpha (double alpha);
+
+ /**
+ * \returns The alpha value used by the battery model.
+ */
+ double GetAlpha (void) const;
+
+ /**
+ * \brief Sets the beta value for the battery model.
+ *
+ * \param beta Beta.
+ */
+ void SetBeta (double beta);
+
+ /**
+ * \returns The beta value used by the battery model.
+ */
+ double GetBeta (void) const;
+
+ /**
+ * \returns Battery level [0, 1].
+ */
+ double GetBatteryLevel (void);
+
+ /**
+ * \returns Lifetime of the battery.
+ */
+ Time GetLifetime (void) const;
+
+ /**
+ * \brief Sets the number of terms of the infinite sum for estimating battery
+ * level.
+ *
+ * \param num Number of terms.
+ */
+ void SetNumOfTerms (int num);
+
+ /**
+ * \returns The number of terms of the infinite sum for estimating battery
+ * level.
+ */
+ int GetNumOfTerms (void) const;
+
+private:
+ /// Defined in ns3::Object
+ virtual void DoStart (void);
+
+ /// Defined in ns3::Object
+ virtual void DoDispose (void);
+
+ /**
+ * Handles the remaining energy going to zero event. This function notifies
+ * all the energy models aggregated to the node about the energy being
+ * depleted. Each energy model is then responsible for its own handler.
+ */
+ void HandleEnergyDrainedEvent (void);
+
+ /**
+ * \brief Discharges the battery.
+ *
+ * \param load Load value (total current form devices, in mA).
+ * \param t Time stamp of the load value.
+ * \returns Calculated alpha value.
+ *
+ * Discharge function calculates a value which is then compared to the alpha
+ * value to determine if the battery is dead. It will also update the battery
+ * level.
+ *
+ * Note that the load value passed to Discharge has to be in mA.
+ */
+ double Discharge (double load, Time t);
+
+ /**
+ * \brief RV model A function.
+ *
+ * \param t Current time.
+ * \param sk Time stamp in array position k
+ * \param sk_1 Time stamp in array position k-1
+ * \param beta Beta value used by the battery model.
+ * \returns Result of A function.
+ *
+ * This function computes alpha value using the recorded load profile.
+ */
+ double RvModelAFunction (Time t, Time sk, Time sk_1, double beta);
+
+private:
+ double m_openCircuitVoltage;
+ double m_cutoffVoltage;
+ double m_alpha; // alpha value of RV model, in Coulomb
+ double m_beta; // beta value of RV model, in second^-1
+
+ double m_previousLoad; // load value (total current) of previous sampling
+ std::vector<double> m_load; // load profile
+ std::vector<Time> m_timeStamps; // time stamps of load profile
+ Time m_lastSampleTime;
+ uint64_t m_counter;
+
+ int m_numOfTerms; // # of terms for infinite sum in battery level estimation
+
+ /**
+ * Battery level is defined as: output of Discharge function / alpha value
+ *
+ * The output of Discharge function is an estimated charge consumption of the
+ * battery.
+ *
+ * The alpha value is the amount of charges stored in the battery, or battery
+ * capacity (in Coulomb).
+ *
+ * When the battery is fully charged (no charge is consumed from the battery)
+ * the battery level is 1. When the battery is fully discharged, the battery
+ * level is 0.
+ *
+ * NOTE Note that the definition in Timmermann's paper is the inverse of this
+ * definition. In the paper, battery level = 1 when the battery is drained.
+ */
+ TracedValue<double> m_batteryLevel;
+
+ /**
+ * (1 / sampling interval) = sampling frequency
+ */
+ Time m_samplingInterval;
+ EventId m_currentSampleEvent;
+
+ TracedValue<Time> m_lifetime; // time of death of the battery
+};
+
+} // namespace ns3
+
+#endif /* RV_BATTERY_MODEL_H */
--- a/src/contrib/energy/model/wifi-radio-energy-model.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/contrib/energy/model/wifi-radio-energy-model.cc Tue Dec 21 17:46:35 2010 +0100
@@ -37,6 +37,18 @@
static TypeId tid = TypeId ("ns3::WifiRadioEnergyModel")
.SetParent<DeviceEnergyModel> ()
.AddConstructor<WifiRadioEnergyModel> ()
+ .AddAttribute ("IdleCurrentA",
+ "The default radio Idle current in Ampere.",
+ DoubleValue (0.000426), // idle mode = 426uA
+ MakeDoubleAccessor (&WifiRadioEnergyModel::SetIdleCurrentA,
+ &WifiRadioEnergyModel::GetIdleCurrentA),
+ MakeDoubleChecker<double> ())
+ .AddAttribute ("CcaBusyCurrentA",
+ "The default radio CCA Busy State current in Ampere.",
+ DoubleValue (0.000426), // default to be the same as idle mode
+ MakeDoubleAccessor (&WifiRadioEnergyModel::SetCcaBusyCurrentA,
+ &WifiRadioEnergyModel::GetCcaBusyCurrentA),
+ MakeDoubleChecker<double> ())
.AddAttribute ("TxCurrentA",
"The radio Tx current in Ampere.",
DoubleValue (0.0174), // transmit at 0dBm = 17.4mA
@@ -49,17 +61,11 @@
MakeDoubleAccessor (&WifiRadioEnergyModel::SetRxCurrentA,
&WifiRadioEnergyModel::GetRxCurrentA),
MakeDoubleChecker<double> ())
- .AddAttribute ("IdleCurrentA",
- "The default radio Idle current in Ampere.",
- DoubleValue (0.000426), // idle mode = 426uA
- MakeDoubleAccessor (&WifiRadioEnergyModel::SetIdleCurrentA,
- &WifiRadioEnergyModel::GetIdleCurrentA),
- MakeDoubleChecker<double> ())
- .AddAttribute ("SleepCurrentA",
- "The default radio Sleep current in Ampere.",
- DoubleValue (0.00002), // power down mode = 20uA
- MakeDoubleAccessor (&WifiRadioEnergyModel::SetSleepCurrentA,
- &WifiRadioEnergyModel::GetSleepCurrentA),
+ .AddAttribute ("SwitchingCurrentA",
+ "The default radio Channel Switch current in Ampere.",
+ DoubleValue (0.000426), // default to be the same as idle mode
+ MakeDoubleAccessor (&WifiRadioEnergyModel::SetSwitchingCurrentA,
+ &WifiRadioEnergyModel::GetSwitchingCurrentA),
MakeDoubleChecker<double> ())
.AddTraceSource ("TotalEnergyConsumption",
"Total energy consumption of the radio device.",
@@ -71,29 +77,18 @@
WifiRadioEnergyModel::WifiRadioEnergyModel ()
{
NS_LOG_FUNCTION (this);
- m_currentState = IDLE; // initially IDLE
+ m_currentState = WifiPhy::IDLE; // initially IDLE
m_lastUpdateTime = Seconds (0.0);
m_energyDepletionCallback.Nullify ();
- m_node = NULL;
m_source = NULL;
+ // set callback for WifiPhy listener
+ m_listener = new WifiRadioEnergyModelPhyListener;
+ m_listener->SetChangeStateCallback (MakeCallback (&DeviceEnergyModel::ChangeState, this));
}
WifiRadioEnergyModel::~WifiRadioEnergyModel ()
{
-}
-
-void
-WifiRadioEnergyModel::SetNode (Ptr<Node> node)
-{
- NS_LOG_FUNCTION (this << node);
- NS_ASSERT (node != NULL);
- m_node = node;
-}
-
-Ptr<Node>
-WifiRadioEnergyModel::GetNode (void) const
-{
- return m_node;
+ delete m_listener;
}
void
@@ -107,14 +102,38 @@
double
WifiRadioEnergyModel::GetTotalEnergyConsumption (void) const
{
- NS_LOG_FUNCTION (this);
return m_totalEnergyConsumption;
}
double
+WifiRadioEnergyModel::GetIdleCurrentA (void) const
+{
+ return m_idleCurrentA;
+}
+
+void
+WifiRadioEnergyModel::SetIdleCurrentA (double idleCurrentA)
+{
+ NS_LOG_FUNCTION (this << idleCurrentA);
+ m_idleCurrentA = idleCurrentA;
+}
+
+double
+WifiRadioEnergyModel::GetCcaBusyCurrentA (void) const
+{
+ return m_ccaBusyCurrentA;
+}
+
+void
+WifiRadioEnergyModel::SetCcaBusyCurrentA (double CcaBusyCurrentA)
+{
+ NS_LOG_FUNCTION (this << CcaBusyCurrentA);
+ m_ccaBusyCurrentA = CcaBusyCurrentA;
+}
+
+double
WifiRadioEnergyModel::GetTxCurrentA (void) const
{
- NS_LOG_FUNCTION (this);
return m_txCurrentA;
}
@@ -128,7 +147,6 @@
double
WifiRadioEnergyModel::GetRxCurrentA (void) const
{
- NS_LOG_FUNCTION (this);
return m_rxCurrentA;
}
@@ -140,37 +158,22 @@
}
double
-WifiRadioEnergyModel::GetIdleCurrentA (void) const
+WifiRadioEnergyModel::GetSwitchingCurrentA (void) const
{
- NS_LOG_FUNCTION (this);
- return m_idleCurrentA;
+ return m_switchingCurrentA;
}
void
-WifiRadioEnergyModel::SetIdleCurrentA (double idleCurrentA)
+WifiRadioEnergyModel::SetSwitchingCurrentA (double switchingCurrentA)
{
- NS_LOG_FUNCTION (this << idleCurrentA);
- m_idleCurrentA = idleCurrentA;
+ NS_LOG_FUNCTION (this << switchingCurrentA);
+ m_switchingCurrentA = switchingCurrentA;
}
-double
-WifiRadioEnergyModel::GetSleepCurrentA (void) const
-{
- NS_LOG_FUNCTION (this);
- return m_sleepCurrentA;
-}
-void
-WifiRadioEnergyModel::SetSleepCurrentA (double sleepCurrentA)
-{
- NS_LOG_FUNCTION (this << sleepCurrentA);
- m_sleepCurrentA = sleepCurrentA;
-}
-
-WifiRadioEnergyModel::WifiRadioState
+WifiPhy::State
WifiRadioEnergyModel::GetCurrentState (void) const
{
- NS_LOG_FUNCTION (this);
return m_currentState;
}
@@ -190,7 +193,6 @@
WifiRadioEnergyModel::ChangeState (int newState)
{
NS_LOG_FUNCTION (this << newState);
- NS_ASSERT (IsStateTransitionValid ((WifiRadioState) newState));
Time duration = Simulator::Now () - m_lastUpdateTime;
NS_ASSERT (duration.GetNanoSeconds () >= 0); // check if duration is valid
@@ -200,20 +202,23 @@
double supplyVoltage = m_source->GetSupplyVoltage ();
switch (m_currentState)
{
- case TX:
+ case WifiPhy::IDLE:
+ energyToDecrease = duration.GetSeconds () * m_idleCurrentA * supplyVoltage;
+ break;
+ case WifiPhy::CCA_BUSY:
+ energyToDecrease = duration.GetSeconds () * m_ccaBusyCurrentA * supplyVoltage;
+ break;
+ case WifiPhy::TX:
energyToDecrease = duration.GetSeconds () * m_txCurrentA * supplyVoltage;
break;
- case RX:
+ case WifiPhy::RX:
energyToDecrease = duration.GetSeconds () * m_rxCurrentA * supplyVoltage;
break;
- case IDLE:
- energyToDecrease = duration.GetSeconds () * m_idleCurrentA * supplyVoltage;
- break;
- case SLEEP:
- energyToDecrease = duration.GetSeconds () * m_sleepCurrentA * supplyVoltage;
+ case WifiPhy::SWITCHING:
+ energyToDecrease = duration.GetSeconds () * m_switchingCurrentA * supplyVoltage;
break;
default:
- NS_FATAL_ERROR ("WifiRadioEnergyModel:Undefined radio state!");
+ NS_FATAL_ERROR ("WifiRadioEnergyModel:Undefined radio state: " << m_currentState);
}
// update total energy consumption
@@ -226,19 +231,17 @@
m_source->UpdateEnergySource ();
// update current state & last update time stamp
- SetWifiRadioState ((WifiRadioState) newState);
+ SetWifiRadioState ((WifiPhy::State) newState);
// some debug message
- NS_LOG_DEBUG ("WifiRadioEnergyModel:Total energy consumption at node #"
- << m_node->GetId () << " is " << m_totalEnergyConsumption << "J");
+ NS_LOG_DEBUG ("WifiRadioEnergyModel:Total energy consumption is " <<
+ m_totalEnergyConsumption << "J");
}
void
WifiRadioEnergyModel::HandleEnergyDepletion (void)
{
- NS_LOG_FUNCTION (this);
- NS_LOG_DEBUG ("WifiRadioEnergyModel:Energy is depleted at node #" <<
- m_node->GetId ());
+ NS_LOG_DEBUG ("WifiRadioEnergyModel:Energy is depleted!");
// invoke energy depletion callback, if set.
if (!m_energyDepletionCallback.IsNull ())
{
@@ -246,6 +249,12 @@
}
}
+WifiRadioEnergyModelPhyListener *
+WifiRadioEnergyModel::GetPhyListener (void)
+{
+ return m_listener;
+}
+
/*
* Private functions start here.
*/
@@ -253,8 +262,6 @@
void
WifiRadioEnergyModel::DoDispose (void)
{
- NS_LOG_FUNCTION (this);
- m_node = NULL;
m_source = NULL;
m_energyDepletionCallback.Nullify ();
}
@@ -262,67 +269,151 @@
double
WifiRadioEnergyModel::DoGetCurrentA (void) const
{
- NS_LOG_FUNCTION (this);
switch (m_currentState)
{
- case TX:
+ case WifiPhy::IDLE:
+ return m_idleCurrentA;
+ case WifiPhy::CCA_BUSY:
+ return m_ccaBusyCurrentA;
+ case WifiPhy::TX:
return m_txCurrentA;
- case RX:
+ case WifiPhy::RX:
return m_rxCurrentA;
- case IDLE:
- return m_idleCurrentA;
- case SLEEP:
- return m_sleepCurrentA;
+ case WifiPhy::SWITCHING:
+ return m_switchingCurrentA;
default:
- NS_FATAL_ERROR ("WifiRadioEnergyModel:Undefined radio state!");
+ NS_FATAL_ERROR ("WifiRadioEnergyModel:Undefined radio state:" << m_currentState);
}
}
-bool
-WifiRadioEnergyModel::IsStateTransitionValid (const WifiRadioState destState)
+void
+WifiRadioEnergyModel::SetWifiRadioState (const WifiPhy::State state)
{
- NS_LOG_FUNCTION (this << destState);
+ NS_LOG_FUNCTION (this << state);
+ m_currentState = state;
+ std::string stateName;
+ switch (state)
+ {
+ case WifiPhy::IDLE:
+ stateName = "IDLE";
+ break;
+ case WifiPhy::CCA_BUSY:
+ stateName = "CCA_BUSY";
+ break;
+ case WifiPhy::TX:
+ stateName = "TX";
+ break;
+ case WifiPhy::RX:
+ stateName = "RX";
+ break;
+ case WifiPhy::SWITCHING:
+ stateName = "SWITCHING";
+ break;
+ }
+ NS_LOG_DEBUG ("WifiRadioEnergyModel:Switching to state: " << stateName <<
+ " at time = " << Simulator::Now ());
+}
- /*
- * This is a placeholder function to specify if some of the radio state
- * transitions are prohibited. For example, if transition TX -> RX is not
- * allowed, and must go through IDLE as TX -> IDLE -> RX, then this method
- * can be used to raise an ns3 error.
- */
+// -------------------------------------------------------------------------- //
+
+WifiRadioEnergyModelPhyListener::WifiRadioEnergyModelPhyListener ()
+{
+ m_changeStateCallback.Nullify ();
+}
- return true;
+WifiRadioEnergyModelPhyListener::~WifiRadioEnergyModelPhyListener ()
+{
+}
+
+void
+WifiRadioEnergyModelPhyListener::SetChangeStateCallback (DeviceEnergyModel::ChangeStateCallback callback)
+{
+ NS_ASSERT (!callback.IsNull ());
+ m_changeStateCallback = callback;
}
void
-WifiRadioEnergyModel::SetWifiRadioState (const WifiRadioState state)
+WifiRadioEnergyModelPhyListener::NotifyRxStart (Time duration)
+{
+ if (m_changeStateCallback.IsNull ())
+ {
+ NS_FATAL_ERROR ("WifiRadioEnergyModelPhyListener:Change state callback not set!");
+ }
+ m_changeStateCallback (WifiPhy::RX);
+ m_switchToIdleEvent.Cancel ();
+}
+
+void
+WifiRadioEnergyModelPhyListener::NotifyRxEndOk (void)
{
- NS_LOG_FUNCTION (this);
- if (IsStateTransitionValid (state))
+ if (m_changeStateCallback.IsNull ())
+ {
+ NS_FATAL_ERROR ("WifiRadioEnergyModelPhyListener:Change state callback not set!");
+ }
+ m_changeStateCallback (WifiPhy::IDLE);
+}
+
+void
+WifiRadioEnergyModelPhyListener::NotifyRxEndError (void)
+{
+ if (m_changeStateCallback.IsNull ())
+ {
+ NS_FATAL_ERROR ("WifiRadioEnergyModelPhyListener:Change state callback not set!");
+ }
+ m_changeStateCallback (WifiPhy::IDLE);
+}
+
+void
+WifiRadioEnergyModelPhyListener::NotifyTxStart (Time duration)
+{
+ if (m_changeStateCallback.IsNull ())
{
- m_currentState = state;
- std::string stateName;
- switch (state)
- {
- case TX:
- stateName = "TX";
- break;
- case RX:
- stateName = "RX";
- break;
- case IDLE:
- stateName = "IDLE";
- break;
- case SLEEP:
- stateName = "SLEEP";
- break;
- }
- NS_LOG_DEBUG ("WifiRadioEnergyModel:Switching to state: " << stateName <<
- " at time = " << Simulator::Now ());
+ NS_FATAL_ERROR ("WifiRadioEnergyModelPhyListener:Change state callback not set!");
+ }
+ m_changeStateCallback (WifiPhy::TX);
+ // schedule changing state back to IDLE after TX duration
+ m_switchToIdleEvent.Cancel ();
+ m_switchToIdleEvent = Simulator::Schedule (duration, &WifiRadioEnergyModelPhyListener::SwitchToIdle, this);
+}
+
+void
+WifiRadioEnergyModelPhyListener::NotifyMaybeCcaBusyStart (Time duration)
+{
+ if (m_changeStateCallback.IsNull ())
+ {
+ NS_FATAL_ERROR ("WifiRadioEnergyModelPhyListener:Change state callback not set!");
}
- else
+ m_changeStateCallback (WifiPhy::CCA_BUSY);
+ // schedule changing state back to IDLE after CCA_BUSY duration
+ m_switchToIdleEvent.Cancel ();
+ m_switchToIdleEvent = Simulator::Schedule (duration, &WifiRadioEnergyModelPhyListener::SwitchToIdle, this);
+}
+
+void
+WifiRadioEnergyModelPhyListener::NotifySwitchingStart (Time duration)
+{
+ if (m_changeStateCallback.IsNull ())
{
- NS_FATAL_ERROR ("WifiRadioEnergyModel:Invalid state transition!");
+ NS_FATAL_ERROR ("WifiRadioEnergyModelPhyListener:Change state callback not set!");
}
+ m_changeStateCallback (WifiPhy::SWITCHING);
+ // schedule changing state back to IDLE after CCA_BUSY duration
+ m_switchToIdleEvent.Cancel ();
+ m_switchToIdleEvent = Simulator::Schedule (duration, &WifiRadioEnergyModelPhyListener::SwitchToIdle, this);
+}
+
+/*
+ * Private function state here.
+ */
+
+void
+WifiRadioEnergyModelPhyListener::SwitchToIdle (void)
+{
+ if (m_changeStateCallback.IsNull ())
+ {
+ NS_FATAL_ERROR ("WifiRadioEnergyModelPhyListener:Change state callback not set!");
+ }
+ m_changeStateCallback (WifiPhy::IDLE);
}
} // namespace ns3
--- a/src/contrib/energy/model/wifi-radio-energy-model.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/contrib/energy/model/wifi-radio-energy-model.h Tue Dec 21 17:46:35 2010 +0100
@@ -25,10 +25,99 @@
#include "ns3/nstime.h"
#include "ns3/event-id.h"
#include "ns3/traced-value.h"
+#include "ns3/wifi-phy.h"
namespace ns3 {
/**
+ * A WifiPhy listener class for notifying the WifiRadioEnergyModel of Wifi radio
+ * state change.
+ */
+class WifiRadioEnergyModelPhyListener : public WifiPhyListener
+{
+public:
+ WifiRadioEnergyModelPhyListener ();
+ virtual ~WifiRadioEnergyModelPhyListener ();
+
+ /**
+ * \brief Sets the change state callback. Used by helper class.
+ *
+ * \param callback Change state callback.
+ */
+ void SetChangeStateCallback (DeviceEnergyModel::ChangeStateCallback callback);
+
+ /**
+ * \brief Switches the WifiRadioEnergyModel to RX state.
+ *
+ * \param duration the expected duration of the packet reception.
+ *
+ * Defined in ns3::WifiPhyListener
+ */
+ virtual void NotifyRxStart (Time duration);
+
+ /**
+ * \brief Switches the WifiRadioEnergyModel back to IDLE state.
+ *
+ * Defined in ns3::WifiPhyListener
+ *
+ * Note that for the WifiRadioEnergyModel, the behavior of the function is the
+ * same as NotifyRxEndError.
+ */
+ virtual void NotifyRxEndOk (void);
+
+ /**
+ * \brief Switches the WifiRadioEnergyModel back to IDLE state.
+ *
+ * Defined in ns3::WifiPhyListener
+ *
+ * Note that for the WifiRadioEnergyModel, the behavior of the function is the
+ * same as NotifyRxEndOk.
+ */
+ virtual void NotifyRxEndError (void);
+
+ /**
+ * \brief Switches the WifiRadioEnergyModel to TX state and switches back to
+ * IDLE after TX duration.
+ *
+ * \param duration the expected transmission duration.
+ *
+ * Defined in ns3::WifiPhyListener
+ */
+ virtual void NotifyTxStart (Time duration);
+
+ /**
+ * \param duration the expected busy duration.
+ *
+ * Defined in ns3::WifiPhyListener
+ */
+ virtual void NotifyMaybeCcaBusyStart (Time duration);
+
+ /**
+ * \param duration the expected channel switching duration.
+ *
+ * Defined in ns3::WifiPhyListener
+ */
+ virtual void NotifySwitchingStart (Time duration);
+
+private:
+ /**
+ * A helper function that makes scheduling m_changeStateCallback possible.
+ */
+ void SwitchToIdle (void);
+
+private:
+ /**
+ * Change state callback used to notify the WifiRadioEnergyModel of a state
+ * change.
+ */
+ DeviceEnergyModel::ChangeStateCallback m_changeStateCallback;
+
+ EventId m_switchToIdleEvent;
+};
+
+// -------------------------------------------------------------------------- //
+
+/**
* \brief A WiFi radio energy model.
*
* 4 states are defined for the radio: TX, RX, IDLE, SLEEP. Default state is
@@ -54,29 +143,6 @@
{
public:
/**
- * Wifi radio states.
- */
- enum WifiRadioState
- {
- /**
- * Radio is transmitting.
- */
- TX = 0,
- /**
- * Radio is receiving.
- */
- RX,
- /**
- * Radio is idling.
- */
- IDLE,
- /**
- * Radio is asleep.
- */
- SLEEP
- };
-
- /**
* Callback type for energy depletion handling.
*/
typedef Callback<void> WifiRadioEnergyDepletionCallback;
@@ -87,24 +153,6 @@
virtual ~WifiRadioEnergyModel ();
/**
- * \brief Sets pointer to node.
- *
- * \param node Pointer to node.
- *
- * Implements DeviceEnergyModel::SetNode.
- */
- virtual void SetNode (Ptr<Node> node);
-
- /**
- * \brief Gets pointer to node.
- *
- * \returns Pointer to node.
- *
- * Implements DeviceEnergyModel::GetNode.
- */
- virtual Ptr<Node> GetNode (void) const;
-
- /**
* \brief Sets pointer to EnergySouce installed on node.
*
* \param source Pointer to EnergySource installed on node.
@@ -121,19 +169,21 @@
virtual double GetTotalEnergyConsumption (void) const;
// Setter & getters for state power consumption.
+ double GetIdleCurrentA (void) const;
+ void SetIdleCurrentA (double idleCurrentA);
+ double GetCcaBusyCurrentA (void) const;
+ void SetCcaBusyCurrentA (double ccaBusyCurrentA);
double GetTxCurrentA (void) const;
void SetTxCurrentA (double txCurrentA);
double GetRxCurrentA (void) const;
void SetRxCurrentA (double rxCurrentA);
- double GetIdleCurrentA (void) const;
- void SetIdleCurrentA (double idleCurrentA);
- double GetSleepCurrentA (void) const;
- void SetSleepCurrentA (double sleepCurrentA);
+ double GetSwitchingCurrentA (void) const;
+ void SetSwitchingCurrentA (double switchingCurrentA);
/**
* \returns Current state.
*/
- WifiRadioState GetCurrentState (void) const;
+ WifiPhy::State GetCurrentState (void) const;
/**
* \param callback Callback function.
@@ -158,6 +208,11 @@
*/
virtual void HandleEnergyDepletion (void);
+ /**
+ * \returns Pointer to the PHY listener.
+ */
+ WifiRadioEnergyModelPhyListener * GetPhyListener (void);
+
private:
void DoDispose (void);
@@ -170,40 +225,35 @@
virtual double DoGetCurrentA (void) const;
/**
- * \param destState Radio state to switch to.
- * \return True if the transition is allowed.
- *
- * This function checks if a given radio state transition is allowed.
- */
- bool IsStateTransitionValid (const WifiRadioState destState);
-
- /**
* \param currentState New state the radio device is currently in.
*
* Sets current state. This function is private so that only the energy model
* can change its own state.
*/
- void SetWifiRadioState (const WifiRadioState state);
+ void SetWifiRadioState (const WifiPhy::State state);
private:
- Ptr<Node> m_node;
Ptr<EnergySource> m_source;
// Member variables for current draw in different radio modes.
double m_txCurrentA;
double m_rxCurrentA;
double m_idleCurrentA;
- double m_sleepCurrentA;
+ double m_ccaBusyCurrentA;
+ double m_switchingCurrentA;
// This variable keeps track of the total energy consumed by this model.
TracedValue<double> m_totalEnergyConsumption;
// State variables.
- WifiRadioState m_currentState; // current state the radio is in
+ WifiPhy::State m_currentState; // current state the radio is in
Time m_lastUpdateTime; // time stamp of previous energy update
- // energy depletion callback
+ // Energy depletion callback
WifiRadioEnergyDepletionCallback m_energyDepletionCallback;
+
+ // WifiPhy listener
+ WifiRadioEnergyModelPhyListener *m_listener;
};
} // namespace ns3
--- a/src/contrib/energy/test/basic-energy-model-test.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/contrib/energy/test/basic-energy-model-test.cc Tue Dec 21 17:46:35 2010 +0100
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Authors: He Wu <mdzz@u.washington.edu>
+ * Author: He Wu <mdzz@u.washington.edu>
*/
#include "ns3/basic-energy-source.h"
@@ -59,7 +59,7 @@
* Runs simulation for a while, check if final state & remaining energy is
* correctly updated.
*/
- bool StateSwitchTest (WifiRadioEnergyModel::WifiRadioState state);
+ bool StateSwitchTest (WifiPhy::State state);
private:
double m_timeS; // in seconds
@@ -88,19 +88,23 @@
m_deviceEnergyModel.SetTypeId ("ns3::WifiRadioEnergyModel");
// run state switch tests
- if (StateSwitchTest (WifiRadioEnergyModel::TX))
+ if (StateSwitchTest (WifiPhy::IDLE))
+ {
+ return true;
+ }
+ if (StateSwitchTest (WifiPhy::CCA_BUSY))
{
return true;
}
- if (StateSwitchTest (WifiRadioEnergyModel::RX))
+ if (StateSwitchTest (WifiPhy::TX))
{
return true;
}
- if (StateSwitchTest (WifiRadioEnergyModel::IDLE))
+ if (StateSwitchTest (WifiPhy::RX))
{
return true;
}
- if (StateSwitchTest (WifiRadioEnergyModel::SLEEP))
+ if (StateSwitchTest (WifiPhy::SWITCHING))
{
return true;
}
@@ -110,8 +114,7 @@
}
bool
-BasicEnergyUpdateTest::StateSwitchTest (
- WifiRadioEnergyModel::WifiRadioState state)
+BasicEnergyUpdateTest::StateSwitchTest (WifiPhy::State state)
{
// create node
Ptr<Node> node = CreateObject<Node> ();
@@ -120,8 +123,6 @@
Ptr<BasicEnergySource> source = m_energySource.Create<BasicEnergySource> ();
// aggregate energy source to node
node->AggregateObject (source);
- // set update interval in source
- source->SetEnergyUpdateInterval (Seconds (1.0));
// create device energy model
Ptr<WifiRadioEnergyModel> model =
@@ -176,17 +177,20 @@
double current = 0.0;
switch (state)
{
- case WifiRadioEnergyModel::TX:
+ case WifiPhy::IDLE:
+ current = devModel->GetIdleCurrentA ();
+ break;
+ case WifiPhy::CCA_BUSY:
+ current = devModel->GetCcaBusyCurrentA ();
+ break;
+ case WifiPhy::TX:
current = devModel->GetTxCurrentA ();
break;
- case WifiRadioEnergyModel::RX:
+ case WifiPhy::RX:
current = devModel->GetRxCurrentA ();
break;
- case WifiRadioEnergyModel::IDLE:
- current = devModel->GetIdleCurrentA ();
- break;
- case WifiRadioEnergyModel::SLEEP:
- current = devModel->GetSleepCurrentA ();
+ case WifiPhy::SWITCHING:
+ current = devModel->GetSwitchingCurrentA ();
break;
default:
NS_FATAL_ERROR ("Undefined radio state: " << state);
@@ -204,7 +208,7 @@
"Incorrect remaining energy!");
// obtain radio state
- WifiRadioEnergyModel::WifiRadioState endState = devModel->GetCurrentState ();
+ WifiPhy::State endState = devModel->GetCurrentState ();
NS_LOG_UNCOND ("Radio state is " << endState);
// check end state
NS_TEST_ASSERT_MSG_EQ (endState, state, "Incorrect end state!");
@@ -362,8 +366,7 @@
MakeCallback (&BasicEnergyDepletionTest::DepletionHandler, this);
radioEnergyHelper.SetDepletionCallback (callback);
// install on node
- DeviceEnergyModelContainer deviceModels = radioEnergyHelper.Install (devices,
- sources);
+ DeviceEnergyModelContainer deviceModels = radioEnergyHelper.Install (devices, sources);
// run simulation
Simulator::Stop (Seconds (simTimeS));
@@ -376,8 +379,7 @@
NS_LOG_UNCOND ("Actual callback count is " << m_callbackCount);
// check result, call back should only be invoked once
- NS_TEST_ASSERT_MSG_EQ (m_numOfNodes, m_callbackCount,
- "Not all callbacks are invoked!");
+ NS_TEST_ASSERT_MSG_EQ (m_numOfNodes, m_callbackCount, "Not all callbacks are invoked!");
return false;
}
@@ -399,7 +401,7 @@
: TestSuite ("basic-energy-model", UNIT)
{
AddTestCase (new BasicEnergyUpdateTest);
- //AddTestCase (new BasicEnergyDepletionTest);
+ AddTestCase (new BasicEnergyDepletionTest);
}
// create an instance of the test suite
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/contrib/energy/test/rv-battery-model-test.cc Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,906 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Network Security Lab, University of Washington, Seattle.
+ *
+ * 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: He Wu <mdzz@u.washington.edu>
+ */
+
+#include "ns3/rv-battery-model.h"
+#include "ns3/wifi-radio-energy-model.h"
+#include "ns3/rv-battery-model-helper.h"
+#include "ns3/wifi-radio-energy-model-helper.h"
+#include "ns3/energy-source-container.h"
+#include "ns3/device-energy-model-container.h"
+#include "ns3/log.h"
+#include "ns3/test.h"
+#include "ns3/node.h"
+#include "ns3/simulator.h"
+#include "ns3/double.h"
+#include "ns3/config.h"
+#include "ns3/string.h"
+#include "ns3/yans-wifi-helper.h"
+#include "ns3/nqos-wifi-mac-helper.h"
+#include <math.h>
+
+using namespace ns3;
+
+NS_LOG_COMPONENT_DEFINE ("RvBatteryModelTestSuite");
+
+/**
+ * Test case of update remaining energy for RvBatteryModel and
+ * WifiRadioEnergyModel.
+ */
+class BatteryLifetimeTest : public TestCase
+{
+public:
+ BatteryLifetimeTest ();
+ virtual ~BatteryLifetimeTest ();
+
+private:
+ /**
+ * Creates load profiles according to "Battery Lifetime Prediction for Energy-
+ * Aware Computing" paper.
+ */
+ void CreateLoadProfiles (void);
+
+ /**
+ * \returns False if no error occurs.
+ *
+ * Runs test.
+ */
+ bool DoRun (void);
+
+ /**
+ * \param load Load value, in Amperes (A).
+ * \param expLifetime Expected lifetime.
+ * \return False if no error occurs.
+ *
+ * Runs simulation with constant load and checks the battery lifetime with
+ * known results.
+ */
+ bool ConstantLoadTest (double load, Time expLifetime);
+
+ /**
+ * \param loads Load profile.
+ * \param timeStamps Time stamps.
+ * \param expLifeTime Expected lifetime.
+ * \returns False if no error occurs.
+ *
+ * Runs simulation with variable load and checks the battery lifetime with
+ * known results.
+ */
+ bool VariableLoadTest (std::vector<double> loads,
+ std::vector<Time> timeStamps,
+ Time expLifetime);
+
+private:
+ typedef struct LoadProfile
+ {
+ std::vector<double> loads;
+ std::vector<Time> timeStamps;
+ Time itsyLifetime;
+ Time dualFoilLifeTime;
+ } LoadProfile;
+
+private:
+ std::vector<LoadProfile> m_loadProfiles;
+ double m_alpha;
+ double m_beta;
+};
+
+BatteryLifetimeTest::BatteryLifetimeTest ()
+ : TestCase ("RV battery model battery lifetime test case.")
+{
+ // Itsy battery
+ m_alpha = 35220;
+ m_beta = 0.637;
+}
+
+BatteryLifetimeTest::~BatteryLifetimeTest ()
+{
+}
+
+void
+BatteryLifetimeTest::CreateLoadProfiles (void)
+{
+ // create set of load profiles
+ LoadProfile profile;
+
+ std::vector<double> loads;
+ std::vector<Time> timeStamps;
+
+ // C1
+ loads.push_back (0.628);
+ loads.push_back (0);
+ loads.push_back (0.628);
+
+ timeStamps.push_back (Seconds (0));
+ timeStamps.push_back (Seconds (19.5 * 60));
+ timeStamps.push_back (Seconds (26.0 * 60));
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (55.0 * 60); // 55.0 minutes
+ profile.dualFoilLifeTime = Seconds (36.2 * 60); // 36.2 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+
+ // C2
+ loads.push_back (0.4947);
+ loads.push_back (0);
+ loads.push_back (0.4947);
+
+ timeStamps.push_back (Seconds (0));
+ timeStamps.push_back (Seconds (31.0 * 60));
+ timeStamps.push_back (Seconds (41.3 * 60));
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (73.9 * 60); // 73.9 minutes
+ profile.dualFoilLifeTime = Seconds (55.8 * 60); // 55.8 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+
+ // C3
+ loads.push_back (0.4256);
+ loads.push_back (0);
+ loads.push_back (0.4256);
+
+ timeStamps.push_back (Seconds (0));
+ timeStamps.push_back (Seconds (41.0 * 60));
+ timeStamps.push_back (Seconds (54.6 * 60));
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (88.8 * 60); // 88.8 minutes
+ profile.dualFoilLifeTime = Seconds (71.8 * 60); // 71.8 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+
+ // C4
+ loads.push_back (0.2923);
+ loads.push_back (0);
+ loads.push_back (0.2923);
+
+ timeStamps.push_back (Seconds (0));
+ timeStamps.push_back (Seconds (74.6 * 60));
+ timeStamps.push_back (Seconds (99.5 * 60));
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (137.8 * 60); // 137.8 minutes
+ profile.dualFoilLifeTime = Seconds (124.9 * 60); // 124.9 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+
+ // C5
+ loads.push_back (0.2227);
+ loads.push_back (0);
+ loads.push_back (0.2227);
+
+ timeStamps.push_back (Seconds (0));
+ timeStamps.push_back (Seconds (105.7 * 60));
+ timeStamps.push_back (Seconds (140.9 * 60));
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (185.8 * 60); // 185.8 minutes
+ profile.dualFoilLifeTime = Seconds (176.7 * 60); // 176.7 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+
+ // C6
+ loads.push_back (0.628);
+ loads.push_back (0);
+ loads.push_back (0.628);
+
+ timeStamps.push_back (Seconds (0));
+ timeStamps.push_back (Seconds (19.5 * 60));
+ timeStamps.push_back (Seconds (29.9 * 60));
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (58.9 * 60); // 58.9 minutes
+ profile.dualFoilLifeTime = Seconds (41.0 * 60); // 41.0 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+
+ // C7
+ loads.push_back (0.628);
+ loads.push_back (0);
+ loads.push_back (0.628);
+
+ timeStamps.push_back (Seconds (0));
+ timeStamps.push_back (Seconds (19.5 * 60));
+ timeStamps.push_back (Seconds (22.1 * 60));
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (51.1 * 60); // 51.1 minutes
+ profile.dualFoilLifeTime = Seconds (30.8 * 60); // 30.8 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+
+ // C8
+ loads.push_back (0.628);
+ loads.push_back (0);
+ loads.push_back (0.628);
+
+ timeStamps.push_back (Seconds (0));
+ timeStamps.push_back (Seconds (23.4 * 60));
+ timeStamps.push_back (Seconds (29.9 * 60));
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (55.0 * 60); // 55.0 minutes
+ profile.dualFoilLifeTime = Seconds (37.4 * 60); // 37.4 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+
+ // C9
+ loads.push_back (0.628);
+ loads.push_back (0);
+ loads.push_back (0.628);
+
+ timeStamps.push_back (Seconds (0));
+ timeStamps.push_back (Seconds (15.6 * 60));
+ timeStamps.push_back (Seconds (22.1 * 60));
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (55.0 * 60); // 55.0 minutes
+ profile.dualFoilLifeTime = Seconds (35.2 * 60); // 35.2 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+
+ // C10
+ loads.push_back (0.300);
+ loads.push_back (0.628);
+ loads.push_back (0.4947);
+ loads.push_back (0.2523);
+ loads.push_back (0.2341);
+ loads.push_back (0.1379);
+ loads.push_back (0.1139);
+ loads.push_back (0.2656);
+
+ timeStamps.push_back (Seconds (0));
+ timeStamps.push_back (Seconds (0.5 * 60));
+ timeStamps.push_back (Seconds (5.5 * 60));
+ timeStamps.push_back (Seconds (10.5 * 60));
+ timeStamps.push_back (Seconds (35.5 * 60));
+ timeStamps.push_back (Seconds (60.5 * 60));
+ timeStamps.push_back (Seconds (85.5 * 60));
+ timeStamps.push_back (Seconds (110.5 * 60));
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (144.3 * 60); // 144.3 minutes
+ profile.dualFoilLifeTime = Seconds (132.6 * 60); // 132.6 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+
+ // C11
+ loads.push_back (0.300);
+ loads.push_back (0.1139);
+ loads.push_back (0.1379);
+ loads.push_back (0.2341);
+ loads.push_back (0.2523);
+ loads.push_back (0.4947);
+ loads.push_back (0.628);
+ loads.push_back (0.2656);
+
+ timeStamps.push_back (Seconds (0));
+ timeStamps.push_back (Seconds (0.5 * 60));
+ timeStamps.push_back (Seconds (25.5 * 60));
+ timeStamps.push_back (Seconds (50.5 * 60));
+ timeStamps.push_back (Seconds (75.5 * 60));
+ timeStamps.push_back (Seconds (100.5 * 60));
+ timeStamps.push_back (Seconds (105.5 * 60));
+ timeStamps.push_back (Seconds (110.5 * 60));
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (144.3 * 60); // 144.3 minutes
+ profile.dualFoilLifeTime = Seconds (107.4 * 60); // 107.4 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+
+ // C12
+ loads.push_back (0.300);
+ loads.push_back (0.1139);
+ loads.push_back (0.1379);
+ loads.push_back (0.2341);
+ loads.push_back (0.2523);
+ loads.push_back (0.4947);
+ loads.push_back (0.0);
+ loads.push_back (0.300);
+ loads.push_back (0.628);
+ loads.push_back (0.2656);
+
+ timeStamps.push_back (Seconds (0));
+ timeStamps.push_back (Seconds (0.5 * 60));
+ timeStamps.push_back (Seconds (25.5 * 60));
+ timeStamps.push_back (Seconds (50.5 * 60));
+ timeStamps.push_back (Seconds (75.5 * 60));
+ timeStamps.push_back (Seconds (100.5 * 60));
+ timeStamps.push_back (Seconds (105.5 * 60));
+ timeStamps.push_back (Seconds (130.5 * 60));
+ timeStamps.push_back (Seconds (131.0 * 60));
+ timeStamps.push_back (Seconds (136.0 * 60));
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (169.3 * 60); // 169.3 minutes
+ profile.dualFoilLifeTime = Seconds (155.4 * 60); // 155.4 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+
+ // C13
+ loads.push_back (0.300);
+ timeStamps.push_back (Seconds (0));
+
+ for (int i = 0; i < 5; i++)
+ {
+ loads.push_back (0.628);
+ loads.push_back (0.4947);
+ loads.push_back (0.2523);
+ loads.push_back (0.2341);
+ loads.push_back (0.1379);
+ loads.push_back (0.1139);
+
+ timeStamps.push_back (Seconds ((0.5 + i * 22.5) * 60));
+ timeStamps.push_back (Seconds ((1.5 + i * 22.5) * 60));
+ timeStamps.push_back (Seconds ((2.5 + i * 22.5) * 60));
+ timeStamps.push_back (Seconds ((7.5 + i * 22.5) * 60));
+ timeStamps.push_back (Seconds ((12.5 + i * 22.5) * 60));
+ timeStamps.push_back (Seconds ((17.5 + i * 22.5) * 60));
+ }
+
+ loads.push_back (0.2656);
+ timeStamps.push_back (Seconds (110.5 * 60));
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (144.3 * 60); // 144.3 minutes
+ profile.dualFoilLifeTime = Seconds (131.7 * 60); // 131.7 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+
+ // C14, time stamp calculation in paper is off, using our own estimated value
+ loads.push_back (0.300);
+ timeStamps.push_back (Seconds (0));
+
+ for (int i = 0; i < 5; i++)
+ {
+ loads.push_back (0.1139);
+ loads.push_back (0.1379);
+ loads.push_back (0.2341);
+ loads.push_back (0.2523);
+ loads.push_back (0.4947);
+ loads.push_back (0.628);
+
+ timeStamps.push_back (Seconds ((0.5 + i * 22.5) * 60));
+ timeStamps.push_back (Seconds ((5.5 + i * 22.5) * 60));
+ timeStamps.push_back (Seconds ((10.5 + i * 22.5) * 60));
+ timeStamps.push_back (Seconds ((15.5 + i * 22.5) * 60));
+ timeStamps.push_back (Seconds ((20.5 + i * 22.5) * 60));
+ timeStamps.push_back (Seconds ((21.5 + i * 22.5) * 60));
+ }
+
+ loads.push_back (0.2656);
+ timeStamps.push_back (Seconds (112.5 * 60));
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (141.5 * 60); // 141.5 minutes
+ profile.dualFoilLifeTime = Seconds (126.3 * 60); // 126.3 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+
+ // C15
+ loads.push_back (0.2227);
+ loads.push_back (0.2045);
+ loads.push_back (0.1083);
+ loads.push_back (0.0843);
+ loads.push_back (0.2227);
+
+ timeStamps.push_back (Seconds (0));
+ timeStamps.push_back (Seconds (50.0 * 60));
+ timeStamps.push_back (Seconds (100.0 * 60));
+ timeStamps.push_back (Seconds (150.0 * 60));
+ timeStamps.push_back (Seconds (200.0 * 60));
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (211.4 * 60); // 211.4 minutes
+ profile.dualFoilLifeTime = Seconds (209.2 * 60); // 209.2 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+
+ // C16
+ loads.push_back (0.0843);
+ loads.push_back (0.1083);
+ loads.push_back (0.2045);
+ loads.push_back (0.2227);
+ loads.push_back (0.2227);
+
+ timeStamps.push_back (Seconds (0));
+ timeStamps.push_back (Seconds (50.0 * 60));
+ timeStamps.push_back (Seconds (100.0 * 60));
+ timeStamps.push_back (Seconds (150.0 * 60));
+ timeStamps.push_back (Seconds (200.0 * 60));
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (211.4 * 60); // 211.4 minutes
+ profile.dualFoilLifeTime = Seconds (200.7 * 60); // 200.7 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+
+ // C17
+ loads.push_back (0.0843);
+ loads.push_back (0.1083);
+ loads.push_back (0.2045);
+ loads.push_back (0.0);
+ loads.push_back (0.2227);
+ loads.push_back (0.2227);
+
+ timeStamps.push_back (Seconds (0));
+ timeStamps.push_back (Seconds (50.0 * 60));
+ timeStamps.push_back (Seconds (100.0 * 60));
+ timeStamps.push_back (Seconds (150.0 * 60));
+ timeStamps.push_back (Seconds (200.0 * 60));
+ timeStamps.push_back (Seconds (250.0 * 60));
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (261.4 * 60); // 261.4 minutes
+ profile.dualFoilLifeTime = Seconds (251.2 * 60); // 251.2 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+
+ // C18
+ for (int i = 0; i < 10; i++)
+ {
+ loads.push_back (0.0843);
+ loads.push_back (0.1083);
+ loads.push_back (0.2045);
+ loads.push_back (0.2227);
+
+ timeStamps.push_back (Seconds ((0.0 + i * 20.0) * 60));
+ timeStamps.push_back (Seconds ((5.0 + i * 20.0) * 60));
+ timeStamps.push_back (Seconds ((10.0 + i * 20.0) * 60));
+ timeStamps.push_back (Seconds ((15.0 + i * 20.0) * 60));
+ }
+
+ loads.push_back (0.2227);
+ timeStamps.push_back (Seconds (200.0));
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (211.4 * 60); // 211.4 minutes
+ profile.dualFoilLifeTime = Seconds (204.6 * 60); // 204.6 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+
+ // C19
+ for (int i = 0; i < 10; i++)
+ {
+ loads.push_back (0.0755);
+ loads.push_back (0.0949);
+ loads.push_back (0.2045);
+ loads.push_back (0.2227);
+
+ timeStamps.push_back (Seconds ((0.0 + i * 20.0) * 60));
+ timeStamps.push_back (Seconds ((5.0 + i * 20.0) * 60));
+ timeStamps.push_back (Seconds ((10.0 + i * 20.0) * 60));
+ timeStamps.push_back (Seconds ((15.0 + i * 20.0) * 60));
+ }
+
+ loads.push_back (0.2227);
+ timeStamps.push_back (Seconds (200.0));
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (216.4 * 60); // 216.4 minutes
+ profile.dualFoilLifeTime = Seconds (208.7 * 60); // 208.7 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+
+ // C20
+ for (int i = 0; i < 50; i++)
+ {
+ loads.push_back (0.4947);
+ loads.push_back (0.628);
+
+ timeStamps.push_back (Seconds ((0.0 + i * 2.0) * 60));
+ timeStamps.push_back (Seconds ((1.0 + i * 2.0) * 60));
+ }
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (55.3 * 60); // 55.3 minutes
+ profile.dualFoilLifeTime = Seconds (33.2 * 60); // 33.2 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+
+ // C21
+ for (int i = 0; i < 50; i++)
+ {
+ loads.push_back (0.4947);
+ loads.push_back (0.628);
+ loads.push_back (0.0576);
+
+ timeStamps.push_back (Seconds ((0.0 + i * 3.0) * 60));
+ timeStamps.push_back (Seconds ((1.0 + i * 3.0) * 60));
+ timeStamps.push_back (Seconds ((2.0 + i * 3.0) * 60));
+ }
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (79.6 * 60); // 79.6 minutes
+ profile.dualFoilLifeTime = Seconds (55.9 * 60); // 55.9 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+
+ // C22
+ for (int i = 0; i < 150; i++)
+ {
+ loads.push_back (0.005 + 0.005 * i);
+ timeStamps.push_back (Seconds ((0.0 + i * 1.0) * 60));
+ }
+
+ profile.loads = loads;
+ profile.timeStamps = timeStamps;
+ profile.itsyLifetime = Seconds (112.2 * 60); // 112.2 minutes
+ profile.dualFoilLifeTime = Seconds (94.5 * 60); // 94.5 minutes
+
+ m_loadProfiles.push_back (profile);
+
+ loads.clear ();
+ timeStamps.clear ();
+}
+
+bool
+BatteryLifetimeTest::DoRun (void)
+{
+ NS_LOG_UNCOND ("Constant load run.");
+ // 640mA
+ if (ConstantLoadTest (0.640, Seconds (2844.0)))
+ {
+ return true;
+ }
+ // 320mA
+ if (ConstantLoadTest (0.320, Seconds (6146.0)))
+ {
+ return true;
+ }
+ // 128mA
+ if (ConstantLoadTest (0.128, Seconds (16052.0)))
+ {
+ return true;
+ }
+ // 64mA
+ if (ConstantLoadTest (0.064, Seconds (32561.0)))
+ {
+ return true;
+ }
+ // 32mA
+ if (ConstantLoadTest (0.032, Seconds (65580.0)))
+ {
+ return true;
+ }
+
+ // create load profiles for variable load test
+ CreateLoadProfiles ();
+
+ // variable load with Itsy battery
+ NS_LOG_UNCOND ("\n\nItsy");
+ m_alpha = 35220;
+ m_beta = 0.637;
+ for (uint32_t i = 0; i < m_loadProfiles.size (); i++)
+ {
+ NS_LOG_UNCOND ("========");
+ NS_LOG_UNCOND ("Variable load profile C" << i + 1);
+ if (VariableLoadTest (m_loadProfiles[i].loads,
+ m_loadProfiles[i].timeStamps,
+ m_loadProfiles[i].itsyLifetime))
+ {
+ return false;
+ }
+ }
+
+ // variable load with DUALFOIL battery
+ NS_LOG_UNCOND ("\n\nDUALFOIL");
+ m_alpha = 40027;
+ m_beta = 0.276;
+ for (uint32_t i = 0; i < m_loadProfiles.size (); i++)
+ {
+ NS_LOG_UNCOND ("========");
+ NS_LOG_UNCOND ("Variable load profile C" << i + 1);
+ if (VariableLoadTest (m_loadProfiles[i].loads,
+ m_loadProfiles[i].timeStamps,
+ m_loadProfiles[i].dualFoilLifeTime))
+ {
+ return false;
+ }
+ }
+
+ return false; // error free
+}
+
+bool
+BatteryLifetimeTest::ConstantLoadTest (double load, Time expLifetime)
+{
+ // create single node
+ NodeContainer c;
+ c.Create (1);
+
+ std::string phyMode ("DsssRate1Mbps");
+
+ // disable fragmentation for frames below 2200 bytes
+ Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold",
+ StringValue ("2200"));
+ // turn off RTS/CTS for frames below 2200 bytes
+ Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold",
+ StringValue ("2200"));
+ // Fix non-unicast data rate to be the same as that of unicast
+ Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode",
+ StringValue (phyMode));
+
+ // install YansWifiPhy
+ WifiHelper wifi;
+ wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
+
+ YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
+ /*
+ * This is one parameter that matters when using FixedRssLossModel, set it to
+ * zero; otherwise, gain will be added.
+ */
+ wifiPhy.Set ("RxGain", DoubleValue (0));
+ // ns-3 supports RadioTap and Prism tracing extensions for 802.11b
+ wifiPhy.SetPcapDataLinkType (YansWifiPhyHelper::DLT_IEEE802_11_RADIO);
+
+ YansWifiChannelHelper wifiChannel ;
+ wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
+ wifiPhy.SetChannel (wifiChannel.Create ());
+
+ // Add a non-QoS upper MAC, and disable rate control
+ NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
+ wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
+ "DataMode", StringValue(phyMode),
+ "ControlMode", StringValue(phyMode));
+ // Set it to ad-hoc mode
+ wifiMac.SetType ("ns3::AdhocWifiMac");
+ NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c);
+
+ // Create and install battery model and device models
+ // RV battery model
+ RvBatteryModelHelper rvModelHelper;
+ // Set alpha & beta values
+ rvModelHelper.Set ("RvBatteryModelAlphaValue", DoubleValue (m_alpha));
+ rvModelHelper.Set ("RvBatteryModelBetaValue", DoubleValue (m_beta));
+ // install source
+ EnergySourceContainer sources = rvModelHelper.Install (c);
+ // device energy model
+ WifiRadioEnergyModelHelper radioEnergyHelper;
+ // set VariableLoadTestIDLE current, which will be the constant load
+ radioEnergyHelper.Set ("IdleCurrentA", DoubleValue (load));
+ // install on node
+ DeviceEnergyModelContainer deviceModels = radioEnergyHelper.Install (devices, sources);
+
+ // run simulation
+ Simulator::Stop (Seconds (70000.0));
+ Simulator::Run ();
+
+ Time actualLifetime;
+ Ptr<RvBatteryModel> srcPtr = DynamicCast<RvBatteryModel> (sources.Get (0));
+ actualLifetime = srcPtr->GetLifetime ();
+
+ NS_LOG_UNCOND ("Expected lifetime = " << expLifetime.GetSeconds () << "s");
+ NS_LOG_UNCOND ("Actual lifetime = " << actualLifetime.GetSeconds () << "s");
+
+ NS_TEST_ASSERT_MSG_EQ (actualLifetime, expLifetime, "Incorrect lifetime!");
+ /*
+ NS_TEST_ASSERT_MSG_EQ_TOL (actualLifetime.GetSeconds () / 60,
+ expLifetime.GetSeconds () / 60, 0.1,
+ "Incorrect lifetime!");
+ */
+
+ Simulator::Destroy ();
+
+ return false; // error free
+}
+
+bool
+BatteryLifetimeTest::VariableLoadTest (std::vector<double> loads,
+ std::vector<Time> timeStamps,
+ Time expLifetime)
+{
+ NS_ASSERT (loads.size () == timeStamps.size ());
+
+ // create single node
+ NodeContainer c;
+ c.Create (1);
+
+ std::string phyMode ("DsssRate1Mbps");
+
+ // disable fragmentation for frames below 2200 bytes
+ Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold",
+ StringValue ("2200"));
+ // turn off RTS/CTS for frames below 2200 bytes
+ Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold",
+ StringValue ("2200"));
+ // Fix non-unicast data rate to be the same as that of unicast
+ Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode",
+ StringValue (phyMode));
+
+ // install YansWifiPhy
+ WifiHelper wifi;
+ wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
+
+ YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
+ /*
+ * This is one parameter that matters when using FixedRssLossModel, set it to
+ * zero; otherwise, gain will be added.
+ */
+ wifiPhy.Set ("RxGain", DoubleValue (0));
+ // ns-3 supports RadioTap and Prism tracing extensions for 802.11b
+ wifiPhy.SetPcapDataLinkType (YansWifiPhyHelper::DLT_IEEE802_11_RADIO);
+
+ YansWifiChannelHelper wifiChannel ;
+ wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
+ wifiPhy.SetChannel (wifiChannel.Create ());
+
+ // Add a non-QoS upper MAC, and disable rate control
+ NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
+ wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
+ "DataMode", StringValue(phyMode),
+ "ControlMode", StringValue(phyMode));
+ // Set it to ad-hoc mode
+ wifiMac.SetType ("ns3::AdhocWifiMac");
+ NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c);
+
+ // Create and install battery model and device models
+ // RV battery model
+ RvBatteryModelHelper rvModelHelper;
+ // Set alpha & beta values
+ rvModelHelper.Set ("RvBatteryModelAlphaValue", DoubleValue (m_alpha));
+ rvModelHelper.Set ("RvBatteryModelBetaValue", DoubleValue (m_beta));
+ // install source
+ EnergySourceContainer sources = rvModelHelper.Install (c);
+ // device energy model
+ WifiRadioEnergyModelHelper radioEnergyHelper;
+ // set VariableLoadTestIDLE current, which will be the constant load
+ radioEnergyHelper.Set ("IdleCurrentA", DoubleValue (loads[0]));
+ // install on node
+ DeviceEnergyModelContainer deviceModels = radioEnergyHelper.Install (devices, sources);
+
+
+ Ptr<WifiRadioEnergyModel> wifiDevicePtr = DynamicCast<WifiRadioEnergyModel> (deviceModels.Get (0));
+ // schedule load change events
+ for (uint32_t i = 1; i < loads.size (); i++)
+ {
+ Simulator::Schedule (timeStamps[i], &WifiRadioEnergyModel::SetIdleCurrentA,
+ wifiDevicePtr, loads[i]);
+ }
+
+ // run simulation
+ Simulator::Stop (Seconds (70000.0));
+ Simulator::Run ();
+
+ Time actualLifetime;
+ Ptr<RvBatteryModel> srcPtr = DynamicCast<RvBatteryModel> (sources.Get (0));
+ actualLifetime = srcPtr->GetLifetime ();
+
+ NS_LOG_UNCOND ("Expected lifetime = " << expLifetime.GetSeconds () << "s");
+ NS_LOG_UNCOND ("Actual lifetime = " << actualLifetime.GetSeconds () << "s");
+ NS_LOG_UNCOND ("Difference = " << expLifetime.GetSeconds () - actualLifetime.GetSeconds () << "s");
+
+ //NS_TEST_ASSERT_MSG_EQ (actualLifetime, expLifetime, "Incorrect lifetime!");
+ NS_TEST_ASSERT_MSG_EQ_TOL (actualLifetime.GetSeconds (), expLifetime.GetSeconds (),
+ 120, // error tolerance = 120s
+ "Incorrect lifetime!");
+
+ Simulator::Destroy ();
+
+ return false; // error free
+}
+
+// -------------------------------------------------------------------------- //
+
+/**
+ * Unit test suite for energy model. Although the test suite involves 2 modules
+ * it is still considered a unit test. Because a DeviceEnergyModel cannot live
+ * without an EnergySource.
+ */
+class RvBatteryModelTestSuite : public TestSuite
+{
+public:
+ RvBatteryModelTestSuite ();
+};
+
+RvBatteryModelTestSuite::RvBatteryModelTestSuite ()
+ : TestSuite ("rv-battery-model", SYSTEM)
+{
+ AddTestCase (new BatteryLifetimeTest);
+}
+
+// create an instance of the test suite
+RvBatteryModelTestSuite g_rvBatteryModelTestSuite;
--- a/src/contrib/energy/wscript Tue Dec 21 17:39:54 2010 +0100
+++ b/src/contrib/energy/wscript Tue Dec 21 17:46:35 2010 +0100
@@ -6,13 +6,16 @@
'model/wifi-radio-energy-model.cc',
'model/energy-source.cc',
'model/basic-energy-source.cc',
+ 'model/rv-battery-model.cc',
'model/device-energy-model.cc',
'model/device-energy-model-container.cc',
'helper/energy-source-container.cc',
'helper/energy-model-helper.cc',
'helper/basic-energy-source-helper.cc',
'helper/wifi-radio-energy-model-helper.cc',
+ 'helper/rv-battery-model-helper.cc',
'test/basic-energy-model-test.cc',
+ 'test/rv-battery-model-test.cc',
]
headers = bld.new_task_gen('ns3header')
headers.module = 'energy'
@@ -20,10 +23,12 @@
'model/wifi-radio-energy-model.h',
'model/energy-source.h',
'model/basic-energy-source.h',
+ 'model/rv-battery-model.h',
'model/device-energy-model.h',
'model/device-energy-model-container.h',
'helper/energy-source-container.h',
'helper/energy-model-helper.h',
'helper/basic-energy-source-helper.h',
'helper/wifi-radio-energy-model-helper.h',
+ 'helper/rv-battery-model-helper.h',
]
--- a/src/contrib/flow-monitor/examples/wifi-olsr-flowmon.py Tue Dec 21 17:39:54 2010 +0100
+++ b/src/contrib/flow-monitor/examples/wifi-olsr-flowmon.py Tue Dec 21 17:46:35 2010 +0100
@@ -44,7 +44,8 @@
wifiPhy.SetChannel(wifiChannel.Create())
ssid = ns3.Ssid("wifi-default")
wifi.SetRemoteStationManager("ns3::ArfWifiManager")
- wifiMac.SetType ("ns3::AdhocWifiMac", "Ssid", ns3.SsidValue(ssid))
+ wifiMac.SetType ("ns3::AdhocWifiMac",
+ "Ssid", ns3.SsidValue(ssid))
internet = ns3.InternetStackHelper()
list_routing = ns3.Ipv4ListRoutingHelper()
--- a/src/devices/mesh/dot11s/airtime-metric.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/devices/mesh/dot11s/airtime-metric.cc Tue Dec 21 17:46:35 2010 +0100
@@ -32,26 +32,26 @@
.AddConstructor<AirtimeLinkMetricCalculator> ()
.AddAttribute ( "TestLength",
"Rate should be estimated using test length.",
- UintegerValue (1024),
- MakeUintegerAccessor (
- &AirtimeLinkMetricCalculator::SetTestLength),
- MakeUintegerChecker<uint16_t> (1)
- )
+ UintegerValue (1024),
+ MakeUintegerAccessor (
+ &AirtimeLinkMetricCalculator::SetTestLength),
+ MakeUintegerChecker<uint16_t> (1)
+ )
.AddAttribute ( "Dot11MetricTid",
"TID used to calculate metric (data rate)",
UintegerValue (0),
MakeUintegerAccessor (
- &AirtimeLinkMetricCalculator::SetHeaderTid),
+ &AirtimeLinkMetricCalculator::SetHeaderTid),
MakeUintegerChecker<uint8_t> (0)
- )
+ )
.AddAttribute ( "Dot11sMeshHeaderLength",
"Length of the mesh header",
UintegerValue (6),
MakeUintegerAccessor (
- &AirtimeLinkMetricCalculator::m_meshHeaderLength),
+ &AirtimeLinkMetricCalculator::m_meshHeaderLength),
MakeUintegerChecker<uint16_t> (0)
- )
- ;
+ )
+ ;
return tid;
}
AirtimeLinkMetricCalculator::AirtimeLinkMetricCalculator () :
@@ -69,7 +69,7 @@
void
AirtimeLinkMetricCalculator::SetTestLength (uint16_t testLength)
{
- m_testFrame = Create<Packet> (testLength + 6 /*Mesh header*/ + 36/*802.11 header*/);
+ m_testFrame = Create<Packet> (testLength + 6 /*Mesh header*/ + 36 /*802.11 header*/);
}
uint32_t
AirtimeLinkMetricCalculator::CalculateMetric (Mac48Address peerAddress, Ptr<MeshWifiInterfaceMac> mac)
@@ -86,15 +86,15 @@
*/
NS_ASSERT (!peerAddress.IsGroup ());
//obtain current rate:
- WifiMode mode = mac->GetStationManager ()->GetDataMode (peerAddress, &m_testHeader, m_testFrame, m_testFrame->GetSize ());
+ WifiMode mode = mac->GetWifiRemoteStationManager ()->GetDataMode (peerAddress, &m_testHeader, m_testFrame, m_testFrame->GetSize ());
//obtain frame error rate:
- double failAvg = mac->GetStationManager ()->GetInfo (peerAddress).GetFrameErrorRate ();
+ double failAvg = mac->GetWifiRemoteStationManager ()->GetInfo (peerAddress).GetFrameErrorRate ();
NS_ASSERT (failAvg < 1.0);
//calculate metric
- uint32_t metric = (uint32_t)((double)(/*Overhead + payload*/
- mac->GetPifs () + mac->GetSlot () + mac->GetEifsNoDifs () + //DIFS + SIFS + AckTxTime = PIFS + SLOT + EifsNoDifs
- mac->GetWifiPhy () ->CalculateTxDuration (m_testFrame->GetSize (), mode, WIFI_PREAMBLE_LONG)
- ).GetMicroSeconds () / (10.24 * (1.0 - failAvg)));
+ uint32_t metric = (uint32_t)((double)( /*Overhead + payload*/
+ mac->GetPifs () + mac->GetSlot () + mac->GetEifsNoDifs () + //DIFS + SIFS + AckTxTime = PIFS + SLOT + EifsNoDifs
+ mac->GetWifiPhy ()->CalculateTxDuration (m_testFrame->GetSize (), mode, WIFI_PREAMBLE_LONG)
+ ).GetMicroSeconds () / (10.24 * (1.0 - failAvg)));
return metric;
}
} //namespace dot11s
Binary file src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-0-1.pcap has changed
Binary file src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-1-1.pcap has changed
Binary file src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-2-1.pcap has changed
Binary file src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-3-1.pcap has changed
Binary file src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-4-1.pcap has changed
Binary file src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-0-1.pcap has changed
Binary file src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-1-1.pcap has changed
Binary file src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-2-1.pcap has changed
Binary file src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-3-1.pcap has changed
Binary file src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-4-1.pcap has changed
Binary file src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-5-1.pcap has changed
Binary file src/devices/mesh/dot11s/test/hwmp-simplest-regression-test-0-1.pcap has changed
Binary file src/devices/mesh/dot11s/test/hwmp-simplest-regression-test-1-1.pcap has changed
Binary file src/devices/mesh/dot11s/test/hwmp-target-flags-regression-test-0-1.pcap has changed
Binary file src/devices/mesh/dot11s/test/hwmp-target-flags-regression-test-1-1.pcap has changed
Binary file src/devices/mesh/dot11s/test/hwmp-target-flags-regression-test-2-1.pcap has changed
Binary file src/devices/mesh/dot11s/test/hwmp-target-flags-regression-test-3-1.pcap has changed
--- a/src/devices/mesh/mesh-wifi-interface-mac.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/devices/mesh/mesh-wifi-interface-mac.cc Tue Dec 21 17:46:35 2010 +0100
@@ -45,41 +45,31 @@
MeshWifiInterfaceMac::GetTypeId ()
{
static TypeId tid = TypeId ("ns3::MeshWifiInterfaceMac")
- .SetParent<WifiMac> ()
- .AddConstructor<MeshWifiInterfaceMac> ()
- .AddAttribute ( "BeaconInterval",
- "Beacon Interval",
- TimeValue (Seconds (0.5)),
+ .SetParent<RegularWifiMac> ()
+ .AddConstructor<MeshWifiInterfaceMac> ()
+ .AddAttribute ( "BeaconInterval",
+ "Beacon Interval",
+ TimeValue (Seconds (0.5)),
- MakeTimeAccessor (
+ MakeTimeAccessor (
&MeshWifiInterfaceMac::m_beaconInterval),
- MakeTimeChecker ()
- )
- .AddAttribute ( "RandomStart",
- "Window when beacon generating starts (uniform random) in seconds",
- TimeValue (Seconds (0.5)),
- MakeTimeAccessor (
+ MakeTimeChecker ()
+ )
+ .AddAttribute ( "RandomStart",
+ "Window when beacon generating starts (uniform random) in seconds",
+ TimeValue (Seconds (0.5)),
+ MakeTimeAccessor (
&MeshWifiInterfaceMac::m_randomStart),
- MakeTimeChecker ()
- )
- .AddAttribute ( "BeaconGeneration",
- "Enable/Disable Beaconing.",
- BooleanValue (true),
- MakeBooleanAccessor (
+ MakeTimeChecker ()
+ )
+ .AddAttribute ( "BeaconGeneration",
+ "Enable/Disable Beaconing.",
+ BooleanValue (true),
+ MakeBooleanAccessor (
&MeshWifiInterfaceMac::SetBeaconGeneration, &MeshWifiInterfaceMac::GetBeaconGeneration),
- MakeBooleanChecker ()
- )
- .AddTraceSource ( "TxOkHeader",
- "The header of successfully transmitted packet",
- MakeTraceSourceAccessor (
- &MeshWifiInterfaceMac::m_txOkCallback)
- )
- .AddTraceSource ( "TxErrHeader",
- "The header of unsuccessfully transmitted packet",
- MakeTraceSourceAccessor (
- &MeshWifiInterfaceMac::m_txErrCallback)
- )
- ;
+ MakeBooleanChecker ()
+ )
+ ;
return tid;
}
MeshWifiInterfaceMac::MeshWifiInterfaceMac () :
@@ -87,136 +77,17 @@
{
NS_LOG_FUNCTION (this);
- m_rxMiddle = new MacRxMiddle ();
- m_rxMiddle->SetForwardCallback (MakeCallback (&MeshWifiInterfaceMac::Receive, this));
-
- m_low = CreateObject<MacLow> ();
- m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle));
-
- m_dcfManager = new DcfManager ();
- m_dcfManager->SetupLowListener (m_low);
-
- m_beaconDca = CreateObject<DcaTxop> ();
- m_beaconDca->SetLow (m_low);
- m_beaconDca->SetMinCw (0);
- m_beaconDca->SetMaxCw (0);
- m_beaconDca->SetAifsn (1);
- m_beaconDca->SetManager (m_dcfManager);
-
- // Construct the EDCAFs. The ordering is important - highest
- // priority (see Table 9-1 in IEEE 802.11-2007) must be created
- // first.
- SetQueue (AC_VO);
- SetQueue (AC_VI);
- SetQueue (AC_BE);
- SetQueue (AC_BK);
+ // Let the lower layers know that we are acting as a mesh node
+ SetTypeOfStation (MESH);
}
MeshWifiInterfaceMac::~MeshWifiInterfaceMac ()
{
NS_LOG_FUNCTION (this);
- m_beaconDca = 0;
- m_stationManager = 0;
- m_phy = 0;
- m_low = 0;
}
//-----------------------------------------------------------------------------
// WifiMac inherited
//-----------------------------------------------------------------------------
void
-MeshWifiInterfaceMac::SetSlot (Time slotTime)
-{
- NS_LOG_FUNCTION (this << slotTime);
- m_dcfManager->SetSlot (slotTime);
- m_low->SetSlotTime (slotTime);
- m_slot = slotTime;
-}
-void
-MeshWifiInterfaceMac::SetSifs (Time sifs)
-{
- NS_LOG_FUNCTION (this << sifs);
- m_dcfManager->SetSifs (sifs);
- m_low->SetSifs (sifs);
- m_sifs = sifs;
-}
-void
-MeshWifiInterfaceMac::SetAckTimeout (Time ackTimeout)
-{
- m_low->SetAckTimeout (ackTimeout);
-}
-void
-MeshWifiInterfaceMac::SetCtsTimeout (Time ctsTimeout)
-{
- m_low->SetCtsTimeout (ctsTimeout);
-}
-void
-MeshWifiInterfaceMac::SetPifs (Time pifs)
-{
- NS_LOG_FUNCTION (this << pifs);
- m_pifs = pifs;
-}
-void
-MeshWifiInterfaceMac::SetEifsNoDifs (Time eifsNoDifs)
-{
- NS_LOG_FUNCTION (this << eifsNoDifs);
- m_dcfManager->SetEifsNoDifs (eifsNoDifs);
- m_eifsNoDifs = eifsNoDifs;
-}
-Time
-MeshWifiInterfaceMac::GetSlot () const
-{
- return m_slot;
-}
-Time
-MeshWifiInterfaceMac::GetSifs () const
-{
- return m_sifs;
-}
-Time
-MeshWifiInterfaceMac::GetEifsNoDifs () const
-{
- return m_eifsNoDifs;
-}
-Time
-MeshWifiInterfaceMac::GetAckTimeout () const
-{
- return m_low->GetAckTimeout ();
-}
-Time
-MeshWifiInterfaceMac::GetCtsTimeout () const
-{
- return m_low->GetCtsTimeout ();
-}
-Time
-MeshWifiInterfaceMac::GetPifs () const
-{
- return m_low->GetPifs ();
-}
-void
-MeshWifiInterfaceMac::SetWifiPhy (Ptr<WifiPhy> phy)
-{
- NS_LOG_FUNCTION (this << phy);
- m_phy = phy;
- m_dcfManager->SetupPhyListener (phy);
- m_low->SetPhy (phy);
-}
-Ptr<WifiPhy>
-MeshWifiInterfaceMac::GetWifiPhy () const
-{
- return m_phy;
-}
-void
-MeshWifiInterfaceMac::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager)
-{
- NS_LOG_FUNCTION (this << stationManager);
- m_stationManager = stationManager;
- for (Queues::const_iterator i = m_queues.begin (); i != m_queues.end (); i++)
- {
- i->second->SetWifiRemoteStationManager (stationManager);
- }
- m_beaconDca->SetWifiRemoteStationManager (stationManager);
- m_low->SetWifiRemoteStationManager (stationManager);
-}
-void
MeshWifiInterfaceMac::Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from)
{
NS_LOG_FUNCTION (this << packet << to << from);
@@ -234,72 +105,24 @@
return true;
}
void
-MeshWifiInterfaceMac::SetForwardUpCallback (
- Callback<void, Ptr<Packet> , Mac48Address, Mac48Address> upCallback)
-{
- NS_LOG_FUNCTION (this);
- m_upCallback = upCallback;
-}
-void
MeshWifiInterfaceMac::SetLinkUpCallback (Callback<void> linkUp)
{
NS_LOG_FUNCTION (this);
- if (!linkUp.IsNull ())
- {
- linkUp ();
- }
-}
-void
-MeshWifiInterfaceMac::SetLinkDownCallback (Callback<void> linkDown)
-{
- NS_LOG_FUNCTION (this);
-}
-Mac48Address
-MeshWifiInterfaceMac::GetAddress () const
-{
- return m_address;
-}
-Mac48Address
-MeshWifiInterfaceMac::GetBssid () const
-{
- return m_address;
-}
-Ssid
-MeshWifiInterfaceMac::GetSsid () const
-{
- return m_meshId;
-}
-void
-MeshWifiInterfaceMac::SetAddress (Mac48Address address)
-{
- NS_LOG_FUNCTION (address);
- m_low->SetAddress (address);
- m_address = address;
-}
-void
-MeshWifiInterfaceMac::SetSsid (Ssid ssid)
-{
- NS_LOG_FUNCTION (ssid);
- m_meshId = ssid;
+ RegularWifiMac::SetLinkUpCallback (linkUp);
+
+ // The approach taken here is that, from the point of view of a mesh
+ // node, the link is always up, so we immediately invoke the
+ // callback if one is set
+ linkUp ();
}
void
MeshWifiInterfaceMac::DoDispose ()
{
NS_LOG_FUNCTION (this);
- delete m_rxMiddle;
- delete m_dcfManager;
- //Delete smart pointers:
- m_rxMiddle = 0;
- m_low = 0;
- m_dcfManager = 0;
- m_stationManager = 0;
- m_phy = 0;
- m_queues.clear ();
m_plugins.clear ();
m_beaconSendEvent.Cancel ();
- m_beaconDca = 0;
- WifiMac::DoDispose ();
+ RegularWifiMac::DoDispose ();
}
//-----------------------------------------------------------------------------
// Plugins
@@ -353,16 +176,9 @@
m_dcfManager->NotifyNavResetNow (Seconds (0));
}
//-----------------------------------------------------------------------------
-// Forward frame up/down
+// Forward frame down
//-----------------------------------------------------------------------------
void
-MeshWifiInterfaceMac::ForwardUp (Ptr<Packet> packet, Mac48Address src, Mac48Address dst)
-{
- NS_LOG_FUNCTION (this << packet << src);
- m_upCallback (packet, src, dst);
-}
-
-void
MeshWifiInterfaceMac::ForwardDown (Ptr<const Packet> const_packet, Mac48Address from, Mac48Address to)
{
// copy packet to allow modifications
@@ -418,8 +234,8 @@
}
m_stats.sentFrames++;
m_stats.sentBytes += packet->GetSize ();
- NS_ASSERT (m_queues.find (ac) != m_queues.end ());
- m_queues[ac]->Queue (packet, hdr);
+ NS_ASSERT (m_edca.find (ac) != m_edca.end ());
+ m_edca[ac]->Queue (packet, hdr);
}
void
MeshWifiInterfaceMac::SendManagementFrame (Ptr<Packet> packet, const WifiMacHeader& hdr)
@@ -436,7 +252,7 @@
}
m_stats.sentFrames++;
m_stats.sentBytes += packet->GetSize ();
- if ((m_queues.find (AC_VO) == m_queues.end ()) || (m_queues.find (AC_BK) == m_queues.end ()))
+ if ((m_edca.find (AC_VO) == m_edca.end ()) || (m_edca.find (AC_BK) == m_edca.end ()))
{
NS_FATAL_ERROR ("Voice or Background queue is not set up!");
}
@@ -450,11 +266,11 @@
*/
if (hdr.GetAddr1 () != Mac48Address::GetBroadcast ())
{
- m_queues[AC_VO]->Queue (packet, header);
+ m_edca[AC_VO]->Queue (packet, header);
}
else
{
- m_queues[AC_BK]->Queue (packet, header);
+ m_edca[AC_BK]->Queue (packet, header);
}
}
SupportedRates
@@ -548,7 +364,7 @@
// Shift scheduled event
Simulator::Cancel (m_beaconSendEvent);
m_beaconSendEvent = Simulator::Schedule (GetTbtt () - Simulator::Now (), &MeshWifiInterfaceMac::SendBeacon,
- this);
+ this);
}
void
MeshWifiInterfaceMac::ScheduleNextBeacon ()
@@ -573,7 +389,7 @@
{
(*i)->UpdateBeacon (beacon);
}
- m_beaconDca->Queue (beacon.CreatePacket (), beacon.CreateHeader (GetAddress (), GetMeshPointAddress ()));
+ m_dca->Queue (beacon.CreatePacket (), beacon.CreateHeader (GetAddress (), GetMeshPointAddress ()));
ScheduleNextBeacon ();
}
@@ -594,7 +410,7 @@
packet->PeekHeader (beacon_hdr);
NS_LOG_DEBUG ("Beacon received from " << hdr->GetAddr2 () << " I am " << GetAddress () << " at "
- << Simulator::Now ().GetMicroSeconds () << " microseconds");
+ << Simulator::Now ().GetMicroSeconds () << " microseconds");
// update supported rates
if (beacon_hdr.GetSsid ().IsEqual (GetSsid ()))
@@ -639,6 +455,10 @@
{
ForwardUp (packet, hdr->GetAddr4 (), hdr->GetAddr3 ());
}
+
+ // We don't bother invoking RegularWifiMac::Receive() here, because
+ // we've explicitly handled all the frames we care about. This is in
+ // contrast to most classes which derive from RegularWifiMac.
}
uint32_t
MeshWifiInterfaceMac::GetLinkMetric (Mac48Address peerAddress)
@@ -655,11 +475,6 @@
{
m_linkMetricCallback = cb;
}
-Ptr<WifiRemoteStationManager>
-MeshWifiInterfaceMac::GetStationManager ()
-{
- return m_stationManager;
-}
void
MeshWifiInterfaceMac::SetMeshPointAddress (Mac48Address a)
{
@@ -680,19 +495,19 @@
{
os << "<Statistics "
// TODO txBeacons
- "rxBeacons=\"" << recvBeacons << "\" "
- "txFrames=\"" << sentFrames << "\" "
- "txBytes=\"" << sentBytes << "\" "
- "rxFrames=\"" << recvFrames << "\" "
- "rxBytes=\"" << recvBytes << "\"/>" << std::endl;
+ "rxBeacons=\"" << recvBeacons << "\" "
+ "txFrames=\"" << sentFrames << "\" "
+ "txBytes=\"" << sentBytes << "\" "
+ "rxFrames=\"" << recvFrames << "\" "
+ "rxBytes=\"" << recvBytes << "\"/>" << std::endl;
}
void
MeshWifiInterfaceMac::Report (std::ostream & os) const
{
os << "<Interface "
- "BeaconInterval=\"" << GetBeaconInterval ().GetSeconds () << "\" "
- "Channel=\"" << GetFrequencyChannel () << "\" "
- "Address = \"" << GetAddress () << "\">" << std::endl;
+ "BeaconInterval=\"" << GetBeaconInterval ().GetSeconds () << "\" "
+ "Channel=\"" << GetFrequencyChannel () << "\" "
+ "Address = \"" << GetAddress () << "\">" << std::endl;
m_stats.Print (os);
os << "</Interface>" << std::endl;
}
@@ -701,71 +516,19 @@
{
m_stats = Statistics ();
}
+
void
-MeshWifiInterfaceMac::SetQueue (AcIndex ac)
-{
- if (m_queues.find (ac) != m_queues.end ())
- {
- NS_LOG_WARN ("Queue is already set!");
- return;
- }
- Ptr<DcaTxop> queue = Create<DcaTxop> ();
- queue->SetLow (m_low);
- queue->SetManager (m_dcfManager);
- queue->SetTxOkCallback (MakeCallback (&MeshWifiInterfaceMac::TxOk, this));
- queue->SetTxFailedCallback (MakeCallback (&MeshWifiInterfaceMac::TxFailed, this));
-
- m_queues.insert (std::make_pair (ac, queue));
-}
-void
-MeshWifiInterfaceMac::TxOk (WifiMacHeader const &hdr)
-{
- m_txOkCallback (hdr);
-}
-void
-MeshWifiInterfaceMac::TxFailed (WifiMacHeader const &hdr)
-{
- m_txErrCallback (hdr);
-}
-void
-MeshWifiInterfaceMac::DoStart ()
-{
- m_beaconDca->Start ();
- for (Queues::iterator i = m_queues.begin (); i != m_queues.end (); i ++)
- {
- i->second->Start ();
- }
- WifiMac::DoStart ();
-}
-
-void
MeshWifiInterfaceMac::FinishConfigureStandard (enum WifiPhyStandard standard)
{
- switch (standard)
- {
- case WIFI_PHY_STANDARD_holland:
- // fall through
- case WIFI_PHY_STANDARD_80211a:
- // fall through
- case WIFI_PHY_STANDARD_80211_10Mhz:
- // fall through
- case WIFI_PHY_STANDARD_80211_5Mhz:
- ConfigureDcf (m_queues[AC_BK], 15, 1023, AC_BK);
- ConfigureDcf (m_queues[AC_BE], 15, 1023, AC_BE);
- ConfigureDcf (m_queues[AC_VI], 15, 1023, AC_VI);
- ConfigureDcf (m_queues[AC_VO], 15, 1023, AC_VO);
- break;
- case WIFI_PHY_STANDARD_80211b:
- ConfigureDcf (m_queues[AC_BK], 31, 1023, AC_BK);
- ConfigureDcf (m_queues[AC_BE], 31, 1023, AC_BE);
- ConfigureDcf (m_queues[AC_VI], 31, 1023, AC_VI);
- ConfigureDcf (m_queues[AC_VO], 31, 1023, AC_VO);
- break;
- default:
- NS_ASSERT (false);
- break;
- }
+ RegularWifiMac::FinishConfigureStandard (standard);
m_standard = standard;
+
+ // We use the single DCF provided by WifiMac for the purpose of
+ // Beacon transmission. For this we need to reconfigure the channel
+ // access parameters slightly, and do so here.
+ m_dca->SetMinCw (0);
+ m_dca->SetMaxCw (0);
+ m_dca->SetAifsn (1);
}
WifiPhyStandard
MeshWifiInterfaceMac::GetPhyStandard () const
--- a/src/devices/mesh/mesh-wifi-interface-mac.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/devices/mesh/mesh-wifi-interface-mac.h Tue Dec 21 17:46:35 2010 +0100
@@ -30,7 +30,7 @@
#include "ns3/packet.h"
#include "ns3/nstime.h"
#include "ns3/wifi-remote-station-manager.h"
-#include "ns3/wifi-mac.h"
+#include "ns3/regular-wifi-mac.h"
#include "ns3/mesh-wifi-interface-mac-plugin.h"
#include "ns3/event-id.h"
#include "qos-utils.h"
@@ -38,10 +38,6 @@
class WifiMacHeader;
class DcaTxop;
-class WifiPhy;
-class DcfManager;
-class MacRxMiddle;
-class MacLow;
/**
* \ingroup mesh
*
@@ -53,7 +49,7 @@
* - management and priority traffic.
*
*/
-class MeshWifiInterfaceMac : public WifiMac
+class MeshWifiInterfaceMac : public RegularWifiMac
{
public:
/// Never forget to support typeid
@@ -65,34 +61,11 @@
///\name Inherited from WifiMac
//\{
- virtual void SetSlot (Time slotTime);
- virtual void SetSifs (Time sifs);
- virtual void SetPifs (Time pifs);
- virtual void SetCtsTimeout (Time ctsTimeout);
- virtual void SetAckTimeout (Time ackTimeout);
- virtual void SetEifsNoDifs (Time eifsNoDifs);
- virtual Time GetSlot () const;
- virtual Time GetSifs () const;
- virtual Time GetPifs () const;
- virtual Time GetCtsTimeout () const;
- virtual Time GetAckTimeout () const;
- virtual Time GetEifsNoDifs () const;
- virtual void SetWifiPhy (Ptr<WifiPhy> phy);
- virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager);
virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to);
virtual bool SupportsSendFrom () const;
- virtual void SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback);
virtual void SetLinkUpCallback (Callback<void> linkUp);
- virtual void SetLinkDownCallback (Callback<void> linkDown);
- virtual Mac48Address GetAddress () const;
- virtual Mac48Address GetBssid () const;
- virtual Ssid GetSsid () const;
- virtual void SetAddress (Mac48Address address);
- virtual void SetSsid (Ssid ssid);
//\}
- ///Needed to obtain phy to calculate TX-duration
- Ptr<WifiPhy> GetWifiPhy () const;
///\name Each mesh point interfaces must know the mesh point address
//\{
void SetMeshPointAddress (Mac48Address);
@@ -152,26 +125,19 @@
///\{
void SetLinkMetricCallback (Callback<uint32_t, Mac48Address, Ptr<MeshWifiInterfaceMac> > cb);
uint32_t GetLinkMetric (Mac48Address peerAddress);
- Ptr<WifiRemoteStationManager> GetStationManager ();
///\}
///\brief Statistics:
void Report (std::ostream &) const;
void ResetStats ();
/// Enable/disable beacons
void SetBeaconGeneration (bool enable);
- void SetQueue (AcIndex ac);
WifiPhyStandard GetPhyStandard () const;
virtual void FinishConfigureStandard (enum WifiPhyStandard standard);
private:
/// Frame receive handler
void Receive (Ptr<Packet> packet, WifiMacHeader const *hdr);
- /// Forward frame to mesh point
- virtual void ForwardUp (Ptr<Packet> packet, Mac48Address src, Mac48Address dst);
/// Send frame. Frame is supposed to be tagged by routing information. TODO: clarify this point
void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to);
- // Notify about tx OK/Error frames:
- void TxOk (WifiMacHeader const &hdr);
- void TxFailed (WifiMacHeader const &hdr);
/// Send beacon
void SendBeacon ();
/// Schedule next beacon
@@ -180,30 +146,9 @@
bool GetBeaconGeneration () const;
/// Real d-tor
virtual void DoDispose ();
- ///Initiator at t=0
- void DoStart ();
private:
- typedef std::map<AcIndex, Ptr<DcaTxop> > Queues;
typedef std::vector<Ptr<MeshWifiInterfaceMacPlugin> > PluginList;
- ///\name Wifi MAC internals
- //\{
- Queues m_queues;
- Ptr<DcaTxop> m_beaconDca;
- Ptr<WifiRemoteStationManager> m_stationManager;
- Ptr<WifiPhy> m_phy;
- Callback<void, Ptr<Packet> , Mac48Address, Mac48Address> m_upCallback;
- //\}
-
- ///\name Wifi timing intervals
- //\{
- Time m_slot;
- Time m_sifs;
- Time m_pifs;
- Time m_ackTimeout;
- Time m_ctsTimeout;
- Time m_eifsNoDifs;
- //\}
///\name Mesh timing intervals
//\{
@@ -215,18 +160,8 @@
Time m_tbtt;
//\}
- /// DCF implementation
- DcfManager* m_dcfManager;
- /// Middle MAC sublayer
- MacRxMiddle* m_rxMiddle;
- /// Low MAC sublayer
- Ptr<MacLow> m_low;
- /// My address
- Mac48Address m_address;
/// Mesh point address
Mac48Address m_mpAddress;
- /// SSID
- Ssid m_meshId;
/// "Timer" for the next beacon
EventId m_beaconSendEvent;
@@ -248,8 +183,6 @@
};
Statistics m_stats;
///\}
- TracedCallback<WifiMacHeader const &> m_txOkCallback;
- TracedCallback<WifiMacHeader const &> m_txErrCallback;
/// Current PHY standard: needed to configure metric
WifiPhyStandard m_standard;
};
--- a/src/devices/wifi/adhoc-wifi-mac.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/devices/wifi/adhoc-wifi-mac.cc Tue Dec 21 17:46:35 2010 +0100
@@ -1,9 +1,10 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2005 INRIA
+ * Copyright (c) 2006, 2009 INRIA
+ * Copyright (c) 2009 MIRKO BANCHI
*
* 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
+ * 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,
@@ -16,19 +17,24 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Author: Mirko Banchi <mk.banchi@gmail.com>
*/
-
#include "adhoc-wifi-mac.h"
-#include "dca-txop.h"
+
+#include "ns3/pointer.h"
+#include "ns3/log.h"
+#include "ns3/string.h"
+#include "ns3/boolean.h"
+#include "ns3/trace-source-accessor.h"
+
+#include "qos-tag.h"
#include "mac-low.h"
+#include "dcf-manager.h"
#include "mac-rx-middle.h"
-#include "wifi-phy.h"
-#include "dcf-manager.h"
-#include "wifi-mac-trailer.h"
-#include "ns3/pointer.h"
-#include "ns3/packet.h"
-#include "ns3/log.h"
-#include "ns3/trace-source-accessor.h"
+#include "mac-tx-middle.h"
+#include "msdu-aggregator.h"
+#include "amsdu-subframe-header.h"
+#include "mgt-headers.h"
NS_LOG_COMPONENT_DEFINE ("AdhocWifiMac");
@@ -36,204 +42,50 @@
NS_OBJECT_ENSURE_REGISTERED (AdhocWifiMac);
-#undef NS_LOG_APPEND_CONTEXT
-#define NS_LOG_APPEND_CONTEXT if (m_low != 0) {std::clog << "[mac=" << m_low->GetAddress () << "] ";}
-
-TypeId
+TypeId
AdhocWifiMac::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::AdhocWifiMac")
- .SetParent<WifiMac> ()
+ .SetParent<RegularWifiMac> ()
.AddConstructor<AdhocWifiMac> ()
- .AddAttribute ("DcaTxop", "The DcaTxop object",
- PointerValue (),
- MakePointerAccessor (&AdhocWifiMac::GetDcaTxop),
- MakePointerChecker<DcaTxop> ())
- .AddTraceSource ( "TxOkHeader",
- "The header of successfully transmitted packet",
- MakeTraceSourceAccessor (&AdhocWifiMac::m_txOkCallback))
- .AddTraceSource ("TxErrHeader",
- "The header of unsuccessfully transmitted packet",
- MakeTraceSourceAccessor (&AdhocWifiMac::m_txErrCallback))
- ;
+ ;
return tid;
}
AdhocWifiMac::AdhocWifiMac ()
{
- m_rxMiddle = new MacRxMiddle ();
- m_rxMiddle->SetForwardCallback (MakeCallback (&AdhocWifiMac::ForwardUp, this));
-
- m_low = CreateObject<MacLow> ();
- m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle));
- m_low->SetBssid (GetBssid ());
+ NS_LOG_FUNCTION (this);
- m_dcfManager = new DcfManager ();
- m_dcfManager->SetupLowListener (m_low);
-
- m_dca = CreateObject<DcaTxop> ();
- m_dca->SetLow (m_low);
- m_dca->SetManager (m_dcfManager);
- m_dca->SetTxFailedCallback (MakeCallback (&AdhocWifiMac::TxFailed, this));
+ // Let the lower layers know that we are acting in an IBSS
+ SetTypeOfStation (ADHOC_STA);
}
+
AdhocWifiMac::~AdhocWifiMac ()
-{}
-
-void
-AdhocWifiMac::DoDispose (void)
{
- delete m_rxMiddle;
- delete m_dcfManager;
- m_rxMiddle = 0;
- m_dcfManager = 0;
- m_low = 0;
- m_phy = 0;
- m_dca = 0;
- m_stationManager = 0;
- WifiMac::DoDispose ();
+ NS_LOG_FUNCTION (this);
}
-void
-AdhocWifiMac::SetSlot (Time slotTime)
-{
- m_dcfManager->SetSlot (slotTime);
- m_low->SetSlotTime (slotTime);
-}
-void
-AdhocWifiMac::SetSifs (Time sifs)
-{
- m_dcfManager->SetSifs (sifs);
- m_low->SetSifs (sifs);
-}
-void
-AdhocWifiMac::SetEifsNoDifs (Time eifsNoDifs)
-{
- m_dcfManager->SetEifsNoDifs (eifsNoDifs);
-}
-void
-AdhocWifiMac::SetAckTimeout (Time ackTimeout)
-{
- m_low->SetAckTimeout (ackTimeout);
-}
-void
-AdhocWifiMac::SetCtsTimeout (Time ctsTimeout)
-{
- m_low->SetCtsTimeout (ctsTimeout);
-}
-void
-AdhocWifiMac::SetPifs (Time pifs)
-{
- m_low->SetPifs (pifs);
-}
-Time
-AdhocWifiMac::GetSlot (void) const
-{
- return m_low->GetSlotTime ();
-}
-Time
-AdhocWifiMac::GetSifs (void) const
-{
- return m_low->GetSifs ();
-}
-Time
-AdhocWifiMac::GetEifsNoDifs (void) const
-{
- return m_dcfManager->GetEifsNoDifs ();
-}
-Time
-AdhocWifiMac::GetAckTimeout (void) const
-{
- return m_low->GetAckTimeout ();
-}
-Time
-AdhocWifiMac::GetCtsTimeout (void) const
-{
- return m_low->GetCtsTimeout ();
-}
-Time
-AdhocWifiMac::GetPifs (void) const
-{
- return m_low->GetPifs ();
-}
-void
-AdhocWifiMac::SetWifiPhy (Ptr<WifiPhy> phy)
-{
- m_phy = phy;
- m_dcfManager->SetupPhyListener (phy);
- m_low->SetPhy (phy);
-}
-void
-AdhocWifiMac::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager)
-{
- m_stationManager = stationManager;
- m_dca->SetWifiRemoteStationManager (stationManager);
- m_low->SetWifiRemoteStationManager (stationManager);
-}
-void
-AdhocWifiMac::SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback)
-{
- m_upCallback = upCallback;
-}
-void
-AdhocWifiMac::SetLinkUpCallback (Callback<void> linkUp)
-{
- // an Adhoc network is always UP.
- linkUp ();
-}
-void
-AdhocWifiMac::SetLinkDownCallback (Callback<void> linkDown)
-{}
-Mac48Address
-AdhocWifiMac::GetAddress (void) const
-{
- return m_low->GetAddress ();
-}
-Ssid
-AdhocWifiMac::GetSsid (void) const
-{
- return m_ssid;
-}
-Mac48Address
-AdhocWifiMac::GetBssid (void) const
-{
- return m_low->GetBssid ();
-}
-void
+void
AdhocWifiMac::SetAddress (Mac48Address address)
{
- m_low->SetAddress (address);
- m_low->SetBssid (address);
- // XXX the bssid should be generated by the procedure
- // described in ieee802.11 section 11.1.3
-}
-void
-AdhocWifiMac::SetSsid (Ssid ssid)
-{
- // XXX: here, we should start a special adhoc network
- m_ssid = ssid;
+ // In an IBSS, the BSSID is supposed to be generated per Section
+ // 11.1.3 of IEEE 802.11. We don't currently do this - instead we
+ // make an IBSS STA a bit like an AP, with the BSSID for frames
+ // transmitted by each STA set to that STA's address.
+ //
+ // This is why we're overriding this method.
+ RegularWifiMac::SetAddress (address);
+ RegularWifiMac::SetBssid (address);
}
-void
-AdhocWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from)
-{
- NS_FATAL_ERROR ("Adhoc does not support a from != m_low->GetAddress ()");
-}
-void
+void
AdhocWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to)
{
- NS_LOG_FUNCTION (packet->GetSize () << to);
- WifiMacHeader hdr;
- hdr.SetType (WIFI_MAC_DATA);
- hdr.SetAddr1 (to);
- hdr.SetAddr2 (m_low->GetAddress ());
- hdr.SetAddr3 (GetBssid ());
- hdr.SetDsNotFrom ();
- hdr.SetDsNotTo ();
-
+ NS_LOG_FUNCTION (this << packet << to);
if (m_stationManager->IsBrandNew (to))
{
- // in adhoc mode, we assume that every destination
- // supports all the rates we support.
+ // In ad hoc mode, we assume that every destination supports all
+ // the rates we support.
for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
{
m_stationManager->AddSupportedMode (to, m_phy->GetMode (i));
@@ -241,65 +93,99 @@
m_stationManager->RecordDisassociated (to);
}
- m_dca->Queue (packet, hdr);
-}
-bool
-AdhocWifiMac::SupportsSendFrom (void) const
-{
- return false;
-}
+ WifiMacHeader hdr;
+
+ // If we are not a QoS STA then we definitely want to use AC_BE to
+ // transmit the packet. A TID of zero will map to AC_BE (through \c
+ // QosUtilsMapTidToAc()), so we use that as our default here.
+ uint8_t tid = 0;
+
+ // For now, a STA that supports QoS does not support non-QoS
+ // associations, and vice versa. In future the STA model should fall
+ // back to non-QoS if talking to a peer that is also non-QoS. At
+ // that point there will need to be per-station QoS state maintained
+ // by the association state machine, and consulted here.
+ if (m_qosSupported)
+ {
+ hdr.SetType (WIFI_MAC_QOSDATA);
+ hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
+ hdr.SetQosNoEosp ();
+ hdr.SetQosNoAmsdu ();
+ // Transmission of multiple frames in the same TXOP is not
+ // supported for now
+ hdr.SetQosTxopLimit (0);
-void
-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 ());
-}
-Ptr<DcaTxop>
-AdhocWifiMac::GetDcaTxop(void) const
-{
- return m_dca;
+ // Fill in the QoS control field in the MAC header
+ tid = QosUtilsGetTidForPacket (packet);
+ // Any value greater than 7 is invalid and likely indicates that
+ // the packet had no QoS tag, so we revert to zero, which'll
+ // mean that AC_BE is used.
+ if (tid >= 7)
+ {
+ tid = 0;
+ }
+ hdr.SetQosTid (tid);
+ }
+ else
+ {
+ hdr.SetTypeData ();
+ }
+
+ hdr.SetAddr1 (to);
+ hdr.SetAddr2 (m_low->GetAddress ());
+ hdr.SetAddr3 (GetBssid ());
+ hdr.SetDsNotFrom ();
+ hdr.SetDsNotTo ();
+
+ if (m_qosSupported)
+ {
+ // Sanity check that the TID is valid
+ NS_ASSERT (tid < 8);
+ m_edca[QosUtilsMapTidToAc (tid)]->Queue (packet, hdr);
+ }
+ else
+ {
+ m_dca->Queue (packet, hdr);
+ }
}
-void
-AdhocWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard)
+void
+AdhocWifiMac::SetLinkUpCallback (Callback<void> linkUp)
{
- switch (standard)
+ NS_LOG_FUNCTION (this);
+ RegularWifiMac::SetLinkUpCallback (linkUp);
+
+ // The approach taken here is that, from the point of view of a STA
+ // in IBSS mode, the link is always up, so we immediately invoke the
+ // callback if one is set
+ linkUp ();
+}
+
+void
+AdhocWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
+{
+ NS_LOG_FUNCTION (this << packet << hdr);
+ NS_ASSERT (!hdr->IsCtl ());
+ Mac48Address from = hdr->GetAddr2 ();
+ Mac48Address to = hdr->GetAddr1 ();
+ if (hdr->IsData ())
{
- case WIFI_PHY_STANDARD_holland:
- // fall through
- case WIFI_PHY_STANDARD_80211_10Mhz:
- // fall through
- case WIFI_PHY_STANDARD_80211_5Mhz:
- // fall through
- case WIFI_PHY_STANDARD_80211a:
- // fall through
- case WIFI_PHY_STANDARD_80211g:
- ConfigureDcf (m_dca, 15, 1023, AC_BE_NQOS);
- break;
- case WIFI_PHY_STANDARD_80211b:
- ConfigureDcf (m_dca, 31, 1023, AC_BE_NQOS);
- break;
- default:
- NS_ASSERT (false);
- break;
+ if (hdr->IsQosData () && hdr->IsQosAmsdu ())
+ {
+ NS_LOG_DEBUG ("Received A-MSDU from"<<from);
+ DeaggregateAmsduAndForward (packet, hdr);
+ }
+ else
+ {
+ ForwardUp (packet, from, to);
+ }
+ return;
}
-}
-void
-AdhocWifiMac::TxOk (const WifiMacHeader &hdr)
-{
- m_txOkCallback (hdr);
-}
-void
-AdhocWifiMac::TxFailed (const WifiMacHeader &hdr)
-{
- m_txErrCallback (hdr);
-}
-void
-AdhocWifiMac::DoStart ()
-{
- m_dca->Start ();
- WifiMac::DoStart ();
+
+ // Invoke the receive handler of our parent class to deal with any
+ // other frames. Specifically, this will handle Block Ack-related
+ // Management Action frames.
+ RegularWifiMac::Receive (packet, hdr);
}
} // namespace ns3
--- a/src/devices/wifi/adhoc-wifi-mac.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/devices/wifi/adhoc-wifi-mac.h Tue Dec 21 17:46:35 2010 +0100
@@ -1,9 +1,10 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2005 INRIA
+ * Copyright (c) 2006, 2009 INRIA
+ * Copyright (c) 2009 MIRKO BANCHI
*
* 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
+ * 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,
@@ -16,91 +17,47 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Author: Mirko Banchi <mk.banchi@gmail.com>
*/
#ifndef ADHOC_WIFI_MAC_H
#define ADHOC_WIFI_MAC_H
-#include "ns3/mac48-address.h"
-#include "ns3/callback.h"
-#include "ns3/packet.h"
-#include "wifi-mac.h"
+#include "regular-wifi-mac.h"
+
+#include "amsdu-subframe-header.h"
namespace ns3 {
-class DcaTxop;
-class Packet;
-class WifiMacHeader;
-class WifiPhy;
-class DcfManager;
-class MacLow;
-class MacRxMiddle;
-
-/**
- * \brief the Adhoc state machine
- *
- * For now, this class is really empty but it should contain
- * the code for the distributed generation of beacons in an adhoc
- * network.
- */
-class AdhocWifiMac : public WifiMac
+class AdhocWifiMac : public RegularWifiMac
{
public:
- typedef Callback<void, Ptr<Packet>, const Mac48Address &> ForwardCallback;
-
static TypeId GetTypeId (void);
AdhocWifiMac ();
- ~AdhocWifiMac ();
+ virtual ~AdhocWifiMac ();
+
+ /**
+ * \param address the current address of this MAC layer.
+ */
+ virtual void SetAddress (Mac48Address address);
- // all inherited from WifiMac base class.
- virtual void SetSlot (Time slotTime);
- virtual void SetSifs (Time sifs);
- virtual void SetEifsNoDifs (Time eifsNoDifs);
- virtual void SetAckTimeout (Time ackTimeout);
- virtual void SetCtsTimeout (Time ctsTimeout);
- virtual void SetPifs (Time pifs);
- virtual Time GetSlot (void) const;
- virtual Time GetSifs (void) const;
- virtual Time GetEifsNoDifs (void) const;
- virtual Time GetAckTimeout (void) const;
- virtual Time GetCtsTimeout (void) const;
- virtual Time GetPifs (void) const;
- virtual void SetWifiPhy (Ptr<WifiPhy> phy);
- virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager);
- virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
+ /**
+ * \param linkUp the callback to invoke when the link becomes up.
+ */
+ virtual void SetLinkUpCallback (Callback<void> linkUp);
+
+ /**
+ * \param packet the packet to send.
+ * \param to the address to which the packet should be sent.
+ *
+ * The packet should be enqueued in a tx queue, and should be
+ * dequeued as soon as the channel access function determines that
+ * access is granted to this MAC.
+ */
virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to);
- virtual bool SupportsSendFrom (void) const;
- virtual void SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback);
- virtual void SetLinkUpCallback (Callback<void> linkUp);
- virtual void SetLinkDownCallback (Callback<void> linkDown);
- virtual Mac48Address GetAddress (void) const;
- virtual Ssid GetSsid (void) const;
- virtual void SetAddress (Mac48Address address);
- virtual void SetSsid (Ssid ssid);
- virtual Mac48Address GetBssid (void) const;
private:
- // inherited from Object base class.
- virtual void DoDispose (void);
- void DoStart ();
- /* invoked by the MacLows. */
- void ForwardUp (Ptr<Packet> packet, const WifiMacHeader *hdr);
- AdhocWifiMac (const AdhocWifiMac & ctor_arg);
- AdhocWifiMac &operator = (const AdhocWifiMac &o);
- Ptr<DcaTxop> GetDcaTxop(void) const;
- void TxOk (const WifiMacHeader &hdr);
- void TxFailed (const WifiMacHeader &hdr);
- virtual void FinishConfigureStandard (enum WifiPhyStandard standard);
- Ptr<DcaTxop> m_dca;
- Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> m_upCallback;
- Ptr<WifiRemoteStationManager> m_stationManager;
- Ptr<WifiPhy> m_phy;
- DcfManager *m_dcfManager;
- MacRxMiddle *m_rxMiddle;
- Ptr<MacLow> m_low;
- Ssid m_ssid;
- TracedCallback<const WifiMacHeader &> m_txOkCallback;
- TracedCallback<const WifiMacHeader &> m_txErrCallback;
+ virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
};
} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/wifi/ap-wifi-mac.cc Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,578 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006, 2009 INRIA
+ * Copyright (c) 2009 MIRKO BANCHI
+ *
+ * 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Author: Mirko Banchi <mk.banchi@gmail.com>
+ */
+#include "ap-wifi-mac.h"
+
+#include "ns3/assert.h"
+#include "ns3/log.h"
+#include "ns3/simulator.h"
+#include "ns3/string.h"
+#include "ns3/pointer.h"
+#include "ns3/boolean.h"
+
+#include "qos-tag.h"
+#include "wifi-phy.h"
+#include "dcf-manager.h"
+#include "mac-rx-middle.h"
+#include "mac-tx-middle.h"
+#include "mgt-headers.h"
+#include "mac-low.h"
+#include "amsdu-subframe-header.h"
+#include "msdu-aggregator.h"
+
+NS_LOG_COMPONENT_DEFINE ("ApWifiMac");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (ApWifiMac);
+
+TypeId
+ApWifiMac::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::ApWifiMac")
+ .SetParent<RegularWifiMac> ()
+ .AddConstructor<ApWifiMac> ()
+ .AddAttribute ("BeaconInterval", "Delay between two beacons",
+ TimeValue (MicroSeconds (102400)),
+ MakeTimeAccessor (&ApWifiMac::GetBeaconInterval,
+ &ApWifiMac::SetBeaconInterval),
+ MakeTimeChecker ())
+ .AddAttribute ("BeaconGeneration", "Whether or not beacons are generated.",
+ BooleanValue (true),
+ MakeBooleanAccessor (&ApWifiMac::SetBeaconGeneration,
+ &ApWifiMac::GetBeaconGeneration),
+ MakeBooleanChecker ())
+ ;
+ return tid;
+}
+
+ApWifiMac::ApWifiMac ()
+{
+ NS_LOG_FUNCTION (this);
+ m_beaconDca = CreateObject<DcaTxop> ();
+ m_beaconDca->SetAifsn(1);
+ m_beaconDca->SetMinCw(0);
+ m_beaconDca->SetMaxCw(0);
+ m_beaconDca->SetLow (m_low);
+ m_beaconDca->SetManager (m_dcfManager);
+
+ // Let the lower layers know that we are acting as an AP.
+ SetTypeOfStation (AP);
+
+ m_enableBeaconGeneration = false;
+}
+
+ApWifiMac::~ApWifiMac ()
+{
+ NS_LOG_FUNCTION (this);
+}
+
+void
+ApWifiMac::DoDispose ()
+{
+ NS_LOG_FUNCTION (this);
+ m_beaconDca = 0;
+ m_enableBeaconGeneration = false;
+ m_beaconEvent.Cancel ();
+ RegularWifiMac::DoDispose ();
+}
+
+void
+ApWifiMac::SetAddress (Mac48Address address)
+{
+ // As an AP, our MAC address is also the BSSID. Hence we are
+ // overriding this function and setting both in our parent class.
+ RegularWifiMac::SetAddress (address);
+ RegularWifiMac::SetBssid (address);
+}
+
+void
+ApWifiMac::SetBeaconGeneration (bool enable)
+{
+ NS_LOG_FUNCTION (this << enable);
+ if (!enable)
+ {
+ m_beaconEvent.Cancel ();
+ }
+ else if (enable && !m_enableBeaconGeneration)
+ {
+ m_beaconEvent = Simulator::ScheduleNow (&ApWifiMac::SendOneBeacon, this);
+ }
+ m_enableBeaconGeneration = enable;
+}
+
+bool
+ApWifiMac::GetBeaconGeneration (void) const
+{
+ return m_enableBeaconGeneration;
+}
+
+Time
+ApWifiMac::GetBeaconInterval (void) const
+{
+ return m_beaconInterval;
+}
+
+void
+ApWifiMac::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager)
+{
+ NS_LOG_FUNCTION (this << stationManager);
+ m_beaconDca->SetWifiRemoteStationManager (stationManager);
+ RegularWifiMac::SetWifiRemoteStationManager (stationManager);
+}
+
+void
+ApWifiMac::SetLinkUpCallback (Callback<void> linkUp)
+{
+ NS_LOG_FUNCTION (this);
+ RegularWifiMac::SetLinkUpCallback (linkUp);
+
+ // The approach taken here is that, from the point of view of an AP,
+ // the link is always up, so we immediately invoke the callback if
+ // one is set
+ linkUp ();
+}
+
+void
+ApWifiMac::SetBeaconInterval (Time interval)
+{
+ NS_LOG_FUNCTION (this << interval);
+ if ((interval.GetMicroSeconds () % 1024) != 0)
+ {
+ NS_LOG_WARN ("beacon interval should be multiple of 1024us, see IEEE Std. 802.11-2007, section 11.1.1.1");
+ }
+ m_beaconInterval = interval;
+}
+
+void
+ApWifiMac::StartBeaconing (void)
+{
+ NS_LOG_FUNCTION (this);
+ SendOneBeacon ();
+}
+
+void
+ApWifiMac::ForwardDown (Ptr<const Packet> packet, Mac48Address from,
+ Mac48Address to)
+{
+ // If we are not a QoS AP then we definitely want to use AC_BE to
+ // transmit the packet. A TID of zero will map to AC_BE (through \c
+ // QosUtilsMapTidToAc()), so we use that as our default here.
+ uint8_t tid = 0;
+
+ // If we are a QoS AP then we attempt to get a TID for this packet
+ if (m_qosSupported)
+ {
+ tid = QosUtilsGetTidForPacket (packet);
+ // Any value greater than 7 is invalid and likely indicates that
+ // the packet had no QoS tag, so we revert to zero, which'll
+ // mean that AC_BE is used.
+ if (tid >= 7)
+ {
+ tid = 0;
+ }
+ }
+
+ ForwardDown (packet, from, to, tid);
+}
+
+void
+ApWifiMac::ForwardDown (Ptr<const Packet> packet, Mac48Address from,
+ Mac48Address to, uint8_t tid)
+{
+ NS_LOG_FUNCTION (this << packet << from << to);
+ WifiMacHeader hdr;
+
+ // For now, an AP that supports QoS does not support non-QoS
+ // associations, and vice versa. In future the AP model should
+ // support simultaneously associated QoS and non-QoS STAs, at which
+ // point there will need to be per-association QoS state maintained
+ // by the association state machine, and consulted here.
+ if (m_qosSupported)
+ {
+ hdr.SetType (WIFI_MAC_QOSDATA);
+ hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
+ hdr.SetQosNoEosp ();
+ hdr.SetQosNoAmsdu ();
+ // Transmission of multiple frames in the same TXOP is not
+ // supported for now
+ hdr.SetQosTxopLimit (0);
+ // Fill in the QoS control field in the MAC header
+ hdr.SetQosTid (tid);
+ }
+ else
+ {
+ hdr.SetTypeData ();
+ }
+
+ hdr.SetAddr1 (to);
+ hdr.SetAddr2 (GetAddress ());
+ hdr.SetAddr3 (from);
+ hdr.SetDsFrom ();
+ hdr.SetDsNotTo ();
+
+ if (m_qosSupported)
+ {
+ // Sanity check that the TID is valid
+ NS_ASSERT (tid < 8);
+ m_edca[QosUtilsMapTidToAc (tid)]->Queue (packet, hdr);
+ }
+ else
+ {
+ m_dca->Queue (packet, hdr);
+ }
+}
+
+void
+ApWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from)
+{
+ NS_LOG_FUNCTION (this << packet << to << from);
+ if (to.IsBroadcast () || m_stationManager->IsAssociated (to))
+ {
+ ForwardDown (packet, from, to);
+ }
+}
+
+void
+ApWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to)
+{
+ // We're sending this packet with a from address that is our own. We
+ // get that address from the lower MAC and make use of the
+ // from-spoofing Enqueue() method to avoid duplicated code.
+ Enqueue (packet, to, m_low->GetAddress ());
+}
+
+bool
+ApWifiMac::SupportsSendFrom (void) const
+{
+ return true;
+}
+
+SupportedRates
+ApWifiMac::GetSupportedRates (void) const
+{
+ // send the set of supported rates and make sure that we indicate
+ // the Basic Rate set in this set of supported rates.
+ SupportedRates rates;
+ for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
+ {
+ WifiMode mode = m_phy->GetMode (i);
+ rates.AddSupportedRate (mode.GetDataRate ());
+ }
+ // set the basic rates
+ for (uint32_t j = 0; j < m_stationManager->GetNBasicModes (); j++)
+ {
+ WifiMode mode = m_stationManager->GetBasicMode (j);
+ rates.SetBasicRate (mode.GetDataRate ());
+ }
+ return rates;
+}
+
+void
+ApWifiMac::SendProbeResp (Mac48Address to)
+{
+ NS_LOG_FUNCTION (this << to);
+ WifiMacHeader hdr;
+ hdr.SetProbeResp ();
+ hdr.SetAddr1 (to);
+ hdr.SetAddr2 (GetAddress ());
+ hdr.SetAddr3 (GetAddress ());
+ hdr.SetDsNotFrom ();
+ hdr.SetDsNotTo ();
+ Ptr<Packet> packet = Create<Packet> ();
+ MgtProbeResponseHeader probe;
+ probe.SetSsid (GetSsid ());
+ probe.SetSupportedRates (GetSupportedRates ());
+ probe.SetBeaconIntervalUs (m_beaconInterval.GetMicroSeconds ());
+ packet->AddHeader (probe);
+
+ // The standard is not clear on the correct queue for management
+ // frames if we are a QoS AP. The approach taken here is to always
+ // use the DCF for these regardless of whether we have a QoS
+ // association or not.
+ m_dca->Queue (packet, hdr);
+}
+
+void
+ApWifiMac::SendAssocResp (Mac48Address to, bool success)
+{
+ NS_LOG_FUNCTION (this << to << success);
+ WifiMacHeader hdr;
+ hdr.SetAssocResp ();
+ hdr.SetAddr1 (to);
+ hdr.SetAddr2 (GetAddress ());
+ hdr.SetAddr3 (GetAddress ());
+ hdr.SetDsNotFrom ();
+ hdr.SetDsNotTo ();
+ Ptr<Packet> packet = Create<Packet> ();
+ MgtAssocResponseHeader assoc;
+ StatusCode code;
+ if (success)
+ {
+ code.SetSuccess ();
+ }
+ else
+ {
+ code.SetFailure ();
+ }
+ assoc.SetSupportedRates (GetSupportedRates ());
+ assoc.SetStatusCode (code);
+ packet->AddHeader (assoc);
+
+ // The standard is not clear on the correct queue for management
+ // frames if we are a QoS AP. The approach taken here is to always
+ // use the DCF for these regardless of whether we have a QoS
+ // association or not.
+ m_dca->Queue (packet, hdr);
+}
+
+void
+ApWifiMac::SendOneBeacon (void)
+{
+ NS_LOG_FUNCTION (this);
+ WifiMacHeader hdr;
+ hdr.SetBeacon ();
+ hdr.SetAddr1 (Mac48Address::GetBroadcast ());
+ hdr.SetAddr2 (GetAddress ());
+ hdr.SetAddr3 (GetAddress ());
+ hdr.SetDsNotFrom ();
+ hdr.SetDsNotTo ();
+ Ptr<Packet> packet = Create<Packet> ();
+ MgtBeaconHeader beacon;
+ beacon.SetSsid (GetSsid ());
+ beacon.SetSupportedRates (GetSupportedRates ());
+ beacon.SetBeaconIntervalUs (m_beaconInterval.GetMicroSeconds ());
+
+ packet->AddHeader (beacon);
+
+ // The beacon has it's own special queue, so we load it in there
+ m_beaconDca->Queue (packet, hdr);
+ m_beaconEvent = Simulator::Schedule (m_beaconInterval, &ApWifiMac::SendOneBeacon, this);
+}
+
+void
+ApWifiMac::TxOk (const WifiMacHeader &hdr)
+{
+ NS_LOG_FUNCTION (this);
+ RegularWifiMac::TxOk (hdr);
+
+ if (hdr.IsAssocResp () &&
+ m_stationManager->IsWaitAssocTxOk (hdr.GetAddr1 ()))
+ {
+ NS_LOG_DEBUG ("associated with sta="<<hdr.GetAddr1 ());
+ m_stationManager->RecordGotAssocTxOk (hdr.GetAddr1 ());
+ }
+}
+
+void
+ApWifiMac::TxFailed (const WifiMacHeader &hdr)
+{
+ NS_LOG_FUNCTION (this);
+ RegularWifiMac::TxFailed (hdr);
+
+ if (hdr.IsAssocResp () &&
+ m_stationManager->IsWaitAssocTxOk (hdr.GetAddr1 ()))
+ {
+ NS_LOG_DEBUG ("assoc failed with sta="<<hdr.GetAddr1 ());
+ m_stationManager->RecordGotAssocTxFailed (hdr.GetAddr1 ());
+ }
+}
+
+void
+ApWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
+{
+ NS_LOG_FUNCTION (this << packet << hdr);
+
+ Mac48Address from = hdr->GetAddr2 ();
+
+ if (hdr->IsData ())
+ {
+ Mac48Address bssid = hdr->GetAddr1 ();
+ if (!hdr->IsFromDs () &&
+ hdr->IsToDs () &&
+ bssid == GetAddress () &&
+ m_stationManager->IsAssociated (from))
+ {
+ Mac48Address to = hdr->GetAddr3 ();
+ if (to == GetAddress ())
+ {
+ NS_LOG_DEBUG ("frame for me from="<<from);
+ if (hdr->IsQosData ())
+ {
+ if (hdr->IsQosAmsdu ())
+ {
+ NS_LOG_DEBUG ("Received A-MSDU from="<<from<<", size="<<packet->GetSize ());
+ DeaggregateAmsduAndForward (packet, hdr);
+ packet = 0;
+ }
+ else
+ {
+ ForwardUp (packet, from, bssid);
+ }
+ }
+ else
+ {
+ ForwardUp (packet, from, bssid);
+ }
+ }
+ else if (to.IsGroup () ||
+ m_stationManager->IsAssociated (to))
+ {
+ NS_LOG_DEBUG ("forwarding frame from="<<from<<", to="<<to);
+ Ptr<Packet> copy = packet->Copy ();
+
+ // If the frame we are forwarding is of type QoS Data,
+ // then we need to preserve the UP in the QoS control
+ // header...
+ if (hdr->IsQosData ())
+ {
+ ForwardDown (packet, from, to, hdr->GetQosTid ());
+ }
+ else
+ {
+ ForwardDown (packet, from, to);
+ }
+ ForwardUp (copy, from, to);
+ }
+ else
+ {
+ ForwardUp (packet, from, to);
+ }
+ }
+ else if (hdr->IsFromDs () &&
+ hdr->IsToDs ())
+ {
+ // this is an AP-to-AP frame
+ // we ignore for now.
+ NotifyRxDrop (packet);
+ }
+ else
+ {
+ // we can ignore these frames since
+ // they are not targeted at the AP
+ NotifyRxDrop (packet);
+ }
+ return;
+ }
+ else if (hdr->IsMgt ())
+ {
+ if (hdr->IsProbeReq ())
+ {
+ NS_ASSERT (hdr->GetAddr1 ().IsBroadcast ());
+ SendProbeResp (from);
+ return;
+ }
+ else if (hdr->GetAddr1 () == GetAddress ())
+ {
+ if (hdr->IsAssocReq ())
+ {
+ // first, verify that the the station's supported
+ // rate set is compatible with our Basic Rate set
+ MgtAssocRequestHeader assocReq;
+ packet->RemoveHeader (assocReq);
+ SupportedRates rates = assocReq.GetSupportedRates ();
+ bool problem = false;
+ for (uint32_t i = 0; i < m_stationManager->GetNBasicModes (); i++)
+ {
+ WifiMode mode = m_stationManager->GetBasicMode (i);
+ if (!rates.IsSupportedRate (mode.GetDataRate ()))
+ {
+ problem = true;
+ break;
+ }
+ }
+ if (problem)
+ {
+ // one of the Basic Rate set mode is not
+ // supported by the station. So, we return an assoc
+ // response with an error status.
+ SendAssocResp (hdr->GetAddr2 (), false);
+ }
+ else
+ {
+ // station supports all rates in Basic Rate Set.
+ // record all its supported modes in its associated WifiRemoteStation
+ for (uint32_t j = 0; j < m_phy->GetNModes (); j++)
+ {
+ WifiMode mode = m_phy->GetMode (j);
+ if (rates.IsSupportedRate (mode.GetDataRate ()))
+ {
+ m_stationManager->AddSupportedMode (from, mode);
+ }
+ }
+ m_stationManager->RecordWaitAssocTxOk (from);
+ // send assoc response with success status.
+ SendAssocResp (hdr->GetAddr2 (), true);
+ }
+ return;
+ }
+ else if (hdr->IsDisassociation ())
+ {
+ m_stationManager->RecordDisassociated (from);
+ return;
+ }
+ }
+ }
+
+ // Invoke the receive handler of our parent class to deal with any
+ // other frames. Specifically, this will handle Block Ack-related
+ // Management Action frames.
+ RegularWifiMac::Receive (packet, hdr);
+}
+
+void
+ApWifiMac::DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
+ const WifiMacHeader *hdr)
+{
+ MsduAggregator::DeaggregatedMsdus packets =
+ MsduAggregator::Deaggregate (aggregatedPacket);
+
+ for (MsduAggregator::DeaggregatedMsdusCI i = packets.begin ();
+ i != packets.end (); ++i)
+ {
+ if ((*i).second.GetDestinationAddr () == GetAddress ())
+ {
+ ForwardUp ((*i).first, (*i).second.GetSourceAddr (),
+ (*i).second.GetDestinationAddr ());
+ }
+ else
+ {
+ Mac48Address from = (*i).second.GetSourceAddr ();
+ Mac48Address to = (*i).second.GetDestinationAddr ();
+ NS_LOG_DEBUG ("forwarding QoS frame from="<<from<<", to="<<to);
+ ForwardDown ((*i).first, from, to, hdr->GetQosTid ());
+ }
+ }
+}
+
+void
+ApWifiMac::DoStart (void)
+{
+ m_beaconDca->Start ();
+ m_beaconEvent.Cancel ();
+ if (m_enableBeaconGeneration)
+ {
+ m_beaconEvent = Simulator::ScheduleNow (&ApWifiMac::SendOneBeacon, this);
+ }
+ RegularWifiMac::DoStart ();
+}
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/wifi/ap-wifi-mac.h Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006, 2009 INRIA
+ * Copyright (c) 2009 MIRKO BANCHI
+ *
+ * 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Author: Mirko Banchi <mk.banchi@gmail.com>
+ */
+#ifndef AP_WIFI_MAC_H
+#define AP_WIFI_MAC_H
+
+#include "regular-wifi-mac.h"
+
+#include "amsdu-subframe-header.h"
+#include "supported-rates.h"
+
+namespace ns3 {
+
+/**
+ * \brief Wi-Fi AP state machine
+ *
+ * Handle association, dis-association and authentication,
+ * of STAs within an infrastructure BSS.
+ */
+class ApWifiMac : public RegularWifiMac
+{
+public:
+ static TypeId GetTypeId (void);
+
+ ApWifiMac ();
+ virtual ~ApWifiMac ();
+
+ /**
+ * \param stationManager the station manager attached to this MAC.
+ */
+ virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager);
+
+ /**
+ * \param linkUp the callback to invoke when the link becomes up.
+ */
+ virtual void SetLinkUpCallback (Callback<void> linkUp);
+
+ /**
+ * \param packet the packet to send.
+ * \param to the address to which the packet should be sent.
+ *
+ * The packet should be enqueued in a tx queue, and should be
+ * dequeued as soon as the channel access function determines that
+ * access is granted to this MAC.
+ */
+ virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to);
+
+ /**
+ * \param packet the packet to send.
+ * \param to the address to which the packet should be sent.
+ * \param from the address from which the packet should be sent.
+ *
+ * The packet should be enqueued in a tx queue, and should be
+ * dequeued as soon as the channel access function determines that
+ * access is granted to this MAC. The extra parameter "from" allows
+ * this device to operate in a bridged mode, forwarding received
+ * frames without altering the source address.
+ */
+ virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
+ virtual bool SupportsSendFrom (void) const;
+
+ /**
+ * \param address the current address of this MAC layer.
+ */
+ virtual void SetAddress (Mac48Address address);
+ /**
+ * \param interval the interval between two beacon transmissions.
+ */
+ void SetBeaconInterval (Time interval);
+ /**
+ * \returns the interval between two beacon transmissions.
+ */
+ Time GetBeaconInterval (void) const;
+ /**
+ * Start beacon transmission immediately.
+ */
+ void StartBeaconing (void);
+
+private:
+ virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
+ virtual void TxOk (const WifiMacHeader &hdr);
+ virtual void TxFailed (const WifiMacHeader &hdr);
+
+ /**
+ * This method is called to de-aggregate an A-MSDU and forward the
+ * constituent packets up the stack. We override the WifiMac version
+ * here because, as an AP, we also need to think about redistributing
+ * to other associated STAs.
+ *
+ * \param aggregatedPacket the Packet containing the A-MSDU.
+ * \param hdr a pointer to the MAC header for \c aggregatedPacket.
+ */
+ virtual void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
+ const WifiMacHeader *hdr);
+
+ void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to);
+ void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to, uint8_t tid);
+ void SendProbeResp (Mac48Address to);
+ void SendAssocResp (Mac48Address to, bool success);
+ void SendOneBeacon (void);
+ SupportedRates GetSupportedRates (void) const;
+ void SetBeaconGeneration (bool enable);
+ bool GetBeaconGeneration (void) const;
+ virtual void DoDispose (void);
+ virtual void DoStart (void);
+
+ Ptr<DcaTxop> m_beaconDca;
+ Time m_beaconInterval;
+ bool m_enableBeaconGeneration;
+ EventId m_beaconEvent;
+};
+
+} // namespace ns3
+
+#endif /* AP_WIFI_MAC_H */
--- a/src/devices/wifi/edca-txop-n.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/devices/wifi/edca-txop-n.h Tue Dec 21 17:46:35 2010 +0100
@@ -27,8 +27,8 @@
#include "ns3/packet.h"
#include "wifi-mode.h"
-#include "wifi-mac.h"
#include "wifi-mac-header.h"
+#include "wifi-remote-station-manager.h"
#include "qos-utils.h"
#include "dcf.h"
#include "ctrl-headers.h"
@@ -43,6 +43,7 @@
class DcfManager;
class MacLow;
class MacTxMiddle;
+class WifiMac;
class WifiMacParameters;
class WifiMacQueue;
class RandomStream;
@@ -55,10 +56,10 @@
/* This queue contains packets for a particular access class.
* possibles access classes are:
- *
+ *
* -AC_VO : voice, tid = 6,7 ^
* -AC_VI : video, tid = 4,5 |
- * -AC_BE : best-effort, tid = 0,3 | priority
+ * -AC_BE : best-effort, tid = 0,3 | priority
* -AC_BK : background, tid = 1,2 |
*
* For more details see section 9.1.3.1 in 802.11 standard.
@@ -67,7 +68,8 @@
{
STA,
AP,
- ADHOC_STA
+ ADHOC_STA,
+ MESH
};
class EdcaTxopN : public Dcf
@@ -76,12 +78,12 @@
typedef Callback <void, const WifiMacHeader&> TxOk;
typedef Callback <void, const WifiMacHeader&> TxFailed;
-
+
static TypeId GetTypeId (void);
EdcaTxopN ();
virtual ~EdcaTxopN ();
void DoDispose ();
-
+
void SetLow (Ptr<MacLow> low);
void SetTxMiddle (MacTxMiddle *txMiddle);
void SetManager (DcfManager *manager);
@@ -137,7 +139,7 @@
bool IsLastFragment (void) const;
void NextFragment (void);
Ptr<Packet> GetFragmentPacket (WifiMacHeader *hdr);
-
+
void SetAccessCategory (enum AcIndex ac);
void Queue (Ptr<const Packet> packet, const WifiMacHeader &hdr);
void SetMsduAggregator (Ptr<MsduAggregator> aggr);
@@ -185,7 +187,7 @@
* if an established block ack agreement exists with the receiver.
*/
void VerifyBlockAck (void);
-
+
AcIndex m_ac;
class Dcf;
class TransmissionListener;
@@ -204,12 +206,12 @@
RandomStream *m_rng;
Ptr<WifiRemoteStationManager> m_stationManager;
uint8_t m_fragmentNumber;
-
+
/* current packet could be a simple MSDU or, if an aggregator for this queue is
present, could be an A-MSDU.
*/
Ptr<const Packet> m_currentPacket;
-
+
WifiMacHeader m_currentHdr;
Ptr<MsduAggregator> m_aggregator;
TypeOfStation m_typeOfStation;
--- a/src/devices/wifi/mac-low.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/devices/wifi/mac-low.h Tue Dec 21 17:46:35 2010 +0100
@@ -453,16 +453,22 @@
*/
void NotifySwitchingStartNow (Time duration);
/**
- * \param respHdr Add block ack response from originator (action frame).
- * \param originator Address of peer station involved in block ack mechanism.
- * \param startingSeq Sequence number of the first MPDU of all packets for which block ack was negotiated.
- *
- * This function is typically invoked only by ns3::QapWifiMac and ns3::QstaWifiMac.
- * If we are transmitting an Add block ack response, MacLow must allocate buffers to collect
- * all correctly received packets belonging to category for which block ack was negotiated.
- * It's needed in order to send a Block ack after corresponding originator's Block ack request.
+ * \param respHdr Add block ack response from originator (action
+ * frame).
+ * \param originator Address of peer station involved in block ack
+ * mechanism.
+ * \param startingSeq Sequence number of the first MPDU of all
+ * packets for which block ack was negotiated.
+ *
+ * This function is typically invoked only by ns3::RegularWifiMac
+ * when the STA (which may be non-AP in ESS, or in an IBSS) has
+ * received an ADDBA Request frame and is transmitting an ADDBA
+ * Response frame. At this point MacLow must allocate buffers to
+ * collect all correctly received packets belonging to the category
+ * for which Block Ack was negotiated.
*/
- void CreateBlockAckAgreement (const MgtAddBaResponseHeader *respHdr, Mac48Address originator,
+ void CreateBlockAckAgreement (const MgtAddBaResponseHeader *respHdr,
+ Mac48Address originator,
uint16_t startingSeq);
/**
* \param originator Address of peer participating in Block Ack mechanism.
@@ -632,7 +638,7 @@
typedef std::map<AgreementKey, BlockAckCache> BlockAckCaches;
typedef std::map<AgreementKey, BlockAckCache>::iterator BlockAckCachesI;
-
+
Agreements m_bAckAgreements;
BlockAckCaches m_bAckCaches;
--- a/src/devices/wifi/msdu-aggregator.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/devices/wifi/msdu-aggregator.h Tue Dec 21 17:46:35 2010 +0100
@@ -38,6 +38,7 @@
{
public:
typedef std::list<std::pair<Ptr<Packet>, AmsduSubframeHeader> > DeaggregatedMsdus;
+ typedef std::list<std::pair<Ptr<Packet>, AmsduSubframeHeader> >::const_iterator DeaggregatedMsdusCI;
static TypeId GetTypeId (void);
/* Adds <i>packet</i> to <i>aggregatedPacket</i>. In concrete aggregator's implementation is
--- a/src/devices/wifi/nqap-wifi-mac.cc Tue Dec 21 17:39:54 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,623 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2005,2006 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
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#include "ns3/assert.h"
-#include "ns3/log.h"
-#include "ns3/simulator.h"
-#include "ns3/node.h"
-#include "ns3/boolean.h"
-
-#include "nqap-wifi-mac.h"
-#include "dca-txop.h"
-#include "wifi-mac-header.h"
-#include "mgt-headers.h"
-#include "wifi-phy.h"
-#include "dcf-manager.h"
-#include "mac-rx-middle.h"
-#include "mac-low.h"
-#include "wifi-mac-trailer.h"
-#include "ns3/pointer.h"
-
-NS_LOG_COMPONENT_DEFINE ("NqapWifiMac");
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED (NqapWifiMac);
-
-#undef NS_LOG_APPEND_CONTEXT
-#define NS_LOG_APPEND_CONTEXT if (m_low != 0) {std::clog << "[mac=" << m_low->GetAddress () << "] ";}
-
-TypeId
-NqapWifiMac::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::NqapWifiMac")
- .SetParent<WifiMac> ()
- .AddConstructor<NqapWifiMac> ()
- .AddAttribute ("BeaconInterval", "Delay between two beacons",
- TimeValue (MicroSeconds (102400)),
- MakeTimeAccessor (&NqapWifiMac::GetBeaconInterval,
- &NqapWifiMac::SetBeaconInterval),
- MakeTimeChecker ())
- .AddAttribute ("BeaconGeneration", "Whether or not beacons are generated.",
- BooleanValue (true),
- MakeBooleanAccessor (&NqapWifiMac::SetBeaconGeneration,
- &NqapWifiMac::GetBeaconGeneration),
- MakeBooleanChecker ())
- .AddAttribute ("DcaTxop", "The DcaTxop object",
- PointerValue (),
- MakePointerAccessor (&NqapWifiMac::GetDcaTxop),
- MakePointerChecker<DcaTxop> ())
- ;
- return tid;
-}
-
-NqapWifiMac::NqapWifiMac ()
-{
- NS_LOG_FUNCTION (this);
- m_rxMiddle = new MacRxMiddle ();
- m_rxMiddle->SetForwardCallback (MakeCallback (&NqapWifiMac::Receive, this));
-
- m_low = CreateObject<MacLow> ();
- m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle));
-
- m_dcfManager = new DcfManager ();
- m_dcfManager->SetupLowListener (m_low);
-
- m_beaconDca = CreateObject<DcaTxop> ();
- m_beaconDca->SetAifsn(1);
- m_beaconDca->SetMinCw(0);
- m_beaconDca->SetMaxCw(0);
- m_beaconDca->SetLow (m_low);
- m_beaconDca->SetManager (m_dcfManager);
-
- m_dca = CreateObject<DcaTxop> ();
- m_dca->SetLow (m_low);
- m_dca->SetManager (m_dcfManager);
- m_dca->SetTxOkCallback (MakeCallback (&NqapWifiMac::TxOk, this));
- m_dca->SetTxFailedCallback (MakeCallback (&NqapWifiMac::TxFailed, this));
-
- m_enableBeaconGeneration = false;
-}
-NqapWifiMac::~NqapWifiMac ()
-{
- NS_LOG_FUNCTION (this);
-}
-
-void
-NqapWifiMac::DoDispose (void)
-{
- NS_LOG_FUNCTION (this);
- delete m_rxMiddle;
- delete m_dcfManager;
- m_low->Dispose ();
- m_rxMiddle = 0;
- m_low = 0;
- m_dcfManager = 0;
- m_phy = 0;
- m_dca = 0;
- m_beaconDca = 0;
- m_stationManager = 0;
- m_enableBeaconGeneration = false;
- m_beaconEvent.Cancel ();
- WifiMac::DoDispose ();
-}
-
-void
-NqapWifiMac::SetBeaconGeneration (bool enable)
-{
- NS_LOG_FUNCTION (this << enable);
- if (!enable)
- {
- m_beaconEvent.Cancel ();
- }
- else if (enable && !m_enableBeaconGeneration)
- {
- m_beaconEvent = Simulator::ScheduleNow (&NqapWifiMac::SendOneBeacon, this);
- }
- m_enableBeaconGeneration = enable;
-}
-
-bool
-NqapWifiMac::GetBeaconGeneration (void) const
-{
- return m_enableBeaconGeneration;
-}
-Time
-NqapWifiMac::GetBeaconInterval (void) const
-{
- return m_beaconInterval;
-}
-
-void
-NqapWifiMac::SetSlot (Time slotTime)
-{
- NS_LOG_FUNCTION (this << slotTime);
- m_dcfManager->SetSlot (slotTime);
- m_low->SetSlotTime (slotTime);
-}
-void
-NqapWifiMac::SetSifs (Time sifs)
-{
- NS_LOG_FUNCTION (this << sifs);
- m_dcfManager->SetSifs (sifs);
- m_low->SetSifs (sifs);
-}
-void
-NqapWifiMac::SetEifsNoDifs (Time eifsNoDifs)
-{
- NS_LOG_FUNCTION (this << eifsNoDifs);
- m_dcfManager->SetEifsNoDifs (eifsNoDifs);
-}
-void
-NqapWifiMac::SetAckTimeout (Time ackTimeout)
-{
- m_low->SetAckTimeout (ackTimeout);
-}
-void
-NqapWifiMac::SetCtsTimeout (Time ctsTimeout)
-{
- m_low->SetCtsTimeout (ctsTimeout);
-}
-void
-NqapWifiMac::SetPifs (Time pifs)
-{
- m_low->SetPifs (pifs);
-}
-Time
-NqapWifiMac::GetSlot (void) const
-{
- return m_low->GetSlotTime ();
-}
-Time
-NqapWifiMac::GetSifs (void) const
-{
- return m_low->GetSifs ();
-}
-Time
-NqapWifiMac::GetEifsNoDifs (void) const
-{
- return m_dcfManager->GetEifsNoDifs ();
-}
-Time
-NqapWifiMac::GetAckTimeout (void) const
-{
- return m_low->GetAckTimeout ();
-}
-Time
-NqapWifiMac::GetCtsTimeout (void) const
-{
- return m_low->GetCtsTimeout ();
-}
-Time
-NqapWifiMac::GetPifs (void) const
-{
- return m_low->GetPifs ();
-}
-void
-NqapWifiMac::SetWifiPhy (Ptr<WifiPhy> phy)
-{
- NS_LOG_FUNCTION (this << phy);
- m_phy = phy;
- m_dcfManager->SetupPhyListener (phy);
- m_low->SetPhy (phy);
-}
-void
-NqapWifiMac::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager)
-{
- NS_LOG_FUNCTION (this << stationManager);
- m_stationManager = stationManager;
- m_dca->SetWifiRemoteStationManager (stationManager);
- m_beaconDca->SetWifiRemoteStationManager (stationManager);
- m_low->SetWifiRemoteStationManager (stationManager);
-}
-void
-NqapWifiMac::SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback)
-{
- NS_LOG_FUNCTION (this);
- m_upCallback = upCallback;
-}
-void
-NqapWifiMac::SetLinkUpCallback (Callback<void> linkUp)
-{
- NS_LOG_FUNCTION (this);
- if (!linkUp.IsNull ())
- {
- linkUp ();
- }
-}
-void
-NqapWifiMac::SetLinkDownCallback (Callback<void> linkDown)
-{
- NS_LOG_FUNCTION (this);
-}
-Mac48Address
-NqapWifiMac::GetAddress (void) const
-{
- return m_low->GetAddress ();
-}
-Ssid
-NqapWifiMac::GetSsid (void) const
-{
- return m_ssid;
-}
-void
-NqapWifiMac::SetAddress (Mac48Address address)
-{
- NS_LOG_FUNCTION (address);
- m_low->SetAddress (address);
- m_low->SetBssid (address);
-}
-void
-NqapWifiMac::SetSsid (Ssid ssid)
-{
- NS_LOG_FUNCTION (ssid);
- m_ssid = ssid;
-}
-Mac48Address
-NqapWifiMac::GetBssid (void) const
-{
- return m_low->GetBssid ();
-}
-
-
-void
-NqapWifiMac::SetBeaconInterval (Time interval)
-{
- NS_LOG_FUNCTION (this << interval);
- if ((interval.GetMicroSeconds () % 1024) != 0)
- {
- NS_LOG_WARN ("beacon interval should be multiple of 1024us, see IEEE Std. 802.11-2007, section 11.1.1.1");
- }
- m_beaconInterval = interval;
-}
-void
-NqapWifiMac::StartBeaconing (void)
-{
- NS_LOG_FUNCTION (this);
- SendOneBeacon ();
-}
-void
-NqapWifiMac::ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to)
-{
- NS_LOG_FUNCTION (this << packet << from);
- m_upCallback (packet, from, to);
-}
-
-void
-NqapWifiMac::ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to)
-{
- NS_LOG_FUNCTION (this << packet << from << to);
- WifiMacHeader hdr;
- hdr.SetTypeData ();
- hdr.SetAddr1 (to);
- hdr.SetAddr2 (GetAddress ());
- hdr.SetAddr3 (from);
- hdr.SetDsFrom ();
- hdr.SetDsNotTo ();
- m_dca->Queue (packet, hdr);
-}
-void
-NqapWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from)
-{
- NS_LOG_FUNCTION (this << packet << to << from);
- if (to.IsBroadcast () || m_stationManager->IsAssociated (to))
- {
- ForwardDown (packet, from, to);
- }
-}
-void
-NqapWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to)
-{
- NS_LOG_FUNCTION (this << packet << to);
- if (to.IsBroadcast () || m_stationManager->IsAssociated (to))
- {
- ForwardDown (packet, m_low->GetAddress (), to);
- }
-}
-bool
-NqapWifiMac::SupportsSendFrom (void) const
-{
- return true;
-}
-SupportedRates
-NqapWifiMac::GetSupportedRates (void) const
-{
- // send the set of supported rates and make sure that we indicate
- // the Basic Rate set in this set of supported rates.
- SupportedRates rates;
- for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
- {
- WifiMode mode = m_phy->GetMode (i);
- rates.AddSupportedRate (mode.GetDataRate ());
- }
- // set the basic rates
- for (uint32_t j = 0; j < m_stationManager->GetNBasicModes (); j++)
- {
- WifiMode mode = m_stationManager->GetBasicMode (j);
- rates.SetBasicRate (mode.GetDataRate ());
- }
- return rates;
-}
-void
-NqapWifiMac::SendProbeResp (Mac48Address to)
-{
- NS_LOG_FUNCTION (this << to);
- WifiMacHeader hdr;
- hdr.SetProbeResp ();
- hdr.SetAddr1 (to);
- hdr.SetAddr2 (GetAddress ());
- hdr.SetAddr3 (GetAddress ());
- hdr.SetDsNotFrom ();
- hdr.SetDsNotTo ();
- Ptr<Packet> packet = Create<Packet> ();
- MgtProbeResponseHeader probe;
- probe.SetSsid (GetSsid ());
- probe.SetSupportedRates (GetSupportedRates ());
- probe.SetBeaconIntervalUs (m_beaconInterval.GetMicroSeconds ());
- packet->AddHeader (probe);
-
- m_dca->Queue (packet, hdr);
-}
-void
-NqapWifiMac::SendAssocResp (Mac48Address to, bool success)
-{
- NS_LOG_FUNCTION (this << to << success);
- WifiMacHeader hdr;
- hdr.SetAssocResp ();
- hdr.SetAddr1 (to);
- hdr.SetAddr2 (GetAddress ());
- hdr.SetAddr3 (GetAddress ());
- hdr.SetDsNotFrom ();
- hdr.SetDsNotTo ();
- Ptr<Packet> packet = Create<Packet> ();
- MgtAssocResponseHeader assoc;
- StatusCode code;
- if (success)
- {
- code.SetSuccess ();
- }
- else
- {
- code.SetFailure ();
- }
- assoc.SetSupportedRates (GetSupportedRates ());
- assoc.SetStatusCode (code);
- packet->AddHeader (assoc);
-
- m_dca->Queue (packet, hdr);
-}
-void
-NqapWifiMac::SendOneBeacon (void)
-{
- NS_LOG_FUNCTION (this);
- WifiMacHeader hdr;
- hdr.SetBeacon ();
- hdr.SetAddr1 (Mac48Address::GetBroadcast ());
- hdr.SetAddr2 (GetAddress ());
- hdr.SetAddr3 (GetAddress ());
- hdr.SetDsNotFrom ();
- hdr.SetDsNotTo ();
- Ptr<Packet> packet = Create<Packet> ();
- MgtBeaconHeader beacon;
- beacon.SetSsid (GetSsid ());
- beacon.SetSupportedRates (GetSupportedRates ());
- beacon.SetBeaconIntervalUs (m_beaconInterval.GetMicroSeconds ());
- packet->AddHeader (beacon);
-
- m_beaconDca->Queue (packet, hdr);
- m_beaconEvent = Simulator::Schedule (m_beaconInterval, &NqapWifiMac::SendOneBeacon, this);
-}
-void
-NqapWifiMac::TxOk (const WifiMacHeader &hdr)
-{
- NS_LOG_FUNCTION (this);
- if (hdr.IsAssocResp () &&
- m_stationManager->IsWaitAssocTxOk (hdr.GetAddr1 ()))
- {
- NS_LOG_DEBUG ("associated with sta="<<hdr.GetAddr1 ());
- m_stationManager->RecordGotAssocTxOk (hdr.GetAddr1 ());
- }
-}
-void
-NqapWifiMac::TxFailed (const WifiMacHeader &hdr)
-{
- NS_LOG_FUNCTION (this);
- if (hdr.IsAssocResp () &&
- m_stationManager->IsWaitAssocTxOk (hdr.GetAddr1 ()))
- {
- NS_LOG_DEBUG ("assoc failed with sta="<<hdr.GetAddr1 ());
- m_stationManager->RecordGotAssocTxFailed (hdr.GetAddr1 ());
- }
-}
-void
-NqapWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
-{
- NS_LOG_FUNCTION (this << packet << hdr);
-
- Mac48Address from = hdr->GetAddr2 ();
-
- if (hdr->IsData ())
- {
- Mac48Address bssid = hdr->GetAddr1 ();
- if (!hdr->IsFromDs () &&
- hdr->IsToDs () &&
- bssid == GetAddress () &&
- m_stationManager->IsAssociated (from))
- {
- Mac48Address to = hdr->GetAddr3 ();
- if (to == GetAddress ())
- {
- NS_LOG_DEBUG ("frame for me from="<<from);
- ForwardUp (packet, from, bssid);
- }
- else if (to.IsGroup () ||
- m_stationManager->IsAssociated (to))
- {
- NS_LOG_DEBUG ("forwarding frame from="<<from<<", to="<<to);
- Ptr<Packet> copy = packet->Copy ();
- ForwardDown (packet,
- from,
- to);
- ForwardUp (copy, from, to);
- }
- else
- {
- ForwardUp (packet, from, to);
- }
- }
- else if (hdr->IsFromDs () &&
- hdr->IsToDs ())
- {
- // this is an AP-to-AP frame
- // we ignore for now.
- NotifyRxDrop (packet);
- }
- else
- {
- // we can ignore these frames since
- // they are not targeted at the AP
- NotifyRxDrop (packet);
- }
- }
- else if (hdr->IsMgt ())
- {
- if (hdr->IsProbeReq ())
- {
- NS_ASSERT (hdr->GetAddr1 ().IsBroadcast ());
- SendProbeResp (hdr->GetAddr2 ());
- }
- else if (hdr->GetAddr1 () == GetAddress ())
- {
- if (hdr->IsAssocReq ())
- {
- // first, verify that the the station's supported
- // rate set is compatible with our Basic Rate set
- MgtAssocRequestHeader assocReq;
- packet->RemoveHeader (assocReq);
- SupportedRates rates = assocReq.GetSupportedRates ();
- bool problem = false;
- for (uint32_t i = 0; i < m_stationManager->GetNBasicModes (); i++)
- {
- WifiMode mode = m_stationManager->GetBasicMode (i);
- if (!rates.IsSupportedRate (mode.GetDataRate ()))
- {
- problem = true;
- break;
- }
- }
- if (problem)
- {
- // one of the Basic Rate set mode is not
- // supported by the station. So, we return an assoc
- // response with an error status.
- SendAssocResp (hdr->GetAddr2 (), false);
- }
- else
- {
- // station supports all rates in Basic Rate Set.
- // record all its supported modes in its associated WifiRemoteStation
- for (uint32_t j = 0; j < m_phy->GetNModes (); j++)
- {
- WifiMode mode = m_phy->GetMode (j);
- if (rates.IsSupportedRate (mode.GetDataRate ()))
- {
- m_stationManager->AddSupportedMode (from, mode);
- }
- }
- m_stationManager->RecordWaitAssocTxOk (from);
- // send assoc response with success status.
- SendAssocResp (hdr->GetAddr2 (), true);
- }
- }
- else if (hdr->IsDisassociation ())
- {
- m_stationManager->RecordDisassociated (from);
- }
- else if (hdr->IsReassocReq ())
- {
- /* we don't support reassoc frames for now */
- }
- else if (hdr->IsAuthentication () ||
- hdr->IsDeauthentication ())
- {
- /*
- */
- }
- else
- {
- /* unknown mgt frame
- */
- }
- }
- }
- else
- {
- /* damn, what could this be ? a control frame ?
- * control frames should never reach the MacHigh so,
- * this is likely to be a bug. assert.
- */
- NS_ASSERT (false);
- }
-}
-Ptr<DcaTxop>
-NqapWifiMac::GetDcaTxop(void) const
-{
- return m_dca;
-}
-
-void
-NqapWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard)
-{
- switch (standard)
- {
- case WIFI_PHY_STANDARD_holland:
- // fall through
- case WIFI_PHY_STANDARD_80211_10Mhz:
- // fall through
- case WIFI_PHY_STANDARD_80211_5Mhz:
- // fall through
- case WIFI_PHY_STANDARD_80211a:
- // fall through
- case WIFI_PHY_STANDARD_80211g:
- ConfigureDcf (m_dca, 15, 1023, AC_BE_NQOS);
- break;
- case WIFI_PHY_STANDARD_80211b:
- ConfigureDcf (m_dca, 31, 1023, AC_BE_NQOS);
- break;
- default:
- NS_ASSERT (false);
- break;
- }
-}
-
-
-void
-NqapWifiMac::DoStart (void)
-{
- m_beaconEvent.Cancel ();
- if (m_enableBeaconGeneration)
- {
- m_beaconEvent = Simulator::ScheduleNow (&NqapWifiMac::SendOneBeacon, this);
- }
- m_dca->Start ();
- m_beaconDca->Start ();
- WifiMac::DoStart ();
-}
-
-} // namespace ns3
--- a/src/devices/wifi/nqap-wifi-mac.h Tue Dec 21 17:39:54 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2005,2006 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
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#ifndef MAC_HIGH_NQAP_H
-#define MAC_HIGH_NQAP_H
-
-#include <stdint.h>
-
-#include "ns3/mac48-address.h"
-#include "ns3/callback.h"
-#include "ns3/packet.h"
-#include "ns3/nstime.h"
-#include "supported-rates.h"
-#include "wifi-remote-station-manager.h"
-#include "wifi-mac.h"
-
-namespace ns3 {
-
-class WifiMacHeader;
-class DcaTxop;
-class WifiPhy;
-class DcfManager;
-class MacRxMiddle;
-class MacLow;
-
-/**
- * \brief non-QoS AP state machine
- *
- * Handle association, dis-association and authentication,
- * of STAs within an IBSS.
- * This class uses two output queues, each of which is server by
- * a single DCF
- * - the highest priority DCF serves the queue which contains
- * only beacons.
- * - the lowest priority DCF serves the queue which contains all
- * other frames, including user data frames.
- */
-class NqapWifiMac : public WifiMac
-{
-public:
- static TypeId GetTypeId (void);
-
- NqapWifiMac ();
- ~NqapWifiMac ();
-
- // inherited from WifiMac.
- virtual void SetSlot (Time slotTime);
- virtual void SetSifs (Time sifs);
- virtual void SetEifsNoDifs (Time eifsNoDifs);
- virtual void SetAckTimeout (Time ackTimeout);
- virtual void SetCtsTimeout (Time ctsTimeout);
- virtual void SetPifs (Time pifs);
- virtual Time GetSlot (void) const;
- virtual Time GetSifs (void) const;
- virtual Time GetEifsNoDifs (void) const;
- virtual Time GetAckTimeout (void) const;
- virtual Time GetCtsTimeout (void) const;
- virtual Time GetPifs (void) const;
- virtual void SetWifiPhy (Ptr<WifiPhy> phy);
- virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager);
- virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
- virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to);
- virtual bool SupportsSendFrom (void) const;
- virtual void SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback);
- virtual void SetLinkUpCallback (Callback<void> linkUp);
- virtual void SetLinkDownCallback (Callback<void> linkDown);
- virtual Mac48Address GetAddress (void) const;
- virtual Ssid GetSsid (void) const;
- virtual void SetAddress (Mac48Address address);
- virtual void SetSsid (Ssid ssid);
- virtual Mac48Address GetBssid (void) const;
-
- /**
- * \param interval the interval between two beacon transmissions.
- */
- void SetBeaconInterval (Time interval);
- /**
- * \returns the interval between two beacon transmissions.
- */
- Time GetBeaconInterval (void) const;
- /**
- * Start beacon transmission immediately.
- */
- void StartBeaconing (void);
-
-private:
- void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
- void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
- void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to);
- void TxOk (const WifiMacHeader &hdr);
- void TxFailed (const WifiMacHeader &hdr);
- void SendProbeResp (Mac48Address to);
- void SendAssocResp (Mac48Address to, bool success);
- void SendOneBeacon (void);
- SupportedRates GetSupportedRates (void) const;
- void SetBeaconGeneration (bool enable);
- bool GetBeaconGeneration (void) const;
- virtual void DoDispose (void);
- virtual void DoStart (void);
- NqapWifiMac (const NqapWifiMac & ctor_arg);
- NqapWifiMac &operator = (const NqapWifiMac &o);
- Ptr<DcaTxop> GetDcaTxop (void) const;
- virtual void FinishConfigureStandard (enum WifiPhyStandard standard);
-
- Ptr<DcaTxop> m_dca;
- Ptr<DcaTxop> m_beaconDca;
- Ptr<WifiRemoteStationManager> m_stationManager;
- Ptr<WifiPhy> m_phy;
- Callback<void, Ptr<Packet>,Mac48Address, Mac48Address> m_upCallback;
- Time m_beaconInterval;
- bool m_enableBeaconGeneration;
-
- DcfManager *m_dcfManager;
- MacRxMiddle *m_rxMiddle;
- Ptr<MacLow> m_low;
- Ssid m_ssid;
- EventId m_beaconEvent;
-};
-
-} // namespace ns3
-
-
-#endif /* MAC_HIGH_NQAP_H */
--- a/src/devices/wifi/nqsta-wifi-mac.cc Tue Dec 21 17:39:54 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,697 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2005,2006 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
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-
-#include "ns3/packet.h"
-#include "ns3/simulator.h"
-#include "ns3/assert.h"
-#include "ns3/log.h"
-#include "ns3/node.h"
-#include "ns3/uinteger.h"
-#include "ns3/boolean.h"
-#include "ns3/trace-source-accessor.h"
-
-#include "nqsta-wifi-mac.h"
-#include "wifi-mac-header.h"
-#include "mgt-headers.h"
-#include "wifi-phy.h"
-#include "dca-txop.h"
-#include "mac-low.h"
-#include "dcf-manager.h"
-#include "mac-rx-middle.h"
-#include "wifi-mac-trailer.h"
-#include "ns3/trace-source-accessor.h"
-#include "ns3/pointer.h"
-
-NS_LOG_COMPONENT_DEFINE ("NqstaWifiMac");
-
-#undef NS_LOG_APPEND_CONTEXT
-#define NS_LOG_APPEND_CONTEXT if (m_low != 0) {std::clog << "[mac=" << m_low->GetAddress () << "] ";}
-
-/*
- * The state machine for this NQSTA is:
- -------------- -----------
- | Associated | <-------------------- -------> | Refused |
- -------------- \ / -----------
- \ \ /
- \ ----------------- -----------------------------
- \-> | Beacon Missed | --> | Wait Association Response |
- ----------------- -----------------------------
- \ ^
- \ |
- \ -----------------------
- \-> | Wait Probe Response |
- -----------------------
- */
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED (NqstaWifiMac);
-
-TypeId
-NqstaWifiMac::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::NqstaWifiMac")
- .SetParent<WifiMac> ()
- .AddConstructor<NqstaWifiMac> ()
- .AddAttribute ("ProbeRequestTimeout", "The interval between two consecutive probe request attempts.",
- TimeValue (Seconds (0.05)),
- MakeTimeAccessor (&NqstaWifiMac::m_probeRequestTimeout),
- MakeTimeChecker ())
- .AddAttribute ("AssocRequestTimeout", "The interval between two consecutive assoc request attempts.",
- TimeValue (Seconds (0.5)),
- MakeTimeAccessor (&NqstaWifiMac::m_assocRequestTimeout),
- MakeTimeChecker ())
- .AddAttribute ("MaxMissedBeacons",
- "Number of beacons which much be consecutively missed before "
- "we attempt to restart association.",
- UintegerValue (10),
- MakeUintegerAccessor (&NqstaWifiMac::m_maxMissedBeacons),
- MakeUintegerChecker<uint32_t> ())
- .AddAttribute ("ActiveProbing", "If true, we send probe requests. If false, we don't.",
- BooleanValue (false),
- MakeBooleanAccessor (&NqstaWifiMac::SetActiveProbing),
- MakeBooleanChecker ())
- .AddAttribute ("DcaTxop", "The DcaTxop object",
- PointerValue (),
- MakePointerAccessor (&NqstaWifiMac::GetDcaTxop),
- MakePointerChecker<DcaTxop> ())
- .AddTraceSource ("Assoc", "Associated with an access point.",
- MakeTraceSourceAccessor (&NqstaWifiMac::m_assocLogger))
- .AddTraceSource ("DeAssoc", "Association with an access point lost.",
- MakeTraceSourceAccessor (&NqstaWifiMac::m_deAssocLogger))
- ;
- return tid;
-}
-
-NqstaWifiMac::NqstaWifiMac ()
- : m_state (BEACON_MISSED),
- m_probeRequestEvent (),
- m_assocRequestEvent (),
- m_beaconWatchdogEnd (Seconds (0.0))
-{
- NS_LOG_FUNCTION (this);
- m_rxMiddle = new MacRxMiddle ();
- m_rxMiddle->SetForwardCallback (MakeCallback (&NqstaWifiMac::Receive, this));
-
- m_low = CreateObject<MacLow> ();
- m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle));
-
- m_dcfManager = new DcfManager ();
- m_dcfManager->SetupLowListener (m_low);
-
- m_dca = CreateObject<DcaTxop> ();
- m_dca->SetLow (m_low);
- m_dca->SetManager (m_dcfManager);
-}
-
-NqstaWifiMac::~NqstaWifiMac ()
-{
- NS_LOG_FUNCTION (this);
-}
-
-void
-NqstaWifiMac::DoDispose (void)
-{
- NS_LOG_FUNCTION (this);
- delete m_rxMiddle;
- delete m_dcfManager;
- m_low->Dispose ();
- m_rxMiddle = 0;
- m_low = 0;
- m_dcfManager = 0;
- m_phy = 0;
- m_dca = 0;
- m_stationManager = 0;
- WifiMac::DoDispose ();
-}
-
-void
-NqstaWifiMac::SetSlot (Time slotTime)
-{
- NS_LOG_FUNCTION (this << slotTime);
- m_dcfManager->SetSlot (slotTime);
- m_low->SetSlotTime (slotTime);
-}
-void
-NqstaWifiMac::SetSifs (Time sifs)
-{
- NS_LOG_FUNCTION (this << sifs);
- m_dcfManager->SetSifs (sifs);
- m_low->SetSifs (sifs);
-}
-void
-NqstaWifiMac::SetEifsNoDifs (Time eifsNoDifs)
-{
- NS_LOG_FUNCTION (this << eifsNoDifs);
- m_dcfManager->SetEifsNoDifs (eifsNoDifs);
-}
-void
-NqstaWifiMac::SetAckTimeout (Time ackTimeout)
-{
- m_low->SetAckTimeout (ackTimeout);
-}
-void
-NqstaWifiMac::SetCtsTimeout (Time ctsTimeout)
-{
- m_low->SetCtsTimeout (ctsTimeout);
-}
-void
-NqstaWifiMac::SetPifs (Time pifs)
-{
- m_low->SetPifs (pifs);
-}
-Time
-NqstaWifiMac::GetSlot (void) const
-{
- return m_low->GetSlotTime ();
-}
-Time
-NqstaWifiMac::GetSifs (void) const
-{
- return m_low->GetSifs ();
-}
-Time
-NqstaWifiMac::GetEifsNoDifs (void) const
-{
- return m_dcfManager->GetEifsNoDifs ();
-}
-Time
-NqstaWifiMac::GetAckTimeout (void) const
-{
- return m_low->GetAckTimeout ();
-}
-Time
-NqstaWifiMac::GetCtsTimeout (void) const
-{
- return m_low->GetCtsTimeout ();
-}
-Time
-NqstaWifiMac::GetPifs (void) const
-{
- return m_low->GetPifs ();
-}
-Ptr<DcaTxop>
-NqstaWifiMac::GetDcaTxop(void) const
-{
- return m_dca;
-}
-void
-NqstaWifiMac::SetWifiPhy (Ptr<WifiPhy> phy)
-{
- m_phy = phy;
- m_dcfManager->SetupPhyListener (phy);
- m_low->SetPhy (phy);
-}
-void
-NqstaWifiMac::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager)
-{
- m_stationManager = stationManager;
- m_dca->SetWifiRemoteStationManager (stationManager);
- m_low->SetWifiRemoteStationManager (stationManager);
-}
-void
-NqstaWifiMac::SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback)
-{
- m_forwardUp = upCallback;
-}
-void
-NqstaWifiMac::SetLinkUpCallback (Callback<void> linkUp)
-{
- m_linkUp = linkUp;
-}
-void
-NqstaWifiMac::SetLinkDownCallback (Callback<void> linkDown)
-{
- m_linkDown = linkDown;
-}
-Mac48Address
-NqstaWifiMac::GetAddress (void) const
-{
- return m_low->GetAddress ();
-}
-Ssid
-NqstaWifiMac::GetSsid (void) const
-{
- return m_ssid;
-}
-Mac48Address
-NqstaWifiMac::GetBssid (void) const
-{
- return m_low->GetBssid ();
-}
-void
-NqstaWifiMac::SetAddress (Mac48Address address)
-{
- NS_LOG_FUNCTION (this << address);
- m_low->SetAddress (address);
-}
-void
-NqstaWifiMac::SetSsid (Ssid ssid)
-{
- NS_LOG_FUNCTION (this << ssid);
- m_ssid = ssid;
-}
-void
-NqstaWifiMac::SetMaxMissedBeacons (uint32_t missed)
-{
- NS_LOG_FUNCTION (this << missed);
- m_maxMissedBeacons = missed;
-}
-void
-NqstaWifiMac::SetProbeRequestTimeout (Time timeout)
-{
- NS_LOG_FUNCTION (this << timeout);
- m_probeRequestTimeout = timeout;
-}
-void
-NqstaWifiMac::SetAssocRequestTimeout (Time timeout)
-{
- NS_LOG_FUNCTION (this << timeout);
- m_assocRequestTimeout = timeout;
-}
-
-void
-NqstaWifiMac::StartActiveAssociation (void)
-{
- NS_LOG_FUNCTION (this);
- TryToEnsureAssociated ();
-}
-
-Mac48Address
-NqstaWifiMac::GetBroadcastBssid (void)
-{
- return Mac48Address::GetBroadcast ();
-}
-
-void
-NqstaWifiMac::SetBssid (Mac48Address bssid)
-{
- NS_LOG_FUNCTION (this << bssid);
- m_low->SetBssid (bssid);
-}
-void
-NqstaWifiMac::SetActiveProbing (bool enable)
-{
- NS_LOG_FUNCTION (this << enable);
- if (enable)
- {
- TryToEnsureAssociated ();
- }
- else
- {
- m_probeRequestEvent.Cancel ();
- }
-}
-void
-NqstaWifiMac::ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to)
-{
- NS_LOG_FUNCTION (this << packet << from << to);
- m_forwardUp (packet, from, to);
-}
-void
-NqstaWifiMac::SendProbeRequest (void)
-{
- NS_LOG_FUNCTION (this);
- WifiMacHeader hdr;
- hdr.SetProbeReq ();
- hdr.SetAddr1 (GetBroadcastBssid ());
- hdr.SetAddr2 (GetAddress ());
- hdr.SetAddr3 (GetBroadcastBssid ());
- hdr.SetDsNotFrom ();
- hdr.SetDsNotTo ();
- Ptr<Packet> packet = Create<Packet> ();
- MgtProbeRequestHeader probe;
- probe.SetSsid (GetSsid ());
- probe.SetSupportedRates (GetSupportedRates ());
- packet->AddHeader (probe);
-
- m_dca->Queue (packet, hdr);
-
- m_probeRequestEvent = Simulator::Schedule (m_probeRequestTimeout,
- &NqstaWifiMac::ProbeRequestTimeout, this);
-}
-
-void
-NqstaWifiMac::SendAssociationRequest (void)
-{
- NS_LOG_FUNCTION (this << GetBssid ());
- WifiMacHeader hdr;
- hdr.SetAssocReq ();
- hdr.SetAddr1 (GetBssid ());
- hdr.SetAddr2 (GetAddress ());
- hdr.SetAddr3 (GetBssid ());
- hdr.SetDsNotFrom ();
- hdr.SetDsNotTo ();
- Ptr<Packet> packet = Create<Packet> ();
- MgtAssocRequestHeader assoc;
- assoc.SetSsid (GetSsid ());
- assoc.SetSupportedRates (GetSupportedRates ());
- packet->AddHeader (assoc);
-
- m_dca->Queue (packet, hdr);
-
- m_assocRequestEvent = Simulator::Schedule (m_assocRequestTimeout,
- &NqstaWifiMac::AssocRequestTimeout, this);
-}
-void
-NqstaWifiMac::TryToEnsureAssociated (void)
-{
- NS_LOG_FUNCTION (this);
- switch (m_state) {
- case ASSOCIATED:
- return;
- break;
- case WAIT_PROBE_RESP:
- /* we have sent a probe request earlier so we
- do not need to re-send a probe request immediately.
- We just need to wait until probe-request-timeout
- or until we get a probe response
- */
- break;
- case BEACON_MISSED:
- /* we were associated but we missed a bunch of beacons
- * so we should assume we are not associated anymore.
- * We try to initiate a probe request now.
- */
- m_linkDown ();
- SetState (WAIT_PROBE_RESP);
- SendProbeRequest ();
- break;
- case WAIT_ASSOC_RESP:
- /* we have sent an assoc request so we do not need to
- re-send an assoc request right now. We just need to
- wait until either assoc-request-timeout or until
- we get an assoc response.
- */
- break;
- case REFUSED:
- /* we have sent an assoc request and received a negative
- assoc resp. We wait until someone restarts an
- association with a given ssid.
- */
- break;
- }
-}
-
-void
-NqstaWifiMac::AssocRequestTimeout (void)
-{
- NS_LOG_FUNCTION (this);
- SetState (WAIT_ASSOC_RESP);
- SendAssociationRequest ();
-}
-void
-NqstaWifiMac::ProbeRequestTimeout (void)
-{
- NS_LOG_FUNCTION (this);
- SetState (WAIT_PROBE_RESP);
- SendProbeRequest ();
-}
-void
-NqstaWifiMac::MissedBeacons (void)
-{
- NS_LOG_FUNCTION (this);
- if (m_beaconWatchdogEnd > Simulator::Now ())
- {
- m_beaconWatchdog = Simulator::Schedule (m_beaconWatchdogEnd - Simulator::Now (),
- &NqstaWifiMac::MissedBeacons, this);
- return;
- }
- NS_LOG_DEBUG ("beacon missed");
- SetState (BEACON_MISSED);
- TryToEnsureAssociated ();
-}
-void
-NqstaWifiMac::RestartBeaconWatchdog (Time delay)
-{
- NS_LOG_FUNCTION (this << delay);
- m_beaconWatchdogEnd = std::max (Simulator::Now () + delay, m_beaconWatchdogEnd);
- if (Simulator::GetDelayLeft (m_beaconWatchdog) < delay &&
- m_beaconWatchdog.IsExpired ())
- {
- NS_LOG_DEBUG ("really restart watchdog.");
- m_beaconWatchdog = Simulator::Schedule (delay, &NqstaWifiMac::MissedBeacons, this);
- }
-}
-bool
-NqstaWifiMac::IsAssociated (void) const
-{
- return m_state == ASSOCIATED;
-}
-
-bool
-NqstaWifiMac::IsWaitAssocResp (void) const
-{
- return m_state == WAIT_ASSOC_RESP;
-}
-
-void
-NqstaWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from)
-{
- NS_FATAL_ERROR ("Qsta does not support SendTo");
-}
-
-void
-NqstaWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to)
-{
- NS_LOG_FUNCTION (this << packet << to);
- if (!IsAssociated ())
- {
- NotifyTxDrop (packet);
- TryToEnsureAssociated ();
- return;
- }
- //NS_LOG_DEBUG ("enqueue size="<<packet->GetSize ()<<", to="<<to);
- WifiMacHeader hdr;
- hdr.SetTypeData ();
- hdr.SetAddr1 (GetBssid ());
- hdr.SetAddr2 (m_low->GetAddress ());
- hdr.SetAddr3 (to);
- hdr.SetDsNotFrom ();
- hdr.SetDsTo ();
-
- m_dca->Queue (packet, hdr);
-}
-
-bool
-NqstaWifiMac::SupportsSendFrom (void) const
-{
- //
- // The 802.11 MAC protocol has no way to support bridging outside of
- // infrastructure mode
- //
- return false;
-}
-
-
-void
-NqstaWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
-{
- NS_LOG_FUNCTION (this << packet << hdr);
- NS_ASSERT (!hdr->IsCtl ());
- if (hdr->GetAddr3 () == GetAddress ())
- {
- NS_LOG_LOGIC ("packet sent by us.");
- }
- else if (hdr->GetAddr1 () != GetAddress () &&
- !hdr->GetAddr1 ().IsGroup ())
- {
- NS_LOG_LOGIC ("packet is not for us");
- NotifyRxDrop (packet);
- }
- else if (hdr->IsData ())
- {
- if (!IsAssociated ())
- {
- NS_LOG_LOGIC ("Received data frame while not associated: ignore");
- NotifyRxDrop (packet);
- return;
- }
- if (!(hdr->IsFromDs () && !hdr->IsToDs ()))
- {
- NS_LOG_LOGIC ("Received data frame not from the DS: ignore");
- NotifyRxDrop (packet);
- return;
- }
- if (hdr->GetAddr2 () != GetBssid ())
- {
- NS_LOG_LOGIC ("Received data frame not from the the BSS we are associated with: ignore");
- NotifyRxDrop (packet);
- return;
- }
-
- ForwardUp (packet, hdr->GetAddr3 (), hdr->GetAddr1 ());
- }
- else if (hdr->IsProbeReq () ||
- hdr->IsAssocReq ())
- {
- /* this is a frame aimed at an AP.
- * so we can safely ignore it.
- */
- NotifyRxDrop (packet);
- }
- else if (hdr->IsBeacon ())
- {
- MgtBeaconHeader beacon;
- packet->RemoveHeader (beacon);
- bool goodBeacon = false;
- if (GetSsid ().IsBroadcast () ||
- beacon.GetSsid ().IsEqual (GetSsid ()))
- {
- goodBeacon = true;
- }
- if ((IsWaitAssocResp () || IsAssociated ()) && hdr->GetAddr3 () != GetBssid ())
- {
- goodBeacon = false;
- }
- if (goodBeacon)
- {
- Time delay = MicroSeconds (beacon.GetBeaconIntervalUs () * m_maxMissedBeacons);
- RestartBeaconWatchdog (delay);
- SetBssid (hdr->GetAddr3 ());
- }
- if (goodBeacon && m_state == BEACON_MISSED)
- {
- SetState (WAIT_ASSOC_RESP);
- SendAssociationRequest ();
- }
- }
- else if (hdr->IsProbeResp ())
- {
- if (m_state == WAIT_PROBE_RESP)
- {
- MgtProbeResponseHeader probeResp;
- packet->RemoveHeader (probeResp);
- if (!probeResp.GetSsid ().IsEqual (GetSsid ()))
- {
- //not a probe resp for our ssid.
- return;
- }
- SetBssid (hdr->GetAddr3 ());
- Time delay = MicroSeconds (probeResp.GetBeaconIntervalUs () * m_maxMissedBeacons);
- RestartBeaconWatchdog (delay);
- if (m_probeRequestEvent.IsRunning ())
- {
- m_probeRequestEvent.Cancel ();
- }
- SetState (WAIT_ASSOC_RESP);
- SendAssociationRequest ();
- }
- }
- else if (hdr->IsAssocResp ())
- {
- if (m_state == WAIT_ASSOC_RESP)
- {
- MgtAssocResponseHeader assocResp;
- packet->RemoveHeader (assocResp);
- if (m_assocRequestEvent.IsRunning ())
- {
- m_assocRequestEvent.Cancel ();
- }
- if (assocResp.GetStatusCode ().IsSuccess ())
- {
- SetState (ASSOCIATED);
- NS_LOG_DEBUG ("assoc completed");
- SupportedRates rates = assocResp.GetSupportedRates ();
- for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
- {
- WifiMode mode = m_phy->GetMode (i);
- if (rates.IsSupportedRate (mode.GetDataRate ()))
- {
- m_stationManager->AddSupportedMode (hdr->GetAddr2 (), mode);
- if (rates.IsBasicRate (mode.GetDataRate ()))
- {
- m_stationManager->AddBasicMode (mode);
- }
- }
- }
- if (!m_linkUp.IsNull ())
- {
- m_linkUp ();
- }
- }
- else
- {
- NS_LOG_DEBUG ("assoc refused");
- SetState (REFUSED);
- }
- }
- }
-}
-
-SupportedRates
-NqstaWifiMac::GetSupportedRates (void) const
-{
- SupportedRates rates;
- for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
- {
- WifiMode mode = m_phy->GetMode (i);
- rates.AddSupportedRate (mode.GetDataRate ());
- }
- return rates;
-}
-
-void
-NqstaWifiMac::SetState (MacState value)
-{
- if (value == ASSOCIATED &&
- m_state != ASSOCIATED)
- {
- m_assocLogger (GetBssid ());
- }
- else if (value != ASSOCIATED &&
- m_state == ASSOCIATED)
- {
- m_deAssocLogger (GetBssid ());
- }
- m_state = value;
-}
-
-void
-NqstaWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard)
-{
- switch (standard)
- {
- case WIFI_PHY_STANDARD_holland:
- // fall through
- case WIFI_PHY_STANDARD_80211_10Mhz:
- // fall through
- case WIFI_PHY_STANDARD_80211_5Mhz:
- // fall through
- case WIFI_PHY_STANDARD_80211a:
- // fall through
- case WIFI_PHY_STANDARD_80211g:
- ConfigureDcf (m_dca, 15, 1023, AC_BE_NQOS);
- break;
- case WIFI_PHY_STANDARD_80211b:
- ConfigureDcf (m_dca, 31, 1023, AC_BE_NQOS);
- break;
- default:
- NS_ASSERT (false);
- break;
- }
-}
-void
-NqstaWifiMac::DoStart ()
-{
- m_dca->Start ();
- WifiMac::DoStart ();
-}
-} // namespace ns3
--- a/src/devices/wifi/nqsta-wifi-mac.h Tue Dec 21 17:39:54 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2005,2006 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
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#ifndef NQSTA_WIFI_MAC_H
-#define NQSTA_WIFI_MAC_H
-
-#include <stdint.h>
-
-#include "ns3/mac48-address.h"
-#include "ns3/callback.h"
-#include "ns3/event-id.h"
-#include "ns3/packet.h"
-#include "ns3/nstime.h"
-#include "ns3/traced-callback.h"
-
-#include "wifi-mac.h"
-#include "supported-rates.h"
-
-namespace ns3 {
-
-class WifiMacHeader;
-class DcaTxop;
-class WifiPhy;
-class DcfManager;
-class MacLow;
-class MacRxMiddle;
-
-/**
- * \brief a non-QoS STA state machine
- *
- * This state machine handles association, disassociation,
- * authentication and beacon monitoring. It does not perform
- * channel scanning.
- * If the station detects a certain number of missed beacons
- * while associated, it automatically attempts a new association
- * sequence.
- */
-class NqstaWifiMac : public WifiMac
-{
-public:
- static TypeId GetTypeId (void);
-
- NqstaWifiMac ();
- ~NqstaWifiMac ();
-
- // inherited from WifiMac.
- virtual void SetSlot (Time slotTime);
- virtual void SetSifs (Time sifs);
- virtual void SetEifsNoDifs (Time eifsNoDifs);
- virtual void SetAckTimeout (Time ackTimeout);
- virtual void SetCtsTimeout (Time ctsTimeout);
- virtual void SetPifs (Time pifs);
- virtual Time GetSlot (void) const;
- virtual Time GetSifs (void) const;
- virtual Time GetEifsNoDifs (void) const;
- virtual Time GetAckTimeout (void) const;
- virtual Time GetCtsTimeout (void) const;
- virtual Time GetPifs (void) const;
- virtual void SetWifiPhy (Ptr<WifiPhy> phy);
- virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager);
- virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
- virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to);
- virtual bool SupportsSendFrom (void) const;
- virtual void SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback);
- virtual void SetLinkUpCallback (Callback<void> linkUp);
- virtual void SetLinkDownCallback (Callback<void> linkDown);
- virtual Mac48Address GetAddress (void) const;
- virtual Ssid GetSsid (void) const;
- virtual void SetAddress (Mac48Address address);
- virtual void SetSsid (Ssid ssid);
- virtual Mac48Address GetBssid (void) const;
-
- /**
- * \param missed the number of beacons which must be missed
- * before a new association sequence is started.
- */
- void SetMaxMissedBeacons (uint32_t missed);
- /**
- * \param timeout
- *
- * If no probe response is received within the specified
- * timeout, the station sends a new probe request.
- */
- void SetProbeRequestTimeout (Time timeout);
- /**
- * \param timeout
- *
- * If no association response is received within the specified
- * timeout, the station sends a new association request.
- */
- void SetAssocRequestTimeout (Time timeout);
-
- /**
- * Start an active association sequence immediately.
- */
- void StartActiveAssociation (void);
-
-private:
- enum MacState{
- ASSOCIATED,
- WAIT_PROBE_RESP,
- WAIT_ASSOC_RESP,
- BEACON_MISSED,
- REFUSED
- };
- void DoStart ();
- void SetBssid (Mac48Address bssid);
- void SetActiveProbing (bool enable);
- bool GetActiveProbing (void) const;
- void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
- void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
- Mac48Address GetBroadcastBssid (void);
- void SendProbeRequest (void);
- void SendAssociationRequest (void);
- void TryToEnsureAssociated (void);
- void AssocRequestTimeout (void);
- void ProbeRequestTimeout (void);
- bool IsAssociated (void) const;
- bool IsWaitAssocResp (void) const;
- void MissedBeacons (void);
- void RestartBeaconWatchdog (Time delay);
- SupportedRates GetSupportedRates (void) const;
- virtual void DoDispose (void);
- NqstaWifiMac (const NqstaWifiMac & ctor_arg);
- NqstaWifiMac &operator = (const NqstaWifiMac & ctor_arg);
- Ptr<DcaTxop> GetDcaTxop(void) const;
- void SetState (enum MacState value);
- virtual void FinishConfigureStandard (enum WifiPhyStandard standard);
-
- enum MacState m_state;
- Time m_probeRequestTimeout;
- Time m_assocRequestTimeout;
- EventId m_probeRequestEvent;
- EventId m_assocRequestEvent;
- Callback<void, Ptr<Packet>, Mac48Address, Mac48Address> m_forwardUp;
- Callback<void> m_linkUp;
- Callback<void> m_linkDown;
- Ptr<DcaTxop> m_dca;
- EventId m_beaconWatchdog;
- Time m_beaconWatchdogEnd;
- uint32_t m_maxMissedBeacons;
-
- Ptr<WifiPhy> m_phy;
- Ptr<WifiRemoteStationManager> m_stationManager;
- DcfManager *m_dcfManager;
- MacRxMiddle *m_rxMiddle;
- Ptr<MacLow> m_low;
- Ssid m_ssid;
-
- TracedCallback<Mac48Address> m_assocLogger;
- TracedCallback<Mac48Address> m_deAssocLogger;
-};
-
-} // namespace ns3
-
-
-#endif /* NQSTA_WIFI_MAC_H */
--- a/src/devices/wifi/qadhoc-wifi-mac.cc Tue Dec 21 17:39:54 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,574 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006, 2009 INRIA
- * Copyright (c) 2009 MIRKO BANCHI
- *
- * 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
- */
-#include "ns3/pointer.h"
-#include "ns3/log.h"
-#include "ns3/string.h"
-
-#include "qos-tag.h"
-#include "edca-txop-n.h"
-#include "qadhoc-wifi-mac.h"
-#include "mac-low.h"
-#include "dcf-manager.h"
-#include "mac-rx-middle.h"
-#include "mac-tx-middle.h"
-#include "wifi-mac-header.h"
-#include "msdu-aggregator.h"
-#include "amsdu-subframe-header.h"
-#include "mgt-headers.h"
-
-NS_LOG_COMPONENT_DEFINE ("QadhocWifiMac");
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED (QadhocWifiMac);
-
-TypeId
-QadhocWifiMac::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::QadhocWifiMac")
- .SetParent<WifiMac> ()
- .AddConstructor<QadhocWifiMac> ()
- .AddAttribute ("VO_EdcaTxopN",
- "Queue that manages packets belonging to AC_VO access class",
- PointerValue (),
- MakePointerAccessor(&QadhocWifiMac::GetVOQueue),
- MakePointerChecker<EdcaTxopN> ())
- .AddAttribute ("VI_EdcaTxopN",
- "Queue that manages packets belonging to AC_VI access class",
- PointerValue (),
- MakePointerAccessor(&QadhocWifiMac::GetVIQueue),
- MakePointerChecker<EdcaTxopN> ())
- .AddAttribute ("BE_EdcaTxopN",
- "Queue that manages packets belonging to AC_BE access class",
- PointerValue (),
- MakePointerAccessor(&QadhocWifiMac::GetBEQueue),
- MakePointerChecker<EdcaTxopN> ())
- .AddAttribute ("BK_EdcaTxopN",
- "Queue that manages packets belonging to AC_BK access class",
- PointerValue (),
- MakePointerAccessor(&QadhocWifiMac::GetBKQueue),
- MakePointerChecker<EdcaTxopN> ())
- ;
- return tid;
-}
-
-QadhocWifiMac::QadhocWifiMac ()
-{
- NS_LOG_FUNCTION (this);
- m_rxMiddle = new MacRxMiddle ();
- m_rxMiddle->SetForwardCallback (MakeCallback (&QadhocWifiMac::Receive, this));
-
- m_txMiddle = new MacTxMiddle ();
-
- m_low = CreateObject<MacLow> ();
- m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle));
-
- m_dcfManager = new DcfManager ();
- m_dcfManager->SetupLowListener (m_low);
-
- // Construct the EDCAFs. The ordering is important - highest
- // priority (see Table 9-1 in IEEE 802.11-2007) must be created
- // first.
- SetQueue (AC_VO);
- SetQueue (AC_VI);
- SetQueue (AC_BE);
- SetQueue (AC_BK);
-}
-
-QadhocWifiMac::~QadhocWifiMac ()
-{
- NS_LOG_FUNCTION (this);
-}
-
-void
-QadhocWifiMac::DoDispose (void)
-{
- NS_LOG_FUNCTION (this);
- delete m_rxMiddle;
- m_rxMiddle = 0;
- delete m_txMiddle;
- m_txMiddle = 0;
- delete m_dcfManager;
- m_dcfManager = 0;
- m_low = 0;
- m_phy = 0;
- m_stationManager = 0;
- for (Queues::iterator i = m_queues.begin (); i != m_queues.end (); ++i)
- {
- (*i).second = 0;
- }
- WifiMac::DoDispose ();
-}
-
-void
-QadhocWifiMac::SetSlot (Time slotTime)
-{
- m_dcfManager->SetSlot (slotTime);
- m_low->SetSlotTime (slotTime);
-}
-
-void
-QadhocWifiMac::SetSifs (Time sifs)
-{
- m_dcfManager->SetSifs (sifs);
- m_low->SetSifs (sifs);
-}
-
-void
-QadhocWifiMac::SetEifsNoDifs (Time eifsNoDifs)
-{
- m_dcfManager->SetEifsNoDifs (eifsNoDifs);
- m_eifsNoDifs = eifsNoDifs;
-}
-
-void
-QadhocWifiMac::SetAckTimeout (Time ackTimeout)
-{
- m_low->SetAckTimeout (ackTimeout);
-}
-
-void
-QadhocWifiMac::SetBasicBlockAckTimeout (Time blockAckTimeout)
-{
- m_low->SetBasicBlockAckTimeout (blockAckTimeout);
-}
-
-void
-QadhocWifiMac::SetCompressedBlockAckTimeout (Time blockAckTimeout)
-{
- m_low->SetCompressedBlockAckTimeout (blockAckTimeout);
-}
-
-void
-QadhocWifiMac::SetCtsTimeout (Time ctsTimeout)
-{
- m_low->SetCtsTimeout (ctsTimeout);
-}
-
-void
-QadhocWifiMac::SetPifs (Time pifs)
-{
- m_low->SetPifs (pifs);
-}
-
-Time
-QadhocWifiMac::GetSlot (void) const
-{
- return m_low->GetSlotTime ();
-}
-
-Time
-QadhocWifiMac::GetSifs (void) const
-{
- return m_low->GetSifs ();
-}
-
-Time
-QadhocWifiMac::GetEifsNoDifs (void) const
-{
- return m_eifsNoDifs;
-}
-
-Time
-QadhocWifiMac::GetAckTimeout (void) const
-{
- return m_low->GetAckTimeout ();
-}
-
-Time
-QadhocWifiMac::GetBasicBlockAckTimeout (void) const
-{
- return m_low->GetBasicBlockAckTimeout ();
-}
-
-Time
-QadhocWifiMac::GetCompressedBlockAckTimeout (void) const
-{
- return m_low->GetCompressedBlockAckTimeout ();
-}
-
-Time
-QadhocWifiMac::GetCtsTimeout (void) const
-{
- return m_low->GetCtsTimeout ();
-}
-
-Time
-QadhocWifiMac::GetPifs (void) const
-{
- return m_low->GetPifs ();
-}
-
-void
-QadhocWifiMac::SetWifiPhy (Ptr<WifiPhy> phy)
-{
- m_phy = phy;
- m_dcfManager->SetupPhyListener (phy);
- m_low->SetPhy (phy);
-}
-
-void
-QadhocWifiMac::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager)
-{
- NS_LOG_FUNCTION (this << stationManager);
- m_stationManager = stationManager;
- for (Queues::iterator i = m_queues.begin (); i != m_queues.end (); ++i)
- {
- (*i).second->SetWifiRemoteStationManager (stationManager);
- }
- m_low->SetWifiRemoteStationManager (stationManager);
-}
-
-void
-QadhocWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from)
-{
- NS_FATAL_ERROR ("Adhoc does not support a from != m_low->GetAddress ()");
-}
-
-void
-QadhocWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to)
-{
- /* For now Qos adhoc stations sends only Qos frame. In the future they
- * should be able to send frames also to Non-Qos Stas.
- */
- NS_LOG_FUNCTION (packet->GetSize () << to);
- WifiMacHeader hdr;
- hdr.SetType (WIFI_MAC_QOSDATA);
- hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
- hdr.SetQosNoEosp ();
- hdr.SetQosNoAmsdu ();
- /* Transmission of multiple frames in the same
- Txop is not supported for now */
- hdr.SetQosTxopLimit (0);
-
- hdr.SetAddr1 (to);
- hdr.SetAddr2 (m_low->GetAddress ());
- hdr.SetAddr3 (GetBssid ());
- hdr.SetDsNotFrom ();
- hdr.SetDsNotTo ();
-
- if (m_stationManager->IsBrandNew (to))
- {
- // in adhoc mode, we assume that every destination
- // supports all the rates we support.
- for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
- {
- m_stationManager->AddSupportedMode (to, m_phy->GetMode (i));
- }
- m_stationManager->RecordDisassociated (to);
- }
-
- uint8_t tid = QosUtilsGetTidForPacket (packet);
- if (tid < 8)
- {
- hdr.SetQosTid (tid);
- AcIndex ac = QosUtilsMapTidToAc (tid);
- m_queues[ac]->Queue (packet, hdr);
- }
- else
- {
- //packet is considerated belonging to BestEffort AC
- hdr.SetQosTid (0);
- m_queues[AC_BE]->Queue (packet, hdr);
- }
-}
-
-bool
-QadhocWifiMac::SupportsSendFrom (void) const
-{
- return false;
-}
-
-void
-QadhocWifiMac::SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback)
-{
- m_forwardUp = upCallback;
-}
-
-void
-QadhocWifiMac::SetLinkUpCallback (Callback<void> linkUp)
-{
- // an Adhoc network is always UP.
- linkUp ();
-}
-
-void
-QadhocWifiMac::SetLinkDownCallback (Callback<void> linkDown)
-{}
-
-Mac48Address
-QadhocWifiMac::GetAddress (void) const
-{
- return m_low->GetAddress ();
-}
-
-Ssid
-QadhocWifiMac::GetSsid (void) const
-{
- return m_ssid;
-}
-
-void
-QadhocWifiMac::SetAddress (Mac48Address address)
-{
- m_low->SetAddress (address);
- m_low->SetBssid (address);
-}
-
-void
-QadhocWifiMac::SetSsid (Ssid ssid)
-{
- NS_LOG_FUNCTION (this << ssid);
- // XXX: here, we should start a special adhoc network
- m_ssid = ssid;
-}
-
-Mac48Address
-QadhocWifiMac::GetBssid (void) const
-{
- return m_low->GetBssid ();
-}
-
-void
-QadhocWifiMac::ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to)
-{
- NS_LOG_FUNCTION (this << packet << from);
- m_forwardUp (packet, from, to);
-}
-
-void
-QadhocWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
-{
- NS_LOG_FUNCTION (this << packet << hdr);
- NS_ASSERT (!hdr->IsCtl ());
- Mac48Address from = hdr->GetAddr2 ();
- Mac48Address to = hdr->GetAddr1 ();
- if (hdr->IsData ())
- {
- if (hdr->IsQosData () && hdr->IsQosAmsdu ())
- {
- NS_LOG_DEBUG ("Received A-MSDU from"<<from);
- DeaggregateAmsduAndForward (packet, hdr);
- }
- else
- {
- ForwardUp (packet, from, to);
- }
- }
- else if (hdr->IsMgt ())
- {
- if (hdr->IsAction ())
- {
- WifiActionHeader actionHdr;
- packet->RemoveHeader (actionHdr);
- if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK &&
- actionHdr.GetAction().blockAck == WifiActionHeader::BLOCK_ACK_ADDBA_REQUEST)
- {
- MgtAddBaRequestHeader reqHdr;
- packet->RemoveHeader (reqHdr);
- SendAddBaResponse (&reqHdr, hdr->GetAddr2 ());
- }
- else if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK &&
- actionHdr.GetAction().blockAck == WifiActionHeader::BLOCK_ACK_ADDBA_RESPONSE)
- {
- MgtAddBaResponseHeader respHdr;
- packet->RemoveHeader (respHdr);
- m_queues[QosUtilsMapTidToAc (respHdr.GetTid ())]->GotAddBaResponse (&respHdr, hdr->GetAddr2 ());
- }
- else if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK &&
- actionHdr.GetAction().blockAck == WifiActionHeader::BLOCK_ACK_DELBA)
- {
- MgtDelBaHeader delBaHdr;
- packet->RemoveHeader (delBaHdr);
- if (delBaHdr.IsByOriginator ())
- {
- /* Delba frame was sent by originator, this means that an ingoing established
- agreement exists in MacLow */
- m_low->DestroyBlockAckAgreement (hdr->GetAddr2 (), delBaHdr.GetTid ()); }
- else
- {
- /* We must notify correct queue tear down of agreement */
- AcIndex ac = QosUtilsMapTidToAc (delBaHdr.GetTid ());
- m_queues[ac]->GotDelBaFrame (&delBaHdr, hdr->GetAddr2 ());
- }
- }
- }
- }
-}
-
-void
-QadhocWifiMac::DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
- const WifiMacHeader *hdr)
-{
- DeaggregatedMsdus packets = MsduAggregator::Deaggregate (aggregatedPacket);
- for (DeaggregatedMsdusCI i = packets.begin (); i != packets.end (); ++i)
- {
- ForwardUp ((*i).first, (*i).second.GetSourceAddr (),
- (*i).second.GetDestinationAddr ());
- }
-}
-
-Ptr<EdcaTxopN>
-QadhocWifiMac::GetVOQueue (void) const
-{
- return m_queues.find (AC_VO)->second;
-}
-
-Ptr<EdcaTxopN>
-QadhocWifiMac::GetVIQueue (void) const
-{
- return m_queues.find (AC_VI)->second;
-}
-
-Ptr<EdcaTxopN>
-QadhocWifiMac::GetBEQueue (void) const
-{
- return m_queues.find (AC_BE)->second;
-}
-void
-QadhocWifiMac::DoStart ()
-{
- for (Queues::iterator i = m_queues.begin (); i != m_queues.end (); ++i)
- {
- i->second->Start ();
- }
- WifiMac::DoStart ();
-}
-
-Ptr<EdcaTxopN>
-QadhocWifiMac::GetBKQueue (void) const
-{
- return m_queues.find (AC_BK)->second;
-}
-
-void
-QadhocWifiMac::SetQueue (enum AcIndex ac)
-{
- Ptr<EdcaTxopN> edca = CreateObject<EdcaTxopN> ();
- edca->SetLow (m_low);
- edca->SetManager (m_dcfManager);
- edca->SetTypeOfStation (ADHOC_STA);
- edca->SetTxMiddle (m_txMiddle);
- edca->SetAccessCategory (ac);
- edca->CompleteConfig ();
- m_queues.insert (std::make_pair(ac, edca));
-}
-
-void
-QadhocWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard)
-{
- switch (standard)
- {
- case WIFI_PHY_STANDARD_80211p_CCH:
- ConfigureCCHDcf (m_queues[AC_BK], 15, 511, AC_BK);
- ConfigureCCHDcf (m_queues[AC_BE], 15, 511, AC_BE);
- ConfigureCCHDcf (m_queues[AC_VI], 15, 511, AC_VI);
- ConfigureCCHDcf (m_queues[AC_VO], 15, 511, AC_VO);
- break;
- case WIFI_PHY_STANDARD_80211p_SCH:
- ConfigureDcf (m_queues[AC_BK], 15, 511, AC_BK);
- ConfigureDcf (m_queues[AC_BE], 15, 511, AC_BE);
- ConfigureDcf (m_queues[AC_VI], 15, 511, AC_VI);
- ConfigureDcf (m_queues[AC_VO], 15, 511, AC_VO);
- break;
- case WIFI_PHY_STANDARD_holland:
- // fall through
- case WIFI_PHY_STANDARD_80211a:
- // fall through
- case WIFI_PHY_STANDARD_80211g:
- // fall through
- case WIFI_PHY_STANDARD_80211_10Mhz:
- // fall through
- case WIFI_PHY_STANDARD_80211_5Mhz:
- ConfigureDcf (m_queues[AC_BK], 15, 1023, AC_BK);
- ConfigureDcf (m_queues[AC_BE], 15, 1023, AC_BE);
- ConfigureDcf (m_queues[AC_VI], 15, 1023, AC_VI);
- ConfigureDcf (m_queues[AC_VO], 15, 1023, AC_VO);
- break;
- case WIFI_PHY_STANDARD_80211b:
- ConfigureDcf (m_queues[AC_BK], 31, 1023, AC_BK);
- ConfigureDcf (m_queues[AC_BE], 31, 1023, AC_BE);
- ConfigureDcf (m_queues[AC_VI], 31, 1023, AC_VI);
- ConfigureDcf (m_queues[AC_VO], 31, 1023, AC_VO);
- break;
- default:
- NS_ASSERT (false);
- break;
- }
-}
-
-
-void
-QadhocWifiMac::SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr, Mac48Address originator)
-{
- NS_LOG_FUNCTION (this);
- WifiMacHeader hdr;
- hdr.SetAction ();
- hdr.SetAddr1 (originator);
- hdr.SetAddr2 (m_low->GetAddress ());
- hdr.SetAddr3 (m_low->GetAddress ());
- hdr.SetDsNotFrom ();
- hdr.SetDsNotTo ();
-
- MgtAddBaResponseHeader respHdr;
- StatusCode code;
- code.SetSuccess ();
- respHdr.SetStatusCode (code);
- //Here a control about queues type?
- respHdr.SetAmsduSupport (reqHdr->IsAmsduSupported ());
-
- if (reqHdr->IsImmediateBlockAck ())
- {
- respHdr.SetImmediateBlockAck ();
- }
- else
- {
- respHdr.SetDelayedBlockAck ();
- }
- respHdr.SetTid (reqHdr->GetTid ());
- /* For now there's not no control about limit of reception.
- We assume that receiver has no limit on reception.
- However we assume that a receiver sets a bufferSize in order to satisfy
- next equation:
- (bufferSize + 1) % 16 = 0
- So if a recipient is able to buffer a packet, it should be also able to buffer
- all possible packet's fragments.
- See section 7.3.1.14 in IEEE802.11e for more details. */
- respHdr.SetBufferSize (1023);
- respHdr.SetTimeout (reqHdr->GetTimeout ());
-
- WifiActionHeader actionHdr;
- WifiActionHeader::ActionValue action;
- action.blockAck = WifiActionHeader::BLOCK_ACK_ADDBA_RESPONSE;
- actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
-
- Ptr<Packet> packet = Create<Packet> ();
- packet->AddHeader (respHdr);
- packet->AddHeader (actionHdr);
-
- /* ns3::MacLow have to buffer all correctly received packet for this block ack session */
- m_low->CreateBlockAckAgreement (&respHdr, originator, reqHdr->GetStartingSequence ());
-
- //Better a management queue?
- m_queues[QosUtilsMapTidToAc (reqHdr->GetTid ())]->PushFront (packet, hdr);
-}
-} //namespace ns3
--- a/src/devices/wifi/qadhoc-wifi-mac.h Tue Dec 21 17:39:54 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006, 2009 INRIA
- * Copyright (c) 2009 MIRKO BANCHI
- *
- * 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
- */
-#ifndef QADHOC_WIFI_MAC_H
-#define QADHOC_WIFI_MAC_H
-
-#include "ns3/mac48-address.h"
-#include "ns3/callback.h"
-#include "ns3/packet.h"
-
-#include "wifi-mac.h"
-#include "qos-utils.h"
-#include "amsdu-subframe-header.h"
-
-namespace ns3 {
-
-class EdcaTxopN;
-class WifiMacHeader;
-class WifiPhy;
-class DcfManager;
-class MacLow;
-class MacRxMiddle;
-class MgtAddBaRequestHeader;
-
-class QadhocWifiMac : public WifiMac
-{
-public:
- static TypeId GetTypeId (void);
-
- QadhocWifiMac ();
- ~QadhocWifiMac ();
-
- // all inherited from WifiMac base class.
- virtual void SetSlot (Time slotTime);
- virtual void SetSifs (Time sifs);
- virtual void SetEifsNoDifs (Time eifsNoDifs);
- virtual void SetAckTimeout (Time ackTimeout);
- virtual void SetCtsTimeout (Time ctsTimeout);
- virtual void SetPifs (Time pifs);
- virtual Time GetSlot (void) const;
- virtual Time GetSifs (void) const;
- virtual Time GetEifsNoDifs (void) const;
- virtual Time GetAckTimeout (void) const;
- virtual Time GetCtsTimeout (void) const;
- virtual Time GetPifs (void) const;
- virtual void SetWifiPhy (Ptr<WifiPhy> phy);
- virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager);
- virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
- virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to);
- virtual bool SupportsSendFrom (void) const;
- virtual void SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback);
- virtual void SetLinkUpCallback (Callback<void> linkUp);
- virtual void SetLinkDownCallback (Callback<void> linkDown);
- virtual Mac48Address GetAddress (void) const;
- virtual Ssid GetSsid (void) const;
- virtual void SetAddress (Mac48Address address);
- virtual void SetSsid (Ssid ssid);
- virtual Mac48Address GetBssid (void) const;
- virtual void SetBasicBlockAckTimeout (Time blockAckTimeout);
- virtual void SetCompressedBlockAckTimeout (Time blockAckTimeout);
- virtual Time GetBasicBlockAckTimeout (void) const;
- virtual Time GetCompressedBlockAckTimeout (void) const;
-
-
-private:
- Callback<void, Ptr<Packet>, Mac48Address, Mac48Address> m_forwardUp;
- virtual void DoDispose (void);
- void DoStart ();
- void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
- void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
- QadhocWifiMac &operator = (const QadhocWifiMac &);
- QadhocWifiMac (const QadhocWifiMac &);
- void SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr, Mac48Address originator);
-
- /**
- * When an A-MSDU is received, is deaggregated by this method and all extracted packets are
- * forwarded up.
- */
- void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket, const WifiMacHeader *hdr);
-
- typedef std::map<AcIndex, Ptr<EdcaTxopN> > Queues;
- typedef std::list<std::pair<Ptr<Packet>, AmsduSubframeHeader> > DeaggregatedMsdus;
- typedef std::list<std::pair<Ptr<Packet>, AmsduSubframeHeader> >::const_iterator DeaggregatedMsdusCI;
-
- virtual void FinishConfigureStandard (enum WifiPhyStandard standard);
- void SetQueue (enum AcIndex ac);
- Ptr<EdcaTxopN> GetVOQueue (void) const;
- Ptr<EdcaTxopN> GetVIQueue (void) const;
- Ptr<EdcaTxopN> GetBEQueue (void) const;
- Ptr<EdcaTxopN> GetBKQueue (void) const;
-
- Queues m_queues;
- Ptr<MacLow> m_low;
- Ptr<WifiPhy> m_phy;
- Ptr<WifiRemoteStationManager> m_stationManager;
- MacRxMiddle *m_rxMiddle;
- MacTxMiddle *m_txMiddle;
- DcfManager *m_dcfManager;
- Ssid m_ssid;
- Time m_eifsNoDifs;
-};
-
-} //namespace ns3
-
-#endif /* QADHOC_WIFI_MAC_H */
--- a/src/devices/wifi/qap-wifi-mac.cc Tue Dec 21 17:39:54 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,937 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006, 2009 INRIA
- * Copyright (c) 2009 MIRKO BANCHI
- *
- * 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
- */
-#include "ns3/assert.h"
-#include "ns3/log.h"
-#include "ns3/simulator.h"
-#include "ns3/string.h"
-#include "ns3/pointer.h"
-#include "ns3/boolean.h"
-
-#include "qos-tag.h"
-#include "qap-wifi-mac.h"
-#include "dca-txop.h"
-#include "edca-txop-n.h"
-#include "wifi-phy.h"
-#include "dcf-manager.h"
-#include "mac-rx-middle.h"
-#include "mac-tx-middle.h"
-#include "mgt-headers.h"
-#include "mac-low.h"
-#include "amsdu-subframe-header.h"
-#include "msdu-aggregator.h"
-
-NS_LOG_COMPONENT_DEFINE ("QapWifiMac");
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED (QapWifiMac);
-
-TypeId
-QapWifiMac::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::QapWifiMac")
- .SetParent<WifiMac> ()
- .AddConstructor<QapWifiMac> ()
- .AddAttribute ("BeaconInterval", "Delay between two beacons",
- TimeValue (MicroSeconds (102400)),
- MakeTimeAccessor (&QapWifiMac::GetBeaconInterval,
- &QapWifiMac::SetBeaconInterval),
- MakeTimeChecker ())
- .AddAttribute ("BeaconGeneration", "Whether or not beacons are generated.",
- BooleanValue (true),
- MakeBooleanAccessor (&QapWifiMac::SetBeaconGeneration,
- &QapWifiMac::GetBeaconGeneration),
- MakeBooleanChecker ())
- .AddAttribute ("VO_EdcaTxopN",
- "Queue that manages packets belonging to AC_VO access class",
- PointerValue (),
- MakePointerAccessor(&QapWifiMac::GetVOQueue),
- MakePointerChecker<EdcaTxopN> ())
- .AddAttribute ("VI_EdcaTxopN",
- "Queue that manages packets belonging to AC_VI access class",
- PointerValue (),
- MakePointerAccessor(&QapWifiMac::GetVIQueue),
- MakePointerChecker<EdcaTxopN> ())
- .AddAttribute ("BE_EdcaTxopN",
- "Queue that manages packets belonging to AC_BE access class",
- PointerValue (),
- MakePointerAccessor(&QapWifiMac::GetBEQueue),
- MakePointerChecker<EdcaTxopN> ())
- .AddAttribute ("BK_EdcaTxopN",
- "Queue that manages packets belonging to AC_BK access class",
- PointerValue (),
- MakePointerAccessor(&QapWifiMac::GetBKQueue),
- MakePointerChecker<EdcaTxopN> ())
- ;
- return tid;
-}
-
-QapWifiMac::QapWifiMac ()
-{
- NS_LOG_FUNCTION (this);
- m_rxMiddle = new MacRxMiddle ();
- m_rxMiddle->SetForwardCallback (MakeCallback (&QapWifiMac::Receive, this));
-
- m_txMiddle = new MacTxMiddle ();
-
- m_low = CreateObject<MacLow> ();
- m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle));
-
- m_dcfManager = new DcfManager ();
- m_dcfManager->SetupLowListener (m_low);
-
- m_beaconDca = CreateObject<DcaTxop> ();
- m_beaconDca->SetAifsn(1);
- m_beaconDca->SetMinCw(0);
- m_beaconDca->SetMaxCw(0);
- m_beaconDca->SetLow (m_low);
- m_beaconDca->SetManager (m_dcfManager);
-
- // Construct the EDCAFs. The ordering is important - highest
- // priority (see Table 9-1 in IEEE 802.11-2007) must be created
- // first.
- SetQueue (AC_VO);
- SetQueue (AC_VI);
- SetQueue (AC_BE);
- SetQueue (AC_BK);
-
- m_enableBeaconGeneration = false;
-}
-
-QapWifiMac::~QapWifiMac ()
-{
- NS_LOG_FUNCTION (this);
-}
-
-void
-QapWifiMac::DoDispose ()
-{
- delete m_rxMiddle;
- delete m_txMiddle;
- delete m_dcfManager;
- m_low->Dispose ();
- m_rxMiddle = 0;
- m_txMiddle = 0;
- m_dcfManager = 0;
- m_low = 0;
- m_phy = 0;
- m_beaconDca = 0;
- m_enableBeaconGeneration = false;
- m_beaconEvent.Cancel ();
- m_stationManager = 0;
- for (Queues::iterator i = m_queues.begin (); i != m_queues.end (); ++i)
- {
- (*i).second = 0;
- }
- WifiMac::DoDispose ();
-}
-
-void
-QapWifiMac::SetBeaconGeneration (bool enable)
-{
- NS_LOG_FUNCTION (this << enable);
- if (!enable)
- {
- m_beaconEvent.Cancel ();
- }
- else if (enable && !m_enableBeaconGeneration)
- {
- m_beaconEvent = Simulator::ScheduleNow (&QapWifiMac::SendOneBeacon, this);
- }
- m_enableBeaconGeneration = enable;
-}
-
-bool
-QapWifiMac::GetBeaconGeneration (void) const
-{
- return m_enableBeaconGeneration;
-}
-
-Time
-QapWifiMac::GetBeaconInterval (void) const
-{
- return m_beaconInterval;
-}
-
-void
-QapWifiMac::SetSlot (Time slotTime)
-{
- NS_LOG_FUNCTION (this << slotTime);
- m_dcfManager->SetSlot (slotTime);
- m_low->SetSlotTime (slotTime);
-}
-
-void
-QapWifiMac::SetSifs (Time sifs)
-{
- NS_LOG_FUNCTION (this << sifs);
- m_dcfManager->SetSifs (sifs);
- m_low->SetSifs (sifs);
-}
-
-void
-QapWifiMac::SetEifsNoDifs (Time eifsNoDifs)
-{
- NS_LOG_FUNCTION (this << eifsNoDifs);
- m_dcfManager->SetEifsNoDifs (eifsNoDifs);
-}
-
-void
-QapWifiMac::SetAckTimeout (Time ackTimeout)
-{
- m_low->SetAckTimeout (ackTimeout);
-}
-
-void
-QapWifiMac::SetBasicBlockAckTimeout (Time blockAckTimeout)
-{
- m_low->SetBasicBlockAckTimeout (blockAckTimeout);
-}
-
-void
-QapWifiMac::SetCompressedBlockAckTimeout (Time blockAckTimeout)
-{
- m_low->SetCompressedBlockAckTimeout (blockAckTimeout);
-}
-
-void
-QapWifiMac::SetCtsTimeout (Time ctsTimeout)
-{
- m_low->SetCtsTimeout (ctsTimeout);
-}
-
-void
-QapWifiMac::SetPifs (Time pifs)
-{
- m_low->SetPifs (pifs);
-}
-
-Time
-QapWifiMac::GetSlot (void) const
-{
- return m_low->GetSlotTime ();
-}
-
-Time
-QapWifiMac::GetSifs (void) const
-{
- return m_low->GetSifs ();
-}
-
-Time
-QapWifiMac::GetEifsNoDifs (void) const
-{
- return m_dcfManager->GetEifsNoDifs ();
-}
-
-Time
-QapWifiMac::GetAckTimeout (void) const
-{
- return m_low->GetAckTimeout ();
-}
-
-Time
-QapWifiMac::GetBasicBlockAckTimeout () const
-{
- return m_low->GetBasicBlockAckTimeout ();
-}
-
-Time
-QapWifiMac::GetCompressedBlockAckTimeout () const
-{
- return m_low->GetCompressedBlockAckTimeout ();
-}
-
-Time
-QapWifiMac::GetCtsTimeout (void) const
-{
- return m_low->GetCtsTimeout ();
-}
-
-Time
-QapWifiMac::GetPifs (void) const
-{
- return m_low->GetPifs ();
-}
-
-void
-QapWifiMac::SetWifiPhy (Ptr<WifiPhy> phy)
-{
- NS_LOG_FUNCTION (this << phy);
- m_phy = phy;
- m_dcfManager->SetupPhyListener (phy);
- m_low->SetPhy (phy);
-}
-
-void
-QapWifiMac::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager)
-{
- NS_LOG_FUNCTION (this << stationManager);
- m_stationManager = stationManager;
- for (Queues::iterator i = m_queues.begin (); i != m_queues.end (); ++i)
- {
- (*i).second->SetWifiRemoteStationManager (stationManager);
- }
- m_beaconDca->SetWifiRemoteStationManager (stationManager);
- m_low->SetWifiRemoteStationManager (stationManager);
-}
-
-void
-QapWifiMac::SetForwardUpCallback (Callback<void, Ptr<Packet>, Mac48Address, Mac48Address> upCallback)
-{
- NS_LOG_FUNCTION (this);
- m_forwardUp = upCallback;
-}
-
-void
-QapWifiMac::SetLinkUpCallback (Callback<void> linkUp)
-{
- NS_LOG_FUNCTION (this);
- if (!linkUp.IsNull ())
- {
- linkUp ();
- }
-}
-
-void
-QapWifiMac::SetLinkDownCallback (Callback<void> linkDown)
-{
- NS_LOG_FUNCTION (this);
-}
-
-Mac48Address
-QapWifiMac::GetAddress () const
-{
- return m_low->GetAddress ();
-}
-
-Ssid
-QapWifiMac::GetSsid (void) const
-{
- return m_ssid;
-}
-
-void
-QapWifiMac::SetAddress (Mac48Address address)
-{
- NS_LOG_FUNCTION (address);
- m_low->SetAddress (address);
- m_low->SetBssid (address);
-}
-
-void
-QapWifiMac::SetSsid (Ssid ssid)
-{
- NS_LOG_FUNCTION (this << ssid);
- m_ssid = ssid;
-}
-
-Mac48Address
-QapWifiMac::GetBssid (void) const
-{
- return m_low->GetBssid ();
-}
-
-void
-QapWifiMac::SetBeaconInterval (Time interval)
-{
- NS_LOG_FUNCTION (this << interval);
- if ((interval.GetMicroSeconds () % 1024) != 0)
- {
- NS_LOG_WARN ("beacon interval should be multiple of 1024us, see IEEE Std. 802.11-2007, section 11.1.1.1");
- }
- m_beaconInterval = interval;
-}
-
-void
-QapWifiMac::StartBeaconing (void)
-{
- NS_LOG_FUNCTION (this);
- SendOneBeacon ();
-}
-
-void
-QapWifiMac::ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to)
-{
- NS_LOG_FUNCTION (this << packet << from);
- m_forwardUp (packet, from, to);
-}
-
-void
-QapWifiMac::ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to)
-{
- /* For now Qos AP sends only Qos frame. In the future it should be able to
- send frames also to Non-Qos Stas.
- */
- NS_LOG_FUNCTION (this << packet << from << to);
- WifiMacHeader hdr;
- hdr.SetType (WIFI_MAC_QOSDATA);
- hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
- hdr.SetQosNoEosp ();
- hdr.SetQosNoAmsdu ();
- /* Transmission of multiple frames in the same
- Txop is not supported for now */
- hdr.SetQosTxopLimit (0);
-
- hdr.SetAddr1 (to);
- hdr.SetAddr2 (GetAddress ());
- hdr.SetAddr3 (from);
- hdr.SetDsFrom ();
- hdr.SetDsNotTo ();
-
- uint8_t tid = QosUtilsGetTidForPacket (packet);
- if (tid < 8)
- {
- hdr.SetQosTid (tid);
- AcIndex ac = QosUtilsMapTidToAc (tid);
- m_queues[ac]->Queue (packet, hdr);
- }
- else
- {
- //packet is considerated belonging to BestEffort AC
- hdr.SetQosTid (0);
- m_queues[AC_BE]->Queue (packet, hdr);
- }
-}
-
-void
-QapWifiMac::ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to,
- const WifiMacHeader *oldHdr)
-{
- /* For now Qos AP sends only Qos frame. In the future it should be able to
- send frames also to Non-Qos Stas.
- */
- NS_LOG_FUNCTION (this << packet << from << to);
- NS_ASSERT (oldHdr->IsQosData ());
- WifiMacHeader hdr;
- hdr.SetType (WIFI_MAC_QOSDATA);
- hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
- hdr.SetQosNoEosp ();
- hdr.SetQosNoAmsdu ();
- /* Transmission of multiple frames in the same
- Txop is not supported for now */
- hdr.SetQosTxopLimit (0);
- hdr.SetQosTid (oldHdr->GetQosTid ());
-
- hdr.SetAddr1 (to);
- hdr.SetAddr2 (GetAddress ());
- hdr.SetAddr3 (from);
- hdr.SetDsFrom ();
- hdr.SetDsNotTo ();
-
- AcIndex ac = QosUtilsMapTidToAc (oldHdr->GetQosTid ());
- m_queues[ac]->Queue (packet, hdr);
-}
-
-void
-QapWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from)
-{
- NS_LOG_FUNCTION (this << packet << from << to);
- if (to.IsBroadcast () || m_stationManager->IsAssociated (to))
- {
- ForwardDown (packet, from, to);
- }
-}
-
-void
-QapWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to)
-{
- NS_LOG_FUNCTION (this << packet << to);
- if (to.IsBroadcast () || m_stationManager->IsAssociated (to))
- {
- ForwardDown (packet, m_low->GetAddress (), to);
- }
-}
-
-bool
-QapWifiMac::SupportsSendFrom (void) const
-{
- return true;
-}
-
-SupportedRates
-QapWifiMac::GetSupportedRates (void) const
-{
- // send the set of supported rates and make sure that we indicate
- // the Basic Rate set in this set of supported rates.
- SupportedRates rates;
- for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
- {
- WifiMode mode = m_phy->GetMode (i);
- rates.AddSupportedRate (mode.GetDataRate ());
- }
- // set the basic rates
- for (uint32_t j = 0; j < m_stationManager->GetNBasicModes (); j++)
- {
- WifiMode mode = m_stationManager->GetBasicMode (j);
- rates.SetBasicRate (mode.GetDataRate ());
- }
- return rates;
-}
-
-void
-QapWifiMac::SendProbeResp (Mac48Address to)
-{
- NS_LOG_FUNCTION (this << to);
- WifiMacHeader hdr;
- hdr.SetProbeResp ();
- hdr.SetAddr1 (to);
- hdr.SetAddr2 (GetAddress ());
- hdr.SetAddr3 (GetAddress ());
- hdr.SetDsNotFrom ();
- hdr.SetDsNotTo ();
- Ptr<Packet> packet = Create<Packet> ();
- MgtProbeResponseHeader probe;
- probe.SetSsid (GetSsid ());
- probe.SetSupportedRates (GetSupportedRates ());
- probe.SetBeaconIntervalUs (m_beaconInterval.GetMicroSeconds ());
- packet->AddHeader (probe);
-
- /* Which is correct queue for management frames ? */
- m_queues[AC_VO]->Queue (packet, hdr);
-}
-
-void
-QapWifiMac::SendAssocResp (Mac48Address to, bool success)
-{
- NS_LOG_FUNCTION (this << to << success);
- WifiMacHeader hdr;
- hdr.SetAssocResp ();
- hdr.SetAddr1 (to);
- hdr.SetAddr2 (GetAddress ());
- hdr.SetAddr3 (GetAddress ());
- hdr.SetDsNotFrom ();
- hdr.SetDsNotTo ();
- Ptr<Packet> packet = Create<Packet> ();
- MgtAssocResponseHeader assoc;
- StatusCode code;
- if (success)
- {
- code.SetSuccess ();
- }
- else
- {
- code.SetFailure ();
- }
- assoc.SetSupportedRates (GetSupportedRates ());
- assoc.SetStatusCode (code);
- packet->AddHeader (assoc);
-
- /* Which is correct queue for management frames ? */
- m_queues[AC_VO]->Queue (packet, hdr);
-}
-
-void
-QapWifiMac::SendOneBeacon (void)
-{
- NS_LOG_FUNCTION (this);
- WifiMacHeader hdr;
- hdr.SetBeacon ();
- hdr.SetAddr1 (Mac48Address::GetBroadcast ());
- hdr.SetAddr2 (GetAddress ());
- hdr.SetAddr3 (GetAddress ());
- hdr.SetDsNotFrom ();
- hdr.SetDsNotTo ();
- Ptr<Packet> packet = Create<Packet> ();
- MgtBeaconHeader beacon;
- beacon.SetSsid (GetSsid ());
- beacon.SetSupportedRates (GetSupportedRates ());
- beacon.SetBeaconIntervalUs (m_beaconInterval.GetMicroSeconds ());
-
- packet->AddHeader (beacon);
-
- m_beaconDca->Queue (packet, hdr);
- m_beaconEvent = Simulator::Schedule (m_beaconInterval, &QapWifiMac::SendOneBeacon, this);
-}
-
-void
-QapWifiMac::TxOk (const WifiMacHeader &hdr)
-{
- NS_LOG_FUNCTION (this);
- if (hdr.IsAssocResp () &&
- m_stationManager->IsWaitAssocTxOk (hdr.GetAddr1 ()))
- {
- NS_LOG_DEBUG ("associated with sta="<<hdr.GetAddr1 ());
- m_stationManager->RecordGotAssocTxOk (hdr.GetAddr1 ());
- }
-}
-
-void
-QapWifiMac::TxFailed (const WifiMacHeader &hdr)
-{
- NS_LOG_FUNCTION (this);
- if (hdr.IsAssocResp () &&
- m_stationManager->IsWaitAssocTxOk (hdr.GetAddr1 ()))
- {
- NS_LOG_DEBUG ("assoc failed with sta="<<hdr.GetAddr1 ());
- m_stationManager->RecordGotAssocTxFailed (hdr.GetAddr1 ());
- }
-}
-
-void
-QapWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
-{
- NS_LOG_FUNCTION (this << packet << hdr);
-
- Mac48Address from = hdr->GetAddr2 ();
-
- if (hdr->IsData ())
- {
- Mac48Address bssid = hdr->GetAddr1 ();
- if (!hdr->IsFromDs () &&
- hdr->IsToDs () &&
- bssid == GetAddress () &&
- m_stationManager->IsAssociated (from))
- {
- Mac48Address to = hdr->GetAddr3 ();
-
- if (to == GetAddress ())
- {
- NS_LOG_DEBUG ("frame for me (Qap) from="<<from);
- if (hdr->IsQosData ())
- {
- if (hdr->IsQosAmsdu ())
- {
- NS_LOG_DEBUG ("Received A-MSDU from="<<from<<", size="<<packet->GetSize ());
- DeaggregateAmsduAndForward (packet, hdr);
- packet = 0;
- }
- else
- {
- ForwardUp (packet, from, bssid);
- }
- }
- else
- {
- ForwardUp (packet, from, bssid);
- }
- }
- else if (to.IsGroup () ||
- m_stationManager->IsAssociated (to))
- {
- NS_LOG_DEBUG ("forwarding frame from="<<from<<", to="<<to);
- Ptr<Packet> copy = packet->Copy ();
- ForwardDown (packet, from, to, hdr);
- ForwardUp (copy, from, to);
- }
- else
- {
- ForwardUp (packet, from, to);
- }
- }
- else if (hdr->IsFromDs () &&
- hdr->IsToDs ())
- {
- // this is an AP-to-AP frame
- // we ignore for now.
- }
- else
- {
- // we can ignore these frames since
- // they are not targeted at the AP
- }
- }
- else if (hdr->IsMgt ())
- {
- if (hdr->IsProbeReq ())
- {
- NS_ASSERT (hdr->GetAddr1 ().IsBroadcast ());
- SendProbeResp (hdr->GetAddr2 ());
- }
- else if (hdr->GetAddr1 () == GetAddress ())
- {
- if (hdr->IsAssocReq ())
- {
- // first, verify that the the station's supported
- // rate set is compatible with our Basic Rate set
- MgtAssocRequestHeader assocReq;
- packet->RemoveHeader (assocReq);
- SupportedRates rates = assocReq.GetSupportedRates ();
- bool problem = false;
- for (uint32_t i = 0; i < m_stationManager->GetNBasicModes (); i++)
- {
- WifiMode mode = m_stationManager->GetBasicMode (i);
- if (!rates.IsSupportedRate (mode.GetDataRate ()))
- {
- problem = true;
- break;
- }
- }
- if (problem)
- {
- // one of the Basic Rate set mode is not
- // supported by the station. So, we return an assoc
- // response with an error status.
- SendAssocResp (hdr->GetAddr2 (), false);
- }
- else
- {
- // station supports all rates in Basic Rate Set.
- // record all its supported modes in its associated WifiRemoteStation
- for (uint32_t j = 0; j < m_phy->GetNModes (); j++)
- {
- WifiMode mode = m_phy->GetMode (j);
- if (rates.IsSupportedRate (mode.GetDataRate ()))
- {
- m_stationManager->AddSupportedMode (from, mode);
- }
- }
- m_stationManager->RecordWaitAssocTxOk (from);
- // send assoc response with success status.
- SendAssocResp (hdr->GetAddr2 (), true);
- }
- }
- else if (hdr->IsDisassociation ())
- {
- m_stationManager->RecordDisassociated (from);
- }
- else if (hdr->IsReassocReq ())
- {
- /* we don't support reassoc frames for now */
- }
- else if (hdr->IsAction ())
- {
- WifiActionHeader actionHdr;
- packet->RemoveHeader (actionHdr);
- if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK &&
- actionHdr.GetAction().blockAck == WifiActionHeader::BLOCK_ACK_ADDBA_REQUEST)
- {
- MgtAddBaRequestHeader reqHdr;
- packet->RemoveHeader (reqHdr);
- SendAddBaResponse (&reqHdr, hdr->GetAddr2 ());
- }
- else if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK &&
- actionHdr.GetAction().blockAck == WifiActionHeader::BLOCK_ACK_ADDBA_RESPONSE)
- {
- MgtAddBaResponseHeader respHdr;
- packet->RemoveHeader (respHdr);
- m_queues[QosUtilsMapTidToAc (respHdr.GetTid ())]->GotAddBaResponse (&respHdr, hdr->GetAddr2 ());
- }
- else if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK &&
- actionHdr.GetAction().blockAck == WifiActionHeader::BLOCK_ACK_DELBA)
- {
- MgtDelBaHeader delBaHdr;
- packet->RemoveHeader (delBaHdr);
- if (delBaHdr.IsByOriginator ())
- {
- /* Delba frame was sent by originator, this means that an ingoing established
- agreement exists in MacLow */
- m_low->DestroyBlockAckAgreement (hdr->GetAddr2 (), delBaHdr.GetTid ());
- }
- else
- {
- /* We must notify correct queue tear down of agreement */
- AcIndex ac = QosUtilsMapTidToAc (delBaHdr.GetTid ());
- m_queues[ac]->GotDelBaFrame (&delBaHdr, hdr->GetAddr2 ());
- }
- }
- }
- else if (hdr->IsAuthentication () ||
- hdr->IsDeauthentication ())
- {
- /*
- */
- }
- else
- {
- /* unknown mgt frame
- */
- }
- }
- }
-}
-
-void
-QapWifiMac::DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket, const WifiMacHeader *hdr)
-{
- DeaggregatedMsdus packets = MsduAggregator::Deaggregate (aggregatedPacket);
- for (DeaggregatedMsdusCI i = packets.begin (); i != packets.end (); ++i)
- {
- if ((*i).second.GetDestinationAddr () == GetAddress ())
- {
- ForwardUp ((*i).first, (*i).second.GetSourceAddr (),
- (*i).second.GetDestinationAddr ());
- }
- else
- {
- Mac48Address from = (*i).second.GetSourceAddr ();
- Mac48Address to = (*i).second.GetDestinationAddr ();
- NS_LOG_DEBUG ("forwarding QoS frame from="<<from<<", to="<<to);
- ForwardDown ((*i).first, from, to, hdr);
- }
- }
-}
-
-Ptr<EdcaTxopN>
-QapWifiMac::GetVOQueue (void) const
-{
- return m_queues.find (AC_VO)->second;
-}
-
-Ptr<EdcaTxopN>
-QapWifiMac::GetVIQueue (void) const
-{
- return m_queues.find (AC_VI)->second;
-}
-
-Ptr<EdcaTxopN>
-QapWifiMac::GetBEQueue (void) const
-{
- return m_queues.find (AC_BE)->second;
-}
-
-Ptr<EdcaTxopN>
-QapWifiMac::GetBKQueue (void) const
-{
- return m_queues.find (AC_BK)->second;
-}
-
-void
-QapWifiMac::SetQueue (enum AcIndex ac)
-{
- Ptr<EdcaTxopN> edca = CreateObject<EdcaTxopN> ();
- edca->SetLow (m_low);
- edca->SetManager (m_dcfManager);
- edca->SetTypeOfStation (AP);
- edca->SetTxMiddle (m_txMiddle);
- edca->SetTxOkCallback (MakeCallback (&QapWifiMac::TxOk, this));
- edca->SetTxFailedCallback (MakeCallback (&QapWifiMac::TxFailed, this));
- edca->SetAccessCategory (ac);
- edca->CompleteConfig ();
- m_queues.insert (std::make_pair(ac, edca));
-}
-
-void
-QapWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard)
-{
- switch (standard)
- {
- case WIFI_PHY_STANDARD_80211p_CCH:
- ConfigureCCHDcf (m_queues[AC_BK], 15, 511, AC_BK);
- ConfigureCCHDcf (m_queues[AC_BE], 15, 511, AC_BE);
- ConfigureCCHDcf (m_queues[AC_VI], 15, 511, AC_VI);
- ConfigureCCHDcf (m_queues[AC_VO], 15, 511, AC_VO);
- break;
- case WIFI_PHY_STANDARD_80211p_SCH:
- ConfigureDcf (m_queues[AC_BK], 15, 511, AC_BK);
- ConfigureDcf (m_queues[AC_BE], 15, 511, AC_BE);
- ConfigureDcf (m_queues[AC_VI], 15, 511, AC_VI);
- ConfigureDcf (m_queues[AC_VO], 15, 511, AC_VO);
- break;
- case WIFI_PHY_STANDARD_holland:
- // fall through
- case WIFI_PHY_STANDARD_80211a:
- // fall through
- case WIFI_PHY_STANDARD_80211g:
- // fall through
- case WIFI_PHY_STANDARD_80211_10Mhz:
- // fall through
- case WIFI_PHY_STANDARD_80211_5Mhz:
- ConfigureDcf (m_queues[AC_BK], 15, 1023, AC_BK);
- ConfigureDcf (m_queues[AC_BE], 15, 1023, AC_BE);
- ConfigureDcf (m_queues[AC_VI], 15, 1023, AC_VI);
- ConfigureDcf (m_queues[AC_VO], 15, 1023, AC_VO);
- break;
- case WIFI_PHY_STANDARD_80211b:
- ConfigureDcf (m_queues[AC_BK], 31, 1023, AC_BK);
- ConfigureDcf (m_queues[AC_BE], 31, 1023, AC_BE);
- ConfigureDcf (m_queues[AC_VI], 31, 1023, AC_VI);
- ConfigureDcf (m_queues[AC_VO], 31, 1023, AC_VO);
- break;
- default:
- NS_ASSERT (false);
- break;
- }
-}
-
-void
-QapWifiMac::DoStart (void)
-{
- m_beaconDca->Start ();
- for (Queues::iterator i = m_queues.begin (); i != m_queues.end (); ++i)
- {
- i->second->Start ();
- }
- m_beaconEvent.Cancel ();
- if (m_enableBeaconGeneration)
- {
- m_beaconEvent = Simulator::ScheduleNow (&QapWifiMac::SendOneBeacon, this);
- }
- WifiMac::DoStart ();
-}
-
-void
-QapWifiMac::SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr, Mac48Address originator)
-{
- NS_LOG_FUNCTION (this);
- WifiMacHeader hdr;
- hdr.SetAction ();
- hdr.SetAddr1 (originator);
- hdr.SetAddr2 (m_low->GetAddress ());
- hdr.SetAddr3 (m_low->GetAddress ());
- hdr.SetDsNotFrom ();
- hdr.SetDsNotTo ();
-
- MgtAddBaResponseHeader respHdr;
- StatusCode code;
- code.SetSuccess ();
- respHdr.SetStatusCode (code);
- //Here a control about queues type?
- respHdr.SetAmsduSupport (reqHdr->IsAmsduSupported ());
-
- if (reqHdr->IsImmediateBlockAck ())
- {
- respHdr.SetImmediateBlockAck ();
- }
- else
- {
- respHdr.SetDelayedBlockAck ();
- }
- respHdr.SetTid (reqHdr->GetTid ());
- /* For now there's not no control about limit of reception.
- We assume that receiver has no limit on reception.
- However we assume that a receiver sets a bufferSize in order to satisfy
- next equation:
- (bufferSize + 1) % 16 = 0
- So if a recipient is able to buffer a packet, it should be also able to buffer
- all possible packet's fragments.
- See section 7.3.1.14 in IEEE802.11e for more details. */
- respHdr.SetBufferSize (1023);
- respHdr.SetTimeout (reqHdr->GetTimeout ());
-
- WifiActionHeader actionHdr;
- WifiActionHeader::ActionValue action;
- action.blockAck = WifiActionHeader::BLOCK_ACK_ADDBA_RESPONSE;
- actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
-
- Ptr<Packet> packet = Create<Packet> ();
- packet->AddHeader (respHdr);
- packet->AddHeader (actionHdr);
-
- /* ns3::MacLow have to buffer all correctly received packet for this block ack session */
- m_low->CreateBlockAckAgreement (&respHdr, originator, reqHdr->GetStartingSequence ());
-
- //Better a management queue?
- m_queues[QosUtilsMapTidToAc (reqHdr->GetTid ())]->PushFront (packet, hdr);
-}
-
-} //namespace ns3
--- a/src/devices/wifi/qap-wifi-mac.h Tue Dec 21 17:39:54 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006, 2009 INRIA
- * Copyright (c) 2009 MIRKO BANCHI
- *
- * 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
- */
-#ifndef QAP_WIFI_MAC_H
-#define QAP_WIFI_MAC_H
-
-#include "ns3/mac48-address.h"
-#include "ns3/callback.h"
-#include "ns3/packet.h"
-#include "ns3/nstime.h"
-#include "ns3/event-id.h"
-
-#include "supported-rates.h"
-#include "wifi-remote-station-manager.h"
-#include "wifi-mac.h"
-#include "qos-utils.h"
-
-#include <map>
-
-namespace ns3 {
-
-class DcaTxop;
-class EdcaTxopN;
-class WifiMacHeader;
-class WifiPhy;
-class MacLow;
-class MacRxMiddle;
-class MacTxMiddle;
-class DcfManager;
-class AmsduSubframeHeader;
-class MsduAggregator;
-class MgtAddBaRequestHeader;
-
-class QapWifiMac : public WifiMac
-{
-public:
- static TypeId GetTypeId (void);
- QapWifiMac ();
- virtual ~QapWifiMac ();
-
- // inherited from WifiMac.
- virtual void SetSlot (Time slotTime);
- virtual void SetSifs (Time sifs);
- virtual void SetEifsNoDifs (Time eifsNoDifs);
- virtual void SetAckTimeout (Time ackTimeout);
- virtual void SetCtsTimeout (Time ctsTimeout);
- virtual void SetPifs (Time pifs);
- virtual Time GetSlot (void) const;
- virtual Time GetSifs (void) const;
- virtual Time GetEifsNoDifs (void) const;
- virtual Time GetAckTimeout (void) const;
- virtual Time GetCtsTimeout (void) const;
- virtual Time GetPifs (void) const;
- virtual void SetWifiPhy (Ptr<WifiPhy> phy);
- virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager);
- virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
- virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to);
- virtual bool SupportsSendFrom (void) const;
- virtual void SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback);
- virtual void SetLinkUpCallback (Callback<void> linkUp);
- virtual void SetLinkDownCallback (Callback<void> linkDown);
- virtual Mac48Address GetAddress (void) const;
- virtual Ssid GetSsid (void) const;
- virtual void SetAddress (Mac48Address address);
- virtual void SetSsid (Ssid ssid);
- virtual Mac48Address GetBssid (void) const;
- virtual void SetBasicBlockAckTimeout (Time blockAckTimeout);
- virtual void SetCompressedBlockAckTimeout (Time blockAckTimeout);
- virtual Time GetBasicBlockAckTimeout (void) const;
- virtual Time GetCompressedBlockAckTimeout (void) const;
-
- void SetBeaconInterval (Time interval);
- Time GetBeaconInterval (void) const;
- void StartBeaconing (void);
-
-private:
- typedef std::map<AcIndex, Ptr<EdcaTxopN> > Queues;
- typedef std::list<std::pair<Ptr<Packet>, AmsduSubframeHeader> > DeaggregatedMsdus;
- typedef std::list<std::pair<Ptr<Packet>, AmsduSubframeHeader> >::const_iterator DeaggregatedMsdusCI;
-
- virtual void DoDispose (void);
- virtual void DoStart (void);
- void Receive (Ptr<Packet> packet, const WifiMacHeader* 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. */
- void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to,
- const WifiMacHeader* oldHdr);
- void TxOk (const WifiMacHeader& hdr);
- void TxFailed (const WifiMacHeader& hdr);
- void SendProbeResp (Mac48Address to);
- void SendAssocResp (Mac48Address to, bool success);
- void SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr, Mac48Address originator);
- void SendOneBeacon (void);
- SupportedRates GetSupportedRates (void) const;
- void SetBeaconGeneration (bool enable);
- bool GetBeaconGeneration (void) const;
-
- void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket, const WifiMacHeader* hdr);
- QapWifiMac &operator = (const QapWifiMac &);
- QapWifiMac (const QapWifiMac &);
-
- Ptr<EdcaTxopN> GetVOQueue (void) const;
- Ptr<EdcaTxopN> GetVIQueue (void) const;
- Ptr<EdcaTxopN> GetBEQueue (void) const;
- Ptr<EdcaTxopN> GetBKQueue (void) const;
- void SetQueue (enum AcIndex ac);
-
- virtual void FinishConfigureStandard (enum WifiPhyStandard standard);
-
- Queues m_queues;
- Ptr<DcaTxop> m_beaconDca;
- Ptr<MacLow> m_low;
- Ptr<WifiPhy> m_phy;
- Ptr<WifiRemoteStationManager> m_stationManager;
- MacRxMiddle *m_rxMiddle;
- MacTxMiddle *m_txMiddle;
- DcfManager *m_dcfManager;
- Ssid m_ssid;
- EventId m_beaconEvent;
- Time m_beaconInterval;
- bool m_enableBeaconGeneration;
- Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> m_forwardUp;
-};
-
-} //namespace ns3
-
-#endif /* QAP_WIFI_MAC_H */
--- a/src/devices/wifi/qsta-wifi-mac.cc Tue Dec 21 17:39:54 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,910 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006, 2009 INRIA
- * Copyright (c) 2009 MIRKO BANCHI
- *
- * 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
- */
-#include "ns3/log.h"
-#include "ns3/simulator.h"
-#include "ns3/string.h"
-#include "ns3/pointer.h"
-#include "ns3/boolean.h"
-
-#include "qos-tag.h"
-#include "edca-txop-n.h"
-#include "qsta-wifi-mac.h"
-#include "mac-low.h"
-#include "dcf-manager.h"
-#include "mac-rx-middle.h"
-#include "mac-tx-middle.h"
-#include "wifi-mac-header.h"
-#include "msdu-aggregator.h"
-#include "amsdu-subframe-header.h"
-#include "mgt-headers.h"
-
-NS_LOG_COMPONENT_DEFINE ("QstaWifiMac");
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED (QstaWifiMac);
-
-TypeId
-QstaWifiMac::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::QstaWifiMac")
- .SetParent<WifiMac> ()
- .AddConstructor<QstaWifiMac> ()
- .AddAttribute ("ProbeRequestTimeout", "The interval between two consecutive probe request attempts.",
- TimeValue (Seconds (0.05)),
- MakeTimeAccessor (&QstaWifiMac::m_probeRequestTimeout),
- MakeTimeChecker ())
- .AddAttribute ("AssocRequestTimeout", "The interval between two consecutive assoc request attempts.",
- TimeValue (Seconds (0.5)),
- MakeTimeAccessor (&QstaWifiMac::m_assocRequestTimeout),
- MakeTimeChecker ())
- .AddAttribute ("MaxMissedBeacons",
- "Number of beacons which much be consecutively missed before "
- "we attempt to restart association.",
- UintegerValue (10),
- MakeUintegerAccessor (&QstaWifiMac::m_maxMissedBeacons),
- MakeUintegerChecker<uint32_t> ())
- .AddAttribute ("ActiveProbing", "If true, we send probe requests. If false, we don't.",
- BooleanValue (false),
- MakeBooleanAccessor (&QstaWifiMac::SetActiveProbing),
- MakeBooleanChecker ())
- .AddAttribute ("VO_EdcaTxopN",
- "Queue that manages packets belonging to AC_VO access class",
- PointerValue (),
- MakePointerAccessor(&QstaWifiMac::GetVOQueue),
- MakePointerChecker<EdcaTxopN> ())
- .AddAttribute ("VI_EdcaTxopN",
- "Queue that manages packets belonging to AC_VI access class",
- PointerValue (),
- MakePointerAccessor(&QstaWifiMac::GetVIQueue),
- MakePointerChecker<EdcaTxopN> ())
- .AddAttribute ("BE_EdcaTxopN",
- "Queue that manages packets belonging to AC_BE access class",
- PointerValue (),
- MakePointerAccessor(&QstaWifiMac::GetBEQueue),
- MakePointerChecker<EdcaTxopN> ())
- .AddAttribute ("BK_EdcaTxopN",
- "Queue that manages packets belonging to AC_BK access class",
- PointerValue (),
- MakePointerAccessor(&QstaWifiMac::GetBKQueue),
- MakePointerChecker<EdcaTxopN> ())
- ;
- return tid;
-}
-
-QstaWifiMac::QstaWifiMac ()
- : m_state (BEACON_MISSED),
- m_probeRequestEvent (),
- m_assocRequestEvent (),
- m_beaconWatchdogEnd (Seconds (0.0))
-{
- NS_LOG_FUNCTION (this);
- m_rxMiddle = new MacRxMiddle ();
- m_rxMiddle->SetForwardCallback (MakeCallback (&QstaWifiMac::Receive, this));
- /*TxMiddle can be shared between all queues */
- m_txMiddle= new MacTxMiddle ();
-
- m_low = CreateObject<MacLow> ();
- m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle));
-
- m_dcfManager = new DcfManager ();
- m_dcfManager->SetupLowListener (m_low);
-
- // Construct the EDCAFs. The ordering is important - highest
- // priority (see Table 9-1 in IEEE 802.11-2007) must be created
- // first.
- SetQueue (AC_VO);
- SetQueue (AC_VI);
- SetQueue (AC_BE);
- SetQueue (AC_BK);
-}
-
-QstaWifiMac::~QstaWifiMac ()
-{
- NS_LOG_FUNCTION (this);
-}
-
-void
-QstaWifiMac::DoDispose ()
-{
- NS_LOG_FUNCTION (this);
- delete m_rxMiddle;
- delete m_txMiddle;
- delete m_dcfManager;
- m_low->Dispose ();
- m_rxMiddle = 0;
- m_txMiddle = 0;
- m_low = 0;
- m_phy = 0;
- m_dcfManager = 0;
- m_stationManager = 0;
- for (Queues::iterator i = m_queues.begin (); i != m_queues.end (); ++i)
- {
- (*i).second = 0;
- }
- WifiMac::DoDispose ();
-}
-
-void
-QstaWifiMac::SetSlot (Time slotTime)
-{
- NS_LOG_FUNCTION (this << slotTime);
- m_dcfManager->SetSlot (slotTime);
- m_low->SetSlotTime (slotTime);
-}
-
-void
-QstaWifiMac::SetSifs (Time sifs)
-{
- NS_LOG_FUNCTION (this << sifs);
- m_dcfManager->SetSifs (sifs);
- m_low->SetSifs (sifs);
-}
-
-void
-QstaWifiMac::SetEifsNoDifs (Time eifsNoDifs)
-{
- NS_LOG_FUNCTION (this << eifsNoDifs);
- m_dcfManager->SetEifsNoDifs (eifsNoDifs);
-}
-
-void
-QstaWifiMac::SetAckTimeout (Time ackTimeout)
-{
- m_low->SetAckTimeout (ackTimeout);
-}
-
-void
-QstaWifiMac::SetBasicBlockAckTimeout (Time blockAckTimeout)
-{
- m_low->SetBasicBlockAckTimeout (blockAckTimeout);
-}
-
-void
-QstaWifiMac::SetCompressedBlockAckTimeout (Time blockAckTimeout)
-{
- m_low->SetCompressedBlockAckTimeout (blockAckTimeout);
-}
-
-void
-QstaWifiMac::SetCtsTimeout (Time ctsTimeout)
-{
- m_low->SetCtsTimeout (ctsTimeout);
-}
-
-void
-QstaWifiMac::SetPifs (Time pifs)
-{
- m_low->SetPifs (pifs);
-}
-
-Time
-QstaWifiMac::GetSlot (void) const
-{
- return m_low->GetSlotTime ();
-}
-
-Time
-QstaWifiMac::GetSifs (void) const
-{
- return m_low->GetSifs ();
-}
-
-Time
-QstaWifiMac::GetEifsNoDifs (void) const
-{
- return m_dcfManager->GetEifsNoDifs ();
-}
-
-Time
-QstaWifiMac::GetAckTimeout (void) const
-{
- return m_low->GetAckTimeout ();
-}
-
-Time
-QstaWifiMac::GetBasicBlockAckTimeout (void) const
-{
- return m_low->GetBasicBlockAckTimeout ();
-}
-
-Time
-QstaWifiMac::GetCompressedBlockAckTimeout (void) const
-{
- return m_low->GetCompressedBlockAckTimeout ();
-}
-
-Time
-QstaWifiMac::GetCtsTimeout (void) const
-{
- return m_low->GetCtsTimeout ();
-}
-
-Time
-QstaWifiMac::GetPifs (void) const
-{
- return m_low->GetPifs ();
-}
-
-void
-QstaWifiMac::SetWifiPhy (Ptr<WifiPhy> phy)
-{
- m_phy = phy;
- m_dcfManager->SetupPhyListener (phy);
- m_low->SetPhy (phy);
-}
-
-void
-QstaWifiMac::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager)
-{
- m_stationManager = stationManager;
- m_queues[AC_VO]->SetWifiRemoteStationManager (stationManager);
- m_queues[AC_VI]->SetWifiRemoteStationManager (stationManager);
- m_queues[AC_BE]->SetWifiRemoteStationManager (stationManager);
- m_queues[AC_BK]->SetWifiRemoteStationManager (stationManager);
- m_low->SetWifiRemoteStationManager (stationManager);
-}
-
-void
-QstaWifiMac::SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback)
-{
- m_forwardUp = upCallback;
-}
-
-void
-QstaWifiMac::SetLinkUpCallback (Callback<void> linkUp)
-{
- m_linkUp = linkUp;
-}
-
-void
-QstaWifiMac::SetLinkDownCallback (Callback<void> linkDown)
-{
- m_linkDown = linkDown;
-}
-
-Mac48Address
-QstaWifiMac::GetAddress (void) const
-{
- return m_low->GetAddress ();
-}
-
-Ssid
-QstaWifiMac::GetSsid (void) const
-{
- return m_ssid;
-}
-
-Mac48Address
-QstaWifiMac::GetBssid () const
-{
- return m_low->GetBssid ();
-}
-
-void
-QstaWifiMac::SetAddress (Mac48Address address)
-{
- NS_LOG_FUNCTION (this << address);
- m_low->SetAddress (address);
-}
-
-void
-QstaWifiMac::SetSsid (Ssid ssid)
-{
- NS_LOG_FUNCTION (this << ssid);
- m_ssid = ssid;
-}
-
-void
-QstaWifiMac::SetMaxMissedBeacons (uint32_t missed)
-{
- NS_LOG_FUNCTION (this << missed);
- m_maxMissedBeacons = missed;
-}
-
-void
-QstaWifiMac::SetProbeRequestTimeout (Time timeout)
-{
- NS_LOG_FUNCTION (this << timeout);
- m_probeRequestTimeout = timeout;
-}
-
-void
-QstaWifiMac::SetAssocRequestTimeout (Time timeout)
-{
- NS_LOG_FUNCTION (this << timeout);
- m_assocRequestTimeout = timeout;
-}
-
-void
-QstaWifiMac::StartActiveAssociation (void)
-{
- NS_LOG_FUNCTION (this);
- TryToEnsureAssociated ();
-}
-
-Mac48Address
-QstaWifiMac::GetBroadcastBssid (void)
-{
- return Mac48Address::GetBroadcast ();
-}
-
-void
-QstaWifiMac::SetBssid (Mac48Address bssid)
-{
- NS_LOG_FUNCTION (this << bssid);
- m_low->SetBssid (bssid);
-}
-
-void
-QstaWifiMac::SetActiveProbing (bool enable)
-{
- NS_LOG_FUNCTION (this << enable);
- if (enable)
- {
- TryToEnsureAssociated ();
- }
- else
- {
- m_probeRequestEvent.Cancel ();
- }
-}
-
-void
-QstaWifiMac::ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to)
-{
- NS_LOG_FUNCTION (this << packet << from << to);
- m_forwardUp (packet, from, to);
-}
-
-void
-QstaWifiMac::SendProbeRequest (void)
-{
- NS_LOG_FUNCTION (this);
- WifiMacHeader hdr;
- hdr.SetProbeReq ();
- hdr.SetAddr1 (GetBroadcastBssid ());
- hdr.SetAddr2 (GetAddress ());
- hdr.SetAddr3 (GetBroadcastBssid ());
- hdr.SetDsNotFrom ();
- hdr.SetDsNotTo ();
- Ptr<Packet> packet = Create<Packet> ();
- MgtProbeRequestHeader probe;
- probe.SetSsid (GetSsid ());
- probe.SetSupportedRates (GetSupportedRates ());
- packet->AddHeader (probe);
-
- /* Which is correct queue for management frames ? */
- m_queues[AC_VO]->Queue (packet, hdr);
-
- m_probeRequestEvent = Simulator::Schedule (m_probeRequestTimeout,
- &QstaWifiMac::ProbeRequestTimeout, this);
-}
-
-void
-QstaWifiMac::SendAssociationRequest (void)
-{
- NS_LOG_FUNCTION (this << GetBssid ());
- WifiMacHeader hdr;
- hdr.SetAssocReq ();
- hdr.SetAddr1 (GetBssid ());
- hdr.SetAddr2 (GetAddress ());
- hdr.SetAddr3 (GetBssid ());
- hdr.SetDsNotFrom ();
- hdr.SetDsNotTo ();
- Ptr<Packet> packet = Create<Packet> ();
- MgtAssocRequestHeader assoc;
- assoc.SetSsid (GetSsid ());
- assoc.SetSupportedRates (GetSupportedRates ());
- packet->AddHeader (assoc);
-
- /* Which is correct queue for management frames ? */
- m_queues[AC_VO]->Queue (packet, hdr);
-
- m_assocRequestEvent = Simulator::Schedule (m_assocRequestTimeout,
- &QstaWifiMac::AssocRequestTimeout, this);
-}
-
-void
-QstaWifiMac::TryToEnsureAssociated (void)
-{
- NS_LOG_FUNCTION (this);
- switch (m_state) {
- case ASSOCIATED:
- return;
- break;
- case WAIT_PROBE_RESP:
- /* we have sent a probe request earlier so we
- do not need to re-send a probe request immediately.
- We just need to wait until probe-request-timeout
- or until we get a probe response
- */
- break;
- case BEACON_MISSED:
- /* we were associated but we missed a bunch of beacons
- * so we should assume we are not associated anymore.
- * We try to initiate a probe request now.
- */
- m_linkDown ();
- m_state = WAIT_PROBE_RESP;
- SendProbeRequest ();
- break;
- case WAIT_ASSOC_RESP:
- /* we have sent an assoc request so we do not need to
- re-send an assoc request right now. We just need to
- wait until either assoc-request-timeout or until
- we get an assoc response.
- */
- break;
- case REFUSED:
- /* we have sent an assoc request and received a negative
- assoc resp. We wait until someone restarts an
- association with a given ssid.
- */
- break;
- }
-}
-
-void
-QstaWifiMac::AssocRequestTimeout (void)
-{
- NS_LOG_FUNCTION (this);
- m_state = WAIT_ASSOC_RESP;
- SendAssociationRequest ();
-}
-
-void
-QstaWifiMac::ProbeRequestTimeout (void)
-{
- NS_LOG_FUNCTION (this);
- m_state = WAIT_PROBE_RESP;
- SendProbeRequest ();
-}
-
-void
-QstaWifiMac::MissedBeacons (void)
-{
- NS_LOG_FUNCTION (this);
- if (m_beaconWatchdogEnd > Simulator::Now ())
- {
- m_beaconWatchdog = Simulator::Schedule (m_beaconWatchdogEnd - Simulator::Now (),
- &QstaWifiMac::MissedBeacons, this);
- return;
- }
- NS_LOG_DEBUG ("beacon missed");
- m_state = BEACON_MISSED;
- TryToEnsureAssociated ();
-}
-
-void
-QstaWifiMac::RestartBeaconWatchdog (Time delay)
-{
- NS_LOG_FUNCTION (this << delay);
- m_beaconWatchdogEnd = std::max (Simulator::Now () + delay, m_beaconWatchdogEnd);
- if (Simulator::GetDelayLeft (m_beaconWatchdog) < delay &&
- m_beaconWatchdog.IsExpired ())
- {
- NS_LOG_DEBUG ("really restart watchdog.");
- m_beaconWatchdog = Simulator::Schedule (delay, &QstaWifiMac::MissedBeacons, this);
- }
-}
-
-bool
-QstaWifiMac::IsAssociated (void) const
-{
- return m_state == ASSOCIATED;
-}
-
-bool
-QstaWifiMac::IsWaitAssocResp (void) const
-{
- return m_state == WAIT_ASSOC_RESP;
-}
-
-void
-QstaWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to)
-{
- NS_LOG_FUNCTION (this << packet << to);
- if (!IsAssociated ())
- {
- TryToEnsureAssociated ();
- return;
- }
- WifiMacHeader hdr;
-
- hdr.SetType (WIFI_MAC_QOSDATA);
- hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
- hdr.SetQosNoAmsdu ();
- hdr.SetQosNoEosp ();
- /* Transmission of multiple frames in the same
- Txop is not supported for now */
- hdr.SetQosTxopLimit (0);
-
- hdr.SetAddr1 (GetBssid ());
- hdr.SetAddr2 (m_low->GetAddress ());
- hdr.SetAddr3 (to);
- hdr.SetDsNotFrom ();
- hdr.SetDsTo ();
-
- uint8_t tid = QosUtilsGetTidForPacket (packet);
- if (tid < 8)
- {
- hdr.SetQosTid (tid);
- AcIndex ac = QosUtilsMapTidToAc (tid);
- m_queues[ac]->Queue (packet, hdr);
- }
- else
- {
- //packet is considerated belonging to BestEffort Access Class (AC_BE)
- hdr.SetQosTid (0);
- m_queues[AC_BE]->Queue (packet, hdr);
- }
-}
-
-bool
-QstaWifiMac::SupportsSendFrom (void) const
-{
- return true;
-}
-
-void
-QstaWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
-{
- NS_LOG_FUNCTION (this);
- NS_ASSERT (!hdr->IsCtl ());
- if (hdr->GetAddr1 () != GetAddress () &&
- !hdr->GetAddr1 ().IsGroup ())
- {
- NS_LOG_LOGIC ("packet is not for us");
- }
- else if (hdr->IsData ())
- {
- if (!IsAssociated ())
- {
- NS_LOG_LOGIC ("Received data frame while not associated: ignore");
- return;
- }
- if (!(hdr->IsFromDs () && !hdr->IsToDs ()))
- {
- NS_LOG_LOGIC ("Received data frame not from the DS: ignore");
- return;
- }
- if (hdr->GetAddr2 () != GetBssid ())
- {
- NS_LOG_LOGIC ("Received data frame not from the BSS we are associated with: ignore");
- return;
- }
- if (hdr->GetAddr3 () != GetAddress ())
- {
- if (hdr->IsQosData ())
- {
- if (hdr->IsQosAmsdu ())
- {
- NS_ASSERT (hdr->GetAddr3 () == GetBssid ());
- DeaggregateAmsduAndForward (packet, hdr);
- packet = 0;
- }
- else
- {
- ForwardUp (packet, hdr->GetAddr3 (), hdr->GetAddr1 ());
- }
- }
- else
- {
- ForwardUp (packet, hdr->GetAddr3 (), hdr->GetAddr1 ());
- }
- }
- }
- else if (hdr->IsBeacon ())
- {
- MgtBeaconHeader beacon;
- packet->RemoveHeader (beacon);
- bool goodBeacon = false;
- if (GetSsid ().IsBroadcast () ||
- beacon.GetSsid ().IsEqual (GetSsid ()))
- {
- goodBeacon = true;
- }
- if ((IsWaitAssocResp () || IsAssociated ()) && hdr->GetAddr3 () != GetBssid ())
- {
- goodBeacon = false;
- }
- if (goodBeacon)
- {
- Time delay = MicroSeconds (beacon.GetBeaconIntervalUs () * m_maxMissedBeacons);
- RestartBeaconWatchdog (delay);
- SetBssid (hdr->GetAddr3 ());
- }
- if (goodBeacon && m_state == BEACON_MISSED)
- {
- m_state = WAIT_ASSOC_RESP;
- SendAssociationRequest ();
- }
- }
- else if (hdr->IsProbeResp ())
- {
- if (m_state == WAIT_PROBE_RESP)
- {
- MgtProbeResponseHeader probeResp;
- packet->RemoveHeader (probeResp);
- if (!probeResp.GetSsid ().IsEqual (GetSsid ()))
- {
- //not a probe resp for our ssid.
- return;
- }
- SetBssid (hdr->GetAddr3 ());
- Time delay = MicroSeconds (probeResp.GetBeaconIntervalUs () * m_maxMissedBeacons);
- RestartBeaconWatchdog (delay);
- if (m_probeRequestEvent.IsRunning ())
- {
- m_probeRequestEvent.Cancel ();
- }
- m_state = WAIT_ASSOC_RESP;
- SendAssociationRequest ();
- }
- }
- else if (hdr->IsAssocResp ())
- {
- if (m_state == WAIT_ASSOC_RESP)
- {
- MgtAssocResponseHeader assocResp;
- packet->RemoveHeader (assocResp);
- if (m_assocRequestEvent.IsRunning ())
- {
- m_assocRequestEvent.Cancel ();
- }
- if (assocResp.GetStatusCode ().IsSuccess ())
- {
- m_state = ASSOCIATED;
- NS_LOG_DEBUG ("assoc completed");
- SupportedRates rates = assocResp.GetSupportedRates ();
- for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
- {
- WifiMode mode = m_phy->GetMode (i);
- if (rates.IsSupportedRate (mode.GetDataRate ()))
- {
- m_stationManager->AddSupportedMode (hdr->GetAddr2 (), mode);
- if (rates.IsBasicRate (mode.GetDataRate ()))
- {
- m_stationManager->AddBasicMode (mode);
- }
- }
- }
- if (!m_linkUp.IsNull ())
- {
- m_linkUp ();
- }
- }
- else
- {
- NS_LOG_DEBUG ("assoc refused");
- m_state = REFUSED;
- }
- }
- }
- else if (hdr->IsAction ())
- {
- WifiActionHeader actionHdr;
- packet->RemoveHeader (actionHdr);
- if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK &&
- actionHdr.GetAction().blockAck == WifiActionHeader::BLOCK_ACK_ADDBA_REQUEST)
- {
- MgtAddBaRequestHeader reqHdr;
- packet->RemoveHeader (reqHdr);
- SendAddBaResponse (&reqHdr, hdr->GetAddr2 ());
- }
- else if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK &&
- actionHdr.GetAction().blockAck == WifiActionHeader::BLOCK_ACK_ADDBA_RESPONSE)
- {
- MgtAddBaResponseHeader respHdr;
- packet->RemoveHeader (respHdr);
- m_queues[QosUtilsMapTidToAc (respHdr.GetTid ())]->GotAddBaResponse (&respHdr, hdr->GetAddr2 ());
- }
- else if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK &&
- actionHdr.GetAction().blockAck == WifiActionHeader::BLOCK_ACK_DELBA)
- {
- MgtDelBaHeader delBaHdr;
- packet->RemoveHeader (delBaHdr);
- if (delBaHdr.IsByOriginator ())
- {
- /* Delba frame was sent by originator, this means that an ingoing established
- agreement exists in MacLow */
- m_low->DestroyBlockAckAgreement (hdr->GetAddr2 (), delBaHdr.GetTid ());
- }
- else
- {
- /* We must notify correct queue tear down of agreement */
- AcIndex ac = QosUtilsMapTidToAc (delBaHdr.GetTid ());
- m_queues[ac]->GotDelBaFrame (&delBaHdr, hdr->GetAddr2 ());
- }
- }
- }
-}
-
-SupportedRates
-QstaWifiMac::GetSupportedRates (void) const
-{
- SupportedRates rates;
- for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
- {
- WifiMode mode = m_phy->GetMode (i);
- rates.AddSupportedRate (mode.GetDataRate ());
- }
- return rates;
-}
-
-void
-QstaWifiMac::DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket, const WifiMacHeader *hdr)
-{
- DeaggregatedMsdus packets = MsduAggregator::Deaggregate (aggregatedPacket);
- for (DeaggregatedMsdusCI i = packets.begin (); i != packets.end (); ++i)
- {
- ForwardUp ((*i).first, (*i).second.GetSourceAddr (),
- (*i).second.GetDestinationAddr ());
- }
-}
-
-Ptr<EdcaTxopN>
-QstaWifiMac::GetVOQueue (void) const
-{
- return m_queues.find (AC_VO)->second;
-}
-
-Ptr<EdcaTxopN>
-QstaWifiMac::GetVIQueue (void) const
-{
- return m_queues.find (AC_VI)->second;
-}
-
-Ptr<EdcaTxopN>
-QstaWifiMac::GetBEQueue (void) const
-{
- return m_queues.find (AC_BE)->second;
-}
-
-Ptr<EdcaTxopN>
-QstaWifiMac::GetBKQueue (void) const
-{
- return m_queues.find (AC_BK)->second;
-}
-
-void
-QstaWifiMac::SetQueue (enum AcIndex ac)
-{
- Ptr<EdcaTxopN> edca = CreateObject<EdcaTxopN> ();
- edca->SetLow (m_low);
- edca->SetManager (m_dcfManager);
- edca->SetTypeOfStation (STA);
- edca->SetTxMiddle (m_txMiddle);
- edca->SetAccessCategory (ac);
- edca->CompleteConfig ();
- m_queues.insert (std::make_pair(ac, edca));
-}
-void
-QstaWifiMac::DoStart ()
-{
- for (Queues::iterator i = m_queues.begin (); i != m_queues.end (); ++i)
- {
- i->second->Start ();
- }
- WifiMac::DoStart ();
-}
-
-void
-QstaWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard)
-{
- switch (standard)
- {
- case WIFI_PHY_STANDARD_80211p_CCH:
- ConfigureCCHDcf (m_queues[AC_BK], 15, 511, AC_BK);
- ConfigureCCHDcf (m_queues[AC_BE], 15, 511, AC_BE);
- ConfigureCCHDcf (m_queues[AC_VI], 15, 511, AC_VI);
- ConfigureCCHDcf (m_queues[AC_VO], 15, 511, AC_VO);
- break;
- case WIFI_PHY_STANDARD_80211p_SCH:
- ConfigureDcf (m_queues[AC_BK], 15, 511, AC_BK);
- ConfigureDcf (m_queues[AC_BE], 15, 511, AC_BE);
- ConfigureDcf (m_queues[AC_VI], 15, 511, AC_VI);
- ConfigureDcf (m_queues[AC_VO], 15, 511, AC_VO);
- break;
- case WIFI_PHY_STANDARD_holland:
- // fall through
- case WIFI_PHY_STANDARD_80211a:
- // fall through
- case WIFI_PHY_STANDARD_80211g:
- // fall through
- case WIFI_PHY_STANDARD_80211_10Mhz:
- // fall through
- case WIFI_PHY_STANDARD_80211_5Mhz:
- ConfigureDcf (m_queues[AC_BK], 15, 1023, AC_BK);
- ConfigureDcf (m_queues[AC_BE], 15, 1023, AC_BE);
- ConfigureDcf (m_queues[AC_VI], 15, 1023, AC_VI);
- ConfigureDcf (m_queues[AC_VO], 15, 1023, AC_VO);
- break;
- case WIFI_PHY_STANDARD_80211b:
- ConfigureDcf (m_queues[AC_BK], 31, 1023, AC_BK);
- ConfigureDcf (m_queues[AC_BE], 31, 1023, AC_BE);
- ConfigureDcf (m_queues[AC_VI], 31, 1023, AC_VI);
- ConfigureDcf (m_queues[AC_VO], 31, 1023, AC_VO);
- break;
- default:
- NS_ASSERT (false);
- break;
- }
-}
-
-void
-QstaWifiMac::SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr, Mac48Address originator)
-{
- NS_LOG_FUNCTION (this);
- WifiMacHeader hdr;
- hdr.SetAction ();
- hdr.SetAddr1 (originator);
- hdr.SetAddr2 (m_low->GetAddress ());
- hdr.SetAddr3 (m_low->GetAddress ());
- hdr.SetDsNotFrom ();
- hdr.SetDsNotTo ();
-
- MgtAddBaResponseHeader respHdr;
- StatusCode code;
- code.SetSuccess ();
- respHdr.SetStatusCode (code);
- //Here a control about queues type?
- respHdr.SetAmsduSupport (reqHdr->IsAmsduSupported ());
-
- if (reqHdr->IsImmediateBlockAck ())
- {
- respHdr.SetImmediateBlockAck ();
- }
- else
- {
- respHdr.SetDelayedBlockAck ();
- }
- respHdr.SetTid (reqHdr->GetTid ());
- /* For now there's not no control about limit of reception.
- We assume that receiver has no limit on reception.
- However we assume that a receiver sets a bufferSize in order to satisfy
- next equation:
- (bufferSize + 1) % 16 = 0
- So if a recipient is able to buffer a packet, it should be also able to buffer
- all possible packet's fragments.
- See section 7.3.1.14 in IEEE802.11e for more details. */
- respHdr.SetBufferSize (1023);
- respHdr.SetTimeout (reqHdr->GetTimeout ());
-
- WifiActionHeader actionHdr;
- WifiActionHeader::ActionValue action;
- action.blockAck = WifiActionHeader::BLOCK_ACK_ADDBA_RESPONSE;
- actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
-
- Ptr<Packet> packet = Create<Packet> ();
- packet->AddHeader (respHdr);
- packet->AddHeader (actionHdr);
-
- /* ns3::MacLow have to buffer all correctly received packet for this block ack session */
- m_low->CreateBlockAckAgreement (&respHdr, originator, reqHdr->GetStartingSequence ());
-
- //Better a management queue?
- m_queues[QosUtilsMapTidToAc (reqHdr->GetTid ())]->PushFront (packet, hdr);
-}
-
-} //namespace ns3
--- a/src/devices/wifi/qsta-wifi-mac.h Tue Dec 21 17:39:54 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006, 2009 INRIA
- * Copyright (c) 2009 MIRKO BANCHI
- *
- * 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
- */
-#ifndef QSTA_WIFI_MAC_H
-#define QSTA_WIFI_MAC_H
-
-#include "ns3/callback.h"
-#include "ns3/packet.h"
-#include "ns3/event-id.h"
-
-#include "wifi-mac.h"
-#include "supported-rates.h"
-#include "qos-utils.h"
-
-#include <string>
-#include <vector>
-#include <list>
-#include <map>
-
-namespace ns3 {
-
-class DcfManager;
-class EdcaTxopN;
-class MacRxMiddle;
-class MacTxMiddle;
-class MacLow;
-class WifiMacHeader;
-class AmsduSubframeHeader;
-class MsduAggregator;
-class MgtAddBaRequestHeader;
-
-class QstaWifiMac : public WifiMac
-{
-public:
- static TypeId GetTypeId (void);
-
- QstaWifiMac ();
- virtual ~QstaWifiMac ();
-
- // inherited from WifiMac.
- virtual void SetSlot (Time slotTime);
- virtual void SetSifs (Time sifs);
- virtual void SetEifsNoDifs (Time eifsNoDifs);
- virtual void SetAckTimeout (Time ackTimeout);
- virtual void SetCtsTimeout (Time ctsTimeout);
- virtual void SetPifs (Time pifs);
- virtual Time GetSlot (void) const;
- virtual Time GetSifs (void) const;
- virtual Time GetEifsNoDifs (void) const;
- virtual Time GetAckTimeout (void) const;
- virtual Time GetCtsTimeout (void) const;
- virtual Time GetPifs (void) const;
- virtual void SetWifiPhy (Ptr<WifiPhy> phy);
- virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager);
- virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from){};
- virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to);
- virtual bool SupportsSendFrom (void) const;
- virtual void SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback);
- virtual void SetLinkUpCallback (Callback<void> linkUp);
- virtual void SetLinkDownCallback (Callback<void> linkDown);
- virtual Mac48Address GetAddress (void) const;
- virtual Ssid GetSsid (void) const;
- virtual void SetAddress (Mac48Address address);
- virtual void SetSsid (Ssid ssid);
- virtual Mac48Address GetBssid (void) const;
- virtual void SetBasicBlockAckTimeout (Time blockAckTimeout);
- virtual void SetCompressedBlockAckTimeout (Time blockAckTimeout);
- virtual Time GetBasicBlockAckTimeout (void) const;
- virtual Time GetCompressedBlockAckTimeout (void) const;
-
- void SetMaxMissedBeacons (uint32_t missed);
- void SetProbeRequestTimeout (Time timeout);
- void SetAssocRequestTimeout (Time timeout);
- void StartActiveAssociation (void);
-
-private:
- void DoStart ();
- void SetBssid (Mac48Address bssid);
- Mac48Address GetBroadcastBssid (void);
- void Receive (Ptr<Packet> p, const WifiMacHeader *hdr);
- void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
- void SetActiveProbing (bool enable);
- bool GetActiveProbing (void) const;
- void MissedBeacons (void);
- SupportedRates GetSupportedRates (void) const;
- void RestartBeaconWatchdog (Time delay);
- void AssocRequestTimeout (void);
- void ProbeRequestTimeout (void);
- void SendAssociationRequest (void);
- void SendProbeRequest (void);
- void SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr, Mac48Address originator);
- void TryToEnsureAssociated (void);
- bool IsAssociated (void) const;
- bool IsWaitAssocResp (void) const;
- virtual void DoDispose (void);
-
- /**
- * When an A-MSDU is received, is deaggregated by this method and all extracted packets are
- * forwarded up.
- */
- void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket, const WifiMacHeader *hdr);
-
- QstaWifiMac &operator = (const QstaWifiMac &);
- QstaWifiMac (const QstaWifiMac &);
- virtual void FinishConfigureStandard (enum WifiPhyStandard standard);
- void SetQueue (enum AcIndex ac);
- Ptr<EdcaTxopN> GetVOQueue (void) const;
- Ptr<EdcaTxopN> GetVIQueue (void) const;
- Ptr<EdcaTxopN> GetBEQueue (void) const;
- Ptr<EdcaTxopN> GetBKQueue (void) const;
-
- typedef std::map<AcIndex, Ptr<EdcaTxopN> > Queues;
- typedef std::list<std::pair<Ptr<Packet>, AmsduSubframeHeader> > DeaggregatedMsdus;
- typedef std::list<std::pair<Ptr<Packet>, AmsduSubframeHeader> >::const_iterator DeaggregatedMsdusCI;
-
- enum {
- ASSOCIATED,
- WAIT_PROBE_RESP,
- WAIT_ASSOC_RESP,
- BEACON_MISSED,
- REFUSED
- } m_state;
-
- Queues m_queues;
- Ptr<MacLow> m_low;
- Ptr<WifiPhy> m_phy;
- Ptr<WifiRemoteStationManager> m_stationManager;
- DcfManager *m_dcfManager;
- MacRxMiddle *m_rxMiddle;
- MacTxMiddle *m_txMiddle;
- Ssid m_ssid;
-
- Callback<void, Ptr<Packet>, Mac48Address, Mac48Address> m_forwardUp;
- Callback<void> m_linkUp;
- Callback<void> m_linkDown;
-
- Time m_probeRequestTimeout;
- Time m_assocRequestTimeout;
- EventId m_probeRequestEvent;
- EventId m_assocRequestEvent;
-
- Time m_beaconWatchdogEnd;
- EventId m_beaconWatchdog;
-
- uint32_t m_maxMissedBeacons;
-};
-
-} //namespace ns3
-
-#endif /* QSTA_WIFI_MAC_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/wifi/regular-wifi-mac.cc Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,692 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 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
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#include "regular-wifi-mac.h"
+
+#include "ns3/log.h"
+#include "ns3/boolean.h"
+#include "ns3/pointer.h"
+#include "ns3/uinteger.h"
+#include "ns3/trace-source-accessor.h"
+
+#include "mac-rx-middle.h"
+#include "mac-tx-middle.h"
+#include "mac-low.h"
+#include "dcf.h"
+#include "dcf-manager.h"
+#include "wifi-phy.h"
+
+#include "msdu-aggregator.h"
+
+NS_LOG_COMPONENT_DEFINE ("RegularWifiMac");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (RegularWifiMac);
+
+RegularWifiMac::RegularWifiMac ()
+{
+ NS_LOG_FUNCTION (this);
+ m_rxMiddle = new MacRxMiddle ();
+ m_rxMiddle->SetForwardCallback (MakeCallback (&RegularWifiMac::Receive, this));
+
+ m_txMiddle = new MacTxMiddle ();
+
+ m_low = CreateObject<MacLow> ();
+ m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle));
+
+ m_dcfManager = new DcfManager ();
+ m_dcfManager->SetupLowListener (m_low);
+
+ m_dca = CreateObject<DcaTxop> ();
+ m_dca->SetLow (m_low);
+ m_dca->SetManager (m_dcfManager);
+ m_dca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this));
+ m_dca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this));
+
+ // Construct the EDCAFs. The ordering is important - highest
+ // priority (see Table 9-1 in IEEE 802.11-2007) must be created
+ // first.
+ SetupEdcaQueue (AC_VO);
+ SetupEdcaQueue (AC_VI);
+ SetupEdcaQueue (AC_BE);
+ SetupEdcaQueue (AC_BK);
+}
+
+RegularWifiMac::~RegularWifiMac ()
+{
+ NS_LOG_FUNCTION (this);
+}
+
+void
+RegularWifiMac::DoStart ()
+{
+ NS_LOG_FUNCTION (this);
+
+ m_dca->Start ();
+
+ for (EdcaQueues::iterator i = m_edca.begin (); i != m_edca.end (); ++i)
+ {
+ i->second->Start ();
+ }
+}
+
+void
+RegularWifiMac::DoDispose ()
+{
+ NS_LOG_FUNCTION (this);
+ delete m_rxMiddle;
+ m_rxMiddle = NULL;
+
+ delete m_txMiddle;
+ m_txMiddle = NULL;
+
+ delete m_dcfManager;
+ m_dcfManager = NULL;
+
+ m_low->Dispose ();
+ m_low = NULL;
+
+ m_phy = NULL;
+ m_stationManager = NULL;
+
+ m_dca->Dispose ();
+ m_dca = NULL;
+
+ for (EdcaQueues::iterator i = m_edca.begin (); i != m_edca.end (); ++i)
+ {
+ i->second = NULL;
+ }
+}
+
+void
+RegularWifiMac::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager)
+{
+ NS_LOG_FUNCTION (this << stationManager);
+ m_stationManager = stationManager;
+ m_low->SetWifiRemoteStationManager (stationManager);
+
+ m_dca->SetWifiRemoteStationManager (stationManager);
+
+ for (EdcaQueues::iterator i = m_edca.begin (); i != m_edca.end (); ++i)
+ {
+ i->second->SetWifiRemoteStationManager (stationManager);
+ }
+}
+
+Ptr<WifiRemoteStationManager>
+RegularWifiMac::GetWifiRemoteStationManager () const
+{
+ return m_stationManager;
+}
+
+void
+RegularWifiMac::SetupEdcaQueue (enum AcIndex ac)
+{
+ NS_LOG_FUNCTION (this << ac);
+
+ // Our caller shouldn't be attempting to setup a queue that is
+ // already configured.
+ NS_ASSERT (m_edca.find (ac) == m_edca.end ());
+
+ Ptr<EdcaTxopN> edca = CreateObject<EdcaTxopN> ();
+ edca->SetLow (m_low);
+ edca->SetManager (m_dcfManager);
+ edca->SetTxMiddle (m_txMiddle);
+ edca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this));
+ edca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this));
+ edca->SetAccessCategory (ac);
+ edca->CompleteConfig ();
+ m_edca.insert (std::make_pair(ac, edca));
+}
+
+void
+RegularWifiMac::SetTypeOfStation (TypeOfStation type)
+{
+ NS_LOG_FUNCTION (this << type);
+ for (EdcaQueues::iterator i = m_edca.begin (); i != m_edca.end (); ++i)
+ {
+ i->second->SetTypeOfStation (type);
+ }
+}
+
+Ptr<DcaTxop>
+RegularWifiMac::GetDcaTxop () const
+{
+ return m_dca;
+}
+
+Ptr<EdcaTxopN>
+RegularWifiMac::GetVOQueue () const
+{
+ return m_edca.find (AC_VO)->second;
+}
+
+Ptr<EdcaTxopN>
+RegularWifiMac::GetVIQueue () const
+{
+ return m_edca.find (AC_VI)->second;
+}
+
+Ptr<EdcaTxopN>
+RegularWifiMac::GetBEQueue () const
+{
+ return m_edca.find (AC_BE)->second;
+}
+
+Ptr<EdcaTxopN>
+RegularWifiMac::GetBKQueue () const
+{
+ return m_edca.find (AC_BK)->second;
+}
+
+void
+RegularWifiMac::SetWifiPhy (Ptr<WifiPhy> phy)
+{
+ NS_LOG_FUNCTION (this << phy);
+ m_phy = phy;
+ m_dcfManager->SetupPhyListener (phy);
+ m_low->SetPhy (phy);
+}
+
+Ptr<WifiPhy>
+RegularWifiMac::GetWifiPhy () const
+{
+ return m_phy;
+}
+
+void
+RegularWifiMac::SetForwardUpCallback (ForwardUpCallback upCallback)
+{
+ NS_LOG_FUNCTION (this);
+ m_forwardUp = upCallback;
+}
+
+void
+RegularWifiMac::SetLinkUpCallback (Callback<void> linkUp)
+{
+ NS_LOG_FUNCTION (this);
+ m_linkUp = linkUp;
+}
+
+void
+RegularWifiMac::SetLinkDownCallback (Callback<void> linkDown)
+{
+ NS_LOG_FUNCTION (this);
+ m_linkDown = linkDown;
+}
+
+void
+RegularWifiMac::SetQosSupported (bool enable)
+{
+ NS_LOG_FUNCTION (this);
+ m_qosSupported = enable;
+}
+
+bool
+RegularWifiMac::GetQosSupported () const
+{
+ return m_qosSupported;
+}
+
+void
+RegularWifiMac::SetSlot (Time slotTime)
+{
+ NS_LOG_FUNCTION (this << slotTime);
+ m_dcfManager->SetSlot (slotTime);
+ m_low->SetSlotTime (slotTime);
+}
+
+Time
+RegularWifiMac::GetSlot (void) const
+{
+ return m_low->GetSlotTime ();
+}
+
+void
+RegularWifiMac::SetSifs (Time sifs)
+{
+ NS_LOG_FUNCTION (this << sifs);
+ m_dcfManager->SetSifs (sifs);
+ m_low->SetSifs (sifs);
+}
+
+Time
+RegularWifiMac::GetSifs (void) const
+{
+ return m_low->GetSifs ();
+}
+
+void
+RegularWifiMac::SetEifsNoDifs (Time eifsNoDifs)
+{
+ NS_LOG_FUNCTION (this << eifsNoDifs);
+ m_dcfManager->SetEifsNoDifs (eifsNoDifs);
+}
+
+Time
+RegularWifiMac::GetEifsNoDifs (void) const
+{
+ return m_dcfManager->GetEifsNoDifs ();
+}
+
+void
+RegularWifiMac::SetPifs (Time pifs)
+{
+ NS_LOG_FUNCTION (this << pifs);
+ m_low->SetPifs (pifs);
+}
+
+Time
+RegularWifiMac::GetPifs (void) const
+{
+ return m_low->GetPifs ();
+}
+
+void
+RegularWifiMac::SetAckTimeout (Time ackTimeout)
+{
+ NS_LOG_FUNCTION (this << ackTimeout);
+ m_low->SetAckTimeout (ackTimeout);
+}
+
+Time
+RegularWifiMac::GetAckTimeout (void) const
+{
+ return m_low->GetAckTimeout ();
+}
+
+void
+RegularWifiMac::SetCtsTimeout (Time ctsTimeout)
+{
+ NS_LOG_FUNCTION (this << ctsTimeout);
+ m_low->SetCtsTimeout (ctsTimeout);
+}
+
+Time
+RegularWifiMac::GetCtsTimeout (void) const
+{
+ return m_low->GetCtsTimeout ();
+}
+
+void
+RegularWifiMac::SetBasicBlockAckTimeout (Time blockAckTimeout)
+{
+ NS_LOG_FUNCTION (this << blockAckTimeout);
+ m_low->SetBasicBlockAckTimeout (blockAckTimeout);
+}
+
+Time
+RegularWifiMac::GetBasicBlockAckTimeout (void) const
+{
+ return m_low->GetBasicBlockAckTimeout ();
+}
+
+void
+RegularWifiMac::SetCompressedBlockAckTimeout (Time blockAckTimeout)
+{
+ NS_LOG_FUNCTION (this << blockAckTimeout);
+ m_low->SetCompressedBlockAckTimeout (blockAckTimeout);
+}
+
+Time
+RegularWifiMac::GetCompressedBlockAckTimeout (void) const
+{
+ return m_low->GetCompressedBlockAckTimeout ();
+}
+
+void
+RegularWifiMac::SetAddress (Mac48Address address)
+{
+ NS_LOG_FUNCTION (this << address);
+ m_low->SetAddress (address);
+}
+
+Mac48Address
+RegularWifiMac::GetAddress (void) const
+{
+ return m_low->GetAddress ();
+}
+
+void
+RegularWifiMac::SetSsid (Ssid ssid)
+{
+ NS_LOG_FUNCTION (this << ssid);
+ m_ssid = ssid;
+}
+
+Ssid
+RegularWifiMac::GetSsid (void) const
+{
+ return m_ssid;
+}
+
+void
+RegularWifiMac::SetBssid (Mac48Address bssid)
+{
+ NS_LOG_FUNCTION (this << bssid);
+ m_low->SetBssid (bssid);
+}
+
+Mac48Address
+RegularWifiMac::GetBssid (void) const
+{
+ return m_low->GetBssid ();
+}
+
+void
+RegularWifiMac::Enqueue (Ptr<const Packet> packet,
+ Mac48Address to, Mac48Address from)
+{
+ // We expect RegularWifiMac subclasses which do support forwarding (e.g.,
+ // AP) to override this method. Therefore, we throw a fatal error if
+ // someone tries to invoke this method on a class which has not done
+ // this.
+ NS_FATAL_ERROR ("This MAC entity (" << this << ", " << GetAddress ()
+ << ") does not support Enqueue() with from address");
+}
+
+bool
+RegularWifiMac::SupportsSendFrom (void) const
+{
+ return false;
+}
+
+void
+RegularWifiMac::ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to)
+{
+ NS_LOG_FUNCTION (this << packet << from);
+ m_forwardUp (packet, from, to);
+}
+
+void
+RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
+{
+ NS_LOG_FUNCTION (this << packet << hdr);
+
+ Mac48Address to = hdr->GetAddr1 ();
+ Mac48Address from = hdr->GetAddr2 ();
+
+ if (hdr->IsMgt () && hdr->IsAction () && to == GetAddress ())
+ {
+ // There is currently only any reason for Management Action
+ // frames to be flying about if we are a QoS STA.
+ NS_ASSERT (m_qosSupported);
+
+ WifiActionHeader actionHdr;
+ packet->RemoveHeader (actionHdr);
+
+ switch (actionHdr.GetCategory ())
+ {
+ case WifiActionHeader::BLOCK_ACK:
+
+ switch (actionHdr.GetAction().blockAck)
+ {
+ case WifiActionHeader::BLOCK_ACK_ADDBA_REQUEST:
+ {
+ MgtAddBaRequestHeader reqHdr;
+ packet->RemoveHeader (reqHdr);
+
+ // We've received an ADDBA Request. Our policy here is
+ // to automatically accept it, so we get the ADDBA
+ // Response on it's way immediately.
+ SendAddBaResponse (&reqHdr, from);
+ // This frame is now completely dealt with, so we're done.
+ return;
+ }
+
+ case WifiActionHeader::BLOCK_ACK_ADDBA_RESPONSE:
+ {
+ MgtAddBaResponseHeader respHdr;
+ packet->RemoveHeader (respHdr);
+
+ // We've received an ADDBA Response. We assume that it
+ // indicates success after an ADDBA Request we have
+ // sent (we could, in principle, check this, but it
+ // seems a waste given the level of the current model)
+ // and act by locally establishing the agreement on
+ // the appropriate queue.
+ AcIndex ac = QosUtilsMapTidToAc (respHdr.GetTid ());
+ m_edca[ac]->GotAddBaResponse (&respHdr, from);
+ // This frame is now completely dealt with, so we're done.
+ return;
+ }
+
+ case WifiActionHeader::BLOCK_ACK_DELBA:
+ {
+ MgtDelBaHeader delBaHdr;
+ packet->RemoveHeader (delBaHdr);
+
+ if (delBaHdr.IsByOriginator ())
+ {
+ // This DELBA frame was sent by the originator, so
+ // this means that an ingoing established
+ // agreement exists in MacLow and we need to
+ // destroy it.
+ m_low->DestroyBlockAckAgreement (from, delBaHdr.GetTid ());
+ }
+ else
+ {
+ // We must have been the originator. We need to
+ // tell the correct queue that the agreement has
+ // been torn down
+ AcIndex ac = QosUtilsMapTidToAc (delBaHdr.GetTid ());
+ m_edca[ac]->GotDelBaFrame (&delBaHdr, from);
+ }
+ // This frame is now completely dealt with, so we're done.
+ return;
+ }
+
+ default:
+ NS_FATAL_ERROR ("Unsupported Action field in Block Ack Action frame");
+ }
+
+ default:
+ NS_FATAL_ERROR ("Unsupported Action frame received");
+ }
+ }
+ NS_FATAL_ERROR ("Don't know how to handle frame (type=" << hdr->GetType ());
+}
+
+void
+RegularWifiMac::DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
+ const WifiMacHeader *hdr)
+{
+ MsduAggregator::DeaggregatedMsdus packets =
+ MsduAggregator::Deaggregate (aggregatedPacket);
+
+ for (MsduAggregator::DeaggregatedMsdusCI i = packets.begin ();
+ i != packets.end (); ++i)
+ {
+ ForwardUp ((*i).first, (*i).second.GetSourceAddr (),
+ (*i).second.GetDestinationAddr ());
+ }
+}
+
+void
+RegularWifiMac::SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr,
+ Mac48Address originator)
+{
+ NS_LOG_FUNCTION (this);
+ WifiMacHeader hdr;
+ hdr.SetAction ();
+ hdr.SetAddr1 (originator);
+ hdr.SetAddr2 (GetAddress ());
+ hdr.SetAddr3 (GetAddress ());
+ hdr.SetDsNotFrom ();
+ hdr.SetDsNotTo ();
+
+ MgtAddBaResponseHeader respHdr;
+ StatusCode code;
+ code.SetSuccess ();
+ respHdr.SetStatusCode (code);
+ //Here a control about queues type?
+ respHdr.SetAmsduSupport (reqHdr->IsAmsduSupported ());
+
+ if (reqHdr->IsImmediateBlockAck ())
+ {
+ respHdr.SetImmediateBlockAck ();
+ }
+ else
+ {
+ respHdr.SetDelayedBlockAck ();
+ }
+ respHdr.SetTid (reqHdr->GetTid ());
+ // For now there's not no control about limit of reception. We
+ // assume that receiver has no limit on reception. However we assume
+ // that a receiver sets a bufferSize in order to satisfy next
+ // equation: (bufferSize + 1) % 16 = 0 So if a recipient is able to
+ // buffer a packet, it should be also able to buffer all possible
+ // packet's fragments. See section 7.3.1.14 in IEEE802.11e for more
+ // details.
+ respHdr.SetBufferSize (1023);
+ respHdr.SetTimeout (reqHdr->GetTimeout ());
+
+ WifiActionHeader actionHdr;
+ WifiActionHeader::ActionValue action;
+ action.blockAck = WifiActionHeader::BLOCK_ACK_ADDBA_RESPONSE;
+ actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
+
+ Ptr<Packet> packet = Create<Packet> ();
+ packet->AddHeader (respHdr);
+ packet->AddHeader (actionHdr);
+
+ // We need to notify our MacLow object as it will have to buffer all
+ // correctly received packets for this Block Ack session
+ m_low->CreateBlockAckAgreement (&respHdr, originator,
+ reqHdr->GetStartingSequence ());
+
+ // It is unclear which queue this frame should go into. For now we
+ // bung it into the queue corresponding to the TID for which we are
+ // establishing an agreement, and push it to the head.
+ m_edca[QosUtilsMapTidToAc (reqHdr->GetTid ())]->PushFront (packet, hdr);
+}
+
+TypeId
+RegularWifiMac::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::RegularWifiMac")
+ .SetParent<WifiMac> ()
+ .AddAttribute ("QosSupported",
+ "This Boolean attribute is set to enable 802.11e/WMM-style QoS support at this STA",
+ BooleanValue (false),
+ MakeBooleanAccessor (&RegularWifiMac::SetQosSupported,
+ &RegularWifiMac::GetQosSupported),
+ MakeBooleanChecker ())
+ .AddAttribute ("DcaTxop", "The DcaTxop object",
+ PointerValue (),
+ MakePointerAccessor (&RegularWifiMac::GetDcaTxop),
+ MakePointerChecker<DcaTxop> ())
+ .AddAttribute ("VO_EdcaTxopN",
+ "Queue that manages packets belonging to AC_VO access class",
+ PointerValue (),
+ MakePointerAccessor(&RegularWifiMac::GetVOQueue),
+ MakePointerChecker<EdcaTxopN> ())
+ .AddAttribute ("VI_EdcaTxopN",
+ "Queue that manages packets belonging to AC_VI access class",
+ PointerValue (),
+ MakePointerAccessor(&RegularWifiMac::GetVIQueue),
+ MakePointerChecker<EdcaTxopN> ())
+ .AddAttribute ("BE_EdcaTxopN",
+ "Queue that manages packets belonging to AC_BE access class",
+ PointerValue (),
+ MakePointerAccessor(&RegularWifiMac::GetBEQueue),
+ MakePointerChecker<EdcaTxopN> ())
+ .AddAttribute ("BK_EdcaTxopN",
+ "Queue that manages packets belonging to AC_BK access class",
+ PointerValue (),
+ MakePointerAccessor(&RegularWifiMac::GetBKQueue),
+ MakePointerChecker<EdcaTxopN> ())
+ .AddTraceSource ( "TxOkHeader",
+ "The header of successfully transmitted packet",
+ MakeTraceSourceAccessor (&RegularWifiMac::m_txOkCallback))
+ .AddTraceSource ("TxErrHeader",
+ "The header of unsuccessfully transmitted packet",
+ MakeTraceSourceAccessor (&RegularWifiMac::m_txErrCallback))
+ ;
+
+ return tid;
+}
+
+void
+RegularWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard)
+{
+ uint32_t cwmin;
+ uint32_t cwmax;
+
+ switch (standard)
+ {
+ case WIFI_PHY_STANDARD_80211p_CCH:
+ case WIFI_PHY_STANDARD_80211p_SCH:
+ cwmin = 15;
+ cwmax = 511;
+ break;
+
+ case WIFI_PHY_STANDARD_holland:
+ case WIFI_PHY_STANDARD_80211a:
+ case WIFI_PHY_STANDARD_80211g:
+ case WIFI_PHY_STANDARD_80211_10Mhz:
+ case WIFI_PHY_STANDARD_80211_5Mhz:
+ cwmin = 15;
+ cwmax = 1023;
+ break;
+
+ case WIFI_PHY_STANDARD_80211b:
+ cwmin = 31;
+ cwmax = 1023;
+ break;
+
+ default:
+ NS_FATAL_ERROR ("Unsupported WifiPhyStandard in RegularWifiMac::FinishConfigureStandard ()");
+ }
+
+ // The special value of AC_BE_NQOS which exists in the Access
+ // Category enumeration allows us to configure plain old DCF.
+ ConfigureDcf (m_dca, cwmin, cwmax, AC_BE_NQOS);
+
+ // Now we configure the EDCA functions
+ for (EdcaQueues::iterator i = m_edca.begin (); i != m_edca.end (); ++i)
+ {
+ // Special configuration for 802.11p CCH
+ if (standard == WIFI_PHY_STANDARD_80211p_CCH)
+ {
+ ConfigureCCHDcf (i->second, cwmin, cwmax, i->first);
+ }
+ else
+ {
+ ConfigureDcf (i->second, cwmin, cwmax, i->first);
+ }
+ }
+}
+
+void
+RegularWifiMac::TxOk (const WifiMacHeader &hdr)
+{
+ NS_LOG_FUNCTION (this << hdr);
+ m_txOkCallback (hdr);
+}
+
+void
+RegularWifiMac::TxFailed (const WifiMacHeader &hdr)
+{
+ NS_LOG_FUNCTION (this << hdr);
+ m_txErrCallback (hdr);
+}
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/wifi/regular-wifi-mac.h Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,342 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 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
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#ifndef REGULAR_WIFI_MAC_H
+#define REGULAR_WIFI_MAC_H
+
+#include "ns3/wifi-mac.h"
+
+#include "dca-txop.h"
+#include "edca-txop-n.h"
+#include "wifi-remote-station-manager.h"
+#include "ssid.h"
+#include "qos-utils.h"
+
+#include <map>
+
+namespace ns3 {
+
+class Dcf;
+class MacLow;
+class MacRxMiddle;
+class MacTxMiddle;
+class DcfManager;
+
+/**
+ * \brief base class for all MAC-level wifi objects.
+ *
+ * This class encapsulates all the low-level MAC functionality
+ * DCA, EDCA, etc) and all the high-level MAC functionality
+ * (association/disassociation state machines).
+ *
+ */
+class RegularWifiMac : public WifiMac
+{
+public:
+ static TypeId GetTypeId (void);
+
+ RegularWifiMac ();
+ virtual ~RegularWifiMac ();
+
+ /**
+ * \param slotTime the slot duration
+ */
+ void SetSlot (Time slotTime);
+ /**
+ * \param sifs the sifs duration
+ */
+ void SetSifs (Time sifs);
+ /**
+ * \param eifsNoDifs the duration of an EIFS minus DIFS.
+ *
+ * This value is used to calculate the EIFS depending
+ * on AIFSN.
+ */
+ void SetEifsNoDifs (Time eifsNoDifs);
+ /**
+ * \param pifs the pifs duration.
+ */
+ void SetPifs (Time pifs);
+ /**
+ * \param ctsTimeout the duration of a CTS timeout.
+ */
+ void SetCtsTimeout (Time ctsTimeout);
+ /**
+ * \param ackTimeout the duration of an ACK timeout.
+ */
+ void SetAckTimeout (Time ackTimeout);
+ /**
+ * \returns the current PIFS duration.
+ */
+ Time GetPifs (void) const;
+ /**
+ * \returns the current SIFS duration.
+ */
+ Time GetSifs (void) const;
+ /**
+ * \returns the current slot duration.
+ */
+ Time GetSlot (void) const;
+ /**
+ * \returns the current EIFS minus DIFS duration
+ */
+ Time GetEifsNoDifs (void) const;
+ /**
+ * \returns the current CTS timeout duration.
+ */
+ Time GetCtsTimeout (void) const;
+ /**
+ * \returns the current ACK timeout duration.
+ */
+ Time GetAckTimeout (void) const;
+ /**
+ * \returns the MAC address associated to this MAC layer.
+ */
+ virtual Mac48Address GetAddress (void) const;
+ /**
+ * \returns the ssid which this MAC layer is going to try to stay in.
+ */
+ virtual Ssid GetSsid (void) const;
+ /**
+ * \param address the current address of this MAC layer.
+ */
+ virtual void SetAddress (Mac48Address address);
+ /**
+ * \param ssid the current ssid of this MAC layer.
+ */
+ virtual void SetSsid (Ssid ssid);
+ /**
+ * \param bssid the BSSID of the network that this device belongs to.
+ */
+ virtual void SetBssid (Mac48Address bssid);
+ /**
+ * \returns the bssid of the network this device belongs to.
+ */
+ virtual Mac48Address GetBssid (void) const;
+
+ /**
+ * \param packet the packet to send.
+ * \param to the address to which the packet should be sent.
+ * \param from the address from which the packet should be sent.
+ *
+ * The packet should be enqueued in a tx queue, and should be
+ * dequeued as soon as the channel access function determines that
+ * access is granted to this MAC. The extra parameter "from" allows
+ * this device to operate in a bridged mode, forwarding received
+ * frames without altering the source address.
+ */
+ virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
+ virtual bool SupportsSendFrom (void) const;
+
+ /**
+ * \param packet the packet to send.
+ * \param to the address to which the packet should be sent.
+ *
+ * The packet should be enqueued in a tx queue, and should be
+ * dequeued as soon as the channel access function determines that
+ * access is granted to this MAC.
+ */
+ virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to) = 0;
+ /**
+ * \param phy the physical layer attached to this MAC.
+ */
+ virtual void SetWifiPhy (Ptr<WifiPhy> phy);
+ /**
+ * \returns the physical layer attached to this MAC.
+ */
+ virtual Ptr<WifiPhy> GetWifiPhy () const;
+ /**
+ * \param stationManager the station manager attached to this MAC.
+ */
+ virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager);
+ /**
+ * \returns the station manager attached to this MAC.
+ */
+ virtual Ptr<WifiRemoteStationManager> GetWifiRemoteStationManager () const;
+
+ /**
+ * This type defines the callback of a higher layer that a
+ * WifiMac(-derived) object invokes to pass a packet up the stack.
+ *
+ * \param packet the packet that has been received.
+ * \param from the MAC address of the device that sent the packet.
+ * \param to the MAC address ot the device that the packet is
+ * destined for.
+ */
+ typedef Callback<void, Ptr<Packet>, Mac48Address, Mac48Address> ForwardUpCallback;
+ /**
+ * \param upCallback the callback to invoke when a packet must be
+ * forwarded up the stack.
+ */
+ virtual void SetForwardUpCallback (ForwardUpCallback upCallback);
+ /**
+ * \param linkUp the callback to invoke when the link becomes up.
+ */
+ virtual void SetLinkUpCallback (Callback<void> linkUp);
+ /**
+ * \param linkDown the callback to invoke when the link becomes down.
+ */
+ virtual void SetLinkDownCallback (Callback<void> linkDown);
+ /* Next functions are not pure virtual so non Qos WifiMacs are not
+ * forced to implement them.
+ */
+ virtual void SetBasicBlockAckTimeout (Time blockAckTimeout);
+ virtual Time GetBasicBlockAckTimeout (void) const;
+ virtual void SetCompressedBlockAckTimeout (Time blockAckTimeout);
+ virtual Time GetCompressedBlockAckTimeout (void) const;
+
+protected:
+ virtual void DoStart ();
+ virtual void DoDispose ();
+
+ MacRxMiddle *m_rxMiddle;
+ MacTxMiddle *m_txMiddle;
+ Ptr<MacLow> m_low;
+ DcfManager *m_dcfManager;
+ Ptr<WifiPhy> m_phy;
+
+ Ptr<WifiRemoteStationManager> m_stationManager;
+
+ ForwardUpCallback m_forwardUp;
+ Callback<void> m_linkUp;
+ Callback<void> m_linkDown;
+
+ Ssid m_ssid;
+
+ /** This holds a pointer to the DCF instance for this WifiMac - used
+ for transmission of frames to non-QoS peers. */
+ Ptr<DcaTxop> m_dca;
+
+ /** This type defines a mapping between an Access Category index,
+ and a pointer to the corresponding channel access function */
+ typedef std::map<AcIndex, Ptr<EdcaTxopN> > EdcaQueues;
+ /** This is a map from Access Category index to the corresponding
+ channel access function */
+ EdcaQueues m_edca;
+
+ /**
+ * \param standard the phy standard to be used
+ *
+ * This method is called by ns3::WifiMac::ConfigureStandard to
+ * complete the configuration process for a requested phy standard.
+ *
+ * This method may be overriden by a derived class (e.g., in order
+ * to apply DCF or EDCA parameters specific to the usage model it is
+ * dealing with), in which case the reimplementation may choose to
+ * deal with certain values in the WifiPhyStandard enumeration, and
+ * chain up to this implementation to deal with the remainder.
+ */
+ virtual void FinishConfigureStandard (enum WifiPhyStandard standard);
+
+ /**
+ * This method is invoked by a subclass to specify what type of
+ * station it is implementing. This is something that the channel
+ * access functions (instantiated within this class as EdcaTxopN's)
+ * need to know.
+ *
+ * \param type the type of station.
+ */
+ void SetTypeOfStation (TypeOfStation type);
+
+ /**
+ * This method acts as the MacRxMiddle receive callback and is
+ * invoked to notify us that a frame has been received. The
+ * implementation is intended to capture logic that is going to be
+ * common to all (or most) derived classes. Specifically, handling
+ * of Block Ack managment frames is dealt with here.
+ *
+ * This method will need, however, to be overriden by derived
+ * classes so that they can perform their data handling before
+ * invoking the base version.
+ *
+ * \param packet the packet that has been received.
+ * \param hdr a pointer to the MAC header of the received frame.
+ */
+ virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
+ virtual void TxOk (const WifiMacHeader &hdr);
+ virtual void TxFailed (const WifiMacHeader &hdr);
+
+ void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
+
+ /**
+ * This method can be called to de-aggregate an A-MSDU and forward
+ * the constituent packets up the stack.
+ *
+ * \param aggregatedPacket the Packet containing the A-MSDU.
+ * \param hdr a pointer to the MAC header for \c aggregatedPacket.
+ */
+ virtual void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
+ const WifiMacHeader *hdr);
+
+ /**
+ * This method can be called to accept a received ADDBA Request. An
+ * ADDBA Response will be constructed and queued for transmission.
+ *
+ * \param reqHdr a pointer to the received ADDBA Request header.
+ * \param originator the MAC address of the originator.
+ */
+ virtual void SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr,
+ Mac48Address originator);
+
+ /**
+ * This Boolean is set \c true iff this WifiMac is to model
+ * 802.11e/WMM style Quality of Service. It is exposed through the
+ * attribute system.
+ *
+ * At the moment, this flag is the sole selection between QoS and
+ * non-QoS operation for the STA (whether IBSS, AP, or
+ * non-AP). Ultimately, we will want a QoS-enabled STA to be able to
+ * fall back to non-QoS operation with a non-QoS peer. This'll
+ * require further intelligence - i.e., per-association QoS
+ * state. Having a big switch seems like a good intermediate stage,
+ * however.
+ */
+ bool m_qosSupported;
+ /** Set accessor for the \c m_qosSupported member */
+ void SetQosSupported (bool enable);
+ /** Get accessor for the \c m_qosSupported member */
+ bool GetQosSupported () const;
+private:
+ /**
+ * This method is a private utility invoked to configure the channel
+ * access function for the specified Access Category.
+ *
+ * \param ac the Access Category index of the queue to initialise.
+ */
+ void SetupEdcaQueue (enum AcIndex ac);
+
+ /** Accessor for the DCF object */
+ Ptr<DcaTxop> GetDcaTxop (void) const;
+
+ /** Accessor for the AC_VO channel access function */
+ Ptr<EdcaTxopN> GetVOQueue (void) const;
+ /** Accessor for the AC_VI channel access function */
+ Ptr<EdcaTxopN> GetVIQueue (void) const;
+ /** Accessor for the AC_BE channel access function */
+ Ptr<EdcaTxopN> GetBEQueue (void) const;
+ /** Accessor for the AC_BK channel access function */
+ Ptr<EdcaTxopN> GetBKQueue (void) const;
+
+ TracedCallback<const WifiMacHeader &> m_txOkCallback;
+ TracedCallback<const WifiMacHeader &> m_txErrCallback;
+};
+
+} // namespace ns3
+
+#endif /* REGULAR_WIFI_MAC_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/wifi/sta-wifi-mac.cc Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,561 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006, 2009 INRIA
+ * Copyright (c) 2009 MIRKO BANCHI
+ *
+ * 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Author: Mirko Banchi <mk.banchi@gmail.com>
+ */
+#include "sta-wifi-mac.h"
+
+#include "ns3/log.h"
+#include "ns3/simulator.h"
+#include "ns3/string.h"
+#include "ns3/pointer.h"
+#include "ns3/boolean.h"
+#include "ns3/trace-source-accessor.h"
+
+#include "qos-tag.h"
+#include "mac-low.h"
+#include "dcf-manager.h"
+#include "mac-rx-middle.h"
+#include "mac-tx-middle.h"
+#include "wifi-mac-header.h"
+#include "msdu-aggregator.h"
+#include "amsdu-subframe-header.h"
+#include "mgt-headers.h"
+
+NS_LOG_COMPONENT_DEFINE ("StaWifiMac");
+
+
+/*
+ * The state machine for this STA is:
+ -------------- -----------
+ | Associated | <-------------------- -------> | Refused |
+ -------------- \ / -----------
+ \ \ /
+ \ ----------------- -----------------------------
+ \-> | Beacon Missed | --> | Wait Association Response |
+ ----------------- -----------------------------
+ \ ^
+ \ |
+ \ -----------------------
+ \-> | Wait Probe Response |
+ -----------------------
+ */
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (StaWifiMac);
+
+TypeId
+StaWifiMac::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::StaWifiMac")
+ .SetParent<RegularWifiMac> ()
+ .AddConstructor<StaWifiMac> ()
+ .AddAttribute ("ProbeRequestTimeout", "The interval between two consecutive probe request attempts.",
+ TimeValue (Seconds (0.05)),
+ MakeTimeAccessor (&StaWifiMac::m_probeRequestTimeout),
+ MakeTimeChecker ())
+ .AddAttribute ("AssocRequestTimeout", "The interval between two consecutive assoc request attempts.",
+ TimeValue (Seconds (0.5)),
+ MakeTimeAccessor (&StaWifiMac::m_assocRequestTimeout),
+ MakeTimeChecker ())
+ .AddAttribute ("MaxMissedBeacons",
+ "Number of beacons which much be consecutively missed before "
+ "we attempt to restart association.",
+ UintegerValue (10),
+ MakeUintegerAccessor (&StaWifiMac::m_maxMissedBeacons),
+ MakeUintegerChecker<uint32_t> ())
+ .AddAttribute ("ActiveProbing", "If true, we send probe requests. If false, we don't.",
+ BooleanValue (false),
+ MakeBooleanAccessor (&StaWifiMac::SetActiveProbing),
+ MakeBooleanChecker ())
+ .AddTraceSource ("Assoc", "Associated with an access point.",
+ MakeTraceSourceAccessor (&StaWifiMac::m_assocLogger))
+ .AddTraceSource ("DeAssoc", "Association with an access point lost.",
+ MakeTraceSourceAccessor (&StaWifiMac::m_deAssocLogger))
+ ;
+ return tid;
+}
+
+StaWifiMac::StaWifiMac ()
+ : m_state (BEACON_MISSED),
+ m_probeRequestEvent (),
+ m_assocRequestEvent (),
+ m_beaconWatchdogEnd (Seconds (0.0))
+{
+ NS_LOG_FUNCTION (this);
+
+ // Let the lower layers know that we are acting as a non-AP STA in
+ // an infrastructure BSS.
+ SetTypeOfStation (STA);
+}
+
+StaWifiMac::~StaWifiMac ()
+{
+ NS_LOG_FUNCTION (this);
+}
+
+void
+StaWifiMac::SetMaxMissedBeacons (uint32_t missed)
+{
+ NS_LOG_FUNCTION (this << missed);
+ m_maxMissedBeacons = missed;
+}
+
+void
+StaWifiMac::SetProbeRequestTimeout (Time timeout)
+{
+ NS_LOG_FUNCTION (this << timeout);
+ m_probeRequestTimeout = timeout;
+}
+
+void
+StaWifiMac::SetAssocRequestTimeout (Time timeout)
+{
+ NS_LOG_FUNCTION (this << timeout);
+ m_assocRequestTimeout = timeout;
+}
+
+void
+StaWifiMac::StartActiveAssociation (void)
+{
+ NS_LOG_FUNCTION (this);
+ TryToEnsureAssociated ();
+}
+
+void
+StaWifiMac::SetActiveProbing (bool enable)
+{
+ NS_LOG_FUNCTION (this << enable);
+ if (enable)
+ {
+ TryToEnsureAssociated ();
+ }
+ else
+ {
+ m_probeRequestEvent.Cancel ();
+ }
+}
+
+void
+StaWifiMac::SendProbeRequest (void)
+{
+ NS_LOG_FUNCTION (this);
+ WifiMacHeader hdr;
+ hdr.SetProbeReq ();
+ hdr.SetAddr1 (Mac48Address::GetBroadcast ());
+ hdr.SetAddr2 (GetAddress ());
+ hdr.SetAddr3 (Mac48Address::GetBroadcast ());
+ hdr.SetDsNotFrom ();
+ hdr.SetDsNotTo ();
+ Ptr<Packet> packet = Create<Packet> ();
+ MgtProbeRequestHeader probe;
+ probe.SetSsid (GetSsid ());
+ probe.SetSupportedRates (GetSupportedRates ());
+ packet->AddHeader (probe);
+
+ // The standard is not clear on the correct queue for management
+ // frames if we are a QoS AP. The approach taken here is to always
+ // use the DCF for these regardless of whether we have a QoS
+ // association or not.
+ m_dca->Queue (packet, hdr);
+
+ m_probeRequestEvent = Simulator::Schedule (m_probeRequestTimeout,
+ &StaWifiMac::ProbeRequestTimeout, this);
+}
+
+void
+StaWifiMac::SendAssociationRequest (void)
+{
+ NS_LOG_FUNCTION (this << GetBssid ());
+ WifiMacHeader hdr;
+ hdr.SetAssocReq ();
+ hdr.SetAddr1 (GetBssid ());
+ hdr.SetAddr2 (GetAddress ());
+ hdr.SetAddr3 (GetBssid ());
+ hdr.SetDsNotFrom ();
+ hdr.SetDsNotTo ();
+ Ptr<Packet> packet = Create<Packet> ();
+ MgtAssocRequestHeader assoc;
+ assoc.SetSsid (GetSsid ());
+ assoc.SetSupportedRates (GetSupportedRates ());
+ packet->AddHeader (assoc);
+
+ // The standard is not clear on the correct queue for management
+ // frames if we are a QoS AP. The approach taken here is to always
+ // use the DCF for these regardless of whether we have a QoS
+ // association or not.
+ m_dca->Queue (packet, hdr);
+
+ m_assocRequestEvent = Simulator::Schedule (m_assocRequestTimeout,
+ &StaWifiMac::AssocRequestTimeout, this);
+}
+
+void
+StaWifiMac::TryToEnsureAssociated (void)
+{
+ NS_LOG_FUNCTION (this);
+ switch (m_state) {
+ case ASSOCIATED:
+ return;
+ break;
+ case WAIT_PROBE_RESP:
+ /* we have sent a probe request earlier so we
+ do not need to re-send a probe request immediately.
+ We just need to wait until probe-request-timeout
+ or until we get a probe response
+ */
+ break;
+ case BEACON_MISSED:
+ /* we were associated but we missed a bunch of beacons
+ * so we should assume we are not associated anymore.
+ * We try to initiate a probe request now.
+ */
+ m_linkDown ();
+ SetState (WAIT_PROBE_RESP);
+ SendProbeRequest ();
+ break;
+ case WAIT_ASSOC_RESP:
+ /* we have sent an assoc request so we do not need to
+ re-send an assoc request right now. We just need to
+ wait until either assoc-request-timeout or until
+ we get an assoc response.
+ */
+ break;
+ case REFUSED:
+ /* we have sent an assoc request and received a negative
+ assoc resp. We wait until someone restarts an
+ association with a given ssid.
+ */
+ break;
+ }
+}
+
+void
+StaWifiMac::AssocRequestTimeout (void)
+{
+ NS_LOG_FUNCTION (this);
+ SetState (WAIT_ASSOC_RESP);
+ SendAssociationRequest ();
+}
+
+void
+StaWifiMac::ProbeRequestTimeout (void)
+{
+ NS_LOG_FUNCTION (this);
+ SetState (WAIT_PROBE_RESP);
+ SendProbeRequest ();
+}
+
+void
+StaWifiMac::MissedBeacons (void)
+{
+ NS_LOG_FUNCTION (this);
+ if (m_beaconWatchdogEnd > Simulator::Now ())
+ {
+ m_beaconWatchdog = Simulator::Schedule (m_beaconWatchdogEnd - Simulator::Now (),
+ &StaWifiMac::MissedBeacons, this);
+ return;
+ }
+ NS_LOG_DEBUG ("beacon missed");
+ SetState (BEACON_MISSED);
+ TryToEnsureAssociated ();
+}
+
+void
+StaWifiMac::RestartBeaconWatchdog (Time delay)
+{
+ NS_LOG_FUNCTION (this << delay);
+ m_beaconWatchdogEnd = std::max (Simulator::Now () + delay, m_beaconWatchdogEnd);
+ if (Simulator::GetDelayLeft (m_beaconWatchdog) < delay &&
+ m_beaconWatchdog.IsExpired ())
+ {
+ NS_LOG_DEBUG ("really restart watchdog.");
+ m_beaconWatchdog = Simulator::Schedule (delay, &StaWifiMac::MissedBeacons, this);
+ }
+}
+
+bool
+StaWifiMac::IsAssociated (void) const
+{
+ return m_state == ASSOCIATED;
+}
+
+bool
+StaWifiMac::IsWaitAssocResp (void) const
+{
+ return m_state == WAIT_ASSOC_RESP;
+}
+
+void
+StaWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to)
+{
+ NS_LOG_FUNCTION (this << packet << to);
+ if (!IsAssociated ())
+ {
+ NotifyTxDrop (packet);
+ TryToEnsureAssociated ();
+ return;
+ }
+ WifiMacHeader hdr;
+
+ // If we are not a QoS AP then we definitely want to use AC_BE to
+ // transmit the packet. A TID of zero will map to AC_BE (through \c
+ // QosUtilsMapTidToAc()), so we use that as our default here.
+ uint8_t tid = 0;
+
+ // For now, an AP that supports QoS does not support non-QoS
+ // associations, and vice versa. In future the AP model should
+ // support simultaneously associated QoS and non-QoS STAs, at which
+ // point there will need to be per-association QoS state maintained
+ // by the association state machine, and consulted here.
+ if (m_qosSupported)
+ {
+ hdr.SetType (WIFI_MAC_QOSDATA);
+ hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
+ hdr.SetQosNoEosp ();
+ hdr.SetQosNoAmsdu ();
+ // Transmission of multiple frames in the same TXOP is not
+ // supported for now
+ hdr.SetQosTxopLimit (0);
+
+ // Fill in the QoS control field in the MAC header
+ tid = QosUtilsGetTidForPacket (packet);
+ // Any value greater than 7 is invalid and likely indicates that
+ // the packet had no QoS tag, so we revert to zero, which'll
+ // mean that AC_BE is used.
+ if (tid >= 7)
+ {
+ tid = 0;
+ }
+ hdr.SetQosTid (tid);
+ }
+ else
+ {
+ hdr.SetTypeData ();
+ }
+
+ hdr.SetAddr1 (GetBssid ());
+ hdr.SetAddr2 (m_low->GetAddress ());
+ hdr.SetAddr3 (to);
+ hdr.SetDsNotFrom ();
+ hdr.SetDsTo ();
+
+ if (m_qosSupported)
+ {
+ // Sanity check that the TID is valid
+ NS_ASSERT (tid < 8);
+ m_edca[QosUtilsMapTidToAc (tid)]->Queue (packet, hdr);
+ }
+ else
+ {
+ m_dca->Queue (packet, hdr);
+ }
+}
+
+void
+StaWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
+{
+ NS_LOG_FUNCTION (this << packet << hdr);
+ NS_ASSERT (!hdr->IsCtl ());
+ if (hdr->GetAddr3 () == GetAddress ())
+ {
+ NS_LOG_LOGIC ("packet sent by us.");
+ return;
+ }
+ else if (hdr->GetAddr1 () != GetAddress () &&
+ !hdr->GetAddr1 ().IsGroup ())
+ {
+ NS_LOG_LOGIC ("packet is not for us");
+ NotifyRxDrop (packet);
+ return;
+ }
+ else if (hdr->IsData ())
+ {
+ if (!IsAssociated ())
+ {
+ NS_LOG_LOGIC ("Received data frame while not associated: ignore");
+ NotifyRxDrop (packet);
+ return;
+ }
+ if (!(hdr->IsFromDs () && !hdr->IsToDs ()))
+ {
+ NS_LOG_LOGIC ("Received data frame not from the DS: ignore");
+ NotifyRxDrop (packet);
+ return;
+ }
+ if (hdr->GetAddr2 () != GetBssid ())
+ {
+ NS_LOG_LOGIC ("Received data frame not from the BSS we are associated with: ignore");
+ NotifyRxDrop (packet);
+ return;
+ }
+
+ if (hdr->IsQosData ())
+ {
+ if (hdr->IsQosAmsdu ())
+ {
+ NS_ASSERT (hdr->GetAddr3 () == GetBssid ());
+ DeaggregateAmsduAndForward (packet, hdr);
+ packet = 0;
+ }
+ else
+ {
+ ForwardUp (packet, hdr->GetAddr3 (), hdr->GetAddr1 ());
+ }
+ }
+ else
+ {
+ ForwardUp (packet, hdr->GetAddr3 (), hdr->GetAddr1 ());
+ }
+ return;
+ }
+ else if (hdr->IsProbeReq () ||
+ hdr->IsAssocReq ())
+ {
+ // This is a frame aimed at an AP, so we can safely ignore it.
+ NotifyRxDrop (packet);
+ return;
+ }
+ else if (hdr->IsBeacon ())
+ {
+ MgtBeaconHeader beacon;
+ packet->RemoveHeader (beacon);
+ bool goodBeacon = false;
+ if (GetSsid ().IsBroadcast () ||
+ beacon.GetSsid ().IsEqual (GetSsid ()))
+ {
+ goodBeacon = true;
+ }
+ if ((IsWaitAssocResp () || IsAssociated ()) && hdr->GetAddr3 () != GetBssid ())
+ {
+ goodBeacon = false;
+ }
+ if (goodBeacon)
+ {
+ Time delay = MicroSeconds (beacon.GetBeaconIntervalUs () * m_maxMissedBeacons);
+ RestartBeaconWatchdog (delay);
+ SetBssid (hdr->GetAddr3 ());
+ }
+ if (goodBeacon && m_state == BEACON_MISSED)
+ {
+ SetState (WAIT_ASSOC_RESP);
+ SendAssociationRequest ();
+ }
+ return;
+ }
+ else if (hdr->IsProbeResp ())
+ {
+ if (m_state == WAIT_PROBE_RESP)
+ {
+ MgtProbeResponseHeader probeResp;
+ packet->RemoveHeader (probeResp);
+ if (!probeResp.GetSsid ().IsEqual (GetSsid ()))
+ {
+ //not a probe resp for our ssid.
+ return;
+ }
+ SetBssid (hdr->GetAddr3 ());
+ Time delay = MicroSeconds (probeResp.GetBeaconIntervalUs () * m_maxMissedBeacons);
+ RestartBeaconWatchdog (delay);
+ if (m_probeRequestEvent.IsRunning ())
+ {
+ m_probeRequestEvent.Cancel ();
+ }
+ SetState (WAIT_ASSOC_RESP);
+ SendAssociationRequest ();
+ }
+ return;
+ }
+ else if (hdr->IsAssocResp ())
+ {
+ if (m_state == WAIT_ASSOC_RESP)
+ {
+ MgtAssocResponseHeader assocResp;
+ packet->RemoveHeader (assocResp);
+ if (m_assocRequestEvent.IsRunning ())
+ {
+ m_assocRequestEvent.Cancel ();
+ }
+ if (assocResp.GetStatusCode ().IsSuccess ())
+ {
+ SetState (ASSOCIATED);
+ NS_LOG_DEBUG ("assoc completed");
+ SupportedRates rates = assocResp.GetSupportedRates ();
+ for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
+ {
+ WifiMode mode = m_phy->GetMode (i);
+ if (rates.IsSupportedRate (mode.GetDataRate ()))
+ {
+ m_stationManager->AddSupportedMode (hdr->GetAddr2 (), mode);
+ if (rates.IsBasicRate (mode.GetDataRate ()))
+ {
+ m_stationManager->AddBasicMode (mode);
+ }
+ }
+ }
+ if (!m_linkUp.IsNull ())
+ {
+ m_linkUp ();
+ }
+ }
+ else
+ {
+ NS_LOG_DEBUG ("assoc refused");
+ SetState (REFUSED);
+ }
+ }
+ return;
+ }
+
+ // Invoke the receive handler of our parent class to deal with any
+ // other frames. Specifically, this will handle Block Ack-related
+ // Management Action frames.
+ RegularWifiMac::Receive (packet, hdr);
+}
+
+SupportedRates
+StaWifiMac::GetSupportedRates (void) const
+{
+ SupportedRates rates;
+ for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
+ {
+ WifiMode mode = m_phy->GetMode (i);
+ rates.AddSupportedRate (mode.GetDataRate ());
+ }
+ return rates;
+}
+
+void
+StaWifiMac::SetState (MacState value)
+{
+ if (value == ASSOCIATED &&
+ m_state != ASSOCIATED)
+ {
+ m_assocLogger (GetBssid ());
+ }
+ else if (value != ASSOCIATED &&
+ m_state == ASSOCIATED)
+ {
+ m_deAssocLogger (GetBssid ());
+ }
+ m_state = value;
+}
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/wifi/sta-wifi-mac.h Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006, 2009 INRIA
+ * Copyright (c) 2009 MIRKO BANCHI
+ *
+ * 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Author: Mirko Banchi <mk.banchi@gmail.com>
+ */
+#ifndef STA_WIFI_MAC_H
+#define STA_WIFI_MAC_H
+
+#include "regular-wifi-mac.h"
+
+#include "ns3/event-id.h"
+#include "ns3/packet.h"
+#include "ns3/traced-callback.h"
+
+#include "supported-rates.h"
+#include "amsdu-subframe-header.h"
+
+namespace ns3 {
+
+class MgtAddBaRequestHeader;
+
+class StaWifiMac : public RegularWifiMac
+{
+public:
+ static TypeId GetTypeId (void);
+
+ StaWifiMac ();
+ virtual ~StaWifiMac ();
+
+ /**
+ * \param packet the packet to send.
+ * \param to the address to which the packet should be sent.
+ *
+ * The packet should be enqueued in a tx queue, and should be
+ * dequeued as soon as the channel access function determines that
+ * access is granted to this MAC.
+ */
+ virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to);
+
+ /**
+ * \param missed the number of beacons which must be missed
+ * before a new association sequence is started.
+ */
+ void SetMaxMissedBeacons (uint32_t missed);
+ /**
+ * \param timeout
+ *
+ * If no probe response is received within the specified
+ * timeout, the station sends a new probe request.
+ */
+ void SetProbeRequestTimeout (Time timeout);
+ /**
+ * \param timeout
+ *
+ * If no association response is received within the specified
+ * timeout, the station sends a new association request.
+ */
+ void SetAssocRequestTimeout (Time timeout);
+
+ /**
+ * Start an active association sequence immediately.
+ */
+ void StartActiveAssociation (void);
+
+private:
+ enum MacState {
+ ASSOCIATED,
+ WAIT_PROBE_RESP,
+ WAIT_ASSOC_RESP,
+ BEACON_MISSED,
+ REFUSED
+ };
+
+ void SetActiveProbing (bool enable);
+ bool GetActiveProbing (void) const;
+ virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
+ void SendProbeRequest (void);
+ void SendAssociationRequest (void);
+ void TryToEnsureAssociated (void);
+ void AssocRequestTimeout (void);
+ void ProbeRequestTimeout (void);
+ bool IsAssociated (void) const;
+ bool IsWaitAssocResp (void) const;
+ void MissedBeacons (void);
+ void RestartBeaconWatchdog (Time delay);
+ SupportedRates GetSupportedRates (void) const;
+ void SetState (enum MacState value);
+
+ enum MacState m_state;
+ Time m_probeRequestTimeout;
+ Time m_assocRequestTimeout;
+ EventId m_probeRequestEvent;
+ EventId m_assocRequestEvent;
+ EventId m_beaconWatchdog;
+ Time m_beaconWatchdogEnd;
+ uint32_t m_maxMissedBeacons;
+
+ TracedCallback<Mac48Address> m_assocLogger;
+ TracedCallback<Mac48Address> m_deAssocLogger;
+};
+
+} // namespace ns3
+
+#endif /* STA_WIFI_MAC_H */
--- a/src/devices/wifi/wifi-test.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/devices/wifi/wifi-test.cc Tue Dec 21 17:46:35 2010 +0100
@@ -58,16 +58,17 @@
WifiTest::WifiTest ()
: TestCase ("Wifi")
-{}
+{
+}
-void
+void
WifiTest::SendOnePacket (Ptr<WifiNetDevice> dev)
{
Ptr<Packet> p = Create<Packet> ();
dev->Send (p, dev->GetBroadcast (), 1);
}
-void
+void
WifiTest::CreateOne (Vector pos, Ptr<YansWifiChannel> channel)
{
Ptr<Node> node = CreateObject<Node> ();
@@ -120,7 +121,7 @@
{
m_mac.SetTypeId ("ns3::AdhocWifiMac");
m_propDelay.SetTypeId ("ns3::ConstantSpeedPropagationDelayModel");
-
+
m_manager.SetTypeId ("ns3::ArfWifiManager");
RunOne ();
m_manager.SetTypeId ("ns3::AarfWifiManager");
@@ -136,9 +137,9 @@
m_mac.SetTypeId ("ns3::AdhocWifiMac");
RunOne ();
- m_mac.SetTypeId ("ns3::NqapWifiMac");
+ m_mac.SetTypeId ("ns3::ApWifiMac");
RunOne ();
- m_mac.SetTypeId ("ns3::NqstaWifiMac");
+ m_mac.SetTypeId ("ns3::StaWifiMac");
RunOne ();
@@ -196,9 +197,10 @@
InterferenceHelperSequenceTest::InterferenceHelperSequenceTest ()
: TestCase ("InterferenceHelperSequence")
-{}
+{
+}
-void
+void
InterferenceHelperSequenceTest::SendOnePacket (Ptr<WifiNetDevice> dev)
{
Ptr<Packet> p = Create<Packet> (9999);
@@ -263,20 +265,20 @@
propLoss->SetDefaultLoss (999);
Simulator::Schedule (Seconds (1.0),
- &InterferenceHelperSequenceTest::SendOnePacket, this,
- DynamicCast<WifiNetDevice> (senderB->GetDevice (0)));
+ &InterferenceHelperSequenceTest::SendOnePacket, this,
+ DynamicCast<WifiNetDevice> (senderB->GetDevice (0)));
Simulator::Schedule (Seconds (1.0000001),
- &InterferenceHelperSequenceTest::SwitchCh, this,
- DynamicCast<WifiNetDevice> (rxOnly->GetDevice (0)));
+ &InterferenceHelperSequenceTest::SwitchCh, this,
+ DynamicCast<WifiNetDevice> (rxOnly->GetDevice (0)));
Simulator::Schedule (Seconds (5.0),
- &InterferenceHelperSequenceTest::SendOnePacket, this,
- DynamicCast<WifiNetDevice> (senderA->GetDevice (0)));
+ &InterferenceHelperSequenceTest::SendOnePacket, this,
+ DynamicCast<WifiNetDevice> (senderA->GetDevice (0)));
Simulator::Schedule (Seconds (7.0),
- &InterferenceHelperSequenceTest::SendOnePacket, this,
- DynamicCast<WifiNetDevice> (senderB->GetDevice (0)));
+ &InterferenceHelperSequenceTest::SendOnePacket, this,
+ DynamicCast<WifiNetDevice> (senderB->GetDevice (0)));
Simulator::Stop (Seconds (100.0));
Simulator::Run ();
--- a/src/devices/wifi/wifi.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/devices/wifi/wifi.h Tue Dec 21 17:46:35 2010 +0100
@@ -16,82 +16,86 @@
* beacon generation, probing, and association state machines.
* - a set of Rate control algorithms used by the MAC low models.
*
- * We have today 6 MAC high models, 3 for non QoS MACs and 3 for QoS MACs.
- *
- * a)non QoS MACs:
+ * There are presently three MAC high models, corresponding to the
+ * three primary Wi-Fi topological elements - Access Point (AP)
+ * (implemented in ns3::ApWifiMac), non-AP Station (STA) (implemented
+ * in ns3::StaWifiMac), and STA in an Independent Basic Service Set
+ * (IBSS - also commonly referred to as an ad hoc network. Implemented
+ * in ns3::AdhocWifiMac).
+ *
*
- * - a simple adhoc state machine which does not perform any
- * kind of beacon generation, probing, or association. This
- * state machine is implemented by the ns3::AdhocWifiMac class.
- * - an active probing and association state machine which handles
- * automatic re-association whenever too many beacons are missed
- * is implemented by the ns3::NqstaWifiMac class.
- * - an access point which generates periodic beacons, and which
- * accepts every attempt to associate. This AP state machine
- * is implemented by the ns3::NqapWifiMac class.
+ * The simplest of these is ns3::AdhocWifiMac, which implements a
+ * Wi-Fi MAC that does not perform any kind of beacon generation,
+ * probing, or association. The ns3::StaWifiMac class implements an
+ * active probing and association state machine that handles automatic
+ * re-association whenever too many beacons are missed. Finally,
+ * ns3::ApWifiMac implements an AP that generates periodic beacons,
+ * and that accepts every attempt to associate.
*
- * b)QoS MACs:
+ * These three MAC high models share a common parent in
+ * ns3::RegularWifiMac, which exposes, among other MAC configuration,
+ * an attribute (QosSupported) that allows configuration of
+ * 802.11e/WMM-style QoS support. With QoS-enabled MAC models it is
+ * possible to work with traffic belonging to four different Access
+ * Categories (ACs): AC_VO for voice traffic, AC_VI for video traffic,
+ * AC_BE for best-effort traffic and AC_BK for background traffic. In
+ * order for the MAC to determine the appropriate AC for an MSDU,
+ * packets forwarded down to these MAC layers should be marked using
+ * ns3::QosTag in order to set a TID (traffic id) for that packet
+ * otherwise it will be considered belonging to AC_BE.
+ *
+ * How TIDs are mapped to access classes are shown in the table below.
*
- * - like above but these MAC models are also able to manage QoS traffic.
- * These MAC layers are implemented respectively by ns3::QadhocWifiMac,
- * ns3::QstaWifiMac and ns3::QapWifiMac classes.
- * With these MAC models is possible to work with traffic belonging to
- * four different access classes: AC_VO for voice traffic, AC_VI for video
- * traffic, AC_BE for best-effort traffic and AC_BK for background traffic.
- * In order to determine MSDU's access class, every packet forwarded down
- * to these MAC layers should be marked using ns3::QosTag in order to set
- * a TID (traffic id) for that packet otherwise it will be considered
- * belonging to AC_BE access class.
- * How TIDs are mapped to access classes are shown in the table below.
- *
- * TID-AcIndex mapping:
- *
- * <table border=1>
- * <tr>
- * <td><b> TID </b></td>
- * <td><b> Access class </b></td>
- * </tr>
- * <tr>
- * <td> 7 </td>
- * <td> AC_VO </td>
- * </tr>
- * <tr>
- * <td> 6 </td>
- * <td> AC_VO </td>
- * </tr>
- * <tr>
- * <td> 5 </td>
- * <td> AC_VI </td>
- * </tr>
- * <tr>
- * <td> 4 </td>
- * <td> AC_VI </td>
- * </tr>
- * <tr>
- * <td> 3 </td>
- * <td> AC_BE </td>
- * </tr>
- * <tr>
- * <td> 0 </td>
- * <td> AC_BE </td>
- * </tr>
- * <tr>
- * <td> 2 </td>
- * <td> AC_BK </td>
- * </tr>
- * <tr>
- * <td> 1 </td>
- * <td> AC_BK </td>
- * </tr>
- * </table>
- *
+ * <table border=1>
+ * <tr>
+ * <td><b> TID </b></td>
+ * <td><b> Access Category </b></td>
+ * </tr>
+ * <tr>
+ * <td> 7 </td>
+ * <td> AC_VO </td>
+ * </tr>
+ * <tr>
+ * <td> 6 </td>
+ * <td> AC_VO </td>
+ * </tr>
+ * <tr>
+ * <td> 5 </td>
+ * <td> AC_VI </td>
+ * </tr>
+ * <tr>
+ * <td> 4 </td>
+ * <td> AC_VI </td>
+ * </tr>
+ * <tr>
+ * <td> 3 </td>
+ * <td> AC_BE </td>
+ * </tr>
+ * <tr>
+ * <td> 0 </td>
+ * <td> AC_BE </td>
+ * </tr>
+ * <tr>
+ * <td> 2 </td>
+ * <td> AC_BK </td>
+ * </tr>
+ * <tr>
+ * <td> 1 </td>
+ * <td> AC_BK </td>
+ * </tr>
+ * </table>
+ *
* The MAC low layer is split in 3 components:
* - ns3::MacLow which takes care of RTS/CTS/DATA/ACK transactions.
* - ns3::DcfManager and ns3::DcfState which implements the DCF function.
- * - ns3::DcaTxop or ns3::EdcaTxopN which handle the packet queue, packet
- * fragmentation, and packet retransmissions if they are needed.
- * ns3::DcaTxop object is used by non QoS high MACs. ns3::EdcaTxopN is
- * used by Qos high MACs and performs also QoS operations like 802.11n MSDU
+ *
+ * - ns3::DcaTxop and ns3::EdcaTxopN which handle the packet queue,
+ * packet fragmentation, and packet retransmissions if they are
+ * needed. The ns3::DcaTxop object is used by high MACs that are
+ * not QoS-enabled, and for transmission of frames (e.g., of type
+ * Management) that the standard says should access the medium
+ * using the DCF. ns3::EdcaTxopN is used by QoS-enabled high MACs
+ * and also performs QoS operations like 802.11n-style MSDU
* aggregation.
*
* The PHY layer implements a single 802.11a model in the ns3::WifiPhy class: the
--- a/src/devices/wifi/wscript Tue Dec 21 17:39:54 2010 +0100
+++ b/src/devices/wifi/wscript Tue Dec 21 17:46:35 2010 +0100
@@ -33,10 +33,11 @@
'dcf-manager.cc',
'dcf-manager-test.cc',
'wifi-mac.cc',
+ 'regular-wifi-mac.cc',
'wifi-remote-station-manager.cc',
+ 'ap-wifi-mac.cc',
+ 'sta-wifi-mac.cc',
'adhoc-wifi-mac.cc',
- 'nqap-wifi-mac.cc',
- 'nqsta-wifi-mac.cc',
'wifi-net-device.cc',
'arf-wifi-manager.cc',
'aarf-wifi-manager.cc',
@@ -51,9 +52,6 @@
'wifi-test.cc',
'qos-tag.cc',
'qos-utils.cc',
- 'qadhoc-wifi-mac.cc',
- 'qap-wifi-mac.cc',
- 'qsta-wifi-mac.cc',
'edca-txop-n.cc',
'msdu-aggregator.cc',
'amsdu-subframe-header.cc',
@@ -83,6 +81,9 @@
'wifi-phy.h',
'interference-helper.h',
'wifi-remote-station-manager.h',
+ 'ap-wifi-mac.h',
+ 'sta-wifi-mac.h',
+ 'adhoc-wifi-mac.h',
'arf-wifi-manager.h',
'aarf-wifi-manager.h',
'ideal-wifi-manager.h',
@@ -94,9 +95,7 @@
'cara-wifi-manager.h',
'minstrel-wifi-manager.h',
'wifi-mac.h',
- 'adhoc-wifi-mac.h',
- 'nqsta-wifi-mac.h',
- 'nqap-wifi-mac.h',
+ 'regular-wifi-mac.h',
'wifi-phy.h',
'supported-rates.h',
'error-rate-model.h',
@@ -105,9 +104,6 @@
'dsss-error-rate-model.h',
'dca-txop.h',
'wifi-mac-header.h',
- 'qadhoc-wifi-mac.h',
- 'qap-wifi-mac.h',
- 'qsta-wifi-mac.h',
'qos-utils.h',
'edca-txop-n.h',
'msdu-aggregator.h',
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/helper/bulk-send-helper.cc Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,78 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 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
+ *
+ * Author: Geoge Riley <riley@ece.gatech.edu>
+ * Adapted from OnOffHelper by:
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+
+#include "bulk-send-helper.h"
+#include "ns3/inet-socket-address.h"
+#include "ns3/packet-socket-address.h"
+#include "ns3/string.h"
+#include "ns3/names.h"
+
+namespace ns3 {
+
+BulkSendHelper::BulkSendHelper (std::string protocol, Address address)
+{
+ m_factory.SetTypeId ("ns3::BulkSendApplication");
+ m_factory.Set ("Protocol", StringValue (protocol));
+ m_factory.Set ("Remote", AddressValue (address));
+}
+
+void
+BulkSendHelper::SetAttribute (std::string name, const AttributeValue &value)
+{
+ m_factory.Set (name, value);
+}
+
+ApplicationContainer
+BulkSendHelper::Install (Ptr<Node> node) const
+{
+ return ApplicationContainer (InstallPriv (node));
+}
+
+ApplicationContainer
+BulkSendHelper::Install (std::string nodeName) const
+{
+ Ptr<Node> node = Names::Find<Node> (nodeName);
+ return ApplicationContainer (InstallPriv (node));
+}
+
+ApplicationContainer
+BulkSendHelper::Install (NodeContainer c) const
+{
+ ApplicationContainer apps;
+ for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
+ {
+ apps.Add (InstallPriv (*i));
+ }
+
+ return apps;
+}
+
+Ptr<Application>
+BulkSendHelper::InstallPriv (Ptr<Node> node) const
+{
+ Ptr<Application> app = m_factory.Create<Application> ();
+ node->AddApplication (app);
+
+ return app;
+}
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/helper/bulk-send-helper.h Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,111 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 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
+ *
+ * Author: Geoge Riley <riley@ece.gatech.edu>
+ * Adapted from OnOffHelper by:
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+
+#ifndef BULK_SEND_HELPER_H
+#define BULK_SEND_HELPER_H
+
+#include <stdint.h>
+#include <string>
+#include "ns3/object-factory.h"
+#include "ns3/address.h"
+#include "ns3/attribute.h"
+#include "ns3/net-device.h"
+#include "node-container.h"
+#include "application-container.h"
+
+namespace ns3 {
+
+/**
+ * \brief A helper to make it easier to instantiate an ns3::BulkSendApplication
+ * on a set of nodes.
+ */
+class BulkSendHelper
+{
+public:
+ /**
+ * Create an BulkSendHelper to make it easier to work with BulkSendApplications
+ *
+ * \param protocol the name of the protocol to use to send traffic
+ * by the applications. This string identifies the socket
+ * factory type used to create sockets for the applications.
+ * A typical value would be ns3::UdpSocketFactory.
+ * \param address the address of the remote node to send traffic
+ * to.
+ */
+ BulkSendHelper (std::string protocol, Address address);
+
+ /**
+ * Helper function used to set the underlying application attributes,
+ * _not_ the socket attributes.
+ *
+ * \param name the name of the application attribute to set
+ * \param value the value of the application attribute to set
+ */
+ void SetAttribute (std::string name, const AttributeValue &value);
+
+ /**
+ * Install an ns3::BulkSendApplication on each node of the input container
+ * configured with all the attributes set with SetAttribute.
+ *
+ * \param c NodeContainer of the set of nodes on which an BulkSendApplication
+ * will be installed.
+ * \returns Container of Ptr to the applications installed.
+ */
+ ApplicationContainer Install (NodeContainer c) const;
+
+ /**
+ * Install an ns3::BulkSendApplication on the node configured with all the
+ * attributes set with SetAttribute.
+ *
+ * \param node The node on which an BulkSendApplication will be installed.
+ * \returns Container of Ptr to the applications installed.
+ */
+ ApplicationContainer Install (Ptr<Node> node) const;
+
+ /**
+ * Install an ns3::BulkSendApplication on the node configured with all the
+ * attributes set with SetAttribute.
+ *
+ * \param nodeName The node on which an BulkSendApplication will be installed.
+ * \returns Container of Ptr to the applications installed.
+ */
+ ApplicationContainer Install (std::string nodeName) const;
+
+private:
+ /**
+ * \internal
+ * Install an ns3::BulkSendApplication on the node configured with all the
+ * attributes set with SetAttribute.
+ *
+ * \param node The node on which an BulkSendApplication will be installed.
+ * \returns Ptr to the application installed.
+ */
+ Ptr<Application> InstallPriv (Ptr<Node> node) const;
+ std::string m_protocol;
+ Address m_remote;
+ ObjectFactory m_factory;
+};
+
+} // namespace ns3
+
+#endif /* ON_OFF_HELPER_H */
+
--- a/src/helper/ipv4-routing-helper.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/helper/ipv4-routing-helper.cc Tue Dec 21 17:46:35 2010 +0100
@@ -17,11 +17,67 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+#include "ns3/node.h"
+#include "ns3/node-list.h"
+#include "ns3/simulator.h"
+#include "ns3/ipv4-routing-protocol.h"
#include "ipv4-routing-helper.h"
namespace ns3 {
Ipv4RoutingHelper::~Ipv4RoutingHelper ()
-{}
+{
+}
+
+void
+Ipv4RoutingHelper::PrintRoutingTableAllAt (Time printTime, Ptr<OutputStreamWrapper> stream) const
+{
+ for (uint32_t i = 0; i < NodeList::GetNNodes (); i++)
+ {
+ Ptr<Node> node = NodeList::GetNode (i);
+ Simulator::Schedule (printTime, &Ipv4RoutingHelper::Print, this, node, stream);
+ }
+}
+
+void
+Ipv4RoutingHelper::PrintRoutingTableAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream) const
+{
+ for (uint32_t i = 0; i < NodeList::GetNNodes (); i++)
+ {
+ Ptr<Node> node = NodeList::GetNode (i);
+ Simulator::Schedule (printInterval, &Ipv4RoutingHelper::PrintEvery, this, printInterval, node, stream);
+ }
+}
+
+void
+Ipv4RoutingHelper::PrintRoutingTableAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const
+{
+ Simulator::Schedule (printTime, &Ipv4RoutingHelper::Print, this, node, stream);
+}
+
+void
+Ipv4RoutingHelper::PrintRoutingTableEvery (Time printInterval,Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const
+{
+ Simulator::Schedule (printInterval, &Ipv4RoutingHelper::PrintEvery, this, printInterval, node, stream);
+}
+
+void
+Ipv4RoutingHelper::Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const
+{
+ Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
+ Ptr<Ipv4RoutingProtocol> rp = ipv4->GetRoutingProtocol ();
+ NS_ASSERT (rp);
+ rp->PrintRoutingTable (stream);
+}
+
+void
+Ipv4RoutingHelper::PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const
+{
+ Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
+ Ptr<Ipv4RoutingProtocol> rp = ipv4->GetRoutingProtocol ();
+ NS_ASSERT (rp);
+ rp->PrintRoutingTable (stream);
+ Simulator::Schedule (printInterval, &Ipv4RoutingHelper::PrintEvery, this, printInterval, node, stream);
+}
} // namespace ns3
--- a/src/helper/ipv4-routing-helper.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/helper/ipv4-routing-helper.h Tue Dec 21 17:46:35 2010 +0100
@@ -21,6 +21,8 @@
#define IPV4_ROUTING_HELPER_H
#include "ns3/ptr.h"
+#include "ns3/nstime.h"
+#include "ns3/output-stream-wrapper.h"
namespace ns3 {
@@ -58,6 +60,56 @@
* \returns a newly-created routing protocol
*/
virtual Ptr<Ipv4RoutingProtocol> Create (Ptr<Node> node) const = 0;
+
+ /**
+ * \brief prints the routing tables of all nodes at a particular time.
+ * \param printTime the time at which the routing table is supposed to be printed.
+ * \param stream The output stream object to use
+ *
+ * This method calls the PrintRoutingTable() method of the
+ * Ipv4RoutingProtocol stored in the Ipv4 object, for all nodes at the
+ * specified time; the output format is routing protocol-specific.
+ */
+ void PrintRoutingTableAllAt (Time printTime, Ptr<OutputStreamWrapper> stream) const;
+
+ /**
+ * \brief prints the routing tables of all nodes at regular intervals specified by user.
+ * \param printInterval the time interval for which the routing table is supposed to be printed.
+ * \param stream The output stream object to use
+ *
+ * This method calls the PrintRoutingTable() method of the
+ * Ipv4RoutingProtocol stored in the Ipv4 object, for all nodes at the
+ * specified time interval; the output format is routing protocol-specific.
+ */
+ void PrintRoutingTableAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream) const;
+
+ /**
+ * \brief prints the routing tables of a node at a particular time.
+ * \param printTime the time at which the routing table is supposed to be printed.
+ * \param node The node ptr for which we need the routing table to be printed
+ * \param stream The output stream object to use
+ *
+ * This method calls the PrintRoutingTable() method of the
+ * Ipv4RoutingProtocol stored in the Ipv4 object, for the selected node
+ * at the specified time; the output format is routing protocol-specific.
+ */
+ void PrintRoutingTableAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
+
+ /**
+ * \brief prints the routing tables of a node at regular intervals specified by user.
+ * \param printInterval the time interval for which the routing table is supposed to be printed.
+ * \param node The node ptr for which we need the routing table to be printed
+ * \param stream The output stream object to use
+ *
+ * This method calls the PrintRoutingTable() method of the
+ * Ipv4RoutingProtocol stored in the Ipv4 object, for the selected node
+ * at the specified interval; the output format is routing protocol-specific.
+ */
+ void PrintRoutingTableEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
+
+private:
+ void Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
+ void PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
};
} // namespace ns3
--- a/src/helper/nqos-wifi-mac-helper.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/helper/nqos-wifi-mac-helper.cc Tue Dec 21 17:46:35 2010 +0100
@@ -20,21 +20,29 @@
#include "nqos-wifi-mac-helper.h"
#include "ns3/wifi-mac.h"
#include "ns3/pointer.h"
+#include "ns3/boolean.h"
#include "ns3/dca-txop.h"
namespace ns3 {
NqosWifiMacHelper::NqosWifiMacHelper ()
-{}
+{
+}
NqosWifiMacHelper::~NqosWifiMacHelper ()
-{}
+{
+}
NqosWifiMacHelper
NqosWifiMacHelper::Default (void)
{
NqosWifiMacHelper helper;
- helper.SetType ("ns3::AdhocWifiMac");
+ // We're making non QoS-enabled Wi-Fi MACs here, so we set the
+ // necessary attribute. I've carefully positioned this here so that
+ // someone who knows what they're doing can override with explicit
+ // attributes.
+ helper.SetType ("ns3::AdhocWifiMac",
+ "QosSupported", BooleanValue (false));
return helper;
}
--- a/src/helper/nqos-wifi-mac-helper.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/helper/nqos-wifi-mac-helper.h Tue Dec 21 17:46:35 2010 +0100
@@ -25,8 +25,10 @@
namespace ns3 {
/**
- * \brief create non-qos MAC layers for a ns3::WifiNetDevice.
- * This class can create MACs of type ns3::NqapWifiMac, ns3::NqstaWifiMac, and, ns3::AdhocWifiMac
+ * \brief create non QoS-enabled MAC layers for a ns3::WifiNetDevice.
+ *
+ * This class can create MACs of type ns3::ApWifiMac, ns3::StaWifiMac,
+ * and, ns3::AdhocWifiMac, with QosSupported attribute set to False.
*/
class NqosWifiMacHelper : public WifiMacHelper
{
--- a/src/helper/point-to-point-helper.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/helper/point-to-point-helper.cc Tue Dec 21 17:46:35 2010 +0100
@@ -171,6 +171,9 @@
asciiTraceHelper.HookDefaultDropSinkWithoutContext<Queue> (queue, "Drop", theStream);
asciiTraceHelper.HookDefaultDequeueSinkWithoutContext<Queue> (queue, "Dequeue", theStream);
+ // PhyRxDrop trace source for "d" event
+ asciiTraceHelper.HookDefaultDropSinkWithoutContext<PointToPointNetDevice> (device, "PhyRxDrop", theStream);
+
return;
}
@@ -204,6 +207,10 @@
oss.str ("");
oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::PointToPointNetDevice/TxQueue/Drop";
Config::Connect (oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultDropSinkWithContext, stream));
+
+ oss.str ("");
+ oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::PointToPointNetDevice/PhyRxDrop";
+ Config::Connect (oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultDropSinkWithContext, stream));
}
NetDeviceContainer
--- a/src/helper/qos-wifi-mac-helper.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/helper/qos-wifi-mac-helper.cc Tue Dec 21 17:46:35 2010 +0100
@@ -22,22 +22,31 @@
#include "ns3/wifi-mac.h"
#include "ns3/edca-txop-n.h"
#include "ns3/pointer.h"
+#include "ns3/boolean.h"
#include "ns3/uinteger.h"
namespace ns3 {
QosWifiMacHelper::QosWifiMacHelper ()
-{}
+{
+}
QosWifiMacHelper::~QosWifiMacHelper ()
-{}
+{
+}
QosWifiMacHelper
QosWifiMacHelper::Default (void)
{
QosWifiMacHelper helper;
- helper.SetType ("ns3::QstaWifiMac");
-
+
+ // We're making QoS-enabled Wi-Fi MACs here, so we set the necessary
+ // attribute. I've carefully positioned this here so that someone
+ // who knows what they're doing can override with explicit
+ // attributes.
+ helper.SetType ("ns3::StaWifiMac",
+ "QosSupported", BooleanValue (true));
+
return helper;
}
@@ -110,7 +119,7 @@
PointerValue ptr;
mac->GetAttribute (dcaAttrName, ptr);
Ptr<EdcaTxopN> edca = ptr.Get<EdcaTxopN> ();
-
+
if (it != m_aggregators.end ())
{
ObjectFactory factory = it->second;
@@ -132,7 +141,7 @@
QosWifiMacHelper::Create (void) const
{
Ptr<WifiMac> mac = m_mac.Create<WifiMac> ();
-
+
Setup (mac, AC_VO, "VO_EdcaTxopN");
Setup (mac, AC_VI, "VI_EdcaTxopN");
Setup (mac, AC_BE, "BE_EdcaTxopN");
--- a/src/helper/qos-wifi-mac-helper.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/helper/qos-wifi-mac-helper.h Tue Dec 21 17:46:35 2010 +0100
@@ -28,8 +28,10 @@
namespace ns3 {
/**
- * \brief create qos MAC layers for a ns3::WifiNetDevice.
- * This class can create MACs of type ns3::QapWifiMac, ns3::QstaWifiMac, and, ns3::QadhocWifiMac
+ * \brief create QoS-enabled MAC layers for a ns3::WifiNetDevice.
+ *
+ * This class can create MACs of type ns3::ApWifiMac, ns3::StaWifiMac,
+ * and, ns3::AdhocWifiMac, with QosSupported attribute set to True.
*/
class QosWifiMacHelper : public WifiMacHelper
{
--- a/src/helper/wifi-helper.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/helper/wifi-helper.cc Tue Dec 21 17:46:35 2010 +0100
@@ -39,14 +39,17 @@
namespace ns3 {
WifiPhyHelper::~WifiPhyHelper ()
-{}
+{
+}
WifiMacHelper::~WifiMacHelper ()
-{}
+{
+}
WifiHelper::WifiHelper ()
: m_standard (WIFI_PHY_STANDARD_80211a)
-{}
+{
+}
WifiHelper
WifiHelper::Default (void)
@@ -131,6 +134,7 @@
LogComponentEnable ("Aarfcd", LOG_LEVEL_ALL);
LogComponentEnable ("AdhocWifiMac", LOG_LEVEL_ALL);
LogComponentEnable ("AmrrWifiRemoteStation", LOG_LEVEL_ALL);
+ LogComponentEnable ("ApWifiMac", LOG_LEVEL_ALL);
LogComponentEnable ("ns3::ArfWifiManager", LOG_LEVEL_ALL);
LogComponentEnable ("Cara", LOG_LEVEL_ALL);
LogComponentEnable ("DcaTxop", LOG_LEVEL_ALL);
@@ -144,14 +148,11 @@
LogComponentEnable ("MsduAggregator", LOG_LEVEL_ALL);
LogComponentEnable ("MsduStandardAggregator", LOG_LEVEL_ALL);
LogComponentEnable ("NistErrorRateModel", LOG_LEVEL_ALL);
- LogComponentEnable ("NqapWifiMac", LOG_LEVEL_ALL);
- LogComponentEnable ("NqstaWifiMac", LOG_LEVEL_ALL);
LogComponentEnable ("OnoeWifiRemoteStation", LOG_LEVEL_ALL);
LogComponentEnable ("PropagationLossModel", LOG_LEVEL_ALL);
- LogComponentEnable ("QadhocWifiMac", LOG_LEVEL_ALL);
- LogComponentEnable ("QapWifiMac", LOG_LEVEL_ALL);
- LogComponentEnable ("QstaWifiMac", LOG_LEVEL_ALL);
+ LogComponentEnable ("RegularWifiMac", LOG_LEVEL_ALL);
LogComponentEnable ("RraaWifiManager", LOG_LEVEL_ALL);
+ LogComponentEnable ("StaWifiMac", LOG_LEVEL_ALL);
LogComponentEnable ("SupportedRates", LOG_LEVEL_ALL);
LogComponentEnable ("WifiChannel", LOG_LEVEL_ALL);
LogComponentEnable ("WifiPhyStateHelper", LOG_LEVEL_ALL);
--- a/src/helper/wscript Tue Dec 21 17:39:54 2010 +0100
+++ b/src/helper/wscript Tue Dec 21 17:46:35 2010 +0100
@@ -47,6 +47,7 @@
'topology-reader-helper.cc',
'waveform-generator-helper.cc',
'spectrum-analyzer-helper.cc',
+ 'bulk-send-helper.cc',
]
headers = bld.new_task_gen('ns3header')
@@ -97,6 +98,7 @@
'topology-reader-helper.h',
'waveform-generator-helper.h',
'spectrum-analyzer-helper.h',
+ 'bulk-send-helper.h',
]
env = bld.env_of_name('default')
--- a/src/internet-stack/ipv4-raw-socket-impl.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/internet-stack/ipv4-raw-socket-impl.cc Tue Dec 21 17:46:35 2010 +0100
@@ -80,6 +80,13 @@
NS_LOG_FUNCTION (this);
return m_err;
}
+
+enum Socket::SocketType
+Ipv4RawSocketImpl::GetSocketType (void) const
+{
+ return NS3_SOCK_RAW;
+}
+
Ptr<Node>
Ipv4RawSocketImpl::GetNode (void) const
{
--- a/src/internet-stack/ipv4-raw-socket-impl.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/internet-stack/ipv4-raw-socket-impl.h Tue Dec 21 17:46:35 2010 +0100
@@ -23,6 +23,7 @@
void SetNode (Ptr<Node> node);
virtual enum Socket::SocketErrno GetErrno (void) const;
+ virtual enum Socket::SocketType GetSocketType (void) const;
virtual Ptr<Node> GetNode (void) const;
virtual int Bind (const Address &address);
virtual int Bind ();
--- a/src/internet-stack/ipv6-raw-socket-impl.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/internet-stack/ipv6-raw-socket-impl.cc Tue Dec 21 17:46:35 2010 +0100
@@ -97,6 +97,11 @@
return m_err;
}
+enum Socket::SocketType Ipv6RawSocketImpl::GetSocketType () const
+{
+ return NS3_SOCK_RAW;
+}
+
int Ipv6RawSocketImpl::Bind (const Address& address)
{
NS_LOG_FUNCTION (this << address);
--- a/src/internet-stack/ipv6-raw-socket-impl.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/internet-stack/ipv6-raw-socket-impl.h Tue Dec 21 17:46:35 2010 +0100
@@ -69,6 +69,12 @@
virtual enum Socket::SocketErrno GetErrno () const;
/**
+ * \brief Get socket type (NS3_SOCK_RAW)
+ * \return socket type
+ */
+ virtual enum Socket::SocketType GetSocketType () const;
+
+ /**
* \brief Get node.
* \return node associated with this raw socket.
*/
--- a/src/internet-stack/nsc-tcp-l4-protocol.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/internet-stack/nsc-tcp-l4-protocol.cc Tue Dec 21 17:46:35 2010 +0100
@@ -37,8 +37,6 @@
#include "nsc-tcp-socket-factory-impl.h"
#include "sim_interface.h"
-#include "tcp-typedefs.h"
-
#include <vector>
#include <sstream>
#include <dlfcn.h>
--- a/src/internet-stack/nsc-tcp-socket-impl.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/internet-stack/nsc-tcp-socket-impl.cc Tue Dec 21 17:46:35 2010 +0100
@@ -28,7 +28,6 @@
#include "nsc-tcp-l4-protocol.h"
#include "nsc-tcp-socket-impl.h"
#include "ns3/simulation-singleton.h"
-#include "tcp-typedefs.h"
#include "ns3/simulator.h"
#include "ns3/packet.h"
#include "ns3/uinteger.h"
@@ -39,8 +38,8 @@
// for ntohs().
#include <arpa/inet.h>
#include <netinet/in.h>
+#include "sim_interface.h"
-#include "sim_interface.h"
#include "sim_errno.h"
NS_LOG_COMPONENT_DEFINE ("NscTcpSocketImpl");
@@ -63,7 +62,7 @@
return tid;
}
- NscTcpSocketImpl::NscTcpSocketImpl ()
+NscTcpSocketImpl::NscTcpSocketImpl ()
: m_endPoint (0),
m_node (0),
m_tcp (0),
@@ -171,6 +170,12 @@
return m_errno;
}
+enum Socket::SocketType
+NscTcpSocketImpl::GetSocketType (void) const
+{
+ return NS3_SOCK_STREAM;
+}
+
Ptr<Node>
NscTcpSocketImpl::GetNode (void) const
{
@@ -789,6 +794,18 @@
return m_delAckMaxCount;
}
+void
+NscTcpSocketImpl::SetPersistTimeout (Time timeout)
+{
+ m_persistTimeout = timeout;
+}
+
+Time
+NscTcpSocketImpl::GetPersistTimeout (void) const
+{
+ return m_persistTimeout;
+}
+
enum Socket::SocketErrno
NscTcpSocketImpl::GetNativeNs3Errno(int error) const
{
--- a/src/internet-stack/nsc-tcp-socket-impl.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/internet-stack/nsc-tcp-socket-impl.h Tue Dec 21 17:46:35 2010 +0100
@@ -27,7 +27,6 @@
#include "ns3/ipv4-address.h"
#include "ns3/inet-socket-address.h"
#include "ns3/event-id.h"
-#include "tcp-typedefs.h"
#include "pending-data.h"
#include "ns3/sequence-number.h"
@@ -66,6 +65,7 @@
void SetTcp (Ptr<NscTcpL4Protocol> tcp);
virtual enum SocketErrno GetErrno (void) const;
+ virtual enum SocketType GetSocketType (void) const;
virtual Ptr<Node> GetNode (void) const;
virtual int Bind (void);
virtual int Bind (const Address &address);
@@ -125,6 +125,8 @@
virtual Time GetDelAckTimeout (void) const;
virtual void SetDelAckMaxCount (uint32_t count);
virtual uint32_t GetDelAckMaxCount (void) const;
+ virtual void SetPersistTimeout (Time timeout);
+ virtual Time GetPersistTimeout (void) const;
enum Socket::SocketErrno GetNativeNs3Errno(int err) const;
uint32_t m_delAckMaxCount;
@@ -145,7 +147,7 @@
bool m_connected;
//manage the state information
- States_t m_state;
+ TracedValue<TcpStates_t> m_state;
bool m_closeOnEmpty;
//needed to queue data when in SYN_SENT state
@@ -166,6 +168,7 @@
// Timer-related members
Time m_cnTimeout;
uint32_t m_cnCount;
+ Time m_persistTimeout;
// Temporary queue for delivering data to application
std::queue<Ptr<Packet> > m_deliveryQueue;
--- a/src/internet-stack/tcp-header.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/internet-stack/tcp-header.cc Tue Dec 21 17:46:35 2010 +0100
@@ -20,7 +20,6 @@
#include <stdint.h>
#include <iostream>
-#include "tcp-socket-impl.h"
#include "tcp-header.h"
#include "ns3/buffer.h"
#include "ns3/address-utils.h"
--- a/src/internet-stack/tcp-l4-protocol.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/internet-stack/tcp-l4-protocol.cc Tue Dec 21 17:46:35 2010 +0100
@@ -35,9 +35,8 @@
#include "ipv4-end-point.h"
#include "ipv4-l3-protocol.h"
#include "tcp-socket-factory-impl.h"
-#include "tcp-socket-impl.h"
+#include "tcp-newreno.h"
#include "rtt-estimator.h"
-#include "tcp-typedefs.h"
#include <vector>
#include <sstream>
@@ -49,269 +48,6 @@
NS_OBJECT_ENSURE_REGISTERED (TcpL4Protocol);
-//State Machine things --------------------------------------------------------
-TcpStateMachine::TcpStateMachine()
- : aT (LAST_STATE, StateActionVec_t(LAST_EVENT)),
- eV (MAX_FLAGS)
-{
- NS_LOG_FUNCTION_NOARGS ();
-
- // Create the state table
- // Closed state
- aT[CLOSED][APP_LISTEN] = SA (LISTEN, NO_ACT);
- aT[CLOSED][APP_CONNECT] = SA (SYN_SENT, SYN_TX);
- aT[CLOSED][APP_SEND] = SA (CLOSED, RST_TX);
- aT[CLOSED][SEQ_RECV] = SA (CLOSED, NO_ACT);
- aT[CLOSED][APP_CLOSE] = SA (CLOSED, NO_ACT);
- aT[CLOSED][TIMEOUT] = SA (CLOSED, RST_TX);
- aT[CLOSED][ACK_RX] = SA (CLOSED, RST_TX);
- aT[CLOSED][SYN_RX] = SA (CLOSED, RST_TX);
- aT[CLOSED][SYN_ACK_RX] = SA (CLOSED, RST_TX);
- aT[CLOSED][FIN_RX] = SA (CLOSED, RST_TX);
- aT[CLOSED][FIN_ACK_RX] = SA (CLOSED, RST_TX);
- aT[CLOSED][RST_RX] = SA (CLOSED, CANCEL_TM);
- aT[CLOSED][BAD_FLAGS] = SA (CLOSED, RST_TX);
-
- // Listen State
- // For the listen state, anything other than CONNECT or SEND
- // is simply ignored....this likely indicates the child TCP
- // has finished and issued unbind call, but the remote end
- // has not yet closed.
- aT[LISTEN][APP_LISTEN] = SA (LISTEN, NO_ACT);
- aT[LISTEN][APP_CONNECT] = SA (SYN_SENT, SYN_TX);
- aT[LISTEN][APP_SEND] = SA (SYN_SENT, SYN_TX);
- aT[LISTEN][SEQ_RECV] = SA (LISTEN, NO_ACT);
- aT[LISTEN][APP_CLOSE] = SA (CLOSED, NO_ACT);
- aT[LISTEN][TIMEOUT] = SA (LISTEN, NO_ACT);
- aT[LISTEN][ACK_RX] = SA (LISTEN, NO_ACT);
- aT[LISTEN][SYN_RX] = SA (LISTEN, SYN_ACK_TX);//stay in listen and fork
- aT[LISTEN][SYN_ACK_RX] = SA (LISTEN, NO_ACT);
- aT[LISTEN][FIN_RX] = SA (LISTEN, NO_ACT);
- aT[LISTEN][FIN_ACK_RX] = SA (LISTEN, NO_ACT);
- aT[LISTEN][RST_RX] = SA (LISTEN, NO_ACT);
- aT[LISTEN][BAD_FLAGS] = SA (LISTEN, NO_ACT);
-
- // Syn Sent State
- aT[SYN_SENT][APP_LISTEN] = SA (CLOSED, RST_TX);
- aT[SYN_SENT][APP_CONNECT] = SA (SYN_SENT, SYN_TX);
- aT[SYN_SENT][APP_SEND] = SA (SYN_SENT, NO_ACT);
- aT[SYN_SENT][SEQ_RECV] = SA (ESTABLISHED, NEW_SEQ_RX);
- aT[SYN_SENT][APP_CLOSE] = SA (CLOSED, RST_TX);
- aT[SYN_SENT][TIMEOUT] = SA (CLOSED, NO_ACT);
- aT[SYN_SENT][ACK_RX] = SA (SYN_SENT, NO_ACT);
- aT[SYN_SENT][SYN_RX] = SA (SYN_RCVD, SYN_ACK_TX);
- aT[SYN_SENT][SYN_ACK_RX] = SA (ESTABLISHED, ACK_TX_1);
- aT[SYN_SENT][FIN_RX] = SA (CLOSED, RST_TX);
- aT[SYN_SENT][FIN_ACK_RX] = SA (CLOSED, RST_TX);
- aT[SYN_SENT][RST_RX] = SA (CLOSED, APP_NOTIFY);
- aT[SYN_SENT][BAD_FLAGS] = SA (CLOSED, RST_TX);
-
- // Syn Recvd State
- aT[SYN_RCVD][APP_LISTEN] = SA (CLOSED, RST_TX);
- aT[SYN_RCVD][APP_CONNECT] = SA (CLOSED, RST_TX);
- aT[SYN_RCVD][APP_SEND] = SA (CLOSED, RST_TX);
- aT[SYN_RCVD][SEQ_RECV] = SA (ESTABLISHED, NEW_SEQ_RX);
- aT[SYN_RCVD][APP_CLOSE] = SA (FIN_WAIT_1, FIN_TX);
- aT[SYN_RCVD][TIMEOUT] = SA (CLOSED, RST_TX);
- aT[SYN_RCVD][ACK_RX] = SA (ESTABLISHED, SERV_NOTIFY);
- aT[SYN_RCVD][SYN_RX] = SA (SYN_RCVD, SYN_ACK_TX);
- aT[SYN_RCVD][SYN_ACK_RX] = SA (CLOSED, RST_TX);
- aT[SYN_RCVD][FIN_RX] = SA (CLOSED, RST_TX);
- aT[SYN_RCVD][FIN_ACK_RX] = SA (CLOSE_WAIT, PEER_CLOSE);
- aT[SYN_RCVD][RST_RX] = SA (CLOSED, CANCEL_TM);
- aT[SYN_RCVD][BAD_FLAGS] = SA (CLOSED, RST_TX);
-
- // Established State
- aT[ESTABLISHED][APP_LISTEN] = SA (CLOSED, RST_TX);
- aT[ESTABLISHED][APP_CONNECT]= SA (CLOSED, RST_TX);
- aT[ESTABLISHED][APP_SEND] = SA (ESTABLISHED,TX_DATA);
- aT[ESTABLISHED][SEQ_RECV] = SA (ESTABLISHED,NEW_SEQ_RX);
- aT[ESTABLISHED][APP_CLOSE] = SA (FIN_WAIT_1, FIN_TX);
- aT[ESTABLISHED][TIMEOUT] = SA (ESTABLISHED,RETX);
- aT[ESTABLISHED][ACK_RX] = SA (ESTABLISHED,NEW_ACK);
- aT[ESTABLISHED][SYN_RX] = SA (SYN_RCVD, SYN_ACK_TX);
- aT[ESTABLISHED][SYN_ACK_RX] = SA (ESTABLISHED,NO_ACT);
- aT[ESTABLISHED][FIN_RX] = SA (CLOSE_WAIT, PEER_CLOSE);
- aT[ESTABLISHED][FIN_ACK_RX] = SA (CLOSE_WAIT, PEER_CLOSE);
- aT[ESTABLISHED][RST_RX] = SA (CLOSED, CANCEL_TM);
- aT[ESTABLISHED][BAD_FLAGS] = SA (CLOSED, RST_TX);
-
- // Close Wait State
- aT[CLOSE_WAIT][APP_LISTEN] = SA (CLOSED, RST_TX);
- aT[CLOSE_WAIT][APP_CONNECT] = SA (SYN_SENT, SYN_TX);
- aT[CLOSE_WAIT][APP_SEND] = SA (CLOSE_WAIT, TX_DATA);
- aT[CLOSE_WAIT][SEQ_RECV] = SA (CLOSE_WAIT, NEW_SEQ_RX);
- aT[CLOSE_WAIT][APP_CLOSE] = SA (LAST_ACK, FIN_ACK_TX);
- aT[CLOSE_WAIT][TIMEOUT] = SA (CLOSE_WAIT, NO_ACT);
- aT[CLOSE_WAIT][ACK_RX] = SA (CLOSE_WAIT, NEW_ACK);
- aT[CLOSE_WAIT][SYN_RX] = SA (CLOSED, RST_TX);
- aT[CLOSE_WAIT][SYN_ACK_RX] = SA (CLOSED, RST_TX);
- aT[CLOSE_WAIT][FIN_RX] = SA (CLOSE_WAIT, ACK_TX);
- aT[CLOSE_WAIT][FIN_ACK_RX] = SA (CLOSE_WAIT, ACK_TX);
- aT[CLOSE_WAIT][RST_RX] = SA (CLOSED, CANCEL_TM);
- aT[CLOSE_WAIT][BAD_FLAGS] = SA (CLOSED, RST_TX);
-
- // Close Last Ack State
- aT[LAST_ACK][APP_LISTEN] = SA (CLOSED, RST_TX);
- aT[LAST_ACK][APP_CONNECT] = SA (SYN_SENT, SYN_TX);
- aT[LAST_ACK][APP_SEND] = SA (CLOSED, RST_TX);
- aT[LAST_ACK][SEQ_RECV] = SA (LAST_ACK, NEW_SEQ_RX);
- aT[LAST_ACK][APP_CLOSE] = SA (CLOSED, NO_ACT);
- aT[LAST_ACK][TIMEOUT] = SA (CLOSED, NO_ACT);
- aT[LAST_ACK][ACK_RX] = SA (LAST_ACK, NO_ACT);
- aT[LAST_ACK][FIN_ACKED] = SA (CLOSED, APP_CLOSED);
- aT[LAST_ACK][SYN_RX] = SA (CLOSED, RST_TX);
- aT[LAST_ACK][SYN_ACK_RX] = SA (CLOSED, RST_TX);
- aT[LAST_ACK][FIN_RX] = SA (LAST_ACK, FIN_ACK_TX);
- aT[LAST_ACK][FIN_ACK_RX] = SA (CLOSED, NO_ACT);
- aT[LAST_ACK][RST_RX] = SA (CLOSED, CANCEL_TM);
- aT[LAST_ACK][BAD_FLAGS] = SA (CLOSED, RST_TX);
-
- // FIN_WAIT_1 state
- aT[FIN_WAIT_1][APP_LISTEN] = SA (CLOSED, RST_TX);
- aT[FIN_WAIT_1][APP_CONNECT] = SA (CLOSED, RST_TX);
- aT[FIN_WAIT_1][APP_SEND] = SA (CLOSED, RST_TX);
- aT[FIN_WAIT_1][SEQ_RECV] = SA (FIN_WAIT_1, NEW_SEQ_RX);
- aT[FIN_WAIT_1][APP_CLOSE] = SA (FIN_WAIT_1, NO_ACT);
- aT[FIN_WAIT_1][TIMEOUT] = SA (FIN_WAIT_1, NO_ACT);
- aT[FIN_WAIT_1][ACK_RX] = SA (FIN_WAIT_1, NEW_ACK);
- aT[FIN_WAIT_1][FIN_ACKED] = SA (FIN_WAIT_2, NEW_ACK);
- aT[FIN_WAIT_1][SYN_RX] = SA (CLOSED, RST_TX);
- aT[FIN_WAIT_1][SYN_ACK_RX] = SA (CLOSED, RST_TX);
- aT[FIN_WAIT_1][FIN_RX] = SA (CLOSING, ACK_TX);
- aT[FIN_WAIT_1][FIN_ACK_RX] = SA (TIMED_WAIT, ACK_TX);
- aT[FIN_WAIT_1][RST_RX] = SA (CLOSED, CANCEL_TM);
- aT[FIN_WAIT_1][BAD_FLAGS] = SA (CLOSED, RST_TX);
-
- // FIN_WAIT_2 state
- aT[FIN_WAIT_2][APP_LISTEN] = SA (CLOSED, RST_TX);
- aT[FIN_WAIT_2][APP_CONNECT] = SA (CLOSED, RST_TX);
- aT[FIN_WAIT_2][APP_SEND] = SA (CLOSED, RST_TX);
- aT[FIN_WAIT_2][SEQ_RECV] = SA (FIN_WAIT_2, NEW_SEQ_RX);
- aT[FIN_WAIT_2][APP_CLOSE] = SA (FIN_WAIT_2, NO_ACT);
- aT[FIN_WAIT_2][TIMEOUT] = SA (FIN_WAIT_2, NO_ACT);
- aT[FIN_WAIT_2][ACK_RX] = SA (FIN_WAIT_2, NEW_ACK);
- aT[FIN_WAIT_2][SYN_RX] = SA (CLOSED, RST_TX);
- aT[FIN_WAIT_2][SYN_ACK_RX] = SA (CLOSED, RST_TX);
- aT[FIN_WAIT_2][FIN_RX] = SA (TIMED_WAIT, ACK_TX);
- aT[FIN_WAIT_2][FIN_ACK_RX] = SA (TIMED_WAIT, ACK_TX);
- aT[FIN_WAIT_2][RST_RX] = SA (CLOSED, CANCEL_TM);
- aT[FIN_WAIT_2][BAD_FLAGS] = SA (CLOSED, RST_TX);
-
- // CLOSING state
- aT[CLOSING][APP_LISTEN] = SA (CLOSED, RST_TX);
- aT[CLOSING][APP_CONNECT] = SA (CLOSED, RST_TX);
- aT[CLOSING][APP_SEND] = SA (CLOSED, RST_TX);
- aT[CLOSING][SEQ_RECV] = SA (CLOSED, RST_TX);
- aT[CLOSING][APP_CLOSE] = SA (CLOSED, RST_TX);
- aT[CLOSING][TIMEOUT] = SA (CLOSING, NO_ACT);
- aT[CLOSING][ACK_RX] = SA (CLOSING, NO_ACT);
- aT[CLOSING][FIN_ACKED] = SA (TIMED_WAIT, NO_ACT);
- aT[CLOSING][SYN_RX] = SA (CLOSED, RST_TX);
- aT[CLOSING][SYN_ACK_RX] = SA (CLOSED, RST_TX);
- aT[CLOSING][FIN_RX] = SA (CLOSED, ACK_TX);
- aT[CLOSING][FIN_ACK_RX] = SA (CLOSED, ACK_TX);
- aT[CLOSING][RST_RX] = SA (CLOSED, CANCEL_TM);
- aT[CLOSING][BAD_FLAGS] = SA (CLOSED, RST_TX);
-
- // TIMED_WAIT state
- aT[TIMED_WAIT][APP_LISTEN] = SA (TIMED_WAIT, NO_ACT);
- aT[TIMED_WAIT][APP_CONNECT] = SA (TIMED_WAIT, NO_ACT);
- aT[TIMED_WAIT][APP_SEND] = SA (TIMED_WAIT, NO_ACT);
- aT[TIMED_WAIT][SEQ_RECV] = SA (TIMED_WAIT, NO_ACT);
- aT[TIMED_WAIT][APP_CLOSE] = SA (TIMED_WAIT, NO_ACT);
- aT[TIMED_WAIT][TIMEOUT] = SA (TIMED_WAIT, NO_ACT);
- aT[TIMED_WAIT][ACK_RX] = SA (TIMED_WAIT, NO_ACT);
- aT[TIMED_WAIT][SYN_RX] = SA (TIMED_WAIT, NO_ACT);
- aT[TIMED_WAIT][SYN_ACK_RX] = SA (TIMED_WAIT, NO_ACT);
- aT[TIMED_WAIT][FIN_RX] = SA (TIMED_WAIT, NO_ACT);
- aT[TIMED_WAIT][FIN_ACK_RX] = SA (TIMED_WAIT, NO_ACT);
- aT[TIMED_WAIT][RST_RX] = SA (TIMED_WAIT, NO_ACT);
- aT[TIMED_WAIT][BAD_FLAGS] = SA (TIMED_WAIT, NO_ACT);
-
- // Create the flags lookup table
- eV[ 0x00] = SEQ_RECV; // No flags
- eV[ 0x01] = FIN_RX; // Fin
- eV[ 0x02] = SYN_RX; // Syn
- eV[ 0x03] = BAD_FLAGS; // Illegal
- eV[ 0x04] = RST_RX; // Rst
- eV[ 0x05] = BAD_FLAGS; // Illegal
- eV[ 0x06] = BAD_FLAGS; // Illegal
- eV[ 0x07] = BAD_FLAGS; // Illegal
- eV[ 0x08] = SEQ_RECV; // Psh flag is not used
- eV[ 0x09] = FIN_RX; // Fin
- eV[ 0x0a] = SYN_RX; // Syn
- eV[ 0x0b] = BAD_FLAGS; // Illegal
- eV[ 0x0c] = RST_RX; // Rst
- eV[ 0x0d] = BAD_FLAGS; // Illegal
- eV[ 0x0e] = BAD_FLAGS; // Illegal
- eV[ 0x0f] = BAD_FLAGS; // Illegal
- eV[ 0x10] = ACK_RX; // Ack
- eV[ 0x11] = FIN_ACK_RX;// Fin/Ack
- eV[ 0x12] = SYN_ACK_RX;// Syn/Ack
- eV[ 0x13] = BAD_FLAGS; // Illegal
- eV[ 0x14] = RST_RX; // Rst
- eV[ 0x15] = BAD_FLAGS; // Illegal
- eV[ 0x16] = BAD_FLAGS; // Illegal
- eV[ 0x17] = BAD_FLAGS; // Illegal
- eV[ 0x18] = ACK_RX; // Ack
- eV[ 0x19] = FIN_ACK_RX;// Fin/Ack
- eV[ 0x1a] = SYN_ACK_RX;// Syn/Ack
- eV[ 0x1b] = BAD_FLAGS; // Illegal
- eV[ 0x1c] = RST_RX; // Rst
- eV[ 0x1d] = BAD_FLAGS; // Illegal
- eV[ 0x1e] = BAD_FLAGS; // Illegal
- eV[ 0x1f] = BAD_FLAGS; // Illegal
- eV[ 0x20] = SEQ_RECV; // No flags (Urgent not presently used)
- eV[ 0x21] = FIN_RX; // Fin
- eV[ 0x22] = SYN_RX; // Syn
- eV[ 0x23] = BAD_FLAGS; // Illegal
- eV[ 0x24] = RST_RX; // Rst
- eV[ 0x25] = BAD_FLAGS; // Illegal
- eV[ 0x26] = BAD_FLAGS; // Illegal
- eV[ 0x27] = BAD_FLAGS; // Illegal
- eV[ 0x28] = SEQ_RECV; // Psh flag is not used
- eV[ 0x29] = FIN_RX; // Fin
- eV[ 0x2a] = SYN_RX; // Syn
- eV[ 0x2b] = BAD_FLAGS; // Illegal
- eV[ 0x2c] = RST_RX; // Rst
- eV[ 0x2d] = BAD_FLAGS; // Illegal
- eV[ 0x2e] = BAD_FLAGS; // Illegal
- eV[ 0x2f] = BAD_FLAGS; // Illegal
- eV[ 0x30] = ACK_RX; // Ack (Urgent not used)
- eV[ 0x31] = FIN_ACK_RX;// Fin/Ack
- eV[ 0x32] = SYN_ACK_RX;// Syn/Ack
- eV[ 0x33] = BAD_FLAGS; // Illegal
- eV[ 0x34] = RST_RX; // Rst
- eV[ 0x35] = BAD_FLAGS; // Illegal
- eV[ 0x36] = BAD_FLAGS; // Illegal
- eV[ 0x37] = BAD_FLAGS; // Illegal
- eV[ 0x38] = ACK_RX; // Ack
- eV[ 0x39] = FIN_ACK_RX;// Fin/Ack
- eV[ 0x3a] = SYN_ACK_RX;// Syn/Ack
- eV[ 0x3b] = BAD_FLAGS; // Illegal
- eV[ 0x3c] = RST_RX; // Rst
- eV[ 0x3d] = BAD_FLAGS; // Illegal
- eV[ 0x3e] = BAD_FLAGS; // Illegal
- eV[ 0x3f] = BAD_FLAGS; // Illegal
-}
-
-SA TcpStateMachine::Lookup (States_t s, Events_t e)
-{
- NS_LOG_FUNCTION (this << s << e);
- return aT[s][e];
-}
-
-Events_t TcpStateMachine::FlagsEvent (uint8_t f)
-{
- NS_LOG_FUNCTION (this << f);
- // Lookup event from flags
- if (f >= MAX_FLAGS) return BAD_FLAGS;
- return eV[f]; // Look up flags event
-}
-
-static TcpStateMachine tcpStateMachine; //only instance of a TcpStateMachine
-
//TcpL4Protocol stuff----------------------------------------------------------
#undef NS_LOG_APPEND_CONTEXT
@@ -321,29 +57,26 @@
/* see http://www.iana.org/assignments/protocol-numbers */
const uint8_t TcpL4Protocol::PROT_NUMBER = 6;
-ObjectFactory
-TcpL4Protocol::GetDefaultRttEstimatorFactory (void)
-{
- ObjectFactory factory;
- factory.SetTypeId (RttMeanDeviation::GetTypeId ());
- return factory;
-}
-
TypeId
TcpL4Protocol::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::TcpL4Protocol")
.SetParent<Ipv4L4Protocol> ()
.AddConstructor<TcpL4Protocol> ()
- .AddAttribute ("RttEstimatorFactory",
- "How RttEstimator objects are created.",
- ObjectFactoryValue (GetDefaultRttEstimatorFactory ()),
- MakeObjectFactoryAccessor (&TcpL4Protocol::m_rttFactory),
- MakeObjectFactoryChecker ())
+ .AddAttribute ("RttEstimatorType",
+ "Type of RttEstimator objects.",
+ TypeIdValue (RttMeanDeviation::GetTypeId()),
+ MakeTypeIdAccessor (&TcpL4Protocol::m_rttTypeId),
+ MakeTypeIdChecker ())
+ .AddAttribute ("SocketType",
+ "Socket type of TCP objects.",
+ TypeIdValue (TcpNewReno::GetTypeId()),
+ MakeTypeIdAccessor (&TcpL4Protocol::m_socketTypeId),
+ MakeTypeIdChecker ())
.AddAttribute ("SocketList", "The list of sockets associated to this protocol.",
ObjectVectorValue (),
MakeObjectVectorAccessor (&TcpL4Protocol::m_sockets),
- MakeObjectVectorChecker<TcpSocketImpl> ())
+ MakeObjectVectorChecker<TcpSocketBase> ())
;
return tid;
}
@@ -403,7 +136,7 @@
TcpL4Protocol::DoDispose (void)
{
NS_LOG_FUNCTION_NOARGS ();
- for (std::vector<Ptr<TcpSocketImpl> >::iterator i = m_sockets.begin (); i != m_sockets.end (); i++)
+ for (std::vector<Ptr<TcpSocketBase> >::iterator i = m_sockets.begin (); i != m_sockets.end (); i++)
{
*i = 0;
}
@@ -420,11 +153,15 @@
}
Ptr<Socket>
-TcpL4Protocol::CreateSocket (void)
+TcpL4Protocol::CreateSocket (TypeId socketTypeId)
{
NS_LOG_FUNCTION_NOARGS ();
- Ptr<RttEstimator> rtt = m_rttFactory.Create<RttEstimator> ();
- Ptr<TcpSocketImpl> socket = CreateObject<TcpSocketImpl> ();
+ ObjectFactory rttFactory;
+ ObjectFactory socketFactory;
+ rttFactory.SetTypeId(m_rttTypeId);
+ socketFactory.SetTypeId(socketTypeId);
+ Ptr<RttEstimator> rtt = rttFactory.Create<RttEstimator> ();
+ Ptr<TcpSocketBase> socket = socketFactory.Create<TcpSocketBase> ();
socket->SetNode (m_node);
socket->SetTcp (this);
socket->SetRtt (rtt);
@@ -432,6 +169,12 @@
return socket;
}
+Ptr<Socket>
+TcpL4Protocol::CreateSocket (void)
+{
+ return CreateSocket (m_socketTypeId);
+}
+
Ipv4EndPoint *
TcpL4Protocol::Allocate (void)
{
--- a/src/internet-stack/tcp-l4-protocol.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/internet-stack/tcp-l4-protocol.h Tue Dec 21 17:46:35 2010 +0100
@@ -37,7 +37,7 @@
class TcpHeader;
class Ipv4EndPointDemux;
class Ipv4Interface;
-class TcpSocketImpl;
+class TcpSocketBase;
class Ipv4EndPoint;
/**
@@ -69,6 +69,7 @@
* of the TCP protocol
*/
Ptr<Socket> CreateSocket (void);
+ Ptr<Socket> CreateSocket (TypeId socketTypeId);
Ipv4EndPoint *Allocate (void);
Ipv4EndPoint *Allocate (Ipv4Address address);
@@ -115,16 +116,16 @@
private:
Ptr<Node> m_node;
Ipv4EndPointDemux *m_endPoints;
- ObjectFactory m_rttFactory;
+ TypeId m_rttTypeId;
+ TypeId m_socketTypeId;
private:
- friend class TcpSocketImpl;
+ friend class TcpSocketBase;
void SendPacket (Ptr<Packet>, const TcpHeader &,
Ipv4Address, Ipv4Address, Ptr<NetDevice> oif = 0);
- static ObjectFactory GetDefaultRttEstimatorFactory (void);
TcpL4Protocol (const TcpL4Protocol &o);
TcpL4Protocol &operator = (const TcpL4Protocol &o);
- std::vector<Ptr<TcpSocketImpl> > m_sockets;
+ std::vector<Ptr<TcpSocketBase> > m_sockets;
};
}; // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/internet-stack/tcp-newreno.cc Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,236 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Adrian Sai-wah Tam
+ *
+ * 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: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
+ */
+
+#define NS_LOG_APPEND_CONTEXT \
+ if (m_node) { std::clog << Simulator::Now ().GetSeconds () << " [node " << m_node->GetId () << "] "; }
+
+#include "tcp-newreno.h"
+#include "ns3/log.h"
+#include "ns3/trace-source-accessor.h"
+#include "ns3/simulator.h"
+#include "ns3/abort.h"
+#include "ns3/node.h"
+
+NS_LOG_COMPONENT_DEFINE ("TcpNewReno");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (TcpNewReno);
+
+TypeId
+TcpNewReno::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::TcpNewReno")
+ .SetParent<TcpSocketBase> ()
+ .AddConstructor<TcpNewReno> ()
+ .AddTraceSource ("CongestionWindow",
+ "The TCP connection's congestion window",
+ MakeTraceSourceAccessor (&TcpNewReno::m_cWnd))
+ ;
+ return tid;
+}
+
+TcpNewReno::TcpNewReno (void) : m_inFastRec (false)
+{
+ NS_LOG_FUNCTION (this);
+}
+
+TcpNewReno::TcpNewReno (const TcpNewReno& sock)
+ : TcpSocketBase (sock),
+ m_cWnd (sock.m_cWnd),
+ m_ssThresh (sock.m_ssThresh),
+ m_initialCWnd (sock.m_initialCWnd),
+ m_inFastRec (false)
+{
+ NS_LOG_FUNCTION (this);
+ NS_LOG_LOGIC ("Invoked the copy constructor");
+}
+
+TcpNewReno::~TcpNewReno (void)
+{
+}
+
+/** We initialize m_cWnd from this function, after attributes initialized */
+int
+TcpNewReno::Listen (void)
+{
+ NS_LOG_FUNCTION (this);
+ InitializeCwnd ();
+ return TcpSocketBase::Listen ();
+}
+
+/** We initialize m_cWnd from this function, after attributes initialized */
+int
+TcpNewReno::Connect (const Address & address)
+{
+ NS_LOG_FUNCTION (this << address);
+ InitializeCwnd ();
+ return TcpSocketBase::Connect (address);
+}
+
+/** Limit the size of in-flight data by cwnd and receiver's rxwin */
+uint32_t
+TcpNewReno::Window (void)
+{
+ NS_LOG_FUNCTION (this);
+ return std::min (m_rWnd.Get (), m_cWnd.Get ());
+}
+
+Ptr<TcpSocketBase>
+TcpNewReno::Fork (void)
+{
+ return CopyObject<TcpNewReno> (this);
+}
+
+/** New ACK (up to seqnum seq) received. Increase cwnd and call TcpSocketBase::NewAck() */
+void
+TcpNewReno::NewAck (const SequenceNumber32& seq)
+{
+ NS_LOG_FUNCTION (this << seq);
+ NS_LOG_LOGIC ("TcpNewReno receieved ACK for seq " << seq <<
+ " cwnd " << m_cWnd <<
+ " ssthresh " << m_ssThresh);
+
+ // Check for exit condition of fast recovery
+ if (m_inFastRec && seq < m_recover)
+ { // Partial ACK, partial window deflation (RFC2582 sec.3 bullet #5 paragraph 3)
+ m_cWnd += m_segmentSize; // increase cwnd
+ NS_LOG_INFO ("Partial ACK in fast recovery: cwnd set to " << m_cWnd);
+ TcpSocketBase::NewAck(seq); // update m_nextTxSequence and send new data if allowed by window
+ DoRetransmit (); // Assume the next seq is lost. Retransmit lost packet
+ return;
+ }
+ else if (m_inFastRec && seq >= m_recover)
+ { // Full ACK (RFC2582 sec.3 bullet #5 paragraph 2, option 1)
+ m_cWnd = std::min (m_ssThresh, BytesInFlight () + m_segmentSize);
+ m_inFastRec = false;
+ NS_LOG_INFO ("Received full ACK. Leaving fast recovery with cwnd set to " << m_cWnd);
+ }
+
+ // Increase of cwnd based on current phase (slow start or congestion avoidance)
+ if (m_cWnd < m_ssThresh)
+ { // Slow start mode, add one segSize to cWnd. Default m_ssThresh is 65535. (RFC2001, sec.1)
+ m_cWnd += m_segmentSize;
+ NS_LOG_INFO ("In SlowStart, updated to cwnd " << m_cWnd << " ssthresh " << m_ssThresh);
+ }
+ else
+ { // Congestion avoidance mode, increase by (segSize*segSize)/cwnd. (RFC2581, sec.3.1)
+ // To increase cwnd for one segSize per RTT, it should be (ackBytes*segSize)/cwnd
+ double adder = static_cast<double> (m_segmentSize * m_segmentSize) / m_cWnd.Get ();
+ adder = std::max (1.0, adder);
+ m_cWnd += static_cast<uint32_t> (adder);
+ NS_LOG_INFO ("In CongAvoid, updated to cwnd " << m_cWnd << " ssthresh " << m_ssThresh);
+ }
+
+ // Complete newAck processing
+ TcpSocketBase::NewAck (seq);
+}
+
+/** Cut cwnd and enter fast recovery mode upon triple dupack */
+void
+TcpNewReno::DupAck (const TcpHeader& t, uint32_t count)
+{
+ if (count == 3 && ! m_inFastRec)
+ { // triple duplicate ack triggers fast retransmit (RFC2582 sec.3 bullet #1)
+ m_ssThresh = std::max (2 * m_segmentSize, BytesInFlight () / 2);
+ m_cWnd = m_ssThresh + 3 * m_segmentSize;
+ m_recover = m_highTxMark;
+ m_inFastRec = true;
+ NS_LOG_INFO ("Triple dupack. Enter fast recovery mode. Reset cwnd to " << m_cWnd <<
+ ", ssthresh to " << m_ssThresh << " at fast recovery seqnum " << m_recover);
+ DoRetransmit ();
+ }
+ else if (m_inFastRec)
+ { // Increase cwnd for every additional dupack (RFC2582, sec.3 bullet #3)
+ m_cWnd += m_segmentSize;
+ NS_LOG_INFO ("Dupack in fast recovery mode. Increase cwnd to " << m_cWnd);
+ SendPendingData (m_connected);
+ };
+}
+
+/** Retransmit timeout */
+void
+TcpNewReno::Retransmit (void)
+{
+ NS_LOG_FUNCTION (this);
+ NS_LOG_LOGIC (this << " ReTxTimeout Expired at time " << Simulator::Now ().GetSeconds ());
+ m_inFastRec = false;
+
+ // If erroneous timeout in closed/timed-wait state, just return
+ if (m_state == CLOSED || m_state == TIME_WAIT) return;
+ // If all data are received, just return
+ if (m_txBuffer.HeadSequence () >= m_nextTxSequence) return;
+
+ // According to RFC2581 sec.3.1, upon RTO, ssthresh is set to half of flight
+ // size and cwnd is set to 1*MSS, then the lost packet is retransmitted and
+ // TCP back to slow start
+ m_ssThresh = std::max (2 * m_segmentSize, BytesInFlight () / 2);
+ m_cWnd = m_segmentSize;
+ m_nextTxSequence = m_txBuffer.HeadSequence (); // Restart from highest Ack
+ NS_LOG_INFO ("RTO. Reset cwnd to " << m_cWnd <<
+ ", ssthresh to " << m_ssThresh << ", restart from seqnum " << m_nextTxSequence);
+ m_rtt->IncreaseMultiplier (); // Double the next RTO
+ DoRetransmit (); // Retransmit the packet
+}
+
+void
+TcpNewReno::SetSegSize (uint32_t size)
+{
+ NS_ABORT_MSG_UNLESS (m_state == CLOSED, "TcpNewReno::SetSegSize() cannot change segment size after connection started.");
+ m_segmentSize = size;
+}
+
+void
+TcpNewReno::SetSSThresh (uint32_t threshold)
+{
+ m_ssThresh = threshold;
+}
+
+uint32_t
+TcpNewReno::GetSSThresh (void) const
+{
+ return m_ssThresh;
+}
+
+void
+TcpNewReno::SetInitialCwnd (uint32_t cwnd)
+{
+ NS_ABORT_MSG_UNLESS (m_state == CLOSED, "TcpNewReno::SetInitialCwnd() cannot change initial cwnd after connection started.");
+ m_initialCWnd = cwnd;
+}
+
+uint32_t
+TcpNewReno::GetInitialCwnd (void) const
+{
+ return m_initialCWnd;
+}
+
+void
+TcpNewReno::InitializeCwnd (void)
+{
+ /*
+ * Initialize congestion window, default to 1 MSS (RFC2001, sec.1) and must
+ * not be larger than 2 MSS (RFC2581, sec.3.1). Both m_initiaCWnd and
+ * m_segmentSize are set by the attribute system in ns3::TcpSocket.
+ */
+ m_cWnd = m_initialCWnd * m_segmentSize;
+}
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/internet-stack/tcp-newreno.h Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Adrian Sai-wah Tam
+ *
+ * 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: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
+ */
+
+#ifndef TCP_NEWRENO_H
+#define TCP_NEWRENO_H
+
+#include "tcp-socket-base.h"
+
+namespace ns3 {
+
+/**
+ * \ingroup socket
+ * \ingroup tcp
+ *
+ * \brief An implementation of a stream socket using TCP.
+ *
+ * This class contains the NewReno implementation of TCP, as of RFC2582.
+ */
+class TcpNewReno : public TcpSocketBase
+{
+public:
+ static TypeId GetTypeId (void);
+ /**
+ * Create an unbound tcp socket.
+ */
+ TcpNewReno (void);
+ TcpNewReno (const TcpNewReno& sock);
+ virtual ~TcpNewReno (void);
+
+ // From TcpSocketBase
+ virtual int Connect (const Address &address);
+ virtual int Listen (void);
+
+protected:
+ virtual uint32_t Window (void); // Return the max possible number of unacked bytes
+ virtual Ptr<TcpSocketBase> Fork (void); // Call CopyObject<TcpNewReno> to clone me
+ virtual void NewAck (SequenceNumber32 const& seq); // Inc cwnd and call NewAck() of parent
+ virtual void DupAck (const TcpHeader& t, uint32_t count); // Halving cwnd and reset nextTxSequence
+ virtual void Retransmit (void); // Exit fast recovery upon retransmit timeout
+
+ // Implementing ns3::TcpSocket -- Attribute get/set
+ virtual void SetSegSize (uint32_t size);
+ virtual void SetSSThresh (uint32_t threshold);
+ virtual uint32_t GetSSThresh (void) const;
+ virtual void SetInitialCwnd (uint32_t cwnd);
+ virtual uint32_t GetInitialCwnd (void) const;
+private:
+ void InitializeCwnd (void); // set m_cWnd when connection starts
+
+protected:
+ TracedValue<uint32_t> m_cWnd; //< Congestion window
+ uint32_t m_ssThresh; //< Slow Start Threshold
+ uint32_t m_initialCWnd; //< Initial cWnd value
+ SequenceNumber32 m_recover; //< Previous highest Tx seqnum for fast recovery
+ bool m_inFastRec; //< currently in fast recovery
+};
+
+} // namespace ns3
+
+#endif /* TCP_NEWRENO_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/internet-stack/tcp-reno.cc Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,227 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Adrian Sai-wah Tam
+ *
+ * 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: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
+ */
+
+#define NS_LOG_APPEND_CONTEXT \
+ if (m_node) { std::clog << Simulator::Now ().GetSeconds () << " [node " << m_node->GetId () << "] "; }
+
+#include "tcp-reno.h"
+#include "ns3/log.h"
+#include "ns3/trace-source-accessor.h"
+#include "ns3/simulator.h"
+#include "ns3/abort.h"
+#include "ns3/node.h"
+
+NS_LOG_COMPONENT_DEFINE ("TcpReno");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (TcpReno);
+
+TypeId
+TcpReno::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::TcpReno")
+ .SetParent<TcpSocketBase> ()
+ .AddConstructor<TcpReno> ()
+ .AddTraceSource ("CongestionWindow",
+ "The TCP connection's congestion window",
+ MakeTraceSourceAccessor (&TcpReno::m_cWnd))
+ ;
+ return tid;
+}
+
+TcpReno::TcpReno (void) : m_inFastRec (false)
+{
+ NS_LOG_FUNCTION (this);
+}
+
+TcpReno::TcpReno (const TcpReno& sock)
+ : TcpSocketBase (sock),
+ m_cWnd (sock.m_cWnd),
+ m_ssThresh (sock.m_ssThresh),
+ m_initialCWnd (sock.m_initialCWnd),
+ m_inFastRec (false)
+{
+ NS_LOG_FUNCTION (this);
+ NS_LOG_LOGIC ("Invoked the copy constructor");
+}
+
+TcpReno::~TcpReno (void)
+{
+}
+
+/** We initialize m_cWnd from this function, after attributes initialized */
+int
+TcpReno::Listen (void)
+{
+ NS_LOG_FUNCTION (this);
+ InitializeCwnd ();
+ return TcpSocketBase::Listen ();
+}
+
+/** We initialize m_cWnd from this function, after attributes initialized */
+int
+TcpReno::Connect (const Address & address)
+{
+ NS_LOG_FUNCTION (this << address);
+ InitializeCwnd ();
+ return TcpSocketBase::Connect (address);
+}
+
+/** Limit the size of in-flight data by cwnd and receiver's rxwin */
+uint32_t
+TcpReno::Window (void)
+{
+ NS_LOG_FUNCTION (this);
+ return std::min (m_rWnd.Get (), m_cWnd.Get ());
+}
+
+Ptr<TcpSocketBase>
+TcpReno::Fork (void)
+{
+ return CopyObject<TcpReno> (this);
+}
+
+/** New ACK (up to seqnum seq) received. Increase cwnd and call TcpSocketBase::NewAck() */
+void
+TcpReno::NewAck (const SequenceNumber32& seq)
+{
+ NS_LOG_FUNCTION (this << seq);
+ NS_LOG_LOGIC ("TcpReno receieved ACK for seq " << seq <<
+ " cwnd " << m_cWnd <<
+ " ssthresh " << m_ssThresh);
+
+ // Check for exit condition of fast recovery
+ if (m_inFastRec)
+ { // RFC2001, sec.4; RFC2581, sec.3.2
+ // First new ACK after fast recovery: reset cwnd
+ m_cWnd = m_ssThresh;
+ m_inFastRec = false;
+ NS_LOG_INFO ("Reset cwnd to " << m_cWnd);
+ };
+
+ // Increase of cwnd based on current phase (slow start or congestion avoidance)
+ if (m_cWnd < m_ssThresh)
+ { // Slow start mode, add one segSize to cWnd. Default m_ssThresh is 65535. (RFC2001, sec.1)
+ m_cWnd += m_segmentSize;
+ NS_LOG_INFO ("In SlowStart, updated to cwnd " << m_cWnd << " ssthresh " << m_ssThresh);
+ }
+ else
+ { // Congestion avoidance mode, increase by (segSize*segSize)/cwnd. (RFC2581, sec.3.1)
+ // To increase cwnd for one segSize per RTT, it should be (ackBytes*segSize)/cwnd
+ double adder = static_cast<double> (m_segmentSize * m_segmentSize) / m_cWnd.Get ();
+ adder = std::max (1.0, adder);
+ m_cWnd += static_cast<uint32_t> (adder);
+ NS_LOG_INFO ("In CongAvoid, updated to cwnd " << m_cWnd << " ssthresh " << m_ssThresh);
+ }
+
+ // Complete newAck processing
+ TcpSocketBase::NewAck (seq);
+}
+
+// Fast recovery and fast retransmit
+void
+TcpReno::DupAck (const TcpHeader& t, uint32_t count)
+{
+ NS_LOG_FUNCTION (this << "t " << count);
+ if (count == 3 && ! m_inFastRec)
+ { // triple duplicate ack triggers fast retransmit (RFC2581, sec.3.2)
+ m_ssThresh = std::max (2 * m_segmentSize, BytesInFlight () / 2);
+ m_cWnd = m_ssThresh + 3 * m_segmentSize;
+ m_inFastRec = true;
+ NS_LOG_INFO ("Triple dupack. Reset cwnd to " << m_cWnd << ", ssthresh to " << m_ssThresh);
+ DoRetransmit ();
+ }
+ else if (m_inFastRec)
+ { // In fast recovery, inc cwnd for every additional dupack (RFC2581, sec.3.2)
+ m_cWnd += m_segmentSize;
+ NS_LOG_INFO ("Increased cwnd to " << m_cWnd);
+ SendPendingData (m_connected);
+ };
+}
+
+// Retransmit timeout
+void TcpReno::Retransmit (void)
+{
+ NS_LOG_FUNCTION (this);
+ NS_LOG_LOGIC (this << " ReTxTimeout Expired at time " << Simulator::Now ().GetSeconds ());
+ m_inFastRec = false;
+
+ // If erroneous timeout in closed/timed-wait state, just return
+ if (m_state == CLOSED || m_state == TIME_WAIT) return;
+ // If all data are received, just return
+ if (m_txBuffer.HeadSequence () >= m_nextTxSequence) return;
+
+ // According to RFC2581 sec.3.1, upon RTO, ssthresh is set to half of flight
+ // size and cwnd is set to 1*MSS, then the lost packet is retransmitted and
+ // TCP back to slow start
+ m_ssThresh = std::max (2 * m_segmentSize, BytesInFlight () / 2);
+ m_cWnd = m_segmentSize;
+ m_nextTxSequence = m_txBuffer.HeadSequence (); // Restart from highest Ack
+ NS_LOG_INFO ("RTO. Reset cwnd to " << m_cWnd <<
+ ", ssthresh to " << m_ssThresh << ", restart from seqnum " << m_nextTxSequence);
+ m_rtt->IncreaseMultiplier (); // Double the next RTO
+ DoRetransmit (); // Retransmit the packet
+}
+
+void
+TcpReno::SetSegSize (uint32_t size)
+{
+ NS_ABORT_MSG_UNLESS (m_state == CLOSED, "TcpReno::SetSegSize() cannot change segment size after connection started.");
+ m_segmentSize = size;
+}
+
+void
+TcpReno::SetSSThresh (uint32_t threshold)
+{
+ m_ssThresh = threshold;
+}
+
+uint32_t
+TcpReno::GetSSThresh (void) const
+{
+ return m_ssThresh;
+}
+
+void
+TcpReno::SetInitialCwnd (uint32_t cwnd)
+{
+ NS_ABORT_MSG_UNLESS (m_state == CLOSED, "TcpReno::SetInitialCwnd() cannot change initial cwnd after connection started.");
+ m_initialCWnd = cwnd;
+}
+
+uint32_t
+TcpReno::GetInitialCwnd (void) const
+{
+ return m_initialCWnd;
+}
+
+void
+TcpReno::InitializeCwnd (void)
+{
+ /*
+ * Initialize congestion window, default to 1 MSS (RFC2001, sec.1) and must
+ * not be larger than 2 MSS (RFC2581, sec.3.1). Both m_initiaCWnd and
+ * m_segmentSize are set by the attribute system in ns3::TcpSocket.
+ */
+ m_cWnd = m_initialCWnd * m_segmentSize;
+}
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/internet-stack/tcp-reno.h Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Adrian Sai-wah Tam
+ *
+ * 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: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
+ */
+
+#ifndef TCP_RENO_H
+#define TCP_RENO_H
+
+#include "tcp-socket-base.h"
+
+namespace ns3 {
+
+/**
+ * \ingroup socket
+ * \ingroup tcp
+ *
+ * \brief An implementation of a stream socket using TCP.
+ *
+ * This class contains the Reno implementation of TCP, according to RFC2581,
+ * except sec.4.1 "re-starting idle connections", which we do not detect for
+ * idleness and thus no slow start upon resumption.
+ */
+class TcpReno : public TcpSocketBase
+{
+public:
+ static TypeId GetTypeId (void);
+ /**
+ * Create an unbound tcp socket.
+ */
+ TcpReno (void);
+ TcpReno (const TcpReno& sock);
+ virtual ~TcpReno (void);
+
+ // From TcpSocketBase
+ virtual int Connect (const Address &address);
+ virtual int Listen (void);
+
+protected:
+ virtual uint32_t Window (void); // Return the max possible number of unacked bytes
+ virtual Ptr<TcpSocketBase> Fork (void); // Call CopyObject<TcpReno> to clone me
+ virtual void NewAck (const SequenceNumber32& seq); // Inc cwnd and call NewAck() of parent
+ virtual void DupAck (const TcpHeader& t, uint32_t count); // Fast retransmit
+ virtual void Retransmit (void); // Retransmit timeout
+
+ // Implementing ns3::TcpSocket -- Attribute get/set
+ virtual void SetSegSize (uint32_t size);
+ virtual void SetSSThresh (uint32_t threshold);
+ virtual uint32_t GetSSThresh (void) const;
+ virtual void SetInitialCwnd (uint32_t cwnd);
+ virtual uint32_t GetInitialCwnd (void) const;
+private:
+ void InitializeCwnd (void); // set m_cWnd when connection starts
+
+protected:
+ TracedValue<uint32_t> m_cWnd; //< Congestion window
+ uint32_t m_ssThresh; //< Slow Start Threshold
+ uint32_t m_initialCWnd; //< Initial cWnd value
+ bool m_inFastRec; //< currently in fast recovery
+};
+
+} // namespace ns3
+
+#endif /* TCP_RENO_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/internet-stack/tcp-rfc793.cc Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Adrian Sai-wah Tam
+ *
+ * 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: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
+ */
+
+#include "tcp-rfc793.h"
+#include "ns3/log.h"
+
+NS_LOG_COMPONENT_DEFINE ("TcpRfc793");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (TcpRfc793);
+
+TypeId
+TcpRfc793::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::TcpRfc793")
+ .SetParent<TcpSocketBase> ()
+ .AddConstructor<TcpRfc793> ()
+ ;
+ return tid;
+}
+
+TcpRfc793::TcpRfc793 (void)
+{
+ NS_LOG_FUNCTION (this);
+ SetDelAckMaxCount(0); // Delayed ACK is not in RFC793
+}
+
+TcpRfc793::TcpRfc793 (const TcpRfc793& sock) : TcpSocketBase (sock)
+{
+}
+
+TcpRfc793::~TcpRfc793 (void)
+{
+}
+
+Ptr<TcpSocketBase>
+TcpRfc793::Fork (void)
+{
+ return CopyObject<TcpRfc793> (this);
+}
+
+void
+TcpRfc793::DupAck (const TcpHeader& t, uint32_t count)
+{
+}
+
+void
+TcpRfc793::SetSSThresh (uint32_t threshold)
+{
+ NS_LOG_WARN ("DoD TCP does not perform slow start");
+}
+
+uint32_t
+TcpRfc793::GetSSThresh (void) const
+{
+ NS_LOG_WARN ("DoD TCP does not perform slow start");
+ return 0;
+}
+
+void
+TcpRfc793::SetInitialCwnd (uint32_t cwnd)
+{
+ NS_LOG_WARN ("DoD TCP does not have congestion window");
+}
+
+uint32_t
+TcpRfc793::GetInitialCwnd (void) const
+{
+ NS_LOG_WARN ("DoD TCP does not have congestion window");
+ return 0;
+}
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/internet-stack/tcp-rfc793.h Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Adrian Sai-wah Tam
+ *
+ * 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: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
+ */
+
+#ifndef TCP_RFC793_H
+#define TCP_RFC793_H
+
+#include "tcp-socket-base.h"
+
+namespace ns3 {
+
+/**
+ * \ingroup socket
+ * \ingroup tcp
+ *
+ * \brief An implementation of a stream socket using TCP.
+ *
+ * This class contains an RFC793 implementation of TCP, as well as a sockets
+ * interface for talking to TCP. This serves as a base for other TCP functions
+ * where the sliding window mechanism is handled here. This class provides
+ * connection orientation and sliding window flow control.
+ */
+class TcpRfc793 : public TcpSocketBase
+{
+public:
+ static TypeId GetTypeId (void);
+ /**
+ * Create an unbound tcp socket.
+ */
+ TcpRfc793 (void);
+ TcpRfc793 (const TcpRfc793& sock);
+ virtual ~TcpRfc793 (void);
+
+protected:
+ virtual Ptr<TcpSocketBase> Fork (); // Call CopyObject<TcpRfc793> to clone me
+ virtual void DupAck (const TcpHeader& t, uint32_t count);
+ virtual void SetSSThresh (uint32_t threshold);
+ virtual uint32_t GetSSThresh (void) const;
+ virtual void SetInitialCwnd (uint32_t cwnd);
+ virtual uint32_t GetInitialCwnd (void) const;
+};
+
+} // namespace ns3
+
+#endif /* TCP_RFC793_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/internet-stack/tcp-rx-buffer.cc Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,264 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Adrian Sai-wah Tam
+ *
+ * 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: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
+ */
+
+#include "ns3/packet.h"
+#include "ns3/fatal-error.h"
+#include "ns3/log.h"
+#include "tcp-rx-buffer.h"
+
+NS_LOG_COMPONENT_DEFINE ("TcpRxBuffer");
+
+namespace ns3 {
+
+TypeId
+TcpRxBuffer::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::TcpRxBuffer")
+ .SetParent<Object> ()
+ .AddConstructor<TcpRxBuffer> ()
+ .AddTraceSource ("NextRxSequence",
+ "Next sequence number expected (RCV.NXT)",
+ MakeTraceSourceAccessor (&TcpRxBuffer::m_nextRxSeq))
+ ;
+ return tid;
+}
+
+/* A user is supposed to create a TcpSocket through a factory. In TcpSocket,
+ * there are attributes SndBufSize and RcvBufSize to control the default Tx and
+ * Rx window sizes respectively, with default of 128 KiByte. The attribute
+ * RcvBufSize is passed to TcpRxBuffer by TcpSocketBase::SetRcvBufSize() and in
+ * turn, TcpRxBuffer:SetMaxBufferSize(). Therefore, the m_maxBuffer value
+ * initialized below is insignificant.
+ */
+TcpRxBuffer::TcpRxBuffer (uint32_t n)
+ : m_nextRxSeq(n), m_gotFin(false), m_size(0), m_maxBuffer(32768), m_availBytes(0)
+{
+}
+
+TcpRxBuffer::~TcpRxBuffer ()
+{
+}
+
+SequenceNumber32
+TcpRxBuffer::NextRxSequence (void) const
+{
+ return m_nextRxSeq;
+}
+
+void
+TcpRxBuffer::SetNextRxSequence (const SequenceNumber32& s)
+{
+ m_nextRxSeq = s;
+}
+
+uint32_t
+TcpRxBuffer::MaxBufferSize (void) const
+{
+ return m_maxBuffer;
+}
+
+void
+TcpRxBuffer::SetMaxBufferSize (uint32_t s)
+{
+ m_maxBuffer = s;
+}
+
+uint32_t
+TcpRxBuffer::Size (void) const
+{
+ return m_size;
+}
+
+uint32_t
+TcpRxBuffer::Available () const
+{
+ return m_availBytes;
+}
+
+void
+TcpRxBuffer::IncNextRxSequence ()
+{
+ NS_LOG_FUNCTION (this);
+ // Increment nextRxSeq is valid only if we don't have any data buffered,
+ // this is supposed to be called only during the three-way handshake
+ NS_ASSERT (m_size == 0);
+ m_nextRxSeq++;
+}
+
+// Return the highest sequence number that this TcpRxBuffer can accept
+SequenceNumber32
+TcpRxBuffer::MaxRxSequence (void) const
+{
+ if (m_gotFin)
+ { // No data allowed beyond FIN
+ return m_finSeq;
+ }
+ else if (m_data.size ())
+ { // No data allowed beyond Rx window allowed
+ return m_data.begin()->first + SequenceNumber32 (m_maxBuffer);
+ }
+ return m_nextRxSeq + SequenceNumber32 (m_maxBuffer);
+}
+
+void
+TcpRxBuffer::SetFinSequence (const SequenceNumber32& s)
+{
+ NS_LOG_FUNCTION (this);
+
+ m_gotFin = true;
+ m_finSeq = s;
+ if (m_nextRxSeq == m_finSeq) ++m_nextRxSeq;
+}
+
+bool
+TcpRxBuffer::Finished (void)
+{
+ return (m_gotFin && m_finSeq < m_nextRxSeq);
+}
+
+bool
+TcpRxBuffer::Add (Ptr<Packet> p, TcpHeader const& tcph)
+{
+ NS_LOG_FUNCTION (this << p << tcph);
+
+ uint32_t pktSize = p->GetSize ();
+ SequenceNumber32 headSeq = tcph.GetSequenceNumber ();
+ SequenceNumber32 tailSeq = headSeq + SequenceNumber32 (pktSize);
+ NS_LOG_LOGIC ("Add pkt " << p << " len=" << pktSize << " seq=" << headSeq
+ << ", when NextRxSeq=" << m_nextRxSeq << ", buffsize=" << m_size);
+
+ // Trim packet to fit Rx window specification
+ if (headSeq < m_nextRxSeq) headSeq = m_nextRxSeq;
+ if (m_data.size ())
+ {
+ SequenceNumber32 maxSeq = m_data.begin ()->first + SequenceNumber32 (m_maxBuffer);
+ if (maxSeq < tailSeq) tailSeq = maxSeq;
+ if (tailSeq < headSeq) headSeq = tailSeq;
+ }
+ // Remove overlapped bytes from packet
+ BufIterator i = m_data.begin ();
+ while (i != m_data.end () && i->first <= tailSeq)
+ {
+ SequenceNumber32 lastByteSeq = i->first + SequenceNumber32 (i->second->GetSize ());
+ if (lastByteSeq > headSeq)
+ {
+ if (i->first > headSeq && lastByteSeq < tailSeq)
+ { // Rare case: Existing packet is embedded fully in the new packet
+ m_size -= i->second->GetSize();
+ m_data.erase (i++);
+ continue;
+ }
+ if (i->first <= headSeq)
+ { // Incoming head is overlapped
+ headSeq = lastByteSeq;
+ }
+ if (lastByteSeq >= tailSeq)
+ { // Incoming tail is overlapped
+ tailSeq = i->first;
+ }
+ }
+ ++i;
+ }
+ // We now know how much we are going to store, trim the packet
+ if (headSeq >= tailSeq)
+ {
+ NS_LOG_LOGIC ("Nothing to buffer");
+ return false; // Nothing to buffer anyway
+ }
+ else
+ {
+ uint32_t start = headSeq - tcph.GetSequenceNumber ();
+ uint32_t length = tailSeq - headSeq;
+ p = p->CreateFragment (start, length);
+ NS_ASSERT (length == p->GetSize ());
+ }
+ // Insert packet into buffer
+ NS_ASSERT (m_data.find (headSeq) == m_data.end ()); // Shouldn't be there yet
+ m_data [ headSeq ] = p;
+ NS_LOG_LOGIC ("Buffered packet of seqno=" << headSeq << " len=" << p->GetSize ());
+ // Update variables
+ m_size += p->GetSize (); // Occupancy
+ for (BufIterator i = m_data.begin (); i != m_data.end (); ++i)
+ {
+ if (i->first < m_nextRxSeq)
+ {
+ continue;
+ }
+ else if (i->first > m_nextRxSeq)
+ {
+ break;
+ };
+ m_nextRxSeq = i->first + SequenceNumber32 (i->second->GetSize ());
+ m_availBytes += i->second->GetSize ();
+ }
+ NS_LOG_LOGIC ("Updated buffer occupancy=" << m_size << " nextRxSeq=" << m_nextRxSeq);
+ if (m_gotFin && m_nextRxSeq == m_finSeq)
+ { // Account for the FIN packet
+ ++m_nextRxSeq;
+ };
+ return true;
+}
+
+Ptr<Packet>
+TcpRxBuffer::Extract (uint32_t maxSize)
+{
+ NS_LOG_FUNCTION (this << maxSize);
+
+ uint32_t extractSize = std::min (maxSize, m_availBytes);
+ NS_LOG_LOGIC ("Requested to extract " << extractSize << " bytes from TcpRxBuffer of size=" << m_size);
+ if (extractSize == 0) return 0; // No contiguous block to return
+ NS_ASSERT (m_data.size ()); // At least we have something to extract
+ Ptr<Packet> outPkt = Create<Packet> (); // The packet that contains all the data to return
+ BufIterator i;
+ while (extractSize)
+ { // Check the buffered data for delivery
+ i = m_data.begin ();
+ NS_ASSERT (i->first <= m_nextRxSeq); // in-sequence data expected
+ // Check if we send the whole pkt or just a partial
+ uint32_t pktSize = i->second->GetSize ();
+ if (pktSize <= extractSize)
+ { // Whole packet is extracted
+ outPkt->AddAtEnd (i->second);
+ m_data.erase (i);
+ m_size -= pktSize;
+ m_availBytes -= pktSize;
+ extractSize -= pktSize;
+ }
+ else
+ { // Partial is extracted and done
+ outPkt->AddAtEnd (i->second->CreateFragment (0, extractSize));
+ m_data[i->first + SequenceNumber32 (extractSize)] = i->second->CreateFragment (extractSize, pktSize - extractSize);
+ m_data.erase (i);
+ m_size -= extractSize;
+ m_availBytes -= extractSize;
+ extractSize = 0;
+ }
+ }
+ if (outPkt->GetSize () == 0)
+ {
+ NS_LOG_LOGIC ("Nothing extracted.");
+ return 0;
+ }
+ NS_LOG_LOGIC ("Extracted " << outPkt->GetSize( ) << " bytes, bufsize=" << m_size
+ << ", num pkts in buffer=" << m_data.size ());
+ return outPkt;
+}
+
+} //namepsace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/internet-stack/tcp-rx-buffer.h Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,89 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Adrian Sai-wah Tam
+ *
+ * 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: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
+ */
+
+#ifndef __TCP_RX_BUFFER_H__
+#define __TCP_RX_BUFFER_H__
+
+#include <map>
+#include "ns3/traced-value.h"
+#include "ns3/trace-source-accessor.h"
+#include "ns3/sequence-number.h"
+#include "ns3/ptr.h"
+#include "ns3/tcp-header.h"
+
+namespace ns3 {
+class Packet;
+
+/**
+ * \ingroup tcp
+ *
+ * \brief class for the reordering buffer that keeps the data from lower layer, i.e.
+ * TcpL4Protocol, sent to the application
+ */
+class TcpRxBuffer : public Object
+{
+public:
+ static TypeId GetTypeId (void);
+ TcpRxBuffer (uint32_t n = 0);
+ virtual ~TcpRxBuffer ();
+
+ // Accessors
+ SequenceNumber32 NextRxSequence (void) const;
+ SequenceNumber32 MaxRxSequence (void) const;
+ void IncNextRxSequence (void);
+ void SetNextRxSequence (const SequenceNumber32& s);
+ void SetFinSequence (const SequenceNumber32& s);
+ uint32_t MaxBufferSize (void) const;
+ void SetMaxBufferSize (uint32_t s);
+ uint32_t Size (void) const;
+ uint32_t Available () const;
+ bool Finished (void);
+
+ /**
+ * Insert a packet into the buffer and update the availBytes counter to
+ * reflect the number of bytes ready to send to the application. This
+ * function handles overlap by triming the head of the inputted packet and
+ * removing data from the buffer that overlaps the tail of the inputted
+ * packet
+ *
+ * \return True when success, false otherwise.
+ */
+ bool Add (Ptr<Packet> p, TcpHeader const& tcph);
+
+ /**
+ * Extract data from the head of the buffer as indicated by nextRxSeq.
+ * The extracted data is going to be forwarded to the application.
+ */
+ Ptr<Packet> Extract (uint32_t maxSize);
+public:
+ typedef std::map<SequenceNumber32, Ptr<Packet> >::iterator BufIterator;
+ TracedValue<SequenceNumber32> m_nextRxSeq; //< Seqnum of the first missing byte in data (RCV.NXT)
+ SequenceNumber32 m_finSeq; //< Seqnum of the FIN packet
+ bool m_gotFin; //< Did I received FIN packet?
+ uint32_t m_size; //< Number of total data bytes in the buffer, not necessarily contiguous
+ uint32_t m_maxBuffer; //< Upper bound of the number of data bytes in buffer (RCV.WND)
+ uint32_t m_availBytes; //< Number of bytes available to read, i.e. contiguous block at head
+ std::map<SequenceNumber32, Ptr<Packet> > m_data;
+ //< Corresponding data (may be null)
+};
+
+}//namepsace ns3
+
+#endif /* __TCP_RX_BUFFER_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/internet-stack/tcp-socket-base.cc Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,1755 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Adrian Sai-wah Tam
+ *
+ * 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: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
+ */
+
+#define NS_LOG_APPEND_CONTEXT \
+ if (m_node) { std::clog << Simulator::Now ().GetSeconds () << " [node " << m_node->GetId () << "] "; }
+
+#include "ns3/abort.h"
+#include "ns3/node.h"
+#include "ns3/inet-socket-address.h"
+#include "ns3/log.h"
+#include "ns3/ipv4.h"
+#include "ns3/ipv4-interface-address.h"
+#include "ns3/ipv4-route.h"
+#include "ns3/ipv4-routing-protocol.h"
+#include "ns3/simulation-singleton.h"
+#include "ns3/simulator.h"
+#include "ns3/packet.h"
+#include "ns3/uinteger.h"
+#include "ns3/trace-source-accessor.h"
+#include "tcp-socket-base.h"
+#include "tcp-l4-protocol.h"
+#include "ipv4-end-point.h"
+#include "tcp-header.h"
+#include "rtt-estimator.h"
+
+#include <algorithm>
+
+NS_LOG_COMPONENT_DEFINE ("TcpSocketBase");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (TcpSocketBase);
+
+TypeId
+TcpSocketBase::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::TcpSocketBase")
+ .SetParent<TcpSocket> ()
+// .AddAttribute ("TcpState", "State in TCP state machine",
+// TypeId::ATTR_GET,
+// EnumValue (CLOSED),
+// MakeEnumAccessor (&TcpSocketBase::m_state),
+// MakeEnumChecker (CLOSED, "Closed"))
+ .AddTraceSource ("RTO",
+ "Retransmission timeout",
+ MakeTraceSourceAccessor (&TcpSocketBase::m_rto))
+ .AddTraceSource ("RTT",
+ "Last RTT sample",
+ MakeTraceSourceAccessor (&TcpSocketBase::m_lastRtt))
+ .AddTraceSource ("NextTxSequence",
+ "Next sequence number to send (SND.NXT)",
+ MakeTraceSourceAccessor (&TcpSocketBase::m_nextTxSequence))
+ .AddTraceSource ("HighestSequence",
+ "Highest sequence number ever sent in socket's life time",
+ MakeTraceSourceAccessor (&TcpSocketBase::m_highTxMark))
+ .AddTraceSource ("State",
+ "TCP state",
+ MakeTraceSourceAccessor (&TcpSocketBase::m_state))
+ .AddTraceSource ("RWND",
+ "Remote side's flow control window",
+ MakeTraceSourceAccessor (&TcpSocketBase::m_rWnd))
+ ;
+ return tid;
+}
+
+TcpSocketBase::TcpSocketBase (void)
+ : m_dupAckCount (0),
+ m_delAckCount (0),
+ m_endPoint (0),
+ m_node (0),
+ m_tcp (0),
+ m_rtt (0),
+ m_nextTxSequence (0), // Change this for non-zero initial sequence number
+ m_highTxMark (0),
+ m_rxBuffer (0),
+ m_txBuffer (0),
+ m_state (CLOSED),
+ m_errno (ERROR_NOTERROR),
+ m_closeNotified (false),
+ m_closeOnEmpty (false),
+ m_shutdownSend (false),
+ m_shutdownRecv (false),
+ m_connected (false),
+ m_segmentSize (0), // For attribute initialization consistency (quiet valgrind)
+ m_rWnd (0)
+{
+ NS_LOG_FUNCTION (this);
+}
+
+TcpSocketBase::TcpSocketBase (const TcpSocketBase& sock)
+ : TcpSocket (sock), //copy object::m_tid and socket::callbacks
+ m_dupAckCount (sock.m_dupAckCount),
+ m_delAckCount (0),
+ m_delAckMaxCount (sock.m_delAckMaxCount),
+ m_cnCount (sock.m_cnCount),
+ m_delAckTimeout (sock.m_delAckTimeout),
+ m_persistTimeout (sock.m_persistTimeout),
+ m_cnTimeout (sock.m_cnTimeout),
+ m_endPoint (0),
+ m_node (sock.m_node),
+ m_tcp (sock.m_tcp),
+ m_rtt (0),
+ m_nextTxSequence (sock.m_nextTxSequence),
+ m_highTxMark (sock.m_highTxMark),
+ m_rxBuffer (sock.m_rxBuffer),
+ m_txBuffer (sock.m_txBuffer),
+ m_state (sock.m_state),
+ m_errno (sock.m_errno),
+ m_closeNotified (sock.m_closeNotified),
+ m_closeOnEmpty (sock.m_closeOnEmpty),
+ m_shutdownSend (sock.m_shutdownSend),
+ m_shutdownRecv (sock.m_shutdownRecv),
+ m_connected (sock.m_connected),
+ m_segmentSize (sock.m_segmentSize),
+ m_rWnd (sock.m_rWnd)
+{
+ NS_LOG_FUNCTION (this);
+ NS_LOG_LOGIC ("Invoked the copy constructor");
+ // Copy the rtt estimator if it is set
+ if (sock.m_rtt)
+ {
+ m_rtt = sock.m_rtt->Copy ();
+ }
+ // Reset all callbacks to null
+ Callback<void, Ptr< Socket > > vPS = MakeNullCallback<void, Ptr<Socket> > ();
+ Callback<void, Ptr<Socket>, const Address &> vPSA = MakeNullCallback<void, Ptr<Socket>, const Address &> ();
+ Callback<void, Ptr<Socket>, uint32_t> vPSUI = MakeNullCallback<void, Ptr<Socket>, uint32_t> ();
+ SetConnectCallback (vPS, vPS);
+ SetDataSentCallback (vPSUI);
+ SetSendCallback (vPSUI);
+ SetRecvCallback (vPS);
+}
+
+TcpSocketBase::~TcpSocketBase (void)
+{
+ NS_LOG_FUNCTION (this);
+ m_node = 0;
+ if (m_endPoint != 0)
+ {
+ NS_ASSERT (m_tcp != 0);
+ /*
+ * Upon Bind, an Ipv4Endpoint is allocated and set to m_endPoint, and
+ * DestroyCallback is set to TcpSocketBase::Destroy. If we called
+ * m_tcp->DeAllocate, it wil destroy its Ipv4EndpointDemux::DeAllocate,
+ * which in turn destroys my m_endPoint, and in turn invokes
+ * TcpSocketBase::Destroy to nullify m_node, m_endPoint, and m_tcp.
+ */
+ NS_ASSERT (m_endPoint != 0);
+ m_tcp->DeAllocate (m_endPoint);
+ NS_ASSERT (m_endPoint == 0);
+ }
+ m_tcp = 0;
+ CancelAllTimers ();
+}
+
+/** Associate a node with this TCP socket */
+void
+TcpSocketBase::SetNode (Ptr<Node> node)
+{
+ m_node = node;
+}
+
+/** Associate the L4 protocol (e.g. mux/demux) with this socket */
+void
+TcpSocketBase::SetTcp (Ptr<TcpL4Protocol> tcp)
+{
+ m_tcp = tcp;
+}
+
+/** Set an RTT estimator with this socket */
+void
+TcpSocketBase::SetRtt (Ptr<RttEstimator> rtt)
+{
+ m_rtt = rtt;
+}
+
+/** Inherit from Socket class: Returns error code */
+enum Socket::SocketErrno
+TcpSocketBase::GetErrno (void) const
+{
+ return m_errno;
+}
+
+/** Inherit from Socket class: Returns socket type, NS3_SOCK_STREAM */
+enum Socket::SocketType
+TcpSocketBase::GetSocketType (void) const
+{
+ return NS3_SOCK_STREAM;
+}
+
+/** Inherit from Socket class: Returns associated node */
+Ptr<Node>
+TcpSocketBase::GetNode (void) const
+{
+ NS_LOG_FUNCTION_NOARGS ();
+ return m_node;
+}
+
+/** Inherit from Socket class: Bind socket to an end-point in TcpL4Protocol */
+int
+TcpSocketBase::Bind (void)
+{
+ NS_LOG_FUNCTION_NOARGS ();
+ m_endPoint = m_tcp->Allocate ();
+ return SetupCallback ();
+}
+
+/** Inherit from Socket class: Bind socket (with specific address) to an end-point in TcpL4Protocol */
+int
+TcpSocketBase::Bind (const Address &address)
+{
+ NS_LOG_FUNCTION (this << address);
+ if (!InetSocketAddress::IsMatchingType (address))
+ {
+ m_errno = ERROR_INVAL;
+ return -1;
+ }
+ InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
+ Ipv4Address ipv4 = transport.GetIpv4 ();
+ uint16_t port = transport.GetPort ();
+ if (ipv4 == Ipv4Address::GetAny () && port == 0)
+ {
+ m_endPoint = m_tcp->Allocate ();
+ }
+ else if (ipv4 == Ipv4Address::GetAny () && port != 0)
+ {
+ m_endPoint = m_tcp->Allocate (port);
+ }
+ else if (ipv4 != Ipv4Address::GetAny () && port == 0)
+ {
+ m_endPoint = m_tcp->Allocate (ipv4);
+ }
+ else if (ipv4 != Ipv4Address::GetAny () && port != 0)
+ {
+ m_endPoint = m_tcp->Allocate (ipv4, port);
+ }
+ NS_LOG_LOGIC ("TcpSocketBase " << this << " got an endpoint: " << m_endPoint);
+
+ return SetupCallback ();
+}
+
+/** Inherit from Socket class: Initiate connection to a remote address:port */
+int
+TcpSocketBase::Connect (const Address & address)
+{
+ NS_LOG_FUNCTION (this << address);
+
+ // If haven't do so, Bind() this socket first
+ if (m_endPoint == 0)
+ {
+ if (Bind () == -1)
+ {
+ NS_ASSERT (m_endPoint == 0);
+ return -1; // Bind() failed
+ }
+ NS_ASSERT (m_endPoint != 0);
+ }
+
+ InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
+ m_endPoint->SetPeer (transport.GetIpv4 (), transport.GetPort ());
+
+ // Get the appropriate local address and port number from the routing protocol and set up endpoint
+ if (SetupEndpoint () != 0)
+ { // Route to destination does not exist
+ return -1;
+ }
+
+ // DoConnect() will do state-checking and send a SYN packet
+ return DoConnect ();
+}
+
+/** Inherit from Socket class: Listen on the endpoint for an incoming connection */
+int
+TcpSocketBase::Listen (void)
+{
+ NS_LOG_FUNCTION (this);
+ // Linux quits EINVAL if we're not in CLOSED state, so match what they do
+ if (m_state != CLOSED)
+ {
+ m_errno = ERROR_INVAL;
+ return -1;
+ }
+ // In other cases, set the state to LISTEN and done
+ NS_LOG_INFO ("CLOSED -> LISTEN");
+ m_state = LISTEN;
+ return 0;
+}
+
+/** Inherit from Socket class: Kill this socket and signal the peer (if any) */
+int
+TcpSocketBase::Close (void)
+{
+ NS_LOG_FUNCTION (this);
+ // First we check to see if there is any unread rx data
+ // Bug number 426 claims we should send reset in this case.
+ if (m_rxBuffer.Size () != 0)
+ {
+ SendRST ();
+ return 0;
+ }
+ if (m_txBuffer.SizeFromSequence (m_nextTxSequence) > 0)
+ { // App close with pending data must wait until all data transmitted
+ if (m_closeOnEmpty == false)
+ {
+ m_closeOnEmpty = true;
+ NS_LOG_INFO ("Socket " << this << " deferring close, state " << TcpStateName[m_state]);
+ }
+ return 0;
+ }
+ return DoClose ();
+}
+
+/** Inherit from Socket class: Signal a termination of send */
+int
+TcpSocketBase::ShutdownSend (void)
+{
+ NS_LOG_FUNCTION (this);
+ m_shutdownSend = true;
+ return 0;
+}
+
+/** Inherit from Socket class: Signal a termination of receive */
+int
+TcpSocketBase::ShutdownRecv (void)
+{
+ NS_LOG_FUNCTION (this);
+ m_shutdownRecv = true;
+ return 0;
+}
+
+/** Inherit from Socket class: Send a packet. Parameter flags is not used.
+ Packet has no TCP header. Invoked by upper-layer application */
+int
+TcpSocketBase::Send (Ptr<Packet> p, uint32_t flags)
+{
+ NS_LOG_FUNCTION (this << p);
+ NS_ABORT_MSG_IF (flags, "use of flags is not supported in TcpSocketBase::Send()");
+ if (m_state == ESTABLISHED || m_state == SYN_SENT || m_state == CLOSE_WAIT)
+ {
+ // Store the packet into Tx buffer
+ if (!m_txBuffer.Add (p))
+ { // TxBuffer overflow, send failed
+ m_errno = ERROR_MSGSIZE;
+ return -1;
+ }
+ // Submit the data to lower layers
+ NS_LOG_LOGIC ("txBufSize=" << m_txBuffer.Size () << " state " << TcpStateName[m_state]);
+ if (m_state == ESTABLISHED || m_state == CLOSE_WAIT)
+ { // Try to send the data out
+ SendPendingData (m_connected);
+ }
+ return p->GetSize ();
+ }
+ else
+ { // Connection not established yet
+ m_errno = ERROR_NOTCONN;
+ return -1; // Send failure
+ }
+}
+
+/** Inherit from Socket class: In TcpSocketBase, it is same as Send() call */
+int
+TcpSocketBase::SendTo (Ptr<Packet> p, uint32_t flags, const Address &address)
+{
+ return Send (p, flags); // SendTo() and Send() are the same
+}
+
+/** Inherit from Socket class: Return data to upper-layer application. Parameter flags
+ is not used. Data is returned as a packet of size no larger than maxSize */
+Ptr<Packet>
+TcpSocketBase::Recv (uint32_t maxSize, uint32_t flags)
+{
+ NS_LOG_FUNCTION (this);
+ NS_ABORT_MSG_IF (flags, "use of flags is not supported in TcpSocketBase::Recv()");
+ if (m_rxBuffer.Size () == 0 && m_state == CLOSE_WAIT)
+ {
+ return Create<Packet> (); // Send EOF on connection close
+ }
+ Ptr<Packet> outPacket = m_rxBuffer.Extract (maxSize);
+ if (outPacket != 0 && outPacket->GetSize () != 0)
+ {
+ SocketAddressTag tag;
+ tag.SetAddress (InetSocketAddress (m_endPoint->GetPeerAddress (), m_endPoint->GetPeerPort ()));
+ outPacket->AddPacketTag (tag);
+ }
+ return outPacket;
+}
+
+/** Inherit from Socket class: Recv and return the remote's address */
+Ptr<Packet>
+TcpSocketBase::RecvFrom (uint32_t maxSize, uint32_t flags, Address &fromAddress)
+{
+ NS_LOG_FUNCTION (this << maxSize << flags);
+ Ptr<Packet> packet = Recv (maxSize, flags);
+ // Null packet means no data to read, and an empty packet indicates EOF
+ if (packet != 0 && packet->GetSize () != 0)
+ {
+ GetSockName (fromAddress);
+ }
+ return packet;
+}
+
+/** Inherit from Socket class: Get the max number of bytes an app can send */
+uint32_t
+TcpSocketBase::GetTxAvailable (void) const
+{
+ NS_LOG_FUNCTION (this);
+ return m_txBuffer.Available ();
+}
+
+/** Inherit from Socket class: Get the max number of bytes an app can read */
+uint32_t
+TcpSocketBase::GetRxAvailable (void) const
+{
+ NS_LOG_FUNCTION (this);
+ return m_rxBuffer.Available ();
+}
+
+/** Inherit from Socket class: Return local address:port */
+int
+TcpSocketBase::GetSockName (Address &address) const
+{
+ NS_LOG_FUNCTION (this);
+ if (m_endPoint != 0)
+ {
+ address = InetSocketAddress (m_endPoint->GetLocalAddress (), m_endPoint->GetLocalPort ());
+ }
+ else
+ { // It is possible to call this method on a socket without a name
+ // in which case, behavior is unspecified
+ address = InetSocketAddress (Ipv4Address::GetZero (), 0);
+ }
+ return 0;
+}
+
+/** Inherit from Socket class: Bind this socket to the specified NetDevice */
+void
+TcpSocketBase::BindToNetDevice (Ptr<NetDevice> netdevice)
+{
+ NS_LOG_FUNCTION (netdevice);
+ Socket::BindToNetDevice (netdevice); // Includes sanity check
+ if (m_endPoint == 0)
+ {
+ if (Bind () == -1)
+ {
+ NS_ASSERT (m_endPoint == 0);
+ return;
+ }
+ NS_ASSERT (m_endPoint != 0);
+ }
+ m_endPoint->BindToNetDevice (netdevice);
+ return;
+}
+
+/** Clean up after Bind. Set up callback functions in the end-point. */
+int
+TcpSocketBase::SetupCallback (void)
+{
+ NS_LOG_FUNCTION (this);
+ if (m_endPoint == 0)
+ {
+ return -1;
+ }
+ m_endPoint->SetRxCallback (MakeCallback (&TcpSocketBase::ForwardUp, Ptr<TcpSocketBase> (this)));
+ m_endPoint->SetDestroyCallback (MakeCallback (&TcpSocketBase::Destroy, Ptr<TcpSocketBase> (this)));
+ return 0;
+}
+
+/** Perform the real connection tasks: Send SYN if allowed, RST if invalid */
+int
+TcpSocketBase::DoConnect (void)
+{
+ NS_LOG_FUNCTION (this);
+
+ // A new connection is allowed only if this socket does not have a connection
+ if (m_state == CLOSED || m_state == LISTEN || m_state == SYN_SENT || m_state == LAST_ACK || m_state == CLOSE_WAIT)
+ { // send a SYN packet and change state into SYN_SENT
+ SendEmptyPacket (TcpHeader::SYN);
+ NS_LOG_INFO (TcpStateName[m_state] << " -> SYN_SENT");
+ m_state = SYN_SENT;
+ }
+ else if (m_state != TIME_WAIT)
+ { // In states SYN_RCVD, ESTABLISHED, FIN_WAIT_1, FIN_WAIT_2, and CLOSING, an connection
+ // exists. We send RST, tear down everything, and close this socket.
+ CloseAndNotify ();
+ SendRST ();
+ }
+ return 0;
+}
+
+/** Do the action to close the socket. Usually send a packet with appropriate
+ flags depended on the current m_state. */
+int
+TcpSocketBase::DoClose (void)
+{
+ NS_LOG_FUNCTION (this);
+ switch (m_state)
+ {
+ case SYN_RCVD:
+ case ESTABLISHED:
+ // send FIN to close the peer
+ SendEmptyPacket (TcpHeader::FIN);
+ NS_LOG_INFO ("ESTABLISHED -> FIN_WAIT_1");
+ m_state = FIN_WAIT_1;
+ break;
+ case CLOSE_WAIT:
+ // send FIN+ACK to close the peer
+ SendEmptyPacket (TcpHeader::FIN | TcpHeader::ACK);
+ NS_LOG_INFO ("CLOSE_WAIT -> LAST_ACK");
+ m_state = LAST_ACK;
+ break;
+ case SYN_SENT:
+ case CLOSING:
+ // Send RST if application closes in SYN_SENT and CLOSING
+ CloseAndNotify ();
+ SendRST ();
+ break;
+ case LISTEN:
+ case LAST_ACK:
+ // In these three states, move to CLOSED and tear down the end point
+ CloseAndNotify ();
+ break;
+ case CLOSED:
+ case FIN_WAIT_1:
+ case FIN_WAIT_2:
+ case TIME_WAIT:
+ default: /* mute compiler */
+ // Do nothing in these four states
+ break;
+ }
+ return 0;
+}
+
+/** Peacefully close the socket by notifying the upper layer and deallocate end point */
+void
+TcpSocketBase::CloseAndNotify (void)
+{
+ NS_LOG_FUNCTION (this);
+
+ if (!m_closeNotified) NotifyNormalClose ();
+ m_closeNotified = true;
+ NS_LOG_INFO (TcpStateName[m_state] << " -> CLOSED");
+ m_state = CLOSED;
+ DeallocateEndPoint ();
+}
+
+
+/** Tell if a sequence number is out side the range that my rx buffer can
+ accpet */
+bool
+TcpSocketBase::OutOfRange (SequenceNumber32 s) const
+{
+ if (m_state == LISTEN || m_state == SYN_SENT || m_state == SYN_RCVD)
+ { // Rx buffer in these states are not initialized.
+ return false;
+ }
+ if (m_state == LAST_ACK || m_state == CLOSING)
+ { // In LAST_ACK and CLOSING states, it only wait for an ACK and the
+ // sequence number must equals to m_rxBuffer.NextRxSequence ()
+ return (m_rxBuffer.NextRxSequence () != s);
+ };
+
+ // In all other cases, check if the sequence number is in range
+ return (m_rxBuffer.MaxRxSequence () < s || m_rxBuffer.NextRxSequence () > s);
+}
+
+/** Function called by the L3 protocol when it received a packet to pass on to
+ the TCP. This function is registered as the "RxCallback" function in
+ SetupCallback(), which invoked by Bind(), and CompleteFork() */
+void
+TcpSocketBase::ForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port,
+ Ptr<Ipv4Interface> incomingInterface)
+{
+ NS_LOG_LOGIC ("Socket " << this << " forward up " <<
+ m_endPoint->GetPeerAddress () <<
+ ":" << m_endPoint->GetPeerPort () <<
+ " to " << m_endPoint->GetLocalAddress () <<
+ ":" << m_endPoint->GetLocalPort ());
+ Address fromAddress = InetSocketAddress (header.GetSource (), port);
+ Address toAddress = InetSocketAddress (header.GetDestination (), m_endPoint->GetLocalPort ());
+
+ // Peel off TCP header and do validity checking
+ TcpHeader tcpHeader;
+ packet->RemoveHeader (tcpHeader);
+ if (tcpHeader.GetFlags () & TcpHeader::ACK)
+ {
+ EstimateRtt (tcpHeader);
+ }
+
+ // Update Rx window size, i.e. the flow control window
+ if (m_rWnd.Get () == 0 && tcpHeader.GetWindowSize () != 0)
+ { // persist probes end
+ NS_LOG_LOGIC (this << " Leaving zerowindow persist state");
+ m_persistEvent.Cancel ();
+ }
+ m_rWnd = tcpHeader.GetWindowSize ();
+
+ // Discard out of range packets
+ if (OutOfRange (tcpHeader.GetSequenceNumber ()))
+ {
+ NS_LOG_LOGIC ("At state " << TcpStateName[m_state] <<
+ " received packet of seq " << tcpHeader.GetSequenceNumber () <<
+ " out of range [" << m_rxBuffer.NextRxSequence () << ":" <<
+ m_rxBuffer.MaxRxSequence () << "]");
+ return;
+ }
+
+ // TCP state machine code in different process functions
+ // C.f.: tcp_rcv_state_process() in tcp_input.c in Linux kernel
+ switch (m_state)
+ {
+ case ESTABLISHED:
+ ProcessEstablished (packet, tcpHeader);
+ break;
+ case LISTEN:
+ ProcessListen (packet, tcpHeader, fromAddress, toAddress);
+ break;
+ case TIME_WAIT:
+ // Do nothing
+ break;
+ case CLOSED:
+ // Send RST if the incoming packet is not a RST
+ if ((tcpHeader.GetFlags () & ~(TcpHeader::PSH | TcpHeader::URG)) != TcpHeader::RST)
+ {
+ SendRST ();
+ }
+ break;
+ case SYN_SENT:
+ ProcessSynSent (packet, tcpHeader);
+ break;
+ case SYN_RCVD:
+ ProcessSynRcvd (packet, tcpHeader, fromAddress, toAddress);
+ break;
+ case FIN_WAIT_1:
+ case FIN_WAIT_2:
+ case CLOSE_WAIT:
+ ProcessWait (packet, tcpHeader);
+ break;
+ case CLOSING:
+ ProcessClosing (packet, tcpHeader);
+ break;
+ case LAST_ACK:
+ ProcessLastAck (packet, tcpHeader);
+ break;
+ default: // mute compiler
+ break;
+ }
+}
+
+/** Received a packet upon ESTABLISHED state. This function is mimicking the
+ role of tcp_rcv_established() in tcp_input.c in Linux kernel. */
+void
+TcpSocketBase::ProcessEstablished (Ptr<Packet> packet, const TcpHeader& tcpHeader)
+{
+ NS_LOG_FUNCTION (this << tcpHeader);
+
+ // Extract the flags. PSH and URG are not honoured.
+ uint8_t tcpflags = tcpHeader.GetFlags () & ~(TcpHeader::PSH | TcpHeader::URG);
+
+ // Different flags are different events
+ if (tcpflags == TcpHeader::ACK)
+ {
+ ReceivedAck (packet, tcpHeader);
+ }
+ else if (tcpflags == TcpHeader::SYN)
+ { // Received SYN, old NS-3 behaviour is to set state to SYN_RCVD and
+ // respond with a SYN+ACK. But it is not a legal state transition as of
+ // RFC793. Thus this is ignored.
+ }
+ else if (tcpflags == (TcpHeader::SYN | TcpHeader::ACK))
+ { // No action for received SYN+ACK, it is probably a duplicated packet
+ }
+ else if (tcpflags == TcpHeader::FIN || tcpflags == (TcpHeader::FIN | TcpHeader::ACK))
+ { // Received FIN or FIN+ACK, bring down this socket nicely
+ PeerClose (packet, tcpHeader);
+ }
+ else if (tcpflags == 0)
+ { // No flags means there is only data
+ ReceivedData (packet, tcpHeader);
+ if (m_rxBuffer.Finished ())
+ {
+ PeerClose (packet, tcpHeader);
+ }
+ }
+ else
+ { // Received RST or the TCP flags is invalid, in either case, terminate this socket
+ CloseAndNotify ();
+ if (tcpflags != TcpHeader::RST)
+ { // this must be an invalid flag, send reset
+ NS_LOG_LOGIC ("Illegal flag " << tcpflags << " received. Reset packet is sent.");
+ SendRST ();
+ }
+ }
+}
+
+/** Process the newly received ACK */
+void
+TcpSocketBase::ReceivedAck (Ptr<Packet> packet, const TcpHeader& tcpHeader)
+{
+ NS_LOG_FUNCTION (this << tcpHeader);
+
+ // Received ACK. Compare the ACK number against highest unacked seqno
+ if (0 == (tcpHeader.GetFlags () & TcpHeader::ACK))
+ { // Ignore if no ACK flag
+ }
+ else if (tcpHeader.GetAckNumber () < m_txBuffer.HeadSequence ())
+ { // Case 1: Old ACK, ignored.
+ NS_LOG_LOGIC ("Ignored ack of " << tcpHeader.GetAckNumber ());
+ }
+ else if (tcpHeader.GetAckNumber () == m_txBuffer.HeadSequence ())
+ { // Case 2: Potentially a duplicated ACK
+ if (tcpHeader.GetAckNumber () < m_nextTxSequence)
+ {
+ NS_LOG_LOGIC ("Dupack of " << tcpHeader.GetAckNumber ());
+ DupAck (tcpHeader, ++m_dupAckCount);
+ }
+ // otherwise, the ACK is precisely equal to the nextTxSequence
+ NS_ASSERT (tcpHeader.GetAckNumber () <= m_nextTxSequence);
+ }
+ else if (tcpHeader.GetAckNumber () > m_txBuffer.HeadSequence ())
+ { // Case 3: New ACK, reset m_dupAckCount and update m_txBuffer
+ NS_LOG_LOGIC ("New ack of " << tcpHeader.GetAckNumber ());
+ NewAck (tcpHeader.GetAckNumber ());
+ m_dupAckCount = 0;
+ }
+ // If there is any data piggybacked, store it into m_rxBuffer
+ if (packet->GetSize () > 0)
+ {
+ ReceivedData (packet, tcpHeader);
+ }
+}
+
+/** Received a packet upon LISTEN state. */
+void
+TcpSocketBase::ProcessListen (Ptr<Packet> packet, const TcpHeader& tcpHeader,
+ const Address& fromAddress, const Address& toAddress)
+{
+ NS_LOG_FUNCTION (this << tcpHeader);
+
+ // Extract the flags. PSH and URG are not honoured.
+ uint8_t tcpflags = tcpHeader.GetFlags () & ~(TcpHeader::PSH | TcpHeader::URG);
+
+ // Fork a socket if received a SYN. Do nothing otherwise.
+ // C.f.: the LISTEN part in tcp_v4_do_rcv() in tcp_ipv4.c in Linux kernel
+ if (tcpflags != TcpHeader::SYN) return;
+
+ // Call socket's notify function to let the server app know we got a SYN
+ // If the server app refuses the connection, do nothing
+ if (!NotifyConnectionRequest (fromAddress)) return;
+ // Clone the socket, simulate fork
+ Ptr<TcpSocketBase> newSock = Fork ();
+ NS_LOG_LOGIC ("Cloned a TcpSocketBase " << newSock);
+ Simulator::ScheduleNow (&TcpSocketBase::CompleteFork, newSock,
+ packet, tcpHeader, fromAddress, toAddress);
+}
+
+/** Received a packet upon SYN_SENT */
+void
+TcpSocketBase::ProcessSynSent (Ptr<Packet> packet, const TcpHeader& tcpHeader)
+{
+ NS_LOG_FUNCTION (this << tcpHeader);
+
+ // Extract the flags. PSH and URG are not honoured.
+ uint8_t tcpflags = tcpHeader.GetFlags () & ~(TcpHeader::PSH | TcpHeader::URG);
+
+ if (tcpflags == 0)
+ { // Bare data, accept it and move to ESTABLISHED state. This is not a normal behaviour. Remove this?
+ NS_LOG_INFO ("SYN_SENT -> ESTABLISHED");
+ m_state = ESTABLISHED;
+ m_connected = true;
+ m_retxEvent.Cancel ();
+ ReceivedData (packet, tcpHeader);
+ Simulator::ScheduleNow (&TcpSocketBase::ConnectionSucceeded, this);
+ }
+ else if (tcpflags == TcpHeader::ACK)
+ { // Ignore ACK in SYN_SENT
+ }
+ else if (tcpflags == TcpHeader::SYN)
+ { // Received SYN, move to SYN_RCVD state and respond with SYN+ACK
+ NS_LOG_INFO ("SYN_SENT -> SYN_RCVD");
+ m_state = SYN_RCVD;
+ m_rxBuffer.SetNextRxSequence (tcpHeader.GetSequenceNumber () + SequenceNumber32 (1));
+ SendEmptyPacket (TcpHeader::SYN | TcpHeader::ACK);
+ }
+ else if (tcpflags == (TcpHeader::SYN | TcpHeader::ACK)
+ && m_nextTxSequence + SequenceNumber32 (1) == tcpHeader.GetAckNumber ())
+ { // Handshake completed
+ NS_LOG_INFO ("SYN_SENT -> ESTABLISHED");
+ m_state = ESTABLISHED;
+ m_connected = true;
+ m_retxEvent.Cancel ();
+ m_rxBuffer.SetNextRxSequence (tcpHeader.GetSequenceNumber () + SequenceNumber32 (1));
+ m_highTxMark = ++m_nextTxSequence;
+ m_txBuffer.SetHeadSequence (m_nextTxSequence);
+ SendEmptyPacket (TcpHeader::ACK);
+ if (GetTxAvailable () > 0)
+ {
+ NotifySend (GetTxAvailable ());
+ }
+ SendPendingData (m_connected);
+ Simulator::ScheduleNow (&TcpSocketBase::ConnectionSucceeded, this);
+ }
+ else
+ { // Other in-sequence input
+ CloseAndNotify ();
+ if (tcpflags != TcpHeader::RST)
+ { // When (1) rx of FIN+ACK; (2) rx of FIN; (3) rx of bad flags
+ NS_LOG_LOGIC ("Illegal flag " << tcpflags << " received. Reset packet is sent.");
+ SendRST ();
+ }
+ }
+}
+
+/** Received a packet upon SYN_RCVD */
+void
+TcpSocketBase::ProcessSynRcvd (Ptr<Packet> packet, const TcpHeader& tcpHeader,
+ const Address& fromAddress, const Address& toAddress)
+{
+ NS_LOG_FUNCTION (this << tcpHeader);
+
+ // Extract the flags. PSH and URG are not honoured.
+ uint8_t tcpflags = tcpHeader.GetFlags () & ~(TcpHeader::PSH | TcpHeader::URG);
+
+ if (tcpflags == 0 ||
+ (tcpflags == TcpHeader::ACK
+ && m_nextTxSequence + SequenceNumber32 (1) == tcpHeader.GetAckNumber ()))
+ { // If it is bare data, accept it and move to ESTABLISHED state. This is
+ // possibly due to ACK lost in 3WHS. If in-sequence ACK is received, the
+ // handshake is completed nicely.
+ NS_LOG_INFO ("SYN_RCVD -> ESTABLISHED");
+ m_state = ESTABLISHED;
+ m_connected = true;
+ m_retxEvent.Cancel ();
+ m_highTxMark = ++m_nextTxSequence;
+ m_txBuffer.SetHeadSequence (m_nextTxSequence);
+ m_endPoint->SetPeer (m_endPoint->GetPeerAddress (), m_endPoint->GetPeerPort ());
+ // Always respond to first data packet to speed up the connection.
+ // Remove to get the behaviour of old NS-3 code.
+ m_delAckCount = m_delAckMaxCount;
+ ReceivedAck (packet, tcpHeader);
+ NotifyNewConnectionCreated (this, fromAddress);
+ }
+ else if (tcpflags == TcpHeader::SYN)
+ { // Probably the peer lost my SYN+ACK
+ m_rxBuffer.SetNextRxSequence (tcpHeader.GetSequenceNumber () + SequenceNumber32 (1));
+ SendEmptyPacket (TcpHeader::SYN | TcpHeader::ACK);
+ }
+ else if (tcpflags == (TcpHeader::FIN | TcpHeader::ACK))
+ {
+ if (tcpHeader.GetSequenceNumber () == m_rxBuffer.NextRxSequence ())
+ { // In-sequence FIN before connection complete. Set up connection and close.
+ m_connected = true;
+ m_retxEvent.Cancel ();
+ m_highTxMark = ++m_nextTxSequence;
+ m_txBuffer.SetHeadSequence (m_nextTxSequence);
+ m_endPoint->SetPeer (m_endPoint->GetPeerAddress (), m_endPoint->GetPeerPort ());
+ PeerClose (packet, tcpHeader);
+ }
+ }
+ else
+ { // Other in-sequence input
+ CloseAndNotify ();
+ if (tcpflags != TcpHeader::RST)
+ { // When (1) rx of SYN+ACK; (2) rx of FIN; (3) rx of bad flags
+ NS_LOG_LOGIC ("Illegal flag " << tcpflags << " received. Reset packet is sent.");
+ SendRST ();
+ }
+ }
+}
+
+/** Received a packet upon CLOSE_WAIT, FIN_WAIT_1, or FIN_WAIT_2 states */
+void
+TcpSocketBase::ProcessWait (Ptr<Packet> packet, const TcpHeader& tcpHeader)
+{
+ NS_LOG_FUNCTION (this << tcpHeader);
+
+ // Extract the flags. PSH and URG are not honoured.
+ uint8_t tcpflags = tcpHeader.GetFlags () & ~(TcpHeader::PSH | TcpHeader::URG);
+
+ if (packet->GetSize () > 0)
+ { // Bare data, accept it
+ ReceivedData (packet, tcpHeader);
+ }
+ else if (tcpflags == TcpHeader::ACK)
+ { // Process the ACK, and if in FIN_WAIT_1, conditionally move to FIN_WAIT_2
+ ReceivedAck (packet, tcpHeader);
+ if (m_state == FIN_WAIT_1 && m_txBuffer.Size () == 0 &&
+ tcpHeader.GetAckNumber () == m_highTxMark + SequenceNumber32 (1))
+ { // This ACK corresponds to the FIN sent
+ NS_LOG_INFO ("FIN_WAIT_1 -> FIN_WAIT_2");
+ m_state = FIN_WAIT_2;
+ }
+ }
+ else if (tcpflags == TcpHeader::FIN || tcpflags == (TcpHeader::FIN | TcpHeader::ACK))
+ { // Got FIN, respond with ACK and move to next state
+ if (tcpflags & TcpHeader::ACK)
+ { // Process the ACK first
+ ReceivedAck (packet, tcpHeader);
+ }
+ m_rxBuffer.SetFinSequence (tcpHeader.GetSequenceNumber ());
+ }
+ else if (tcpflags == TcpHeader::SYN || tcpflags == (TcpHeader::SYN | TcpHeader::ACK))
+ { // Duplicated SYN or SYN+ACK, possibly due to spurious retransmission
+ return;
+ }
+ else
+ { // This is a RST or bad flags
+ CloseAndNotify ();
+ if (tcpflags != TcpHeader::RST)
+ {
+ NS_LOG_LOGIC ("Illegal flag " << tcpflags << " received. Reset packet is sent.");
+ SendRST ();
+ }
+ return;
+ }
+
+ // Check if the close responder sent an in-sequence FIN, if so, respond ACK
+ if ((m_state == FIN_WAIT_1 || m_state == FIN_WAIT_2) && m_rxBuffer.Finished ())
+ {
+ if (m_state == FIN_WAIT_1)
+ {
+ NS_LOG_INFO ("FIN_WAIT_1 -> CLOSING");
+ m_state = CLOSING;
+ if (m_txBuffer.Size () == 0 &&
+ tcpHeader.GetAckNumber () == m_highTxMark + SequenceNumber32 (1))
+ { // This ACK corresponds to the FIN sent
+ NS_LOG_INFO ("CLOSING -> TIME_WAIT");
+ m_state = TIME_WAIT;
+ CancelAllTimers ();
+ }
+ }
+ else if (m_state == FIN_WAIT_2)
+ {
+ NS_LOG_INFO ("FIN_WAIT_2 -> TIME_WAIT");
+ m_state = TIME_WAIT;
+ CancelAllTimers ();
+ // TODO: In TIME_WAIT, we supposed to move to CLOSED after 2*MSL time
+ // but this move is not yet implemeneted. Is this necessary?
+ };
+ SendEmptyPacket (TcpHeader::ACK);
+ if (!m_shutdownRecv) NotifyDataRecv ();
+ }
+}
+
+/** Received a packet upon CLOSING */
+void
+TcpSocketBase::ProcessClosing (Ptr<Packet> packet, const TcpHeader& tcpHeader)
+{
+ NS_LOG_FUNCTION (this << tcpHeader);
+
+ // Extract the flags. PSH and URG are not honoured.
+ uint8_t tcpflags = tcpHeader.GetFlags () & ~(TcpHeader::PSH | TcpHeader::URG);
+
+ if (tcpflags == TcpHeader::ACK)
+ {
+ if (tcpHeader.GetSequenceNumber () == m_rxBuffer.NextRxSequence ())
+ { // This ACK corresponds to the FIN sent
+ NS_LOG_INFO ("CLOSING -> TIME_WAIT");
+ m_state = TIME_WAIT;
+ CancelAllTimers ();
+ // TODO: In TIME_WAIT, we supposed to move to CLOSED after 2*MSL time
+ // but this move is not yet implemeneted. Is this necessary?
+ }
+ }
+ else
+ { // CLOSING state means simultaneous close, i.e. no one is sending data to
+ // anyone. If anything other than ACK is received, respond with a reset.
+ CloseAndNotify ();
+ if (tcpflags == TcpHeader::FIN || tcpflags == (TcpHeader::FIN | TcpHeader::ACK))
+ { // FIN from the peer as well. We can close immediately.
+ SendEmptyPacket (TcpHeader::ACK);
+ }
+ else if (tcpflags != TcpHeader::RST)
+ { // Receive of SYN or SYN+ACK or bad flags or pure data
+ NS_LOG_LOGIC ("Illegal flag " << tcpflags << " received. Reset packet is sent.");
+ SendRST ();
+ }
+ }
+}
+
+/** Received a packet upon LAST_ACK */
+void
+TcpSocketBase::ProcessLastAck (Ptr<Packet> packet, const TcpHeader& tcpHeader)
+{
+ NS_LOG_FUNCTION (this << tcpHeader);
+
+ // Extract the flags. PSH and URG are not honoured.
+ uint8_t tcpflags = tcpHeader.GetFlags () & ~(TcpHeader::PSH | TcpHeader::URG);
+
+ if (tcpflags == 0)
+ {
+ ReceivedData (packet, tcpHeader);
+ }
+ else if (tcpflags == TcpHeader::ACK)
+ {
+ if (tcpHeader.GetSequenceNumber () == m_rxBuffer.NextRxSequence ())
+ { // This ACK corresponds to the FIN sent. This socket closed peacefully.
+ CloseAndNotify ();
+ }
+ }
+ else if (tcpflags == TcpHeader::FIN)
+ { // Received FIN again, the peer probably lost the FIN+ACK
+ SendEmptyPacket (TcpHeader::FIN | TcpHeader::ACK);
+ }
+ else if (tcpflags == (TcpHeader::FIN | TcpHeader::ACK) || tcpflags == TcpHeader::RST)
+ {
+ CloseAndNotify ();
+ }
+ else
+ { // Received a SYN or SYN+ACK or bad flags
+ CloseAndNotify ();
+ NS_LOG_LOGIC ("Illegal flag " << tcpflags << " received. Reset packet is sent.");
+ SendRST ();
+ }
+}
+
+/** Peer sent me a FIN. Remember its sequence in rx buffer. */
+void
+TcpSocketBase::PeerClose (Ptr<Packet> p, const TcpHeader& tcpHeader)
+{
+ NS_LOG_FUNCTION (this << tcpHeader);
+
+ // Ignore all out of range packets
+ if (tcpHeader.GetSequenceNumber () < m_rxBuffer.NextRxSequence () ||
+ tcpHeader.GetSequenceNumber () > m_rxBuffer.MaxRxSequence ())
+ {
+ return;
+ };
+ // For any case, remember the FIN position in rx buffer first
+ m_rxBuffer.SetFinSequence (tcpHeader.GetSequenceNumber () + SequenceNumber32 (p->GetSize ()));
+ NS_LOG_LOGIC ("Accepted FIN at seq " << tcpHeader.GetSequenceNumber () + SequenceNumber32 (p->GetSize ()));
+ // If there is any piggybacked data, process it
+ if (p->GetSize ())
+ {
+ ReceivedData (p, tcpHeader);
+ }
+ // Return if FIN is out of sequence, otherwise move to CLOSE_WAIT state by DoPeerClose
+ if (! m_rxBuffer.Finished ())
+ {
+ return;
+ };
+
+ // Simultaneous close: Application invoked Close() when we are processing this FIN packet
+ if (m_state == FIN_WAIT_1)
+ {
+ NS_LOG_INFO ("FIN_WAIT_1 -> CLOSING");
+ m_state = CLOSING;
+ return;
+ }
+
+ DoPeerClose (); // Change state, respond with ACK
+}
+
+/** Received a in-sequence FIN. Close down this socket. */
+void
+TcpSocketBase::DoPeerClose (void)
+{
+ NS_ASSERT (m_state == ESTABLISHED || m_state == SYN_RCVD);
+
+ // Move the state to CLOSE_WAIT
+ NS_LOG_INFO (TcpStateName[m_state] << " -> CLOSE_WAIT");
+ m_state = CLOSE_WAIT;
+
+ if (!m_closeNotified)
+ {
+ // The normal behaviour for an application is that, when the peer sent a in-sequence
+ // FIN, the app should prepare to close. The app has two choices at this point: either
+ // respond with ShutdownSend() call to declare that it has nothing more to send and
+ // the socket can be closed immediately; or remember the peer's close request, wait
+ // until all its existing data are pushed into the TCP socket, then call Close()
+ // explicitly.
+ NS_LOG_LOGIC ("TCP " << this << " calling NotifyNormalClose");
+ if (!m_closeNotified) NotifyNormalClose ();
+ m_closeNotified = true;
+ }
+ if (m_shutdownSend)
+ { // The application declares that it would not sent any more, close this socket
+ Close();
+ }
+ else
+ { // Need to ack, the application will close later
+ SendEmptyPacket (TcpHeader::ACK);
+ }
+ if (m_state == LAST_ACK)
+ {
+ NS_LOG_LOGIC ("TcpSocketBase " << this << " scheduling LATO1");
+ m_lastAckEvent = Simulator::Schedule (m_rtt->RetransmitTimeout (),
+ &TcpSocketBase::LastAckTimeout, this);
+ }
+}
+
+/** Kill this socket. This is a callback function configured to m_endpoint in
+ SetupCallback(), invoked when the endpoint is destroyed. */
+void
+TcpSocketBase::Destroy (void)
+{
+ NS_LOG_FUNCTION (this);
+ m_node = 0;
+ m_endPoint = 0;
+ m_tcp = 0;
+ NS_LOG_LOGIC (this << " Cancelled ReTxTimeout event which was set to expire at " <<
+ (Simulator::Now () + Simulator::GetDelayLeft (m_retxEvent)).GetSeconds ());
+ CancelAllTimers ();
+}
+
+/** Send an empty packet with specified TCP flags */
+void
+TcpSocketBase::SendEmptyPacket (uint8_t flags)
+{
+ NS_LOG_FUNCTION (this << (uint32_t)flags);
+ Ptr<Packet> p = Create<Packet> ();
+ TcpHeader header;
+ SequenceNumber32 s = m_nextTxSequence;
+
+ if (m_endPoint == 0)
+ {
+ NS_LOG_WARN ("Failed to send empty packet due to null endpoint");
+ return;
+ }
+ if (flags & TcpHeader::FIN)
+ {
+ flags |= TcpHeader::ACK;
+ }
+ else if (m_state == FIN_WAIT_1 || m_state == LAST_ACK || m_state == CLOSING)
+ {
+ ++s;
+ }
+
+ header.SetFlags (flags);
+ header.SetSequenceNumber (s);
+ header.SetAckNumber (m_rxBuffer.NextRxSequence ());
+ header.SetSourcePort (m_endPoint->GetLocalPort ());
+ header.SetDestinationPort (m_endPoint->GetPeerPort ());
+ header.SetWindowSize (AdvertisedWindowSize ());
+ m_tcp->SendPacket (p, header, m_endPoint->GetLocalAddress (), m_endPoint->GetPeerAddress (), m_boundnetdevice);
+ m_rto = m_rtt->RetransmitTimeout ();
+ bool hasSyn = flags & TcpHeader::SYN;
+ bool hasFin = flags & TcpHeader::FIN;
+ bool isAck = flags == TcpHeader::ACK;
+ if (hasSyn)
+ { // Exponential backoff of connection time out
+ m_rto = m_cnTimeout;
+ m_cnTimeout = m_cnTimeout + m_cnTimeout;
+ m_cnCount--;
+ }
+ if (flags & TcpHeader::ACK)
+ { // If sending an ACK, cancel the delay ACK as well
+ m_delAckEvent.Cancel ();
+ m_delAckCount = 0;
+ }
+ if (m_retxEvent.IsExpired () && (hasSyn || hasFin) && !isAck )
+ { // Retransmit SYN / SYN+ACK / FIN / FIN+ACK to guard against lost
+ NS_LOG_LOGIC ("Schedule retransmission timeout at time "
+ << Simulator::Now ().GetSeconds () << " to expire at time "
+ << (Simulator::Now () + m_rto.Get ()).GetSeconds ());
+ m_retxEvent = Simulator::Schedule (m_rto, &TcpSocketBase::SendEmptyPacket, this, flags);
+ }
+}
+
+/** This function closes the endpoint completely. Called upon RST_TX action. */
+void
+TcpSocketBase::SendRST (void)
+{
+ NS_LOG_FUNCTION (this);
+ SendEmptyPacket (TcpHeader::RST);
+ NotifyErrorClose ();
+ DeallocateEndPoint ();
+}
+
+/** Deallocate the end point the cancel all the timers */
+void
+TcpSocketBase::DeallocateEndPoint (void)
+{
+ if (m_endPoint != 0)
+ {
+ m_endPoint->SetDestroyCallback (MakeNullCallback<void> ());
+ m_tcp->DeAllocate (m_endPoint);
+ m_endPoint = 0;
+ CancelAllTimers ();
+ }
+}
+
+/** Configure the endpoint to a local address. Called by Connect() if Bind() didn't specify one. */
+int
+TcpSocketBase::SetupEndpoint ()
+{
+ NS_LOG_FUNCTION (this);
+ Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
+ NS_ASSERT (ipv4 != 0);
+ if (ipv4->GetRoutingProtocol () == 0)
+ {
+ NS_FATAL_ERROR ("No Ipv4RoutingProtocol in the node");
+ }
+ // Create a dummy packet, then ask the routing function for the best output
+ // interface's address
+ Ipv4Header header;
+ header.SetDestination (m_endPoint->GetPeerAddress ());
+ Socket::SocketErrno errno_;
+ Ptr<Ipv4Route> route;
+ Ptr<NetDevice> oif = m_boundnetdevice;
+ route = ipv4->GetRoutingProtocol ()->RouteOutput (Ptr<Packet> (), header, oif, errno_);
+ if (route == 0)
+ {
+ NS_LOG_LOGIC ("Route to " << m_endPoint->GetPeerAddress () << " does not exist");
+ NS_LOG_ERROR (errno_);
+ m_errno = errno_;
+ return -1;
+ }
+ NS_LOG_LOGIC ("Route exists");
+ m_endPoint->SetLocalAddress (route->GetSource ());
+ return 0;
+}
+
+/** This function is called only if a SYN received in LISTEN state. After
+ TcpSocketBase cloned, allocate a new end point to handle the incoming
+ connection and send a SYN+ACK to complete the handshake. */
+void
+TcpSocketBase::CompleteFork (Ptr<Packet> p, const TcpHeader& h,
+ const Address& fromAddress, const Address& toAddress)
+{
+ // Get port and address from peer (connecting host)
+ m_endPoint = m_tcp->Allocate (InetSocketAddress::ConvertFrom (toAddress).GetIpv4 (),
+ InetSocketAddress::ConvertFrom (toAddress).GetPort (),
+ InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (),
+ InetSocketAddress::ConvertFrom (fromAddress).GetPort ());
+
+ // Change the cloned socket from LISTEN state to SYN_RCVD
+ NS_LOG_INFO ("LISTEN -> SYN_RCVD");
+ m_state = SYN_RCVD;
+ SetupCallback ();
+ // Set the sequence number and send SYN+ACK
+ m_rxBuffer.SetNextRxSequence (h.GetSequenceNumber () + SequenceNumber32 (1));
+ SendEmptyPacket (TcpHeader::SYN | TcpHeader::ACK);
+}
+
+void
+TcpSocketBase::ConnectionSucceeded ()
+{ // Wrapper to protected function NotifyConnectionSucceeded() so that it can
+ // be called as a scheduled event
+ NotifyConnectionSucceeded ();
+}
+
+// Send as much pending data as possible according to the Tx window. Note that
+// this function did not implement the PSH flag
+bool
+TcpSocketBase::SendPendingData (bool withAck)
+{
+ NS_LOG_FUNCTION (this << withAck);
+ if (m_txBuffer.Size () == 0) return false; // Nothing to send
+ if (m_endPoint == 0)
+ {
+ NS_LOG_INFO ("TcpSocketImpl::SendPendingData: No endpoint; m_shutdownSend=" << m_shutdownSend);
+ return false; // Is this the right way to handle this condition?
+ }
+ uint32_t nPacketsSent = 0;
+ while (m_txBuffer.SizeFromSequence (m_nextTxSequence))
+ {
+ uint32_t w = AvailableWindow (); // Get available window size
+ NS_LOG_LOGIC ("TcpSocketBase " << this << " SendPendingData" <<
+ " w " << w <<
+ " rxwin " << m_rWnd <<
+ " segsize " << m_segmentSize <<
+ " nextTxSeq " << m_nextTxSequence <<
+ " highestRxAck " << m_txBuffer.HeadSequence () <<
+ " pd->Size " << m_txBuffer.Size () <<
+ " pd->SFS " << m_txBuffer.SizeFromSequence (m_nextTxSequence));
+ // Quit if send disallowed
+ if (m_shutdownSend)
+ {
+ m_errno = ERROR_SHUTDOWN;
+ return false;
+ }
+ // Stop sending if we need to wait for a larger Tx window
+ if (w < m_segmentSize && m_txBuffer.SizeFromSequence (m_nextTxSequence) > w)
+ {
+ break; // No more
+ }
+ uint32_t s = std::min (w, m_segmentSize); // Send no more than window
+ Ptr<Packet> p = m_txBuffer.CopyFromSequence (s, m_nextTxSequence);
+ NS_LOG_LOGIC ("TcpSocketBase " << this << " SendPendingData" <<
+ " txseq " << m_nextTxSequence <<
+ " s " << s << " datasize " << p->GetSize ());
+ uint8_t flags = 0;
+ uint32_t sz = p->GetSize (); // Size of packet
+ uint32_t remainingData = m_txBuffer.SizeFromSequence (m_nextTxSequence + SequenceNumber32 (sz));
+ if (m_closeOnEmpty && (remainingData == 0))
+ {
+ flags = TcpHeader::FIN;
+ if (m_state == ESTABLISHED)
+ { // On active close: I am the first one to send FIN
+ NS_LOG_INFO ("ESTABLISHED -> FIN_WAIT_1");
+ m_state = FIN_WAIT_1;
+ }
+ else
+ { // On passive close: Peer sent me FIN already
+ NS_LOG_INFO ("CLOSE_WAIT -> LAST_ACK");
+ m_state = LAST_ACK;
+ }
+ }
+ if (withAck)
+ {
+ flags |= TcpHeader::ACK;
+ }
+ TcpHeader header;
+ header.SetFlags (flags);
+ header.SetSequenceNumber (m_nextTxSequence);
+ header.SetAckNumber (m_rxBuffer.NextRxSequence ());
+ header.SetSourcePort (m_endPoint->GetLocalPort ());
+ header.SetDestinationPort (m_endPoint->GetPeerPort ());
+ header.SetWindowSize (AdvertisedWindowSize ());
+ if (m_retxEvent.IsExpired () )
+ { // Schedule retransmit
+ m_rto = m_rtt->RetransmitTimeout ();
+ NS_LOG_LOGIC (this << " SendPendingData Schedule ReTxTimeout at time " <<
+ Simulator::Now ().GetSeconds () << " to expire at time " <<
+ (Simulator::Now () + m_rto.Get ()).GetSeconds () );
+ m_retxEvent = Simulator::Schedule (m_rto, &TcpSocketBase::ReTxTimeout, this);
+ }
+ NS_LOG_LOGIC ("Send packet via TcpL4Protocol with flags 0x" << std::hex << static_cast<uint32_t> (flags) << std::dec);
+ m_tcp->SendPacket (p, header, m_endPoint->GetLocalAddress (),
+ m_endPoint->GetPeerAddress (), m_boundnetdevice);
+ m_rtt->SentSeq (m_nextTxSequence, sz); // notify the RTT
+ // Notify the application of the data being sent
+ Simulator::ScheduleNow (&TcpSocketBase::NotifyDataSent, this, sz);
+ nPacketsSent++; // Count sent this loop
+ m_nextTxSequence += sz; // Advance next tx sequence
+ // Update highTxMark
+ m_highTxMark = std::max (m_nextTxSequence, m_highTxMark);
+ }
+ NS_LOG_LOGIC ("SendPendingData sent " << nPacketsSent << " packets");
+ return (nPacketsSent > 0);
+}
+
+uint32_t
+TcpSocketBase::UnAckDataCount ()
+{
+ NS_LOG_FUNCTION (this);
+ return m_nextTxSequence.Get () - m_txBuffer.HeadSequence ();
+}
+
+uint32_t
+TcpSocketBase::BytesInFlight ()
+{
+ NS_LOG_FUNCTION (this);
+ return m_highTxMark.Get () - m_txBuffer.HeadSequence ();
+}
+
+uint32_t
+TcpSocketBase::Window ()
+{
+ NS_LOG_FUNCTION (this);
+ return m_rWnd;
+}
+
+uint32_t
+TcpSocketBase::AvailableWindow ()
+{
+ NS_LOG_FUNCTION_NOARGS ();
+ uint32_t unack = UnAckDataCount (); // Number of outstanding bytes
+ uint32_t win = Window (); // Number of bytes allowed to be outstanding
+ NS_LOG_LOGIC ("UnAckCount=" << unack << ", Win=" << win);
+ return (win < unack) ? 0 : (win - unack);
+}
+
+uint16_t
+TcpSocketBase::AdvertisedWindowSize ()
+{
+ uint32_t max = 0xffff;
+ return std::min (m_rxBuffer.MaxBufferSize () - m_rxBuffer.Size (), max);
+}
+
+// Receipt of new packet, put into Rx buffer
+void
+TcpSocketBase::ReceivedData (Ptr<Packet> p, const TcpHeader& tcpHeader)
+{
+ NS_LOG_FUNCTION (this << tcpHeader);
+ NS_LOG_LOGIC ("seq " << tcpHeader.GetSequenceNumber () <<
+ " ack " << tcpHeader.GetAckNumber () <<
+ " pkt size " << p->GetSize () );
+
+ // Put into Rx buffer
+ SequenceNumber32 expectedSeq = m_rxBuffer.NextRxSequence ();
+ if (!m_rxBuffer.Add (p, tcpHeader))
+ { // Insert failed: No data or RX buffer full
+ SendEmptyPacket (TcpHeader::ACK);
+ return;
+ }
+ // Now send a new ACK packet acknowledging all received and delivered data
+ if (tcpHeader.GetSequenceNumber () > expectedSeq)
+ { // Out of sequence packet: Always ACK
+ SendEmptyPacket (TcpHeader::ACK);
+ }
+ else
+ { // In-sequence packet: ACK if delayed ack count allows
+ if (++m_delAckCount >= m_delAckMaxCount)
+ {
+ m_delAckEvent.Cancel ();
+ m_delAckCount = 0;
+ SendEmptyPacket (TcpHeader::ACK);
+ }
+ else if (m_delAckEvent.IsExpired ())
+ {
+ m_delAckEvent = Simulator::Schedule (m_delAckTimeout,
+ &TcpSocketBase::DelAckTimeout, this);
+ }
+ }
+ // Notify app to receive if necessary
+ if (expectedSeq < m_rxBuffer.NextRxSequence ())
+ { // NextRxSeq advanced, we have something to send to the app
+ if (!m_shutdownRecv) NotifyDataRecv ();
+ // Handle exceptions
+ if (m_closeNotified)
+ {
+ NS_LOG_WARN ("Why TCP " << this << " got data after close notification?");
+ }
+ // If we received FIN before and now completed all "holes" in rx buffer,
+ // invoke peer close procedure
+ if (m_rxBuffer.Finished () && (tcpHeader.GetFlags() & TcpHeader::FIN) == 0)
+ {
+ DoPeerClose ();
+ }
+ }
+}
+
+/** Called by ForwardUp() to estimate RTT */
+void
+TcpSocketBase::EstimateRtt (const TcpHeader& tcpHeader)
+{
+ // Use m_rtt for the estimation. Note, RTT of duplicated acknowledgement
+ // (which should be ignored) is handled by m_rtt. Once timestamp option
+ // is implemented, this function would be more elaborated.
+ m_rtt->AckSeq (tcpHeader.GetAckNumber () );
+};
+
+// Called by the ReceivedAck() when new ACK received and by ProcessSynRcvd()
+// when the three-way handshake completed. This cancels retransmission timer
+// and advances Tx window
+void
+TcpSocketBase::NewAck (SequenceNumber32 const& ack)
+{
+ NS_LOG_FUNCTION (this << ack);
+
+ if (m_state != SYN_RCVD)
+ { // Set RTO unless the ACK is received in SYN_RCVD state
+ NS_LOG_LOGIC (this << " Cancelled ReTxTimeout event which was set to expire at " <<
+ (Simulator::Now () + Simulator::GetDelayLeft (m_retxEvent)).GetSeconds ());
+ m_retxEvent.Cancel ();
+ // On recieving a "New" ack we restart retransmission timer .. RFC 2988
+ m_rto = m_rtt->RetransmitTimeout ();
+ NS_LOG_LOGIC (this << " Schedule ReTxTimeout at time " <<
+ Simulator::Now ().GetSeconds () << " to expire at time " <<
+ (Simulator::Now () + m_rto.Get ()).GetSeconds ());
+ m_retxEvent = Simulator::Schedule (m_rto, &TcpSocketBase::ReTxTimeout, this);
+ }
+ if (m_rWnd.Get () == 0 && m_persistEvent.IsExpired ())
+ { // Zero window: Enter persist state to send 1 byte to probe
+ NS_LOG_LOGIC (this << "Enter zerowindow persist state");
+ NS_LOG_LOGIC (this << "Cancelled ReTxTimeout event which was set to expire at " <<
+ (Simulator::Now () + Simulator::GetDelayLeft (m_retxEvent)).GetSeconds ());
+ m_retxEvent.Cancel ();
+ NS_LOG_LOGIC ("Schedule persist timeout at time " <<
+ Simulator::Now ().GetSeconds () << " to expire at time " <<
+ (Simulator::Now () + m_persistTimeout).GetSeconds ());
+ m_persistEvent = Simulator::Schedule (m_persistTimeout, &TcpSocketBase::PersistTimeout, this);
+ NS_ASSERT (m_persistTimeout == Simulator::GetDelayLeft (m_persistEvent));
+ }
+ // Note the highest ACK and tell app to send more
+ NS_LOG_LOGIC ("TCP " << this << " NewAck " << ack <<
+ " numberAck " << (ack - m_txBuffer.HeadSequence ())); // Number bytes ack'ed
+ m_txBuffer.DiscardUpTo (ack);
+ if (GetTxAvailable () > 0)
+ {
+ NotifySend (GetTxAvailable ());
+ }
+ if (ack > m_nextTxSequence)
+ {
+ m_nextTxSequence = ack; // If advanced
+ }
+ if (m_txBuffer.Size () == 0 && m_state != FIN_WAIT_1 && m_state != CLOSING)
+ { // No retransmit timer if no data to retransmit
+ NS_LOG_LOGIC (this << " Cancelled ReTxTimeout event which was set to expire at " <<
+ (Simulator::Now () + Simulator::GetDelayLeft (m_retxEvent)).GetSeconds ());
+ m_retxEvent.Cancel ();
+ }
+ // Try to send more data
+ SendPendingData (m_connected);
+}
+
+// Retransmit timeout
+void
+TcpSocketBase::ReTxTimeout ()
+{
+ NS_LOG_FUNCTION (this);
+ NS_LOG_LOGIC (this << " ReTxTimeout Expired at time " << Simulator::Now ().GetSeconds ());
+ // If erroneous timeout in closed/timed-wait state, just return
+ if (m_state == CLOSED || m_state == TIME_WAIT) return;
+ // If all data are received, just return
+ if (m_state <= ESTABLISHED && m_txBuffer.HeadSequence () >= m_nextTxSequence) return;
+
+ Retransmit ();
+}
+
+void
+TcpSocketBase::DelAckTimeout (void)
+{
+ m_delAckCount = 0;
+ SendEmptyPacket (TcpHeader::ACK);
+}
+
+void
+TcpSocketBase::LastAckTimeout (void)
+{
+ NS_LOG_FUNCTION (this);
+
+ m_lastAckEvent.Cancel ();
+ if (m_state == LAST_ACK)
+ {
+ CloseAndNotify ();
+ }
+ if (!m_closeNotified)
+ {
+ m_closeNotified = true;
+ }
+}
+
+// Send 1-byte data to probe for the window size at the receiver when
+// the local knowledge tells that the receiver has zero window size
+// C.f.: RFC793 p.42, RFC1112 sec.4.2.2.17
+void
+TcpSocketBase::PersistTimeout ()
+{
+ NS_LOG_LOGIC ("PersistTimeout expired at " << Simulator::Now ().GetSeconds ());
+ m_persistTimeout = std::min (Seconds (60), Scalar (2) * m_persistTimeout); // max persist timeout = 60s
+ Ptr<Packet> p = m_txBuffer.CopyFromSequence (1, m_nextTxSequence);
+ TcpHeader tcpHeader;
+ tcpHeader.SetSequenceNumber (m_nextTxSequence);
+ tcpHeader.SetAckNumber (m_rxBuffer.NextRxSequence ());
+ tcpHeader.SetSourcePort (m_endPoint->GetLocalPort ());
+ tcpHeader.SetDestinationPort (m_endPoint->GetPeerPort ());
+ tcpHeader.SetWindowSize (AdvertisedWindowSize ());
+
+ m_tcp->SendPacket (p, tcpHeader, m_endPoint->GetLocalAddress (),
+ m_endPoint->GetPeerAddress (), m_boundnetdevice);
+ NS_LOG_LOGIC ("Schedule persist timeout at time "
+ << Simulator::Now ().GetSeconds () << " to expire at time "
+ << (Simulator::Now () + m_persistTimeout).GetSeconds ());
+ m_persistEvent = Simulator::Schedule (m_persistTimeout, &TcpSocketBase::PersistTimeout, this);
+}
+
+void
+TcpSocketBase::Retransmit ()
+{
+ m_nextTxSequence = m_txBuffer.HeadSequence (); // Start from highest Ack
+ m_rtt->IncreaseMultiplier (); // Double the timeout value for next retx timer
+ m_dupAckCount = 0;
+ DoRetransmit (); // Retransmit the packet
+}
+
+void
+TcpSocketBase::DoRetransmit ()
+{
+ NS_LOG_FUNCTION (this);
+ uint8_t flags = TcpHeader::ACK;
+ // Retransmit SYN packet
+ if (m_state == SYN_SENT)
+ {
+ if (m_cnCount > 0)
+ {
+ SendEmptyPacket (TcpHeader::SYN);
+ }
+ else
+ {
+ NotifyConnectionFailed ();
+ }
+ return;
+ }
+ // Retransmit non-data packet: Only if in FIN_WAIT_1 or CLOSING state
+ if (m_txBuffer.Size () == 0)
+ {
+ if (m_state == FIN_WAIT_1 || m_state == CLOSING)
+ { // Must have lost FIN, re-send
+ SendEmptyPacket (TcpHeader::FIN);
+ }
+ return;
+ }
+ // Retransmit a data packet: Extract data
+ Ptr<Packet> p = m_txBuffer.CopyFromSequence (m_segmentSize, m_txBuffer.HeadSequence ());
+ // Close-on-Empty check
+ if (m_closeOnEmpty && m_txBuffer.Size () == p->GetSize ())
+ {
+ flags |= TcpHeader::FIN;
+ }
+ // Reset transmission timeout
+ NS_LOG_LOGIC ("TcpSocketBase " << this << " retxing seq " << m_txBuffer.HeadSequence ());
+ if (m_retxEvent.IsExpired ())
+ {
+ m_rto = m_rtt->RetransmitTimeout ();
+ NS_LOG_LOGIC (this << " Schedule ReTxTimeout at time " <<
+ Simulator::Now ().GetSeconds () << " to expire at time " <<
+ (Simulator::Now () + m_rto.Get ()).GetSeconds ());
+ m_retxEvent = Simulator::Schedule (m_rto, &TcpSocketBase::ReTxTimeout, this);
+ }
+ m_rtt->SentSeq (m_txBuffer.HeadSequence (), p->GetSize ());
+ // And send the packet
+ TcpHeader tcpHeader;
+ tcpHeader.SetSequenceNumber (m_txBuffer.HeadSequence ());
+ tcpHeader.SetAckNumber (m_rxBuffer.NextRxSequence ());
+ tcpHeader.SetSourcePort (m_endPoint->GetLocalPort ());
+ tcpHeader.SetDestinationPort (m_endPoint->GetPeerPort ());
+ tcpHeader.SetFlags (flags);
+ tcpHeader.SetWindowSize (AdvertisedWindowSize ());
+
+ m_tcp->SendPacket (p, tcpHeader, m_endPoint->GetLocalAddress (),
+ m_endPoint->GetPeerAddress (), m_boundnetdevice);
+}
+
+void
+TcpSocketBase::CancelAllTimers ()
+{
+ m_retxEvent.Cancel ();
+ m_persistEvent.Cancel ();
+ m_delAckEvent.Cancel ();
+ m_lastAckEvent.Cancel ();
+}
+
+/** Below are the attribute get/set functions */
+
+void
+TcpSocketBase::SetSndBufSize (uint32_t size)
+{
+ m_txBuffer.SetMaxBufferSize (size);
+}
+
+uint32_t
+TcpSocketBase::GetSndBufSize (void) const
+{
+ return m_txBuffer.MaxBufferSize ();
+}
+
+void
+TcpSocketBase::SetRcvBufSize (uint32_t size)
+{
+ m_rxBuffer.SetMaxBufferSize (size);
+}
+
+uint32_t
+TcpSocketBase::GetRcvBufSize (void) const
+{
+ return m_rxBuffer.MaxBufferSize ();
+}
+
+void
+TcpSocketBase::SetSegSize (uint32_t size)
+{
+ m_segmentSize = size;
+ NS_ABORT_MSG_UNLESS (m_state == CLOSED, "Cannot change segment size dynamically.");
+}
+
+uint32_t
+TcpSocketBase::GetSegSize (void) const
+{
+ return m_segmentSize;
+}
+
+void
+TcpSocketBase::SetConnTimeout (Time timeout)
+{
+ m_cnTimeout = timeout;
+}
+
+Time
+TcpSocketBase::GetConnTimeout (void) const
+{
+ return m_cnTimeout;
+}
+
+void
+TcpSocketBase::SetConnCount (uint32_t count)
+{
+ m_cnCount = count;
+}
+
+uint32_t
+TcpSocketBase::GetConnCount (void) const
+{
+ return m_cnCount;
+}
+
+void
+TcpSocketBase::SetDelAckTimeout (Time timeout)
+{
+ m_delAckTimeout = timeout;
+}
+
+Time
+TcpSocketBase::GetDelAckTimeout (void) const
+{
+ return m_delAckTimeout;
+}
+
+void
+TcpSocketBase::SetDelAckMaxCount (uint32_t count)
+{
+ m_delAckMaxCount = count;
+}
+
+uint32_t
+TcpSocketBase::GetDelAckMaxCount (void) const
+{
+ return m_delAckMaxCount;
+}
+
+void
+TcpSocketBase::SetPersistTimeout (Time timeout)
+{
+ m_persistTimeout = timeout;
+}
+
+Time
+TcpSocketBase::GetPersistTimeout (void) const
+{
+ return m_persistTimeout;
+}
+
+bool
+TcpSocketBase::SetAllowBroadcast (bool allowBroadcast)
+{
+ // Broadcast is not implemented. Return true only if allowBroadcast==false
+ return (! allowBroadcast);
+}
+
+bool
+TcpSocketBase::GetAllowBroadcast () const
+{
+ return false;
+}
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/internet-stack/tcp-socket-base.h Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,222 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Adrian Sai-wah Tam
+ *
+ * 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: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
+ */
+#ifndef TCP_SOCKET_BASE_H
+#define TCP_SOCKET_BASE_H
+
+#include <stdint.h>
+#include <queue>
+#include "ns3/callback.h"
+#include "ns3/traced-value.h"
+#include "ns3/tcp-socket.h"
+#include "ns3/ptr.h"
+#include "ns3/ipv4-address.h"
+#include "ns3/ipv4-header.h"
+#include "ns3/ipv4-interface.h"
+#include "ns3/event-id.h"
+#include "tcp-tx-buffer.h"
+#include "tcp-rx-buffer.h"
+#include "rtt-estimator.h"
+
+namespace ns3 {
+
+class Ipv4EndPoint;
+class Node;
+class Packet;
+class TcpL4Protocol;
+class TcpHeader;
+
+/**
+ * \ingroup socket
+ * \ingroup tcp
+ *
+ * \brief A base class for implementation of a stream socket using TCP.
+ *
+ * This class contains the essential components of TCP, as well as a sockets
+ * interface for upper layers to call. This serves as a base for other TCP
+ * functions where the sliding window mechanism is handled here. This class
+ * provides connection orientation and sliding window flow control. Part of
+ * this class is modified from the original NS-3 TCP socket implementation
+ * (TcpSocketImpl) by Raj Bhattacharjea.
+ */
+class TcpSocketBase : public TcpSocket
+{
+public:
+ static TypeId GetTypeId (void);
+ /**
+ * Create an unbound TCP socket
+ */
+ TcpSocketBase (void);
+
+ /**
+ * Clone a TCP socket, for use upon receiving a connection request in LISTEN state
+ */
+ TcpSocketBase (const TcpSocketBase& sock);
+ virtual ~TcpSocketBase (void);
+
+ // Set associated Node, TcpL4Protocol, RttEstimator to this socket
+ virtual void SetNode (Ptr<Node> node);
+ virtual void SetTcp (Ptr<TcpL4Protocol> tcp);
+ virtual void SetRtt (Ptr<RttEstimator> rtt);
+
+ // Necessary implementations of null functions from ns3::Socket
+ virtual enum SocketErrno GetErrno (void) const; // returns m_errno
+ virtual enum SocketType GetSocketType (void) const;// returns socket type
+ virtual Ptr<Node> GetNode (void) const; // returns m_node
+ virtual int Bind (void); // Bind a socket by setting up endpoint in TcpL4Protocol
+ virtual int Bind (const Address &address); // ... endpoint of specific addr or port
+ virtual int Connect (const Address &address); // Setup endpoint and call ProcessAction() to connect
+ virtual int Listen (void); // Verify the socket is in a correct state and call ProcessAction() to listen
+ virtual int Close (void); // Close by app: Kill socket upon tx buffer emptied
+ virtual int ShutdownSend (void); // Assert the m_shutdownSend flag to prevent send to network
+ virtual int ShutdownRecv (void); // Assert the m_shutdownRecv flag to prevent forward to app
+ virtual int Send (Ptr<Packet> p, uint32_t flags); // Call by app to send data to network
+ virtual int SendTo (Ptr<Packet> p, uint32_t flags, const Address &toAddress); // Same as Send(), toAddress is insignificant
+ virtual Ptr<Packet> Recv (uint32_t maxSize, uint32_t flags); // Return a packet to be forwarded to app
+ virtual Ptr<Packet> RecvFrom (uint32_t maxSize, uint32_t flags, Address &fromAddress); // ... and write the remote address at fromAddress
+ virtual uint32_t GetTxAvailable (void) const; // Available Tx buffer size
+ virtual uint32_t GetRxAvailable (void) const; // Available-to-read data size, i.e. value of m_rxAvailable
+ virtual int GetSockName (Address &address) const; // Return local addr:port in address
+ virtual void BindToNetDevice (Ptr<NetDevice> netdevice); // NetDevice with my m_endPoint
+
+protected:
+ // Implementing ns3::TcpSocket -- Attribute get/set
+ virtual void SetSndBufSize (uint32_t size);
+ virtual uint32_t GetSndBufSize (void) const;
+ virtual void SetRcvBufSize (uint32_t size);
+ virtual uint32_t GetRcvBufSize (void) const;
+ virtual void SetSegSize (uint32_t size);
+ virtual uint32_t GetSegSize (void) const;
+ virtual void SetSSThresh (uint32_t threshold) = 0;
+ virtual uint32_t GetSSThresh (void) const = 0;
+ virtual void SetInitialCwnd (uint32_t cwnd) = 0;
+ virtual uint32_t GetInitialCwnd (void) const = 0;
+ virtual void SetConnTimeout (Time timeout);
+ virtual Time GetConnTimeout (void) const;
+ virtual void SetConnCount (uint32_t count);
+ virtual uint32_t GetConnCount (void) const;
+ virtual void SetDelAckTimeout (Time timeout);
+ virtual Time GetDelAckTimeout (void) const;
+ virtual void SetDelAckMaxCount (uint32_t count);
+ virtual uint32_t GetDelAckMaxCount (void) const;
+ virtual void SetPersistTimeout (Time timeout);
+ virtual Time GetPersistTimeout (void) const;
+ virtual bool SetAllowBroadcast (bool allowBroadcast);
+ virtual bool GetAllowBroadcast () const;
+
+ // Helper functions: Connection set up
+ int SetupCallback (void); // Common part of the two Bind(), i.e. set callback and remembering local addr:port
+ int DoConnect (void); // Sending a SYN packet to make a connection if the state allows
+ void ConnectionSucceeded (void); // Schedule-friendly wrapper for Socket::NotifyConnectionSucceeded()
+ int SetupEndpoint (void); // Configure m_endpoint for local addr for given remote addr
+ void CompleteFork (Ptr<Packet>, const TcpHeader&, const Address& fromAddress, const Address& toAdress);
+
+ // Helper functions: Transfer operation
+ void ForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port, Ptr<Ipv4Interface> incomingInterface); //Get a pkt from L3
+ bool SendPendingData (bool withAck = false); // Send as much as the window allows
+ void SendEmptyPacket (uint8_t flags); // Send a empty packet that carries a flag, e.g. ACK
+ void SendRST (void); // Send reset and tear down this socket
+ bool OutOfRange (SequenceNumber32 s) const; // Check if a sequence number is within rx window
+
+ // Helper functions: Connection close
+ int DoClose (void); // Close a socket by sending RST, FIN, or FIN+ACK, depend on the current state
+ void CloseAndNotify (void); // To CLOSED state, notify upper layer, and deallocate end point
+ void Destroy (void); // Kill this socket by zeroing its attributes
+ void DeallocateEndPoint (void); // Deallocate m_endPoint
+ void PeerClose (Ptr<Packet>, const TcpHeader&); // Received a FIN from peer, notify rx buffer
+ void DoPeerClose (void); // FIN is in sequence, notify app and respond with a FIN
+ void CancelAllTimers (void); // Cancel all timer when endpoint is deleted
+
+ // State transition functions
+ void ProcessEstablished (Ptr<Packet>, const TcpHeader&); // Received a packet upon ESTABLISHED state
+ void ProcessListen (Ptr<Packet>, const TcpHeader&, const Address&, const Address&); // Process the newly received ACK
+ void ProcessSynSent (Ptr<Packet>, const TcpHeader&); // Received a packet upon SYN_SENT
+ void ProcessSynRcvd (Ptr<Packet>, const TcpHeader&, const Address&, const Address&); // Received a packet upon SYN_RCVD
+ void ProcessWait (Ptr<Packet>, const TcpHeader&); // Received a packet upon CLOSE_WAIT, FIN_WAIT_1, FIN_WAIT_2
+ void ProcessClosing (Ptr<Packet>, const TcpHeader&); // Received a packet upon CLOSING
+ void ProcessLastAck (Ptr<Packet>, const TcpHeader&); // Received a packet upon LAST_ACK
+
+ // Window management
+ virtual uint32_t UnAckDataCount (void); // Return count of number of unacked bytes
+ virtual uint32_t BytesInFlight (void); // Return total bytes in flight
+ virtual uint32_t Window (void); // Return the max possible number of unacked bytes
+ virtual uint32_t AvailableWindow (void); // Return unfilled portion of window
+ virtual uint16_t AdvertisedWindowSize (void); // The amount of Rx window announced to the peer
+
+ // Manage data tx/rx
+ virtual Ptr<TcpSocketBase> Fork (void) = 0; // Call CopyObject<> to clone me
+ virtual void ReceivedAck (Ptr<Packet>, const TcpHeader&); // Received an ACK packet
+ virtual void ReceivedData (Ptr<Packet>, const TcpHeader&); // Recv of a data, put into buffer, call L7 to get it if necessary
+ virtual void EstimateRtt (const TcpHeader&); // RTT accounting
+ virtual void NewAck (SequenceNumber32 const& seq); // Update buffers w.r.t. ACK
+ virtual void DupAck (const TcpHeader& t, uint32_t count) = 0; // Received dupack
+ virtual void ReTxTimeout (void); // Call Retransmit() upon RTO event
+ virtual void Retransmit (void); // Halving cwnd and call DoRetransmit()
+ virtual void DelAckTimeout (void); // Action upon delay ACK timeout, i.e. send an ACK
+ virtual void LastAckTimeout (void); // Timeout at LAST_ACK, close the connection
+ virtual void PersistTimeout (void); // Send 1 byte probe to get an updated window size
+ virtual void DoRetransmit (void); // Retransmit the oldest packet
+
+protected:
+ // Counters and events
+ EventId m_retxEvent; //< Retransmission event
+ EventId m_lastAckEvent; //< Last ACK timeout event
+ EventId m_delAckEvent; //< Delayed ACK timeout event
+ EventId m_persistEvent; //< Persist event: Send 1 byte to probe for a non-zero Rx window
+ uint32_t m_dupAckCount; //< Dupack counter
+ uint32_t m_delAckCount; //< Delayed ACK counter
+ uint32_t m_delAckMaxCount; //< Number of packet to fire an ACK before delay timeout
+ uint32_t m_cnCount; //< Count of remaining connection retries
+ TracedValue<Time> m_rto; //< Retransmit timeout
+ TracedValue<Time> m_lastRtt; //< Last RTT sample collected
+ Time m_delAckTimeout; //< Time to delay an ACK
+ Time m_persistTimeout; //< Time between sending 1-byte probes
+ Time m_cnTimeout; //< Timeout for connection retry
+
+ // Connections to other layers of TCP/IP
+ Ipv4EndPoint* m_endPoint;
+ Ptr<Node> m_node;
+ Ptr<TcpL4Protocol> m_tcp;
+
+ // Round trip time estimation
+ Ptr<RttEstimator> m_rtt;
+
+ // Rx and Tx buffer management
+ TracedValue<SequenceNumber32> m_nextTxSequence; //< Next seqnum to be sent (SND.NXT), ReTx pushes it back
+ TracedValue<SequenceNumber32> m_highTxMark; //< Highest seqno ever sent, regardless of ReTx
+ TcpRxBuffer m_rxBuffer; //< Rx buffer (reordering buffer)
+ TcpTxBuffer m_txBuffer; //< Tx buffer
+
+ // State-related attributes
+ TracedValue<TcpStates_t> m_state; //< TCP state
+ enum SocketErrno m_errno; //< Socket error code
+ bool m_closeNotified; //< Told app to close socket
+ bool m_closeOnEmpty; //< Close socket upon tx buffer emptied
+ bool m_shutdownSend; //< Send no longer allowed
+ bool m_shutdownRecv; //< Receive no longer allowed
+ bool m_connected; //< Connection established
+
+ // Window management
+ uint32_t m_segmentSize; //< Segment size
+ TracedValue<uint32_t> m_rWnd; //< Flow control window at remote side
+};
+
+} // namespace ns3
+
+#endif /* TCP_SOCKET_BASE_H */
--- a/src/internet-stack/tcp-socket-impl.cc Tue Dec 21 17:39:54 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1871 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 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: Raj Bhattacharjea <raj.b@gatech.edu>
- */
-
-#define NS_LOG_APPEND_CONTEXT \
- if (m_node) { std::clog << Simulator::Now ().GetSeconds () << " [node " << m_node->GetId () << "] "; }
-
-#include "ns3/abort.h"
-#include "ns3/node.h"
-#include "ns3/inet-socket-address.h"
-#include "ns3/log.h"
-#include "ns3/ipv4.h"
-#include "ns3/ipv4-interface-address.h"
-#include "ns3/ipv4-route.h"
-#include "ns3/ipv4-routing-protocol.h"
-#include "ns3/simulation-singleton.h"
-#include "ns3/simulator.h"
-#include "ns3/packet.h"
-#include "ns3/uinteger.h"
-#include "ns3/trace-source-accessor.h"
-#include "tcp-typedefs.h"
-#include "tcp-socket-impl.h"
-#include "tcp-l4-protocol.h"
-#include "ipv4-end-point.h"
-#include "tcp-header.h"
-#include "rtt-estimator.h"
-
-#include <algorithm>
-
-NS_LOG_COMPONENT_DEFINE ("TcpSocketImpl");
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED (TcpSocketImpl);
-
-TypeId
-TcpSocketImpl::GetTypeId ()
-{
- static TypeId tid = TypeId("ns3::TcpSocketImpl")
- .SetParent<TcpSocket> ()
- .AddTraceSource ("CongestionWindow",
- "The TCP connection's congestion window",
- MakeTraceSourceAccessor (&TcpSocketImpl::m_cWnd))
- ;
- return tid;
-}
-
- TcpSocketImpl::TcpSocketImpl ()
- : m_skipRetxResched (false),
- m_dupAckCount (0),
- m_delAckCount (0),
- m_endPoint (0),
- m_node (0),
- m_tcp (0),
- m_errno (ERROR_NOTERROR),
- m_shutdownSend (false),
- m_shutdownRecv (false),
- m_connected (false),
- m_state (CLOSED),
- m_closeNotified (false),
- m_closeRequestNotified (false),
- m_closeOnEmpty (false),
- m_pendingClose (false),
- m_nextTxSequence (0),
- m_highTxMark (0),
- m_highestRxAck (0),
- m_lastRxAck (0),
- m_nextRxSequence (0),
- m_finSequence (0),
- m_rxAvailable (0),
- m_rxBufSize (0),
- m_pendingData (0),
- m_segmentSize (0), // For attribute initialization consistency (quiet valgrind)
- m_rxWindowSize (0),
- m_initialCWnd (0), // For attribute initialization consistency (quiet valgrind)
- m_persistTime (Seconds(6)), //XXX hook this into attributes?
- m_rtt (0),
- m_lastMeasuredRtt (Seconds(0.0))
-{
- NS_LOG_FUNCTION (this);
-}
-
-TcpSocketImpl::TcpSocketImpl(const TcpSocketImpl& sock)
- : TcpSocket(sock), //copy object::m_tid, copy socket::callbacks
- m_skipRetxResched (sock.m_skipRetxResched),
- m_dupAckCount (sock.m_dupAckCount),
- m_delAckCount (0),
- m_delAckMaxCount (sock.m_delAckMaxCount),
- m_delAckTimeout (sock.m_delAckTimeout),
- m_endPoint (0),
- m_node (sock.m_node),
- m_tcp (sock.m_tcp),
- m_errno (sock.m_errno),
- m_shutdownSend (sock.m_shutdownSend),
- m_shutdownRecv (sock.m_shutdownRecv),
- m_connected (sock.m_connected),
- m_state (sock.m_state),
- m_closeNotified (sock.m_closeNotified),
- m_closeRequestNotified (sock.m_closeRequestNotified),
- m_closeOnEmpty (sock.m_closeOnEmpty),
- m_pendingClose (sock.m_pendingClose),
- m_nextTxSequence (sock.m_nextTxSequence),
- m_highTxMark (sock.m_highTxMark),
- m_highestRxAck (sock.m_highestRxAck),
- m_lastRxAck (sock.m_lastRxAck),
- m_nextRxSequence (sock.m_nextRxSequence),
- m_finSequence (sock.m_finSequence),
- m_rxAvailable (0),
- m_rxBufSize (0),
- m_pendingData (0),
- m_segmentSize (sock.m_segmentSize),
- m_rxWindowSize (sock.m_rxWindowSize),
- m_cWnd (sock.m_cWnd),
- m_ssThresh (sock.m_ssThresh),
- m_initialCWnd (sock.m_initialCWnd),
- m_persistTime (sock.m_persistTime),
- m_rtt (0),
- m_lastMeasuredRtt (Seconds(0.0)),
- m_cnTimeout (sock.m_cnTimeout),
- m_cnCount (sock.m_cnCount),
- m_sndBufSize (sock.m_sndBufSize),
- m_rxBufMaxSize(sock.m_rxBufMaxSize)
-{
- NS_LOG_FUNCTION_NOARGS ();
- NS_LOG_LOGIC("Invoked the copy constructor");
- //copy the pending data if necessary
- if(sock.m_pendingData)
- {
- m_pendingData = sock.m_pendingData->Copy();
- }
- //copy the rtt if necessary
- if (sock.m_rtt)
- {
- m_rtt = sock.m_rtt->Copy();
- }
- //null out the socket base class callbacks,
- //make user of the socket register this explicitly
- Callback<void, Ptr< Socket > > vPS =
- MakeNullCallback<void, Ptr<Socket> > ();
- Callback<void, Ptr<Socket>, const Address &> vPSA =
- MakeNullCallback<void, Ptr<Socket>, const Address &> ();
- Callback<void, Ptr<Socket>, uint32_t> vPSUI =
- MakeNullCallback<void, Ptr<Socket>, uint32_t> ();
-
- SetConnectCallback (vPS, vPS);
- SetDataSentCallback (vPSUI);
- SetSendCallback (vPSUI);
- SetRecvCallback (vPS);
- //can't "copy" the endpoint just yes, must do this when we know the peer info
- //too; this is in SYN_ACK_TX
-}
-
-TcpSocketImpl::~TcpSocketImpl ()
-{
- NS_LOG_FUNCTION(this);
- m_node = 0;
- if (m_endPoint != 0)
- {
- NS_ASSERT (m_tcp != 0);
- /*
- * Note that this piece of code is seriously convoluted: When we do a
- * Bind we allocate an Ipv4Endpoint. Immediately thereafter we always do
- * a FinishBind which sets the DestroyCallback of that endpoint to be
- * TcpSocketImpl::Destroy, below. When m_tcp->DeAllocate is called, it
- * will in turn call into Ipv4EndpointDemux::DeAllocate with the endpoint
- * (m_endPoint). The demux will look up the endpoint and destroy it (the
- * corollary is that we don't own the object pointed to by m_endpoint, we
- * just borrowed it). The destructor for the endpoint will call the
- * DestroyCallback which will then invoke TcpSocketImpl::Destroy below.
- * Destroy will zero m_node, m_tcp and m_endpoint. The zero of m_node and
- * m_tcp need to be here also in case the endpoint is deallocated before
- * shutdown.
- */
- NS_ASSERT (m_endPoint != 0);
- m_tcp->DeAllocate (m_endPoint);
- NS_ASSERT (m_endPoint == 0);
- }
- m_tcp = 0;
- delete m_pendingData; //prevents leak
- m_pendingData = 0;
- CancelAllTimers();
-}
-
-void
-TcpSocketImpl::SetNode (Ptr<Node> node)
-{
- m_node = node;
- /*
- * Set the congestion window to IW. This method is called from the L4
- * Protocol after it creates the socket. The Attribute system takes
- * care of setting m_initialCWnd and m_segmentSize to their default
- * values. m_cWnd depends on m_initialCwnd and m_segmentSize so it
- * also needs to be updated in SetInitialCwnd and SetSegSize.
- */
- m_cWnd = m_initialCWnd * m_segmentSize;
-}
-
-void
-TcpSocketImpl::SetTcp (Ptr<TcpL4Protocol> tcp)
-{
- m_tcp = tcp;
-}
-void
-TcpSocketImpl::SetRtt (Ptr<RttEstimator> rtt)
-{
- m_rtt = rtt;
-}
-
-
-enum Socket::SocketErrno
-TcpSocketImpl::GetErrno (void) const
-{
- NS_LOG_FUNCTION_NOARGS ();
- return m_errno;
-}
-
-Ptr<Node>
-TcpSocketImpl::GetNode (void) const
-{
- NS_LOG_FUNCTION_NOARGS ();
- return m_node;
-}
-
-void
-TcpSocketImpl::Destroy (void)
-{
- NS_LOG_FUNCTION_NOARGS ();
- m_node = 0;
- m_endPoint = 0;
- m_tcp = 0;
- NS_LOG_LOGIC (this<<" Cancelled ReTxTimeout event which was set to expire at "
- << (Simulator::Now () +
- Simulator::GetDelayLeft (m_retxEvent)).GetSeconds());
- CancelAllTimers();
-}
-
-int
-TcpSocketImpl::FinishBind (void)
-{
- NS_LOG_FUNCTION_NOARGS ();
- if (m_endPoint == 0)
- {
- return -1;
- }
- m_endPoint->SetRxCallback (MakeCallback (&TcpSocketImpl::ForwardUp, Ptr<TcpSocketImpl>(this)));
- m_endPoint->SetDestroyCallback (MakeCallback (&TcpSocketImpl::Destroy, Ptr<TcpSocketImpl>(this)));
- return 0;
-}
-
-int
-TcpSocketImpl::Bind (void)
-{
- NS_LOG_FUNCTION_NOARGS ();
- m_endPoint = m_tcp->Allocate ();
- return FinishBind ();
-}
-int
-TcpSocketImpl::Bind (const Address &address)
-{
- NS_LOG_FUNCTION (this<<address);
- if (!InetSocketAddress::IsMatchingType (address))
- {
- m_errno = ERROR_INVAL;
- return -1;
- }
- InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
- Ipv4Address ipv4 = transport.GetIpv4 ();
- uint16_t port = transport.GetPort ();
- if (ipv4 == Ipv4Address::GetAny () && port == 0)
- {
- m_endPoint = m_tcp->Allocate ();
- NS_LOG_LOGIC ("TcpSocketImpl "<<this<<" got an endpoint: "<<m_endPoint);
- }
- else if (ipv4 == Ipv4Address::GetAny () && port != 0)
- {
- m_endPoint = m_tcp->Allocate (port);
- NS_LOG_LOGIC ("TcpSocketImpl "<<this<<" got an endpoint: "<<m_endPoint);
- }
- else if (ipv4 != Ipv4Address::GetAny () && port == 0)
- {
- m_endPoint = m_tcp->Allocate (ipv4);
- NS_LOG_LOGIC ("TcpSocketImpl "<<this<<" got an endpoint: "<<m_endPoint);
- }
- else if (ipv4 != Ipv4Address::GetAny () && port != 0)
- {
- m_endPoint = m_tcp->Allocate (ipv4, port);
- NS_LOG_LOGIC ("TcpSocketImpl "<<this<<" got an endpoint: "<<m_endPoint);
- }
-
- return FinishBind ();
-}
-
-int
-TcpSocketImpl::ShutdownSend (void)
-{
- NS_LOG_FUNCTION_NOARGS ();
- m_shutdownSend = true;
- return 0;
-}
-int
-TcpSocketImpl::ShutdownRecv (void)
-{
- NS_LOG_FUNCTION_NOARGS ();
- m_shutdownRecv = true;
- return 0;
-}
-
-int
-TcpSocketImpl::Close (void)
-{
- NS_LOG_FUNCTION_NOARGS ();
- // First we check to see if there is any unread rx data
- // Bug number 426 claims we should send reset in this case.
- if (!m_bufferedData.empty())
- {
- SendRST();
- return 0;
- }
-
- uint32_t remainingData = 0;
- if (m_pendingData)
- {
- remainingData = m_pendingData->SizeFromSeq (m_firstPendingSequence,
- m_nextTxSequence);
- }
-
- if (remainingData != 0)
- { // App close with pending data must wait until all data transmitted
- m_closeOnEmpty = true;
- NS_LOG_LOGIC("Socket " << this <<
- " deferring close, state " << m_state);
- return 0;
- }
- Actions_t action = ProcessEvent (APP_CLOSE);
- ProcessAction (action);
- return 0;
-}
-
-int
-TcpSocketImpl::Connect (const Address & address)
-{
- NS_LOG_FUNCTION (this << address);
-
- Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
- NS_ASSERT (ipv4 != 0);
-
- if (m_endPoint == 0)
- {
- if (Bind () == -1)
- {
- NS_ASSERT (m_endPoint == 0);
- return -1;
- }
- NS_ASSERT (m_endPoint != 0);
- }
- InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
- m_endPoint->SetPeer(transport.GetIpv4 (), transport.GetPort ());
-
- if (ipv4->GetRoutingProtocol () != 0)
- {
- Ipv4Header header;
- header.SetDestination (m_endPoint->GetPeerAddress());
- Socket::SocketErrno errno_;
- Ptr<Ipv4Route> route;
- Ptr<NetDevice> oif = m_boundnetdevice; //specify non-zero if bound to a source address
- // XXX here, cache the route in the endpoint?
- route = ipv4->GetRoutingProtocol ()->RouteOutput (Ptr<Packet> (), header, oif, errno_);
- if (route != 0)
- {
- NS_LOG_LOGIC ("Route exists");
- m_endPoint->SetLocalAddress (route->GetSource ());
- }
- else
- {
- NS_LOG_LOGIC ("TcpSocketImpl::Connect(): Route to " << m_endPoint->GetPeerAddress() << " does not exist");
- NS_LOG_ERROR (errno_);
- m_errno = errno_;
- return -1;
- }
- }
- else
- {
- NS_FATAL_ERROR ("No Ipv4RoutingProtocol in the node");
- }
-
- Actions_t action = ProcessEvent (APP_CONNECT);
- bool success = ProcessAction (action);
- if (success)
- {
- return 0;
- }
- return -1;
-}
-
-//p here is just data, no headers
-int
-TcpSocketImpl::Send (Ptr<Packet> p, uint32_t flags)
-{
- NS_LOG_FUNCTION (this << p);
- if (m_state == ESTABLISHED || m_state == SYN_SENT || m_state == CLOSE_WAIT)
- {
- if (p->GetSize() > GetTxAvailable ())
- {
- m_errno = ERROR_MSGSIZE;
- return -1;
- }
- if (!m_pendingData)
- {
- m_pendingData = new PendingData (); // Create if non-existent
- m_firstPendingSequence = m_nextTxSequence; // Note seq of first
- }
- //PendingData::Add stores a copy of the Ptr p
- m_pendingData->Add (p);
- NS_LOG_DEBUG("TcpSock::Send, pdsize " << m_pendingData->Size() <<
- " state " << m_state);
- Actions_t action = ProcessEvent (APP_SEND);
- NS_LOG_DEBUG(" action " << action);
- if (!ProcessAction (action))
- {
- return -1; // Failed, return zero
- }
- return p->GetSize();
- }
- else
- {
- m_errno = ERROR_NOTCONN;
- return -1;
- }
-}
-
-int TcpSocketImpl::DoSendTo (Ptr<Packet> p, const Address &address)
-{
- NS_LOG_FUNCTION (this << p << address);
- InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
- Ipv4Address ipv4 = transport.GetIpv4 ();
- uint16_t port = transport.GetPort ();
- return DoSendTo (p, ipv4, port);
-}
-
-int TcpSocketImpl::DoSendTo (Ptr<Packet> p, Ipv4Address ipv4, uint16_t port)
-{
- NS_LOG_FUNCTION (this << p << ipv4 << port);
- if (m_endPoint == 0)
- {
- if (Bind () == -1)
- {
- NS_ASSERT (m_endPoint == 0);
- return -1;
- }
- NS_ASSERT (m_endPoint != 0);
- }
- if (m_shutdownSend)
- {
- m_errno = ERROR_SHUTDOWN;
- return -1;
- }
- // Get the size before sending to tcp, as the sent callback cares
- // about payload sent, not with headers
- uint32_t sentSize = p->GetSize();
- m_tcp->Send (p, m_endPoint->GetLocalAddress (), ipv4,
- m_endPoint->GetLocalPort (), port, m_boundnetdevice);
- NotifyDataSent (sentSize);
- return 0;
-}
-
-int
-TcpSocketImpl::SendTo (Ptr<Packet> p, uint32_t flags, const Address &address)
-{
- NS_LOG_FUNCTION (this << address << p);
- if (!m_connected)
- {
- m_errno = ERROR_NOTCONN;
- return -1;
- }
- else
- {
- return Send (p, flags); //drop the address according to BSD manpages
- }
-}
-
-uint32_t
-TcpSocketImpl::GetTxAvailable (void) const
-{
- NS_LOG_FUNCTION_NOARGS ();
- if (m_pendingData != 0)
- {
- uint32_t unAckedDataSize =
- m_pendingData->SizeFromSeq (m_firstPendingSequence, m_highestRxAck);
- NS_ASSERT (m_sndBufSize >= unAckedDataSize); //else a logical error
- return m_sndBufSize-unAckedDataSize;
- }
- else
- {
- return m_sndBufSize;
- }
-}
-
-int
-TcpSocketImpl::Listen (void)
-{
- NS_LOG_FUNCTION (this);
- // Linux quits EINVAL if we're not closed, so match what they do
- if (m_state != CLOSED)
- {
- m_errno = ERROR_INVAL;
- return -1;
- }
- Actions_t action = ProcessEvent (APP_LISTEN);
- ProcessAction (action);
- return 0;
-}
-
-Ptr<Packet>
-TcpSocketImpl::Recv (uint32_t maxSize, uint32_t flags)
-{
- NS_LOG_FUNCTION_NOARGS ();
- if(m_bufferedData.empty())
- {
- if(m_state == CLOSE_WAIT) //means EOF
- {
- return Create<Packet>();
- }
- //else, means nothing to read
- return 0;
- }
- UnAckData_t out; //serves as buffer to return up to the user
- UnAckData_t::iterator i;
- while (!m_bufferedData.empty ())
- { // Check the buffered data for delivery
- NS_LOG_LOGIC("TCP " << this << " bufferedData.size() "
- << m_bufferedData.size ()
- << " time " << Simulator::Now ());
- i = m_bufferedData.begin ();
- SequenceNumber32 s1 (0);
- if (i->first > m_nextRxSequence)
- {
- break; // we're done, no more in-sequence data exits
- }
- else // (i->first <= m_nextRxSequence)
- { // Two cases here.
- // 1) seq + length > nextRxSeq, can deliver partial
- // 2) seq + length <= nextRxSeq, deliver whole
- s1 = i->second->GetSize ();
- if (i->first + s1 > m_nextRxSequence)
- { // Remove partial data to prepare for delivery
- uint32_t avail = s1 + i->first - m_nextRxSequence;
- i->second = i->second->CreateFragment (0, avail);
- }
- // else this packet is okay to deliver whole
- // so don't do anything else and output it
- out[i->first] = i->second;
- }
- m_rxAvailable -= i->second->GetSize ();
- m_rxBufSize -= i->second->GetSize ();
- m_bufferedData.erase (i); // Remove from list
- }
- if (out.size() == 0)
- {
- return 0;
- }
- Ptr<Packet> outPacket = Create<Packet>();
- for(i = out.begin(); i!=out.end(); ++i)
- {
- if (outPacket->GetSize() + i->second->GetSize() <= maxSize )
- {
- outPacket->AddAtEnd(i->second);
- }
- else
- {
- //only append as much as will fit
- uint32_t avail = maxSize - outPacket->GetSize();
- outPacket->AddAtEnd(i->second->CreateFragment(0,avail));
- //put the rest back into the buffer
- m_bufferedData[i->first+SequenceNumber32(avail)]
- = i->second->CreateFragment(avail,i->second->GetSize()-avail);
- m_rxAvailable += i->second->GetSize()-avail;
- m_rxBufSize += i->second->GetSize()-avail;
- }
- }
- SocketAddressTag tag;
- tag.SetAddress (InetSocketAddress (m_endPoint->GetPeerAddress(), m_endPoint->GetPeerPort()));
- outPacket->AddPacketTag (tag);
- return outPacket;
-}
-
-uint32_t
-TcpSocketImpl::GetRxAvailable (void) const
-{
- NS_LOG_FUNCTION_NOARGS ();
- // We separately maintain this state to avoid walking the queue
- // every time this might be called
- return m_rxAvailable;
-}
-
-Ptr<Packet>
-TcpSocketImpl::RecvFrom (uint32_t maxSize, uint32_t flags,
- Address &fromAddress)
-{
- NS_LOG_FUNCTION (this << maxSize << flags);
- Ptr<Packet> packet = Recv (maxSize, flags);
- //Null packet means no data to read, and an empty packet indicates EOF
- if (packet != 0 && packet->GetSize() != 0)
- {
- SocketAddressTag tag;
- bool found;
- found = packet->PeekPacketTag (tag);
- NS_ASSERT (found);
- fromAddress = tag.GetAddress ();
- }
- return packet;
-}
-
-int
-TcpSocketImpl::GetSockName (Address &address) const
-{
- NS_LOG_FUNCTION_NOARGS ();
- if (m_endPoint != 0)
- {
- address = InetSocketAddress (m_endPoint->GetLocalAddress (),
- m_endPoint->GetLocalPort ());
- }
- else
- {
- // It is possible to call this method on a socket without a name
- // in which case, behavior is unspecified
- address = InetSocketAddress (Ipv4Address::GetZero (), 0);
- }
- return 0;
-}
-
-void
-TcpSocketImpl::BindToNetDevice (Ptr<NetDevice> netdevice)
-{
- NS_LOG_FUNCTION (netdevice);
- Socket::BindToNetDevice (netdevice); // Includes sanity check
- if (m_endPoint == 0)
- {
- if (Bind () == -1)
- {
- NS_ASSERT (m_endPoint == 0);
- return;
- }
- NS_ASSERT (m_endPoint != 0);
- }
- m_endPoint->BindToNetDevice (netdevice);
- return;
-}
-
-void
-TcpSocketImpl::ForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port,
- Ptr<Ipv4Interface> incomingInterface)
-{
- NS_LOG_DEBUG("Socket " << this << " got forward up" <<
- " dport " << m_endPoint->GetLocalPort() <<
- " daddr " << m_endPoint->GetLocalAddress() <<
- " sport " << m_endPoint->GetPeerPort() <<
- " saddr " << m_endPoint->GetPeerAddress());
-
- NS_LOG_FUNCTION (this << packet << header << port);
-
- Address fromAddress = InetSocketAddress (header.GetSource (), port);
- Address toAddress = InetSocketAddress (header.GetDestination (), m_endPoint->GetLocalPort());
-
- TcpHeader tcpHeader;
- packet->RemoveHeader (tcpHeader);
-
- if (tcpHeader.GetFlags () & TcpHeader::ACK)
- {
- Time m = m_rtt->AckSeq (tcpHeader.GetAckNumber () );
- if (m != Seconds (0.0))
- {
- m_lastMeasuredRtt = m;
- }
- }
-
- if (m_rxWindowSize == 0 && tcpHeader.GetWindowSize () != 0)
- { //persist probes end
- NS_LOG_LOGIC (this<<" Leaving zerowindow persist state");
- m_persistEvent.Cancel ();
- }
- m_rxWindowSize = tcpHeader.GetWindowSize (); //update the flow control window
-
- Events_t event = SimulationSingleton<TcpStateMachine>::Get ()->FlagsEvent (tcpHeader.GetFlags () );
- // Given an ACK_RX event and FIN_WAIT_1, CLOSING, or LAST_ACK state,
- // we have to check the sequence numbers to determine if the
- // ACK is for the FIN
- if ((m_state == FIN_WAIT_1 || m_state == CLOSING
- || m_state == LAST_ACK) && event == ACK_RX)
- {
- if (tcpHeader.GetSequenceNumber () == m_nextRxSequence)
- {
- // This ACK is for the fin, change event to
- // recognize this
- event = FIN_ACKED;
- }
- }
- Actions_t action = ProcessEvent (event); //updates the state
- NS_LOG_DEBUG("Socket " << this <<
- " processing pkt action, " << action <<
- " current state " << m_state);
- ProcessPacketAction (action, packet, tcpHeader, fromAddress, toAddress);
-}
-
-Actions_t TcpSocketImpl::ProcessEvent (Events_t e)
-{
- NS_LOG_FUNCTION (this << e);
- States_t saveState = m_state;
- NS_LOG_LOGIC ("TcpSocketImpl " << this << " processing event " << e);
- // simulation singleton is a way to get a single global static instance of a
- // class intended to be a singleton; see simulation-singleton.h
- SA stateAction = SimulationSingleton<TcpStateMachine>::Get ()->Lookup (m_state,e);
- NS_LOG_LOGIC ("TcpSocketImpl::ProcessEvent stateAction " << stateAction.action);
-
- bool needCloseNotify = (stateAction.state == CLOSED && m_state != CLOSED
- && e != TIMEOUT);
- m_state = stateAction.state;
- NS_LOG_LOGIC ("TcpSocketImpl " << this << " moved from state " << saveState
- << " to state " <<m_state);
- NS_LOG_LOGIC ("TcpSocketImpl " << this << " pendingData " << m_pendingData);
-
- //extra event logic is here for RX events
- //e = SYN_ACK_RX
- if (saveState == SYN_SENT && m_state == ESTABLISHED)
- // this means the application side has completed its portion of
- // the handshaking
- {
- Simulator::ScheduleNow(&TcpSocketImpl::ConnectionSucceeded, this);
- m_connected = true;
- NS_LOG_LOGIC ("TcpSocketImpl " << this << " Connected!");
- }
- if (saveState < CLOSING && (m_state == CLOSING || m_state == TIMED_WAIT) )
- {
- NS_LOG_LOGIC ("TcpSocketImpl peer closing, send EOF to application");
- if (!m_shutdownRecv)
- {
- NotifyDataRecv ();
- }
- }
-
- if (needCloseNotify && !m_closeNotified)
- {
- NS_LOG_LOGIC ("TcpSocketImpl " << this << " transition to CLOSED from "
- << m_state << " event " << e << " closeNot " << m_closeNotified
- << " action " << stateAction.action);
- NotifyNormalClose();
- m_closeNotified = true;
- NS_LOG_LOGIC ("TcpSocketImpl " << this << " calling Closed from PE"
- << " origState " << saveState
- << " event " << e);
- NS_LOG_LOGIC ("TcpSocketImpl " << this << " transition to CLOSED from "
- << m_state << " event " << e
- << " set CloseNotif ");
- }
-
- if (m_state == CLOSED && saveState != CLOSED && m_endPoint != 0)
- {
- NS_ASSERT (m_tcp != 0);
- /*
- * We want to deallocate the endpoint now. We can't just naively call
- * Deallocate (see the comment in TcpSocketImpl::~TcpSocketImpl), we
- * have to turn off the DestroyCallback to keep it from calling back
- * into TcpSocketImpl::Destroy and closing pretty much everything down.
- * Once we have the callback disconnected, we can DeAllocate the
- * endpoint which actually deals with destroying the actual endpoint,
- * and then zero our member varible on general principles.
- */
- m_endPoint->SetDestroyCallback(MakeNullCallback<void>());
- m_tcp->DeAllocate (m_endPoint);
- m_endPoint = 0;
- CancelAllTimers();
- }
-
- return stateAction.action;
-}
-
-void TcpSocketImpl::SendEmptyPacket (uint8_t flags)
-{
- NS_LOG_FUNCTION (this << (uint32_t)flags);
- Ptr<Packet> p = Create<Packet> ();
- TcpHeader header;
-
- if (m_endPoint == 0)
- {
- NS_LOG_WARN ("Failed to send empty packet due to null endpoint");
- return;
- }
-
- if (flags & TcpHeader::FIN)
- {
- flags |= TcpHeader::ACK;
- }
-
- header.SetFlags (flags);
- header.SetSequenceNumber (m_nextTxSequence);
- header.SetAckNumber (m_nextRxSequence);
- header.SetSourcePort (m_endPoint->GetLocalPort ());
- header.SetDestinationPort (m_endPoint->GetPeerPort ());
- header.SetWindowSize (AdvertisedWindowSize());
- m_tcp->SendPacket (p, header, m_endPoint->GetLocalAddress (),
- m_endPoint->GetPeerAddress (), m_boundnetdevice);
- Time rto = m_rtt->RetransmitTimeout ();
- bool hasSyn = flags & TcpHeader::SYN;
- bool hasFin = flags & TcpHeader::FIN;
- bool isAck = flags == TcpHeader::ACK;
- if (hasSyn)
- {
- rto = m_cnTimeout;
- m_cnTimeout = m_cnTimeout + m_cnTimeout;
- m_cnCount--;
- }
- if (m_retxEvent.IsExpired () && (hasSyn || hasFin) && !isAck )
- //no outstanding timer
- {
- NS_LOG_LOGIC ("Schedule retransmission timeout at time "
- << Simulator::Now ().GetSeconds () << " to expire at time "
- << (Simulator::Now () + rto).GetSeconds ());
- m_retxEvent = Simulator::Schedule (rto, &TcpSocketImpl::ReTxTimeout, this);
- }
-}
-
-// This function closes the endpoint completely
-void TcpSocketImpl::SendRST()
-{
- SendEmptyPacket(TcpHeader::RST);
- NotifyErrorClose();
- CancelAllTimers();
- if (m_endPoint != 0)
- {
- m_endPoint->SetDestroyCallback(MakeNullCallback<void>());
- m_tcp->DeAllocate (m_endPoint);
- m_endPoint = 0;
- }
-}
-
-
-bool TcpSocketImpl::ProcessAction (Actions_t a)
-{ // These actions do not require a packet or any TCP Headers
- NS_LOG_FUNCTION (this << a);
- switch (a)
- {
- case NO_ACT:
- NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action: NO_ACT");
- break;
- case ACK_TX:
- SendEmptyPacket (TcpHeader::ACK);
- break;
- case ACK_TX_1:
- NS_ASSERT (false); // This should be processed in ProcessPacketAction
- break;
- case RST_TX:
- NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action RST_TX");
- SendEmptyPacket (TcpHeader::RST);
- break;
- case SYN_TX:
- NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action SYN_TX");
- // TCP SYN Flag consumes one byte
- // is the above correct? we're SENDING a syn, not acking back -- Raj
- // commented out for now
- // m_nextTxSequence+= 1;
- SendEmptyPacket (TcpHeader::SYN);
- break;
- case SYN_ACK_TX:
- NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action SYN_ACK_TX");
- // TCP SYN Flag consumes one byte
- ++m_nextRxSequence;
- SendEmptyPacket (TcpHeader::SYN | TcpHeader::ACK);
- break;
- case FIN_TX:
- NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action FIN_TX");
- SendEmptyPacket (TcpHeader::FIN);
- break;
- case FIN_ACK_TX:
- NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action FIN_ACK_TX");
- SendEmptyPacket (TcpHeader::FIN | TcpHeader::ACK);
- break;
- case NEW_ACK:
- NS_ASSERT (false); // This should be processed in ProcessPacketAction
- break;
- case NEW_SEQ_RX:
- NS_ASSERT (false); // This should be processed in ProcessPacketAction
- break;
- case RETX:
- NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action RETX");
- break;
- case TX_DATA:
- NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action TX_DATA");
- SendPendingData (m_connected);
- break;
- case PEER_CLOSE:
- NS_ASSERT (false); // This should be processed in ProcessPacketAction
- NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action PEER_CLOSE");
- break;
- case APP_CLOSED:
- NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action APP_CLOSED");
- break;
- case CANCEL_TM:
- NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action CANCEL_TM");
- break;
- case APP_NOTIFY:
- NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action APP_NOTIFY");
- break;
- case SERV_NOTIFY:
- NS_ASSERT (false); // This should be processed in ProcessPacketAction
- break;
- case LAST_ACTION:
- NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action LAST_ACTION");
- break;
- }
- return true;
-}
-
-bool TcpSocketImpl::ProcessPacketAction (Actions_t a, Ptr<Packet> p,
- const TcpHeader& tcpHeader,
- const Address& fromAddress,
- const Address& toAddress)
-{
- NS_LOG_FUNCTION (this << a << p << fromAddress);
- Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
-
- switch (a)
- {
- case RST_TX:
- {
- NS_LOG_LOGIC ("TcpSocketImpl " << this << " Action RST_TX");
- SendRST();
- return NO_ACT;
- }
- case ACK_TX:
- NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action ACK_TX");
- if(tcpHeader.GetFlags() & TcpHeader::FIN)
- {
- ++m_nextRxSequence; //bump this to account for the FIN
- }
- SendEmptyPacket (TcpHeader::ACK);
- break;
- case SYN_ACK_TX:
- NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action SYN_ACK_TX");
- if (m_state == LISTEN) //this means we should fork a new TcpSocketImpl
- {
- NS_LOG_DEBUG("In SYN_ACK_TX, m_state is LISTEN, this " << this);
- //notify the server that we got a SYN
- // If server refuses connection do nothing
- if (!NotifyConnectionRequest(fromAddress)) return true;
- // Clone the socket
- Ptr<TcpSocketImpl> newSock = Copy ();
- NS_LOG_LOGIC ("Cloned a TcpSocketImpl " << newSock);
- //this listening socket should do nothing more
- Simulator::ScheduleNow (&TcpSocketImpl::CompleteFork, newSock,
- p, tcpHeader, fromAddress, toAddress);
- return true;
- }
- else
- {
- // This is the cloned endpoint
- // TCP SYN consumes one byte
- m_nextRxSequence = tcpHeader.GetSequenceNumber ()
- + SequenceNumber32 (1);
- SendEmptyPacket (TcpHeader::SYN | TcpHeader::ACK);
- }
-
- break;
- case ACK_TX_1:
- NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action ACK_TX_1");
- // TCP SYN consumes one byte
- m_nextRxSequence = tcpHeader.GetSequenceNumber() + SequenceNumber32(1);
- m_nextTxSequence = tcpHeader.GetAckNumber ();
- m_firstPendingSequence = m_nextTxSequence; //bug 166
- NS_LOG_DEBUG ("TcpSocketImpl " << this << " ACK_TX_1" <<
- " nextRxSeq " << m_nextRxSequence);
- SendEmptyPacket (TcpHeader::ACK);
- if (tcpHeader.GetAckNumber () > m_highestRxAck)
- {
- m_highestRxAck = tcpHeader.GetAckNumber ();
- // Data freed from the send buffer; notify any blocked sender
- if (GetTxAvailable () > 0)
- {
- NotifySend (GetTxAvailable ());
- }
- }
- SendPendingData (m_connected); //send acks if we are connected
- break;
- case NEW_ACK:
- NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action NEW_ACK_TX");
- //check to see of the ACK had data with it; if so, pass it along
- //to NEW_SEQ_RX
- if(p->GetSize () > 0)
- {
- Simulator::ScheduleNow(&TcpSocketImpl::ProcessPacketAction,
- this,
- NEW_SEQ_RX,
- p,
- tcpHeader,
- fromAddress,
- toAddress);
- }
- if (tcpHeader.GetAckNumber () < m_highestRxAck) //old ack, do nothing
- {
- break;
- }
- if (tcpHeader.GetAckNumber () == m_highestRxAck)
- {
- if (tcpHeader.GetAckNumber () < m_nextTxSequence)
- {
- DupAck (tcpHeader, ++m_dupAckCount);
- }
- NS_ASSERT(tcpHeader.GetAckNumber () <= m_nextTxSequence);
- //if the ack is precisely equal to the nextTxSequence
- break;
- }
- if (tcpHeader.GetAckNumber () > m_highestRxAck)
- {
- m_dupAckCount = 0;
- }
- NewAck (tcpHeader.GetAckNumber ());
- break;
- case NEW_SEQ_RX:
- NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action NEW_SEQ_RX");
- NewRx (p, tcpHeader, fromAddress, toAddress); // Process new data received
- break;
- case PEER_CLOSE:
- {
- NS_LOG_LOGIC("Got Peer Close");
- // First we have to be sure the FIN packet was not received
- // out of sequence. If so, note pending close and process
- // new sequence rx
- if (tcpHeader.GetSequenceNumber () != m_nextRxSequence)
- {
- if (m_finSequence != m_nextRxSequence)
- {
- // process close later
- m_finSequence = tcpHeader.GetSequenceNumber () + SequenceNumber32 (p->GetSize ());
- m_pendingClose = true;
- NS_LOG_LOGIC ("TcpSocketImpl " << this << " setting pendingClose"
- << " rxseq " << tcpHeader.GetSequenceNumber ()
- << " nextRxSeq " << m_nextRxSequence);
- NewRx (p, tcpHeader, fromAddress, toAddress);
- return true;
- }
- }
- // Now we need to see if any data came with the FIN
- // if so, call NewRx, unless NewRx was already called
- if (p->GetSize () != 0)
- {
- if (m_finSequence != m_nextRxSequence)
- {
- NewRx (p, tcpHeader, fromAddress, toAddress);
- }
- }
- ++m_nextRxSequence; //bump this to account for the FIN
- States_t saveState = m_state; // Used to see if app responds
- NS_LOG_LOGIC ("TcpSocketImpl " << this
- << " peer close, state " << m_state);
- if (!m_closeRequestNotified)
- {
- NS_LOG_LOGIC ("TCP " << this
- << " calling AppCloseRequest");
- NotifyNormalClose();
- m_closeRequestNotified = true;
- }
- NS_LOG_LOGIC ("TcpSocketImpl " << this
- << " peer close, state after " << m_state);
- if (m_state == saveState)
- { // Need to ack, the application will close later
- SendEmptyPacket (TcpHeader::ACK);
-// // Also need to re-tx the ack if we
- }
- if (m_state == LAST_ACK)
- {
- NS_LOG_LOGIC ("TcpSocketImpl " << this << " scheduling LATO1");
- m_lastAckEvent = Simulator::Schedule (m_rtt->RetransmitTimeout (),
- &TcpSocketImpl::LastAckTimeout,this);
- }
- break;
- }
- case SERV_NOTIFY:
- NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action SERV_NOTIFY");
- NS_LOG_LOGIC ("TcpSocketImpl " << this << " Connected!");
- m_connected = true; // ! This is bogus; fix when we clone the tcp
- m_endPoint->SetPeer (m_endPoint->GetPeerAddress(), m_endPoint->GetPeerPort());
- //treat the connection orientation final ack as a newack
- CommonNewAck (tcpHeader.GetAckNumber (), true);
- NotifyNewConnectionCreated (this, fromAddress);
- break;
- default:
- return ProcessAction (a);
- }
- return true;
-}
-
-void TcpSocketImpl::CompleteFork(Ptr<Packet> p, const TcpHeader& h, const Address& fromAddress, const Address& toAddress)
-{
- // Get port and address from peer (connecting host)
- m_endPoint = m_tcp->Allocate (InetSocketAddress::ConvertFrom(toAddress).GetIpv4 (),
- InetSocketAddress::ConvertFrom(toAddress).GetPort (),
- InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (),
- InetSocketAddress::ConvertFrom (fromAddress).GetPort ());
- //the cloned socket with be in listen state, so manually change state
- m_state = SYN_RCVD;
- //equivalent to FinishBind
- m_endPoint->SetRxCallback (MakeCallback (&TcpSocketImpl::ForwardUp, Ptr<TcpSocketImpl>(this)));
- m_endPoint->SetDestroyCallback (MakeCallback (&TcpSocketImpl::Destroy, Ptr<TcpSocketImpl>(this)));
- ProcessPacketAction(SYN_ACK_TX, p, h, fromAddress, toAddress);
- }
-
-void TcpSocketImpl::ConnectionSucceeded()
-{ // We would preferred to have scheduled an event directly to
- // NotifyConnectionSucceeded, but (sigh) these are protected
- // and we can get the address of it :(
- NotifyConnectionSucceeded();
-}
-
-bool TcpSocketImpl::SendPendingData (bool withAck)
-{
- NS_LOG_FUNCTION (this << withAck);
- NS_LOG_LOGIC ("ENTERING SendPendingData");
- if (!m_pendingData)
- {
- return false; // No data exists
- }
- if (m_endPoint == 0)
- {
- NS_LOG_INFO ("TcpSocketImpl::SendPendingData: No endpoint; m_shutdownSend=" << m_shutdownSend);
- return false; // Is this the right way to handle this condition?
- }
- uint32_t nPacketsSent = 0;
- while (m_pendingData->SizeFromSeq (m_firstPendingSequence, m_nextTxSequence))
- {
- uint32_t w = AvailableWindow ();// Get available window size
- NS_LOG_LOGIC ("TcpSocketImpl " << this << " SendPendingData"
- << " w " << w
- << " rxwin " << m_rxWindowSize
- << " cWnd " << m_cWnd
- << " segsize " << m_segmentSize
- << " nextTxSeq " << m_nextTxSequence
- << " highestRxAck " << m_highestRxAck
- << " pd->Size " << m_pendingData->Size ()
- << " pd->SFS " << m_pendingData->SizeFromSeq (m_firstPendingSequence, m_nextTxSequence));
-//XXX pd->Size is probably a bug, should be SizeFromSeq(...)
- if (w < m_segmentSize && m_pendingData->Size () > w)
- {
- break; // No more
- }
- uint32_t s = std::min (w, m_segmentSize); // Send no more than window
- Ptr<Packet> p = m_pendingData->CopyFromSeq (s, m_firstPendingSequence,
- m_nextTxSequence);
- NS_LOG_LOGIC("TcpSocketImpl " << this << " SendPendingData"
- << " txseq " << m_nextTxSequence
- << " s " << s
- << " datasize " << p->GetSize() );
- uint8_t flags = 0;
- uint32_t sz = p->GetSize (); // Size of packet
- uint32_t remainingData = m_pendingData->SizeFromSeq(
- m_firstPendingSequence,
- m_nextTxSequence + SequenceNumber32 (sz));
- if (m_closeOnEmpty && (remainingData == 0))
- {
- flags = TcpHeader::FIN;
- m_state = FIN_WAIT_1;
- }
- if (withAck)
- {
- flags |= TcpHeader::ACK;
- }
- TcpHeader header;
- header.SetFlags (flags);
- header.SetSequenceNumber (m_nextTxSequence);
- header.SetAckNumber (m_nextRxSequence);
- header.SetSourcePort (m_endPoint->GetLocalPort());
- header.SetDestinationPort (m_endPoint->GetPeerPort());
- header.SetWindowSize (AdvertisedWindowSize());
- if (m_shutdownSend)
- {
- m_errno = ERROR_SHUTDOWN;
- return false;
- }
-
-
- if (m_retxEvent.IsExpired () ) //go ahead and schedule the retransmit
- {
- Time rto = m_rtt->RetransmitTimeout ();
- NS_LOG_LOGIC (this<<" SendPendingData Schedule ReTxTimeout at time " <<
- Simulator::Now ().GetSeconds () << " to expire at time " <<
- (Simulator::Now () + rto).GetSeconds () );
- m_retxEvent = Simulator::Schedule (rto,&TcpSocketImpl::ReTxTimeout,this);
- }
- NS_LOG_LOGIC ("About to send a packet with flags: " << flags);
- m_tcp->SendPacket (p, header,
- m_endPoint->GetLocalAddress (),
- m_endPoint->GetPeerAddress (),
- m_boundnetdevice);
- m_rtt->SentSeq(m_nextTxSequence, sz); // notify the RTT
- // Notify the application of the data being sent
- Simulator::ScheduleNow(&TcpSocketImpl::NotifyDataSent, this, sz);
- nPacketsSent++; // Count sent this loop
- m_nextTxSequence += sz; // Advance next tx sequence
- // Note the high water mark
- m_highTxMark = std::max (m_nextTxSequence, m_highTxMark);
- }
- NS_LOG_LOGIC ("SendPendingData Sent "<<nPacketsSent<<" packets");
- NS_LOG_LOGIC("RETURN SendPendingData");
- return (nPacketsSent>0);
-}
-
-uint32_t TcpSocketImpl::UnAckDataCount ()
-{
- NS_LOG_FUNCTION_NOARGS ();
- return m_nextTxSequence - m_highestRxAck;
-}
-
-uint32_t TcpSocketImpl::BytesInFlight ()
-{
- NS_LOG_FUNCTION_NOARGS ();
- return m_highTxMark - m_highestRxAck;
-}
-
-uint32_t TcpSocketImpl::Window ()
-{
- NS_LOG_FUNCTION_NOARGS ();
- NS_LOG_LOGIC ("TcpSocketImpl::Window() "<<this);
- return std::min (m_rxWindowSize, m_cWnd.Get());
-}
-
-uint32_t TcpSocketImpl::AvailableWindow ()
-{
- NS_LOG_FUNCTION_NOARGS ();
- uint32_t unack = UnAckDataCount (); // Number of outstanding bytes
- uint32_t win = Window ();
- if (win < unack)
- {
- return 0; // No space available
- }
- return (win - unack); // Amount of window space available
-}
-
-uint32_t TcpSocketImpl::RxBufferFreeSpace()
-{
- return m_rxBufMaxSize - m_rxBufSize;
-}
-
-uint16_t TcpSocketImpl::AdvertisedWindowSize()
-{
- uint32_t max = 0xffff;
- return std::min(RxBufferFreeSpace(), max);
-}
-
-void TcpSocketImpl::NewRx (Ptr<Packet> p,
- const TcpHeader& tcpHeader,
- const Address& fromAddress,
- const Address& toAddress)
-{
- NS_LOG_FUNCTION (this << p << "tcpHeader " << fromAddress);
- NS_LOG_LOGIC ("TcpSocketImpl " << this << " NewRx,"
- << " seq " << tcpHeader.GetSequenceNumber()
- << " ack " << tcpHeader.GetAckNumber()
- << " p.size is " << p->GetSize () );
- States_t origState = m_state;
- if (RxBufferFreeSpace() < p->GetSize())
- { //if not enough room, fragment
- p = p->CreateFragment(0, RxBufferFreeSpace());
- }
- //XXX
- //fragmenting here MIGHT not be the right thing to do, since possibly we trim
- //the front and back off the packet below if it isn't all new data, so the
- //check against RxBufferFreeSpace and fragmentation should ideally occur
- //just before insertion into m_bufferedData, but this strategy is more
- //agressive in rejecting oversized packets and still gives acceptable TCP
- uint32_t s = p->GetSize (); // Size of associated data
- if (s == 0)
- {//if there is no data or no rx buffer space, just ack anyway
- SendEmptyPacket (TcpHeader::ACK);
- return;
- }
- // Log sequence received if enabled
- // NoteTimeSeq(LOG_SEQ_RX, h->sequenceNumber);
- // Three possibilities
- // 1) Received seq is expected, buffer this, update rxAvailable, and ack
- // 2) Received seq is < expected, just re-ack previous
- // 3) Received seq is > expected, just re-ack previous and buffer data
- if (tcpHeader.GetSequenceNumber () == m_nextRxSequence)
- { // If seq is expected seq
- // Trim the end if necessary
- // 1) Update nextRxSeq
- // 2) Buffer this packet so Recv can read it
- // 3) Send the ack
- UnAckData_t::iterator next = m_bufferedData.upper_bound (m_nextRxSequence);
- if (next != m_bufferedData.end ())
- {
- SequenceNumber32 nextBufferedSeq = next->first;
- if (m_nextRxSequence + SequenceNumber32(s) > nextBufferedSeq)
- {//tail end isn't all new, trim enough off the end
- s = nextBufferedSeq - m_nextRxSequence;
- }
- }
- p = p->CreateFragment (0,s);
- m_nextRxSequence += s; // Advance next expected sequence
- NS_LOG_LOGIC("Case 1, advanced nrxs to " << m_nextRxSequence );
- //buffer this, it'll be read by call to Recv
- // Save for later delivery if there is room
- m_bufferedData[tcpHeader.GetSequenceNumber () ] = p;
- m_rxAvailable += p->GetSize ();
- RxBufFinishInsert (tcpHeader.GetSequenceNumber ());
- m_rxBufSize += p->GetSize ();
- if (!m_shutdownRecv)
- {
- NotifyDataRecv ();
- }
- if (m_closeNotified)
- {
- NS_LOG_LOGIC ("Tcp " << this << " HuH? Got data after closeNotif");
- }
- NS_LOG_LOGIC ("TcpSocketImpl " << this << " adv rxseq by " << s);
- if (m_pendingClose || (origState > ESTABLISHED))
- { // See if we can close now
- if (m_bufferedData.empty())
- {
- ProcessPacketAction (PEER_CLOSE, p, tcpHeader, fromAddress, toAddress);
- return;
- }
- }
- }
- else if (tcpHeader.GetSequenceNumber () > m_nextRxSequence)
- { // Need to buffer this one, but trim off the front and back if necessary
- NS_LOG_LOGIC ("Case 2, buffering " << tcpHeader.GetSequenceNumber () );
- UnAckData_t::iterator previous =
- m_bufferedData.lower_bound (tcpHeader.GetSequenceNumber ());
- SequenceNumber32 startSeq = tcpHeader.GetSequenceNumber();
- if (previous != m_bufferedData.begin ())
- {
- --previous;
- startSeq = previous->first + SequenceNumber32(previous->second->GetSize());
- if (startSeq > tcpHeader.GetSequenceNumber ())
- {
- s = tcpHeader.GetSequenceNumber () + SequenceNumber32(s) - startSeq;
- }
- else
- {
- startSeq = tcpHeader.GetSequenceNumber();
- }
- }
- //possibly trim off the end
- UnAckData_t::iterator next = m_bufferedData.upper_bound (tcpHeader.GetSequenceNumber());
- if (next != m_bufferedData.end ())
- {
- SequenceNumber32 nextBufferedSeq = next->first;
- if (startSeq + SequenceNumber32(s) > nextBufferedSeq)
- {//tail end isn't all new either, trim enough off the end
- s = nextBufferedSeq - startSeq;
- }
- }
- p = p->CreateFragment (startSeq - tcpHeader.GetSequenceNumber (),s);
- UnAckData_t::iterator i =
- m_bufferedData.find (startSeq);
- if (i != m_bufferedData.end () )
- {
- if(p->GetSize() > i->second->GetSize())
- {
- i->second = 0; // relase reference to already buffered
- }
- else
- {
- p = i->second;
- }
- }
- // Save for later delivery
- m_bufferedData[startSeq] = p;
- m_rxBufSize += p->GetSize();
- i = m_bufferedData.find (startSeq);
- next = i;
- ++next;
- if(next != m_bufferedData.end())
- {
- NS_ASSERT(next->first >= i->first + SequenceNumber32(i->second->GetSize ()));
- }
- }
- else if (tcpHeader.GetSequenceNumber () + SequenceNumber32(s) > m_nextRxSequence)
- {//parial new data case, only part of the packet is new data
- //trim the beginning
- s = tcpHeader.GetSequenceNumber () + SequenceNumber32(s) - m_nextRxSequence; //how much new
- //possibly trim off the end
- UnAckData_t::iterator next = m_bufferedData.upper_bound (m_nextRxSequence);
- if (next != m_bufferedData.end ())
- {
- SequenceNumber32 nextBufferedSeq = next->first;
- if (m_nextRxSequence + SequenceNumber32(s) > nextBufferedSeq)
- {//tail end isn't all new either, trim enough off the end
- s = nextBufferedSeq - m_nextRxSequence;
- }
- }
- p = p->CreateFragment (m_nextRxSequence - tcpHeader.GetSequenceNumber (),s);
- SequenceNumber32 start = m_nextRxSequence;
- m_nextRxSequence += s; // Advance next expected sequence
- //buffer the new fragment, it'll be read by call to Recv
- UnAckData_t::iterator i = m_bufferedData.find (start);
- if (i != m_bufferedData.end () ) //we found it already in the buffer
- {
- i->second = 0; // relase reference to already buffered
- }
- // Save for later delivery
- m_bufferedData[start] = p;
- m_rxAvailable += p->GetSize ();
- m_rxBufSize += p->GetSize();
- RxBufFinishInsert(start);
- if (!m_shutdownRecv)
- {
- NotifyDataRecv ();
- }
- }
- else
- { // debug
- NS_LOG_LOGIC("TCP " << this
- << " got seq " << tcpHeader.GetSequenceNumber ()
- << " expected " << m_nextRxSequence
- << " flags " << tcpHeader.GetFlags ());
- }
- // Now send a new ack packet acknowledging all received and delivered data
- if(++m_delAckCount >= m_delAckMaxCount)
- {
- m_delAckEvent.Cancel();
- m_delAckCount = 0;
- SendEmptyPacket (TcpHeader::ACK);
- }
- else
- {
- if (m_delAckEvent.IsExpired())
- {
- m_delAckEvent = Simulator::Schedule (m_delAckTimeout, &TcpSocketImpl::DelAckTimeout, this);
- }
- }
-}
-
-void TcpSocketImpl::RxBufFinishInsert (SequenceNumber32 seq)
-{
- //putting data into the buffer might have filled in a sequence gap so we have
- //to iterate through the list to find the largest contiguous sequenced chunk,
- //and update m_rxAvailable and m_nextRxSequence appropriately
- UnAckData_t::iterator i = m_bufferedData.find (seq);
- UnAckData_t::iterator next = i;
- ++next;
- //make sure the buffer is logically sequenced
- if(next != m_bufferedData.end())
- {
- NS_ASSERT(next->first >= i->first + SequenceNumber32(i->second->GetSize ()));
- }
- while(next != m_bufferedData.end())
- {
- if(i->first + SequenceNumber32(i->second->GetSize ()) == next->first)
- {
- //next packet is in sequence, count it
- m_rxAvailable += next->second->GetSize();
- m_nextRxSequence += next->second->GetSize();
- }
- else
- {
- break; //no more in this contiguous chunk
- }
- ++i;
- ++next;
- }
-}
-
-void TcpSocketImpl::DelAckTimeout ()
-{
- m_delAckCount = 0;
- SendEmptyPacket (TcpHeader::ACK);
-}
-
-void TcpSocketImpl::CommonNewAck (SequenceNumber32 ack, bool skipTimer)
-{ // CommonNewAck is called only for "New" (non-duplicate) acks
- // and MUST be called by any subclass, from the NewAck function
- // Always cancel any pending re-tx timer on new acknowledgement
- NS_LOG_FUNCTION (this << ack << skipTimer);
- if (!skipTimer)
- {
- NS_LOG_LOGIC (this<<" Cancelled ReTxTimeout event which was set to expire at "
- << (Simulator::Now () +
- Simulator::GetDelayLeft (m_retxEvent)).GetSeconds());
- m_retxEvent.Cancel ();
- //On recieving a "New" ack we restart retransmission timer .. RFC 2988
- Time rto = m_rtt->RetransmitTimeout ();
- NS_LOG_LOGIC (this<<" Schedule ReTxTimeout at time "
- << Simulator::Now ().GetSeconds () << " to expire at time "
- << (Simulator::Now () + rto).GetSeconds ());
- m_retxEvent =
- Simulator::Schedule (rto, &TcpSocketImpl::ReTxTimeout, this);
- }
- if (m_rxWindowSize == 0 && m_persistEvent.IsExpired ()) //zerowindow
- {
- NS_LOG_LOGIC (this<<"Enter zerowindow persist state");
- NS_LOG_LOGIC (this<<" Cancelled ReTxTimeout event which was set to expire at "
- << (Simulator::Now () +
- Simulator::GetDelayLeft (m_retxEvent)).GetSeconds());
- m_retxEvent.Cancel ();
- NS_LOG_LOGIC ("Schedule persist timeout at time "
- <<Simulator::Now ().GetSeconds () << " to expire at time "
- << (Simulator::Now () + m_persistTime).GetSeconds());
- m_persistEvent =
- Simulator::Schedule (m_persistTime, &TcpSocketImpl::PersistTimeout, this);
- NS_ASSERT (m_persistTime == Simulator::GetDelayLeft (m_persistEvent));
- }
- NS_LOG_LOGIC ("TCP " << this << " NewAck " << ack
- << " numberAck " << (ack - m_highestRxAck)); // Number bytes ack'ed
- m_highestRxAck = ack; // Note the highest received Ack
- if (GetTxAvailable () > 0)
- {
- NotifySend (GetTxAvailable ());
- }
- if (ack > m_nextTxSequence)
- {
- m_nextTxSequence = ack; // If advanced
- }
- // See if all pending ack'ed; if so we can delete the data
- if (m_pendingData)
- { // Data exists, see if can be deleted
- if (m_pendingData->SizeFromSeq (m_firstPendingSequence, m_highestRxAck) == 0)
- { // All pending acked, can be deleted
- m_pendingData->Clear ();
- delete m_pendingData;
- m_pendingData = 0;
- // Insure no re-tx timer
- NS_LOG_LOGIC (this<<" Cancelled ReTxTimeout event which was set to expire at "
- << (Simulator::Now () +
- Simulator::GetDelayLeft (m_retxEvent)).GetSeconds());
- m_retxEvent.Cancel ();
- }
- else if (m_pendingData->SizeFromSeq (m_firstPendingSequence, m_highestRxAck) > 0)
- {
- // Remove from front, if possible
- m_firstPendingSequence += m_pendingData->RemoveToSeq (m_firstPendingSequence, m_highestRxAck);
- }
- }
- // Try to send more data
- SendPendingData (m_connected);
-}
-
-void TcpSocketImpl::CancelAllTimers()
-{
- m_retxEvent.Cancel ();
- m_persistEvent.Cancel ();
- m_delAckEvent.Cancel();
- m_lastAckEvent.Cancel ();
-}
-
-Ptr<TcpSocketImpl> TcpSocketImpl::Copy ()
-{
- return CopyObject<TcpSocketImpl> (this);
-}
-
-void TcpSocketImpl::NewAck (SequenceNumber32 seq)
-{ // New acknowledgement up to sequence number "seq"
- // Adjust congestion window in response to new ack's received
- NS_LOG_FUNCTION (this << seq);
- NS_LOG_LOGIC ("TcpSocketImpl " << this << " NewAck "
- << " seq " << seq
- << " cWnd " << m_cWnd
- << " ssThresh " << m_ssThresh);
- if (m_cWnd < m_ssThresh)
- { // Slow start mode, add one segSize to cWnd
- m_cWnd += m_segmentSize;
- NS_LOG_LOGIC ("TcpSocketImpl " << this << " NewCWnd SlowStart, cWnd " << m_cWnd
- << " sst " << m_ssThresh);
- }
- else
- { // Congestion avoidance mode, adjust by (ackBytes*segSize) / cWnd
- double adder = ((double) m_segmentSize * m_segmentSize) / m_cWnd.Get();
- if (adder < 1.0)
- {
- adder = 1.0;
- }
- m_cWnd += (uint32_t) adder;
- NS_LOG_LOGIC ("NewCWnd CongAvoid, cWnd " << m_cWnd
- << " sst " << m_ssThresh);
- }
- CommonNewAck (seq, false); // Complete newAck processing
-}
-
-void TcpSocketImpl::DupAck (const TcpHeader& t, uint32_t count)
-{
- NS_LOG_FUNCTION (this << "t " << count);
- NS_LOG_LOGIC ("TcpSocketImpl " << this << " DupAck " << t.GetAckNumber ()
- << ", count " << count
- << ", time " << Simulator::Now ());
- if (count == 3)
- { // Count of three indicates triple duplicate ack
- m_ssThresh = Window () / 2; // Per RFC2581
- m_ssThresh = std::max (m_ssThresh, 2 * m_segmentSize);
- NS_LOG_LOGIC("TcpSocketImpl " << this << "Tahoe TDA, time " << Simulator::Now ()
- << " seq " << t.GetAckNumber ()
- << " in flight " << BytesInFlight ()
- << " new ssthresh " << m_ssThresh);
-
- m_cWnd = m_segmentSize; // Collapse cwnd (re-enter slowstart)
- // For Tahoe, we also reset nextTxSeq
- m_nextTxSequence = m_highestRxAck;
- SendPendingData (m_connected);
- }
-}
-
-void TcpSocketImpl::ReTxTimeout ()
-{ // Retransmit timeout
- NS_LOG_FUNCTION (this);
- NS_LOG_LOGIC (this<<" ReTxTimeout Expired at time "<<Simulator::Now ().GetSeconds());
- // If erroneous timeout in closed/timed-wait state, just return
- if (m_state == CLOSED || m_state == TIMED_WAIT) return;
-
- m_ssThresh = Window () / 2; // Per RFC2581
- m_ssThresh = std::max (m_ssThresh, 2 * m_segmentSize);
- // Set cWnd to segSize on timeout, per rfc2581
- // Collapse congestion window (re-enter slowstart)
- m_cWnd = m_segmentSize;
- m_nextTxSequence = m_highestRxAck; // Start from highest Ack
- m_rtt->IncreaseMultiplier (); // DoubleValue timeout value for next retx timer
- Retransmit (); // Retransmit the packet
-}
-
-void TcpSocketImpl::LastAckTimeout ()
-{
- m_lastAckEvent.Cancel ();
- if (m_state == LAST_ACK)
- {
- Actions_t action = ProcessEvent (TIMEOUT);
- ProcessAction (action);
- }
- if (!m_closeNotified)
- {
- m_closeNotified = true;
- }
-}
-
-void TcpSocketImpl::PersistTimeout ()
-{
- NS_LOG_LOGIC ("PersistTimeout expired at "<<Simulator::Now ().GetSeconds ());
- m_persistTime = Scalar(2)*m_persistTime;
- m_persistTime = std::min(Seconds(60),m_persistTime); //maxes out at 60
- //the persist timeout sends exactly one byte probes
- //this is explicit in stevens, and kind of in rfc793 p42, rfc1122 sec4.2.2.17
- Ptr<Packet> p =
- m_pendingData->CopyFromSeq(1,m_firstPendingSequence,m_nextTxSequence);
- TcpHeader tcpHeader;
- tcpHeader.SetSequenceNumber (m_nextTxSequence);
- tcpHeader.SetAckNumber (m_nextRxSequence);
- tcpHeader.SetSourcePort (m_endPoint->GetLocalPort());
- tcpHeader.SetDestinationPort (m_endPoint->GetPeerPort ());
- tcpHeader.SetWindowSize (AdvertisedWindowSize());
-
- m_tcp->SendPacket (p, tcpHeader, m_endPoint->GetLocalAddress (),
- m_endPoint->GetPeerAddress (), m_boundnetdevice);
- NS_LOG_LOGIC ("Schedule persist timeout at time "
- <<Simulator::Now ().GetSeconds () << " to expire at time "
- << (Simulator::Now () + m_persistTime).GetSeconds());
- m_persistEvent =
- Simulator::Schedule (m_persistTime, &TcpSocketImpl::PersistTimeout, this);
-}
-
-void TcpSocketImpl::Retransmit ()
-{
- NS_LOG_FUNCTION (this);
- uint8_t flags = TcpHeader::ACK;
- if (m_state == SYN_SENT)
- {
- if (m_cnCount > 0)
- {
- SendEmptyPacket (TcpHeader::SYN);
- return;
- }
- else
- {
- NotifyConnectionFailed ();
- return;
- }
- }
- if (!m_pendingData)
- {
- if (m_state == FIN_WAIT_1)
- { // Must have lost FIN, re-send
- SendEmptyPacket (TcpHeader::FIN);
- }
- return;
- }
- NS_ASSERT(m_nextTxSequence == m_highestRxAck);
- Ptr<Packet> p = m_pendingData->CopyFromSeq (m_segmentSize,
- m_firstPendingSequence,
- m_nextTxSequence);
- // Calculate remaining data for COE check
- uint32_t remainingData = m_pendingData->SizeFromSeq (
- m_firstPendingSequence,
- m_nextTxSequence + SequenceNumber32(p->GetSize ()));
- if (m_closeOnEmpty && remainingData == 0)
- { // Add the FIN flag
- flags = flags | TcpHeader::FIN;
- }
-
- NS_LOG_LOGIC ("TcpSocketImpl " << this << " retxing seq " << m_highestRxAck);
- if (m_retxEvent.IsExpired () )
- {
- Time rto = m_rtt->RetransmitTimeout ();
- NS_LOG_LOGIC (this<<" Schedule ReTxTimeout at time "
- << Simulator::Now ().GetSeconds () << " to expire at time "
- << (Simulator::Now () + rto).GetSeconds ());
- m_retxEvent = Simulator::Schedule (rto,&TcpSocketImpl::ReTxTimeout,this);
- }
- m_rtt->SentSeq (m_highestRxAck,p->GetSize ());
- // And send the packet
- TcpHeader tcpHeader;
- tcpHeader.SetSequenceNumber (m_nextTxSequence);
- tcpHeader.SetAckNumber (m_nextRxSequence);
- tcpHeader.SetSourcePort (m_endPoint->GetLocalPort());
- tcpHeader.SetDestinationPort (m_endPoint->GetPeerPort ());
- tcpHeader.SetFlags (flags);
- tcpHeader.SetWindowSize (AdvertisedWindowSize());
-
- m_tcp->SendPacket (p, tcpHeader, m_endPoint->GetLocalAddress (),
- m_endPoint->GetPeerAddress (), m_boundnetdevice);
-}
-
-void
-TcpSocketImpl::SetSndBufSize (uint32_t size)
-{
- m_sndBufSize = size;
-}
-
-uint32_t
-TcpSocketImpl::GetSndBufSize (void) const
-{
- return m_sndBufSize;
-}
-
-void
-TcpSocketImpl::SetRcvBufSize (uint32_t size)
-{
- m_rxBufMaxSize = size;
-}
-
-uint32_t
-TcpSocketImpl::GetRcvBufSize (void) const
-{
- return m_rxBufMaxSize;
-}
-
-void
-TcpSocketImpl::SetSegSize (uint32_t size)
-{
- m_segmentSize = size;
- /*
- * Make sure that the congestion window is initialized for IW properly. We
- * can't do this after the connection starts up or would would most likely
- * change m_cWnd out from under the protocol. That would be Bad (TM).
- */
- NS_ABORT_MSG_UNLESS (m_state == CLOSED, "TcpSocketImpl::SetSegSize(): Cannot change segment size dynamically.");
- m_cWnd = m_initialCWnd * m_segmentSize;
-}
-
-uint32_t
-TcpSocketImpl::GetSegSize (void) const
-{
- return m_segmentSize;
-}
-
-void
-TcpSocketImpl::SetSSThresh (uint32_t threshold)
-{
- m_ssThresh = threshold;
-}
-
-uint32_t
-TcpSocketImpl::GetSSThresh (void) const
-{
- return m_ssThresh;
-}
-
-void
-TcpSocketImpl::SetInitialCwnd (uint32_t cwnd)
-{
- m_initialCWnd = cwnd;
- /*
- * Make sure that the congestion window is initialized for IW properly. We
- * can't do this after the connection starts up or would would most likely
- * change m_cWnd out from under the protocol. That would be Bad (TM).
- */
- NS_ABORT_MSG_UNLESS (m_state == CLOSED, "TcpSocketImpl::SetInitialCwnd(): Cannot change initial cwnd dynamically.");
- m_cWnd = m_initialCWnd * m_segmentSize;
-}
-
-uint32_t
-TcpSocketImpl::GetInitialCwnd (void) const
-{
- return m_initialCWnd;
-}
-
-void
-TcpSocketImpl::SetConnTimeout (Time timeout)
-{
- m_cnTimeout = timeout;
-}
-
-Time
-TcpSocketImpl::GetConnTimeout (void) const
-{
- return m_cnTimeout;
-}
-
-void
-TcpSocketImpl::SetConnCount (uint32_t count)
-{
- m_cnCount = count;
-}
-
-uint32_t
-TcpSocketImpl::GetConnCount (void) const
-{
- return m_cnCount;
-}
-
-void
-TcpSocketImpl::SetDelAckTimeout (Time timeout)
-{
- m_delAckTimeout = timeout;
-}
-
-Time
-TcpSocketImpl::GetDelAckTimeout (void) const
-{
- return m_delAckTimeout;
-}
-
-void
-TcpSocketImpl::SetDelAckMaxCount (uint32_t count)
-{
- m_delAckMaxCount = count;
-}
-
-uint32_t
-TcpSocketImpl::GetDelAckMaxCount (void) const
-{
- return m_delAckMaxCount;
-}
-
-bool
-TcpSocketImpl::SetAllowBroadcast (bool allowBroadcast)
-{
- if (allowBroadcast)
- {
- return false;
- }
- return true;
-}
-
-bool
-TcpSocketImpl::GetAllowBroadcast () const
-{
- return false;
-}
-
-}//namespace ns3
-
-
--- a/src/internet-stack/tcp-socket-impl.h Tue Dec 21 17:39:54 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,253 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 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: Raj Bhattacharjea <raj.b@gatech.edu>
- */
-#ifndef TCP_SOCKET_IMPL_H
-#define TCP_SOCKET_IMPL_H
-
-#include <stdint.h>
-#include <queue>
-#include "ns3/callback.h"
-#include "ns3/traced-value.h"
-#include "ns3/tcp-socket.h"
-#include "ns3/ptr.h"
-#include "ns3/ipv4-address.h"
-#include "ns3/event-id.h"
-#include "ns3/ipv4-header.h"
-#include "ipv4-interface.h"
-#include "tcp-typedefs.h"
-#include "pending-data.h"
-#include "ns3/sequence-number.h"
-#include "rtt-estimator.h"
-
-
-namespace ns3 {
-
-class Ipv4EndPoint;
-class Node;
-class Packet;
-class TcpL4Protocol;
-class TcpHeader;
-
-/**
- * \ingroup socket
- * \ingroup tcp
- *
- * \brief An implementation of a stream socket using TCP.
- *
- * This class contains an implementation of TCP Tahoe, as well as a sockets
- * interface for talking to TCP. Features include connection orientation,
- * reliability through cumulative acknowledgements, congestion and flow
- * control. Finite send buffer semantics are modeled, but as of yet, finite
- * receive buffer modelling is unimplemented.
- *
- * The closedown of these sockets is as of yet not compliant with the relevant
- * RFCs, i.e. the FIN handshaking isn't correct. While this is visible at the
- * PCAP tracing level, it has no effect on the statistics users are interested
- * in, i.e. throughput, delay, etc. of actual payload data.
- *
- * Asynchronous callbacks to provide notifications to higher layers that a
- * protocol event has occured, such as space freeing up in the send buffer
- * or new data arriving in the receive buffer.
- */
-class TcpSocketImpl : public TcpSocket
-{
-public:
- static TypeId GetTypeId (void);
- /**
- * Create an unbound tcp socket.
- */
- TcpSocketImpl ();
- TcpSocketImpl (const TcpSocketImpl& sock);
- virtual ~TcpSocketImpl ();
-
- void SetNode (Ptr<Node> node);
- void SetTcp (Ptr<TcpL4Protocol> tcp);
- void SetRtt (Ptr<RttEstimator> rtt);
-
- virtual enum SocketErrno GetErrno (void) const;
- virtual Ptr<Node> GetNode (void) const;
- virtual int Bind (void);
- virtual int Bind (const Address &address);
- virtual int Close (void);
- virtual int ShutdownSend (void);
- virtual int ShutdownRecv (void);
- virtual int Connect(const Address &address);
- virtual int Listen(void);
- virtual uint32_t GetTxAvailable (void) const;
- virtual int Send (Ptr<Packet> p, uint32_t flags);
- virtual int SendTo(Ptr<Packet> p, uint32_t flags, const Address &toAddress);
- virtual uint32_t GetRxAvailable (void) const;
- virtual Ptr<Packet> Recv (uint32_t maxSize, uint32_t flags);
- virtual Ptr<Packet> RecvFrom (uint32_t maxSize, uint32_t flags,
- Address &fromAddress);
- virtual int GetSockName (Address &address) const;
- virtual void BindToNetDevice (Ptr<NetDevice> netdevice);
- virtual bool SetAllowBroadcast (bool allowBroadcast);
- virtual bool GetAllowBroadcast () const;
-
-private:
- friend class Tcp;
- // invoked by Tcp class
- int FinishBind (void);
- void ForwardUp (Ptr<Packet> p, Ipv4Header header, uint16_t port,
- Ptr<Ipv4Interface> incomingInterface);
- void Destroy (void);
- int DoSendTo (Ptr<Packet> p, const Address &daddr);
- int DoSendTo (Ptr<Packet> p, Ipv4Address daddr, uint16_t dport);
- void SendEmptyPacket(uint8_t flags);
- void SendRST();
-
- //methods for state
- bool ProcessAction (Actions_t a);
- bool ProcessAction (Actions_t a, const TcpHeader& tcpHeader,
- Ipv4Address saddr, Ipv4Address daddr);
- bool ProcessPacketAction (Actions_t a, Ptr<Packet> p,
- const TcpHeader& tcpHeader,
- const Address& fromAddress,
- const Address& toAddress);
- Actions_t ProcessEvent (Events_t e);
- bool SendPendingData(bool withAck = false);
- void CompleteFork(Ptr<Packet>, const TcpHeader&, const Address& fromAddress, const Address& toAddress);
- void ConnectionSucceeded();
-
- //methods for window management
- virtual uint32_t UnAckDataCount(); // Return count of number of unacked bytes
- virtual uint32_t BytesInFlight(); // Return total bytes in flight
- virtual uint32_t Window(); // Return window size (integer)
- virtual uint32_t AvailableWindow();// Return unfilled portion of window
-
- //methods for Rx buffer management
- uint32_t RxBufferFreeSpace();
- uint16_t AdvertisedWindowSize();
-
- // Manage data tx/rx
- void NewRx (Ptr<Packet>, const TcpHeader&, const Address& fromAddress, const Address& toAddress);
- void RxBufFinishInsert (SequenceNumber32);
- Ptr<TcpSocketImpl> Copy ();
- virtual void NewAck (SequenceNumber32 seq);
- virtual void DupAck (const TcpHeader& t, uint32_t count);
- virtual void ReTxTimeout ();
- void DelAckTimeout ();
- void LastAckTimeout ();
- void PersistTimeout ();
- void Retransmit ();
- void CommonNewAck (SequenceNumber32 seq, bool skipTimer = false);
- // All timers are cancelled when the endpoint is deleted, to insure
- // we don't have additional activity
- void CancelAllTimers();
- // attribute related
- virtual void SetSndBufSize (uint32_t size);
- virtual uint32_t GetSndBufSize (void) const;
- virtual void SetRcvBufSize (uint32_t size);
- virtual uint32_t GetRcvBufSize (void) const;
- virtual void SetSegSize (uint32_t size);
- virtual uint32_t GetSegSize (void) const;
- virtual void SetSSThresh (uint32_t threshold);
- virtual uint32_t GetSSThresh (void) const;
- virtual void SetInitialCwnd (uint32_t cwnd);
- virtual uint32_t GetInitialCwnd (void) const;
- virtual void SetConnTimeout (Time timeout);
- virtual Time GetConnTimeout (void) const;
- virtual void SetConnCount (uint32_t count);
- virtual uint32_t GetConnCount (void) const;
- virtual void SetDelAckTimeout (Time timeout);
- virtual Time GetDelAckTimeout (void) const;
- virtual void SetDelAckMaxCount (uint32_t count);
- virtual uint32_t GetDelAckMaxCount (void) const;
-
- bool m_skipRetxResched;
- uint32_t m_dupAckCount;
- EventId m_retxEvent;
- EventId m_lastAckEvent;
-
- EventId m_delAckEvent;
- uint32_t m_delAckCount;
- uint32_t m_delAckMaxCount;
- Time m_delAckTimeout;
-
- Ipv4EndPoint *m_endPoint;
- Ptr<Node> m_node;
- Ptr<TcpL4Protocol> m_tcp;
-
- enum SocketErrno m_errno;
- bool m_shutdownSend;
- bool m_shutdownRecv;
- bool m_connected;
-
- //manage the state information
- States_t m_state;
- bool m_closeNotified;
- bool m_closeRequestNotified;
- bool m_closeOnEmpty;
- bool m_pendingClose;
-
-
- //sequence info, sender side
- SequenceNumber32 m_nextTxSequence;
- SequenceNumber32 m_highTxMark;
- SequenceNumber32 m_highestRxAck;
- SequenceNumber32 m_lastRxAck;
-
- //sequence info, receiver side
- SequenceNumber32 m_nextRxSequence; //next expected sequence
-
- //sequence number where fin was sent or received
- SequenceNumber32 m_finSequence;
-
- //Rx buffer
- UnAckData_t m_bufferedData; //buffer which sorts out of sequence data
- //Rx buffer state
- uint32_t m_rxAvailable; // amount of data available for reading through Recv
- uint32_t m_rxBufSize; //size in bytes of the data in the rx buf
- //note that these two are not the same: rxAvailbale is the number of
- //contiguous sequenced bytes that can be read, rxBufSize is the TOTAL size
- //including out of sequence data, such that m_rxAvailable <= m_rxBufSize
-
- //this is kind of the tx buffer
- PendingData* m_pendingData;
- SequenceNumber32 m_firstPendingSequence;
-
- // Window management
- uint32_t m_segmentSize; //SegmentSize
- uint32_t m_rxWindowSize; //Flow control window
- TracedValue<uint32_t> m_cWnd; //Congestion window
- uint32_t m_ssThresh; //Slow Start Threshold
- uint32_t m_initialCWnd; //Initial cWnd value
-
- //persist timer management
- Time m_persistTime;
- EventId m_persistEvent;
-
-
- // Round trip time estimation
- Ptr<RttEstimator> m_rtt;
- Time m_lastMeasuredRtt;
-
- // Timer-related members
- Time m_cnTimeout;
- uint32_t m_cnCount;
-
- // Attributes
- uint32_t m_sndBufSize; // buffer limit for the outgoing queue
- uint32_t m_rxBufMaxSize; // maximum receive socket buffer size
-};
-
-}//namespace ns3
-
-#endif /* TCP_SOCKET_IMPL_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/internet-stack/tcp-tahoe.cc Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,205 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Adrian Sai-wah Tam
+ *
+ * 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: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
+ */
+
+#define NS_LOG_APPEND_CONTEXT \
+ if (m_node) { std::clog << Simulator::Now ().GetSeconds () << " [node " << m_node->GetId () << "] "; }
+
+#include "tcp-tahoe.h"
+#include "ns3/log.h"
+#include "ns3/trace-source-accessor.h"
+#include "ns3/simulator.h"
+#include "ns3/abort.h"
+#include "ns3/node.h"
+
+NS_LOG_COMPONENT_DEFINE ("TcpTahoe");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (TcpTahoe);
+
+TypeId
+TcpTahoe::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::TcpTahoe")
+ .SetParent<TcpSocketBase> ()
+ .AddConstructor<TcpTahoe> ()
+ .AddTraceSource ("CongestionWindow",
+ "The TCP connection's congestion window",
+ MakeTraceSourceAccessor (&TcpTahoe::m_cWnd))
+ ;
+ return tid;
+}
+
+TcpTahoe::TcpTahoe (void) : m_initialCWnd (0)
+{
+ NS_LOG_FUNCTION (this);
+}
+
+TcpTahoe::TcpTahoe (const TcpTahoe& sock)
+ : TcpSocketBase (sock),
+ m_cWnd (sock.m_cWnd),
+ m_ssThresh (sock.m_ssThresh),
+ m_initialCWnd (sock.m_initialCWnd)
+{
+ NS_LOG_FUNCTION (this);
+ NS_LOG_LOGIC ("Invoked the copy constructor");
+}
+
+TcpTahoe::~TcpTahoe (void)
+{
+}
+
+/** We initialize m_cWnd from this function, after attributes initialized */
+int
+TcpTahoe::Listen (void)
+{
+ NS_LOG_FUNCTION (this);
+ InitializeCwnd ();
+ return TcpSocketBase::Listen ();
+}
+
+/** We initialize m_cWnd from this function, after attributes initialized */
+int
+TcpTahoe::Connect (const Address & address)
+{
+ NS_LOG_FUNCTION (this << address);
+ InitializeCwnd ();
+ return TcpSocketBase::Connect (address);
+}
+
+/** Limit the size of in-flight data by cwnd and receiver's rxwin */
+uint32_t
+TcpTahoe::Window (void)
+{
+ NS_LOG_FUNCTION (this);
+ return std::min (m_rWnd.Get (), m_cWnd.Get ());
+}
+
+Ptr<TcpSocketBase>
+TcpTahoe::Fork (void)
+{
+ return CopyObject<TcpTahoe> (this);
+}
+
+/** New ACK (up to seqnum seq) received. Increase cwnd and call TcpSocketBase::NewAck() */
+void
+TcpTahoe::NewAck (SequenceNumber32 const& seq)
+{
+ NS_LOG_FUNCTION (this << seq);
+ NS_LOG_LOGIC ("TcpTahoe receieved ACK for seq " << seq <<
+ " cwnd " << m_cWnd <<
+ " ssthresh " << m_ssThresh);
+ if (m_cWnd < m_ssThresh)
+ { // Slow start mode, add one segSize to cWnd. Default m_ssThresh is 65535. (RFC2001, sec.1)
+ m_cWnd += m_segmentSize;
+ NS_LOG_INFO ("In SlowStart, updated to cwnd " << m_cWnd << " ssthresh " << m_ssThresh);
+ }
+ else
+ { // Congestion avoidance mode, increase by (segSize*segSize)/cwnd. (RFC2581, sec.3.1)
+ // To increase cwnd for one segSize per RTT, it should be (ackBytes*segSize)/cwnd
+ double adder = static_cast<double> (m_segmentSize * m_segmentSize) / m_cWnd.Get ();
+ adder = std::max (1.0, adder);
+ m_cWnd += static_cast<uint32_t> (adder);
+ NS_LOG_INFO ("In CongAvoid, updated to cwnd " << m_cWnd << " ssthresh " << m_ssThresh);
+ }
+ TcpSocketBase::NewAck (seq); // Complete newAck processing
+}
+
+/** Cut down ssthresh upon triple dupack */
+void
+TcpTahoe::DupAck (const TcpHeader& t, uint32_t count)
+{
+ NS_LOG_FUNCTION (this << "t " << count);
+ if (count == 3)
+ { // triple duplicate ack triggers fast retransmit (RFC2001, sec.3)
+ NS_LOG_INFO ("Triple Dup Ack: old ssthresh " << m_ssThresh << " cwnd " << m_cWnd);
+ // fast retransmit in Tahoe means triggering RTO earlier. Tx is restarted
+ // from the highest ack and run slow start again.
+ // (Fall & Floyd 1996, sec.1)
+ m_ssThresh = std::max (static_cast<unsigned> (m_cWnd / 2), m_segmentSize * 2); // Half ssthresh
+ m_cWnd = m_segmentSize; // Run slow start again
+ m_nextTxSequence = m_txBuffer.HeadSequence (); // Restart from highest Ack
+ NS_LOG_INFO ("Triple Dup Ack: new ssthresh " << m_ssThresh << " cwnd " << m_cWnd);
+ NS_LOG_LOGIC ("Triple Dup Ack: retransmit missing segment at " << Simulator::Now ().GetSeconds ());
+ DoRetransmit ();
+ }
+}
+
+/** Retransmit timeout */
+void TcpTahoe::Retransmit (void)
+{
+ NS_LOG_FUNCTION (this);
+ NS_LOG_LOGIC (this << " ReTxTimeout Expired at time " << Simulator::Now ().GetSeconds ());
+ // If erroneous timeout in closed/timed-wait state, just return
+ if (m_state == CLOSED || m_state == TIME_WAIT) return;
+ // If all data are received, just return
+ if (m_txBuffer.HeadSequence () >= m_nextTxSequence) return;
+
+ m_ssThresh = std::max (static_cast<unsigned> (m_cWnd / 2), m_segmentSize * 2); // Half ssthresh
+ m_cWnd = m_segmentSize; // Set cwnd to 1 segSize (RFC2001, sec.2)
+ m_nextTxSequence = m_txBuffer.HeadSequence (); // Restart from highest Ack
+ m_rtt->IncreaseMultiplier (); // Double the next RTO
+ DoRetransmit (); // Retransmit the packet
+}
+
+void
+TcpTahoe::SetSegSize (uint32_t size)
+{
+ NS_ABORT_MSG_UNLESS (m_state == CLOSED, "TcpTahoe::SetSegSize() cannot change segment size after connection started.");
+ m_segmentSize = size;
+}
+
+void
+TcpTahoe::SetSSThresh (uint32_t threshold)
+{
+ m_ssThresh = threshold;
+}
+
+uint32_t
+TcpTahoe::GetSSThresh (void) const
+{
+ return m_ssThresh;
+}
+
+void
+TcpTahoe::SetInitialCwnd (uint32_t cwnd)
+{
+ NS_ABORT_MSG_UNLESS (m_state == CLOSED, "TcpTahoe::SetInitialCwnd() cannot change initial cwnd after connection started.");
+ m_initialCWnd = cwnd;
+}
+
+uint32_t
+TcpTahoe::GetInitialCwnd (void) const
+{
+ return m_initialCWnd;
+}
+
+void
+TcpTahoe::InitializeCwnd (void)
+{
+ /*
+ * Initialize congestion window, default to 1 MSS (RFC2001, sec.1) and must
+ * not be larger than 2 MSS (RFC2581, sec.3.1). Both m_initiaCWnd and
+ * m_segmentSize are set by the attribute system in ns3::TcpSocket.
+ */
+ m_cWnd = m_initialCWnd * m_segmentSize;
+}
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/internet-stack/tcp-tahoe.h Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Adrian Sai-wah Tam
+ *
+ * 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: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
+ */
+
+#ifndef TCP_TAHOE_H
+#define TCP_TAHOE_H
+
+#include "tcp-socket-base.h"
+
+namespace ns3 {
+
+/**
+ * \ingroup socket
+ * \ingroup tcp
+ *
+ * \brief An implementation of a stream socket using TCP.
+ *
+ * This class contains the Tahoe implementation of TCP. Tahoe is not officially
+ * published in RFC. The reference for implementing this is based on
+ * Kevin Fall and Sally Floyd, "Simulation-based Comparisons of Tahoe, Reno, and SACK TCP", CCR, 1996
+ * http://inst.eecs.berkeley.edu/~ee122/fa05/projects/Project2/proj2_spec_files/sacks.pdf
+ * In summary, we have slow start, congestion avoidance, and fast retransmit.
+ * The implementation of these algorithms are based on W. R. Stevens's book and
+ * also RFC2001.
+ */
+class TcpTahoe : public TcpSocketBase
+{
+public:
+ static TypeId GetTypeId (void);
+ /**
+ * Create an unbound tcp socket.
+ */
+ TcpTahoe (void);
+ TcpTahoe (const TcpTahoe& sock);
+ virtual ~TcpTahoe (void);
+
+ // From TcpSocketBase
+ virtual int Connect (const Address &address);
+ virtual int Listen (void);
+
+protected:
+ virtual uint32_t Window (void); // Return the max possible number of unacked bytes
+ virtual Ptr<TcpSocketBase> Fork (void); // Call CopyObject<TcpTahoe> to clone me
+ virtual void NewAck (SequenceNumber32 const& seq); // Inc cwnd and call NewAck() of parent
+ virtual void DupAck (const TcpHeader& t, uint32_t count); // Treat 3 dupack as timeout
+ virtual void Retransmit (void); // Retransmit time out
+
+ // Implementing ns3::TcpSocket -- Attribute get/set
+ virtual void SetSegSize (uint32_t size);
+ virtual void SetSSThresh (uint32_t threshold);
+ virtual uint32_t GetSSThresh (void) const;
+ virtual void SetInitialCwnd (uint32_t cwnd);
+ virtual uint32_t GetInitialCwnd (void) const;
+private:
+ void InitializeCwnd (void); // set m_cWnd when connection starts
+
+protected:
+ TracedValue<uint32_t> m_cWnd; //< Congestion window
+ uint32_t m_ssThresh; //< Slow Start Threshold
+ uint32_t m_initialCWnd; //< Initial cWnd value
+};
+
+} // namespace ns3
+
+#endif /* TCP_TAHOE_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/internet-stack/tcp-tx-buffer.cc Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,250 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Adrian Sai-wah Tam
+ *
+ * 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: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
+ */
+
+#include <iostream>
+#include <algorithm>
+#include <string.h>
+#include "ns3/packet.h"
+#include "ns3/fatal-error.h"
+#include "ns3/log.h"
+#include "tcp-tx-buffer.h"
+
+NS_LOG_COMPONENT_DEFINE ("TcpTxBuffer");
+
+namespace ns3 {
+
+TypeId
+TcpTxBuffer::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::TcpTxBuffer")
+ .SetParent<Object> ()
+ .AddConstructor<TcpTxBuffer> ()
+ .AddTraceSource ("UnackSequence",
+ "First unacknowledged sequence number (SND.UNA)",
+ MakeTraceSourceAccessor (&TcpTxBuffer::m_firstByteSeq))
+ ;
+ return tid;
+}
+
+/* A user is supposed to create a TcpSocket through a factory. In TcpSocket,
+ * there are attributes SndBufSize and RcvBufSize to control the default Tx and
+ * Rx window sizes respectively, with default of 128 KiByte. The attribute
+ * SndBufSize is passed to TcpTxBuffer by TcpSocketBase::SetSndBufSize() and in
+ * turn, TcpTxBuffer:SetMaxBufferSize(). Therefore, the m_maxBuffer value
+ * initialized below is insignificant.
+ */
+TcpTxBuffer::TcpTxBuffer (uint32_t n)
+ : m_firstByteSeq(n), m_size (0), m_maxBuffer(32768), m_data (0)
+{
+}
+
+TcpTxBuffer::~TcpTxBuffer (void)
+{
+}
+
+SequenceNumber32
+TcpTxBuffer::HeadSequence (void) const
+{
+ return m_firstByteSeq;
+}
+
+SequenceNumber32
+TcpTxBuffer::TailSequence (void) const
+{
+ return m_firstByteSeq + SequenceNumber32 (m_size);
+}
+
+uint32_t
+TcpTxBuffer::Size (void) const
+{
+ return m_size;
+}
+
+uint32_t
+TcpTxBuffer::MaxBufferSize (void) const
+{
+ return m_maxBuffer;
+}
+
+void
+TcpTxBuffer::SetMaxBufferSize (uint32_t n)
+{
+ m_maxBuffer = n;
+}
+
+uint32_t
+TcpTxBuffer::Available (void) const
+{
+ return m_maxBuffer - m_size;
+}
+
+bool
+TcpTxBuffer::Add (Ptr<Packet> p)
+{
+ NS_LOG_FUNCTION (this << p);
+ NS_LOG_LOGIC ("Packet of size " << p->GetSize () << " appending to window starting at "
+ << m_firstByteSeq << ", availSize="<< Available ());
+ if (p->GetSize () <= Available ())
+ {
+ if (p->GetSize () > 0)
+ {
+ m_data.push_back (p);
+ m_size += p->GetSize ();
+ NS_LOG_LOGIC ("Updated size=" << m_size << ", lastSeq=" << m_firstByteSeq + SequenceNumber32 (m_size));
+ }
+ return true;
+ }
+ NS_LOG_LOGIC ("Rejected. Not enough room to buffer packet.");
+ return false;
+}
+
+uint32_t
+TcpTxBuffer::SizeFromSequence (const SequenceNumber32& seq) const
+{
+ NS_LOG_FUNCTION (this << seq);
+ // Sequence of last byte in buffer
+ SequenceNumber32 lastSeq = m_firstByteSeq + SequenceNumber32 (m_size);
+ // Non-negative size
+ NS_LOG_LOGIC ("HeadSeq=" << m_firstByteSeq << ", lastSeq=" << lastSeq << ", size=" << m_size <<
+ ", returns " << lastSeq - seq);
+ return lastSeq - seq;
+}
+
+Ptr<Packet>
+TcpTxBuffer::CopyFromSequence (uint32_t numBytes, const SequenceNumber32& seq)
+{
+ NS_LOG_FUNCTION (this << numBytes << seq);
+ uint32_t s = std::min (numBytes, SizeFromSequence (seq)); // Real size to extract. Insure not beyond end of data
+ if (s == 0)
+ {
+ return Create<Packet> (); // Empty packet returned
+ }
+ if (m_data.size () == 0)
+ { // No actual data, just return dummy-data packet of correct size
+ return Create<Packet> (s);
+ }
+
+ // Extract data from the buffer and return
+ uint32_t offset = seq - m_firstByteSeq.Get ();
+ uint32_t count = 0; // Offset of the first byte of a packet in the buffer
+ uint32_t pktSize = 0;
+ bool beginFound = false;
+ int pktCount = 0;
+ Ptr<Packet> outPacket;
+ NS_LOG_LOGIC ("There are " << m_data.size () << " number of packets in buffer");
+ for (BufIterator i = m_data.begin (); i != m_data.end (); ++i)
+ {
+ pktCount++;
+ pktSize = (*i)->GetSize ();
+ if (!beginFound)
+ { // Look for first fragment
+ if (count + pktSize > offset)
+ {
+ NS_LOG_LOGIC ("First byte found in packet #" << pktCount << " at buffer offset " << count
+ << ", packet len=" << pktSize);
+ beginFound = true;
+ uint32_t packetOffset = offset - count;
+ uint32_t fragmentLength = count + pktSize - offset;
+ if (fragmentLength >= s)
+ { // Data to be copied falls entirely in this packet
+ return (*i)->CreateFragment (packetOffset, s);
+ }
+ else
+ { // This packet only fulfills part of the request
+ outPacket = (*i)->CreateFragment (packetOffset, fragmentLength);
+ }
+ NS_LOG_LOGIC ("Output packet is now of size " << outPacket->GetSize ());
+ }
+ }
+ else if (count + pktSize >= offset + s)
+ { // Last packet fragment found
+ NS_LOG_LOGIC ("Last byte found in packet #" << pktCount << " at buffer offset " << count
+ << ", packet len=" << pktSize);
+ uint32_t fragmentLength = offset + s - count;
+ Ptr<Packet> endFragment = (*i)->CreateFragment (0, fragmentLength);
+ outPacket->AddAtEnd (endFragment);
+ NS_LOG_LOGIC ("Output packet is now of size " << outPacket->GetSize ());
+ break;
+ }
+ else
+ {
+ NS_LOG_LOGIC ("Appending to output the packet #" << pktCount << " of offset " << count << " len=" << pktSize);
+ outPacket->AddAtEnd (*i);
+ NS_LOG_LOGIC ("Output packet is now of size " << outPacket->GetSize ());
+ }
+ count += pktSize;
+ }
+ NS_ASSERT (outPacket->GetSize () == s);
+ return outPacket;
+}
+
+void
+TcpTxBuffer::SetHeadSequence (const SequenceNumber32& seq)
+{
+ NS_LOG_FUNCTION (this << seq);
+ m_firstByteSeq = seq;
+}
+
+void
+TcpTxBuffer::DiscardUpTo (const SequenceNumber32& seq)
+{
+ NS_LOG_FUNCTION (this << seq);
+ NS_LOG_LOGIC ("current data size=" << m_size << ", headSeq=" << m_firstByteSeq << ", maxBuffer=" << m_maxBuffer
+ << ", numPkts=" << m_data.size ());
+ // Cases do not need to scan the buffer
+ if (m_firstByteSeq >= seq) return;
+
+ // Scan the buffer and discard packets
+ uint32_t offset = seq - m_firstByteSeq.Get (); // Number of bytes to remove
+ uint32_t pktSize;
+ NS_LOG_LOGIC ("Offset=" << offset);
+ BufIterator i = m_data.begin ();
+ while (i != m_data.end ())
+ {
+ if (offset > (*i)->GetSize ())
+ { // This packet is behind the seqnum. Remove this packet from the buffer
+ pktSize = (*i)->GetSize ();
+ m_size -= pktSize;
+ offset -= pktSize;
+ m_firstByteSeq += pktSize;
+ i = m_data.erase (i);
+ NS_LOG_LOGIC ("Removed one packet of size " << pktSize << ", offset=" << offset);
+ }
+ else if (offset > 0)
+ { // Part of the packet is behind the seqnum. Fragment
+ pktSize = (*i)->GetSize () - offset;
+ *i = (*i)->CreateFragment (offset, pktSize);
+ m_size -= offset;
+ m_firstByteSeq += offset;
+ NS_LOG_LOGIC ("Fragmented one packet by size " << offset << ", new size=" << pktSize);
+ break;
+ }
+ }
+ // Catching the case of ACKing a FIN
+ if (m_size == 0)
+ {
+ m_firstByteSeq = seq;
+ }
+ NS_LOG_LOGIC ("size=" << m_size << " headSeq=" << m_firstByteSeq << " maxBuffer=" << m_maxBuffer
+ <<" numPkts="<< m_data.size ());
+ NS_ASSERT (m_firstByteSeq == seq);
+}
+
+} // namepsace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/internet-stack/tcp-tx-buffer.h Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,121 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Adrian Sai-wah Tam
+ *
+ * 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: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
+ */
+
+#ifndef __TCP_TX_BUFFER_H__
+#define __TCP_TX_BUFFER_H__
+
+#include <list>
+#include "ns3/traced-value.h"
+#include "ns3/trace-source-accessor.h"
+#include "ns3/object.h"
+#include "ns3/sequence-number.h"
+#include "ns3/ptr.h"
+
+namespace ns3 {
+class Packet;
+
+/**
+ * \ingroup tcp
+ *
+ * \brief class for keeping the data sent by the application to the TCP socket, i.e.
+ * the sending buffer.
+ */
+class TcpTxBuffer : public Object
+{
+public:
+ static TypeId GetTypeId (void);
+ TcpTxBuffer (uint32_t n = 0);
+ virtual ~TcpTxBuffer (void);
+
+ // Accessors
+
+ /**
+ * Returns the first byte's sequence number
+ */
+ SequenceNumber32 HeadSequence (void) const;
+
+ /**
+ * Returns the last byte's sequence number + 1
+ */
+ SequenceNumber32 TailSequence (void) const;
+
+ /**
+ * Returns total number of bytes in this Tx buffer
+ */
+ uint32_t Size (void) const;
+
+ /**
+ * Returns the Tx window size
+ */
+ uint32_t MaxBufferSize (void) const;
+
+ /**
+ * Set the Tx window size
+ */
+ void SetMaxBufferSize (uint32_t n);
+
+ /**
+ * Returns the available capacity in this Tx window
+ */
+ uint32_t Available (void) const;
+
+ /**
+ * Append a data packet to the end of the buffer
+ *
+ * \param p The packet to be appended to the Tx buffer
+ * \return Boolean to indicate success
+ */
+ bool Add (Ptr<Packet> p);
+
+ /**
+ * Returns the number of bytes from the buffer in the range [seq, tailSequence)
+ */
+ uint32_t SizeFromSequence (const SequenceNumber32& seq) const;
+
+ /**
+ * Copy data of size numBytes into a packet, data from the range [seq, seq+numBytes)
+ */
+ Ptr<Packet> CopyFromSequence (uint32_t numBytes, const SequenceNumber32& seq);
+
+ /**
+ * Set the m_firstByteSeq to seq. Supposed to be called only when the
+ * connection is just set up and we did not send any data out yet.
+ */
+ void SetHeadSequence (const SequenceNumber32& seq);
+
+ /**
+ * Discard data up to but not including this sequence number.
+ *
+ * \param seq The sequence number of the head byte
+ */
+ void DiscardUpTo (const SequenceNumber32& seq);
+
+private:
+ typedef std::list<Ptr<Packet> >::iterator BufIterator;
+
+ TracedValue<SequenceNumber32> m_firstByteSeq; //< Sequence number of the first byte in data (SND.UNA)
+ uint32_t m_size; //< Number of data bytes
+ uint32_t m_maxBuffer; //< Max number of data bytes in buffer (SND.WND)
+ std::list<Ptr<Packet> > m_data; //< Corresponding data (may be null)
+};
+
+} // namepsace ns3
+
+#endif
--- a/src/internet-stack/tcp-typedefs.h Tue Dec 21 17:39:54 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 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: Raj Bhattacharjea <raj.b@gatech.edu>
- * typedefs for tcp state machine
- */
-
-#include <vector>
-#include <map>
-#include "ns3/sequence-number.h"
-
-#ifndef TCP_TYPEDEFS_H
-#define TCP_TYPEDEFS_H
-
-namespace ns3 {
-
-typedef enum { MAX_FLAGS = 0x40 } TCPMaxFlags_t; // Flags are 6 bits
-
-typedef enum {
- CLOSED, // 0
- LISTEN, // 1
- SYN_SENT, // 2
- SYN_RCVD, // 3
- ESTABLISHED, // 4
- CLOSE_WAIT, // 5
- LAST_ACK, // 6
- FIN_WAIT_1, // 7
- FIN_WAIT_2, // 8
- CLOSING, // 9
- TIMED_WAIT, // 10
- LAST_STATE } States_t;
-
-typedef enum {
- APP_LISTEN, // 0
- APP_CONNECT, // 1
- APP_SEND, // 2
- SEQ_RECV, // 3
- APP_CLOSE, // 4
- TIMEOUT, // 5
- ACK_RX, // 6
- SYN_RX, // 7
- SYN_ACK_RX, // 8
- FIN_RX, // 9
- FIN_ACK_RX, // 10
- FIN_ACKED, // 11
- RST_RX, // 12
- BAD_FLAGS, // 13
- LAST_EVENT } Events_t;
-
-typedef enum {
- NO_ACT, // 0
- ACK_TX, // 1
- ACK_TX_1, // 2 - ACK response to syn
- RST_TX, // 3
- SYN_TX, // 4
- SYN_ACK_TX, // 5
- FIN_TX, // 6
- FIN_ACK_TX, // 7
- NEW_ACK, // 8
- NEW_SEQ_RX, // 9
- RETX, // 10
- TX_DATA, // 11
- PEER_CLOSE, // 12
- APP_CLOSED, // 13
- CANCEL_TM, // 14
- APP_NOTIFY, // 15 - Notify app that connection failed
- SERV_NOTIFY, // 16 - Notify server tcp that connection completed
- LAST_ACTION } Actions_t;
-
-class SA // State/Action pair
-{
-public:
- SA () : state (LAST_STATE), action (LAST_ACTION) { }
- SA (States_t s, Actions_t a) : state (s), action (a) { }
-public:
- States_t state;
- Actions_t action;
-};
-typedef std::vector<SA> StateActionVec_t;
-typedef std::vector<StateActionVec_t> StateActions_t; // One per current state
-typedef std::vector<Events_t> EventVec_t; // For flag events lookup
-
-//type for managing buffered out of sequence data
-typedef std::map<SequenceNumber32, Ptr<Packet> > UnAckData_t;
-
-class TcpStateMachine {
- public:
- TcpStateMachine ();
- SA Lookup (States_t, Events_t);
- Events_t FlagsEvent (uint8_t); // Lookup event from flags
-
- public:
- StateActions_t aT; // Action table
- EventVec_t eV; // Flags event lookup
-};
-
-}//namespace ns3
-#endif //TCP_TYPEDEFS_H
--- a/src/internet-stack/udp-socket-impl.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/internet-stack/udp-socket-impl.cc Tue Dec 21 17:46:35 2010 +0100
@@ -116,6 +116,12 @@
return m_errno;
}
+enum Socket::SocketType
+UdpSocketImpl::GetSocketType (void) const
+{
+ return NS3_SOCK_DGRAM;
+}
+
Ptr<Node>
UdpSocketImpl::GetNode (void) const
{
--- a/src/internet-stack/udp-socket-impl.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/internet-stack/udp-socket-impl.h Tue Dec 21 17:46:35 2010 +0100
@@ -60,6 +60,7 @@
void SetUdp (Ptr<UdpL4Protocol> udp);
virtual enum SocketErrno GetErrno (void) const;
+ virtual enum SocketType GetSocketType (void) const;
virtual Ptr<Node> GetNode (void) const;
virtual int Bind (void);
virtual int Bind (const Address &address);
--- a/src/internet-stack/wscript Tue Dec 21 17:39:54 2010 +0100
+++ b/src/internet-stack/wscript Tue Dec 21 17:46:35 2010 +0100
@@ -109,7 +109,6 @@
'arp-cache.cc',
'arp-l3-protocol.cc',
'udp-socket-impl.cc',
- 'tcp-socket-impl.cc',
'ipv4-end-point-demux.cc',
'udp-socket-factory-impl.cc',
'tcp-socket-factory-impl.cc',
@@ -139,6 +138,13 @@
'icmpv6-l4-protocol.cc',
'ipv6-test.cc',
'ipv6-extension-header-test-suite.cc',
+ 'tcp-socket-base.cc',
+ 'tcp-rfc793.cc',
+ 'tcp-tahoe.cc',
+ 'tcp-reno.cc',
+ 'tcp-newreno.cc',
+ 'tcp-rx-buffer.cc',
+ 'tcp-tx-buffer.cc',
]
headers = bld.new_task_gen('ns3header')
--- a/src/node/ipv4-routing-protocol.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/node/ipv4-routing-protocol.h Tue Dec 21 17:46:35 2010 +0100
@@ -25,6 +25,7 @@
#include "ipv4-header.h"
#include "ipv4-interface-address.h"
#include "ipv4.h"
+#include "ns3/output-stream-wrapper.h"
namespace ns3 {
@@ -140,6 +141,8 @@
* Typically, invoked directly or indirectly from ns3::Ipv4::SetRoutingProtocol
*/
virtual void SetIpv4 (Ptr<Ipv4> ipv4) = 0;
+
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const = 0;
};
} //namespace ns3
--- a/src/node/packet-socket.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/node/packet-socket.cc Tue Dec 21 17:46:35 2010 +0100
@@ -89,6 +89,12 @@
return m_errno;
}
+enum Socket::SocketType
+PacketSocket::GetSocketType (void) const
+{
+ return NS3_SOCK_RAW;
+}
+
Ptr<Node>
PacketSocket::GetNode (void) const
{
--- a/src/node/packet-socket.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/node/packet-socket.h Tue Dec 21 17:46:35 2010 +0100
@@ -86,6 +86,7 @@
void SetNode (Ptr<Node> node);
virtual enum SocketErrno GetErrno (void) const;
+ virtual enum SocketType GetSocketType (void) const;
virtual Ptr<Node> GetNode (void) const;
virtual int Bind (void);
virtual int Bind (const Address & address);
--- a/src/node/simple-net-device.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/node/simple-net-device.cc Tue Dec 21 17:46:35 2010 +0100
@@ -176,7 +176,7 @@
Address SimpleNetDevice::GetMulticast (Ipv6Address addr) const
{
- return Mac48Address::GetMulticast (addr);
+ return Mac48Address::GetMulticast (addr);
}
bool
--- a/src/node/socket.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/node/socket.h Tue Dec 21 17:46:35 2010 +0100
@@ -85,6 +85,13 @@
SOCKET_ERRNO_LAST
};
+ enum SocketType {
+ NS3_SOCK_STREAM,
+ NS3_SOCK_SEQPACKET,
+ NS3_SOCK_DGRAM,
+ NS3_SOCK_RAW
+ };
+
/**
* This method wraps the creation of sockets that is performed
* by a socket factory on a given node based on a TypeId.
@@ -102,6 +109,10 @@
*/
virtual enum Socket::SocketErrno GetErrno (void) const = 0;
/**
+ * \return the socket type, analogous to getsockopt (SO_TYPE)
+ */
+ virtual enum Socket::SocketType GetSocketType (void) const = 0;
+ /**
* \returns the node this socket is associated with.
*/
virtual Ptr<Node> GetNode (void) const = 0;
--- a/src/node/tcp-socket.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/node/tcp-socket.cc Tue Dec 21 17:46:35 2010 +0100
@@ -32,6 +32,8 @@
NS_OBJECT_ENSURE_REGISTERED (TcpSocket);
+const char* const TcpSocket::TcpStateName[LAST_STATE] = {"CLOSED", "LISTEN", "SYN_SENT", "SYN_RCVD", "ESTABLISHED", "CLOSE_WAIT", "LAST_ACK", "FIN_WAIT_1", "FIN_WAIT_2", "CLOSING", "TIME_WAIT" };
+
TypeId
TcpSocket::GetTypeId (void)
{
@@ -83,7 +85,7 @@
"Timeout value for TCP delayed acks, in seconds",
TimeValue (Seconds (0.2)),
MakeTimeAccessor (&TcpSocket::GetDelAckTimeout,
- &TcpSocket::SetDelAckTimeout),
+ &TcpSocket::SetDelAckTimeout),
MakeTimeChecker ())
.AddAttribute ("DelAckCount",
"Number of packets to wait before sending a TCP ack",
@@ -91,6 +93,12 @@
MakeUintegerAccessor (&TcpSocket::GetDelAckMaxCount,
&TcpSocket::SetDelAckMaxCount),
MakeUintegerChecker<uint32_t> ())
+ .AddAttribute ("PersistTimeout",
+ "Persist timeout to probe for rx window",
+ TimeValue (Seconds (6)),
+ MakeTimeAccessor (&TcpSocket::GetPersistTimeout,
+ &TcpSocket::SetPersistTimeout),
+ MakeTimeChecker ())
;
return tid;
}
--- a/src/node/tcp-socket.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/node/tcp-socket.h Tue Dec 21 17:46:35 2010 +0100
@@ -35,6 +35,21 @@
class Node;
class Packet;
+/* Names of the 11 TCP states */
+typedef enum {
+ CLOSED, // 0
+ LISTEN, // 1
+ SYN_SENT, // 2
+ SYN_RCVD, // 3
+ ESTABLISHED, // 4
+ CLOSE_WAIT, // 5
+ LAST_ACK, // 6
+ FIN_WAIT_1, // 7
+ FIN_WAIT_2, // 8
+ CLOSING, // 9
+ TIME_WAIT, // 10
+ LAST_STATE } TcpStates_t;
+
/**
* \ingroup socket
*
@@ -51,6 +66,9 @@
TcpSocket (void);
virtual ~TcpSocket (void);
+ // Literal names of TCP states for use in log messages */
+ static const char* const TcpStateName[LAST_STATE];
+
private:
// Indirect the attribute setting and getting through private virtual methods
virtual void SetSndBufSize (uint32_t size) = 0;
@@ -71,6 +89,8 @@
virtual Time GetDelAckTimeout (void) const = 0;
virtual void SetDelAckMaxCount (uint32_t count) = 0;
virtual uint32_t GetDelAckMaxCount (void) const = 0;
+ virtual void SetPersistTimeout (Time timeout) = 0;
+ virtual Time GetPersistTimeout (void) const = 0;
};
--- a/src/routing/aodv/aodv-routing-protocol.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/routing/aodv/aodv-routing-protocol.cc Tue Dec 21 17:46:35 2010 +0100
@@ -194,11 +194,13 @@
MakeTimeChecker ())
.AddAttribute ("MaxQueueLen", "Maximum number of packets that we allow a routing protocol to buffer.",
UintegerValue (64),
- MakeUintegerAccessor (&RoutingProtocol::MaxQueueLen),
+ MakeUintegerAccessor (&RoutingProtocol::SetMaxQueueLen,
+ &RoutingProtocol::GetMaxQueueLen),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("MaxQueueTime", "Maximum time packets can be queued (in seconds)",
TimeValue (Seconds (30)),
- MakeTimeAccessor (&RoutingProtocol::MaxQueueTime),
+ MakeTimeAccessor (&RoutingProtocol::SetMaxQueueTime,
+ &RoutingProtocol::GetMaxQueueTime),
MakeTimeChecker ())
.AddAttribute ("AllowedHelloLoss", "Number of hello messages which may be loss for valid link.",
UintegerValue (2),
@@ -228,6 +230,19 @@
return tid;
}
+void
+RoutingProtocol::SetMaxQueueLen (uint32_t len)
+{
+ MaxQueueLen = len;
+ m_queue.SetMaxQueueLen (len);
+}
+void
+RoutingProtocol::SetMaxQueueTime (Time t)
+{
+ MaxQueueTime = t;
+ m_queue.SetQueueTimeout (t);
+}
+
RoutingProtocol::~RoutingProtocol ()
{
}
@@ -246,6 +261,13 @@
}
void
+RoutingProtocol::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
+{
+ *stream->GetStream () << "Node: " << m_ipv4->GetObject<Node> ()->GetId () << " Time: " << Simulator::Now().GetSeconds () << "s ";
+ m_routingTable.Print (stream);
+}
+
+void
RoutingProtocol::Start ()
{
NS_LOG_FUNCTION (this);
@@ -915,10 +937,17 @@
else
{
Ptr<NetDevice> dev = m_ipv4->GetNetDevice (m_ipv4->GetInterfaceForAddress (receiver));
- RoutingTableEntry newEntry (/*device=*/dev, /*dst=*/sender, /*know seqno=*/false, /*seqno=*/0,
- /*iface=*/m_ipv4->GetAddress (m_ipv4->GetInterfaceForAddress (receiver), 0),
- /*hops=*/1, /*next hop=*/sender, /*lifetime=*/std::max (ActiveRouteTimeout, toNeighbor.GetLifeTime ()));
- m_routingTable.Update (newEntry);
+ if (toNeighbor.GetValidSeqNo () && (toNeighbor.GetHop () == 1) && (toNeighbor.GetOutputDevice () == dev))
+ {
+ toNeighbor.SetLifeTime (std::max (ActiveRouteTimeout, toNeighbor.GetLifeTime ()));
+ }
+ else
+ {
+ RoutingTableEntry newEntry (/*device=*/dev, /*dst=*/sender, /*know seqno=*/false, /*seqno=*/0,
+ /*iface=*/m_ipv4->GetAddress (m_ipv4->GetInterfaceForAddress (receiver), 0),
+ /*hops=*/1, /*next hop=*/sender, /*lifetime=*/std::max (ActiveRouteTimeout, toNeighbor.GetLifeTime ()));
+ m_routingTable.Update (newEntry);
+ }
}
}
@@ -1009,13 +1038,21 @@
if (m_routingTable.LookupRoute (dst, toDst))
{
/*
+ * Drop RREQ, This node RREP wil make a loop.
+ */
+ if (toDst.GetNextHop () == src)
+ {
+ NS_LOG_DEBUG ("Drop RREQ from " << src << ", dest next hop " << toDst.GetNextHop ());
+ return;
+ }
+ /*
* The Destination Sequence number for the requested destination is set to the maximum of the corresponding value
* received in the RREQ message, and the destination sequence value currently maintained by the node for the requested destination.
* However, the forwarding node MUST NOT modify its maintained value for the destination sequence number, even if the value
* received in the incoming RREQ is larger than the value currently maintained by the forwarding node.
*/
- if (rreqHeader.GetUnknownSeqno () || ( (int32_t (toDst.GetSeqNo ()) - int32_t (rreqHeader.GetDstSeqno ()) > 0)
- && toDst.GetValidSeqNo () ))
+ if ((rreqHeader.GetUnknownSeqno () || (int32_t (toDst.GetSeqNo ()) - int32_t (rreqHeader.GetDstSeqno ()) >= 0))
+ && toDst.GetValidSeqNo () )
{
if (!rreqHeader.GetDestinationOnly () && toDst.GetFlag() == VALID)
{
@@ -1226,7 +1263,8 @@
m_addressReqTimer[dst].Remove ();
m_addressReqTimer.erase (dst);
}
- SendPacketFromQueue (rrepHeader.GetDst (), newEntry.GetRoute ());
+ m_routingTable.LookupRoute (dst, toDst);
+ SendPacketFromQueue (dst, toDst.GetRoute ());
return;
}
--- a/src/routing/aodv/aodv-routing-protocol.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/routing/aodv/aodv-routing-protocol.h Tue Dec 21 17:46:35 2010 +0100
@@ -34,6 +34,7 @@
#include "aodv-neighbor.h"
#include "aodv-dpd.h"
#include "ns3/node.h"
+#include "ns3/output-stream-wrapper.h"
#include "ns3/ipv4-routing-protocol.h"
#include "ns3/ipv4-interface.h"
#include "ns3/ipv4-l3-protocol.h"
@@ -58,7 +59,7 @@
RoutingProtocol ();
virtual ~RoutingProtocol();
virtual void DoDispose ();
-
+
///\name From Ipv4RoutingProtocol
//\{
Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr);
@@ -70,10 +71,15 @@
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
//\}
///\name Handle protocol parameters
//\{
+ Time GetMaxQueueTime () const { return MaxQueueTime; }
+ void SetMaxQueueTime (Time t);
+ uint32_t GetMaxQueueLen () const { return MaxQueueLen; }
+ void SetMaxQueueLen (uint32_t len);
bool GetDesinationOnlyFlag () const { return DestinationOnly; }
void SetDesinationOnlyFlag (bool f) { DestinationOnly = f; }
bool GetGratuitousReplyFlag () const { return GratuitousReply; }
--- a/src/routing/aodv/aodv-rtable.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/routing/aodv/aodv-rtable.cc Tue Dec 21 17:46:35 2010 +0100
@@ -28,6 +28,7 @@
#include "aodv-rtable.h"
#include <algorithm>
+#include <iomanip>
#include "ns3/simulator.h"
#include "ns3/log.h"
@@ -155,30 +156,34 @@
}
void
-RoutingTableEntry::Print (std::ostream & os) const
+RoutingTableEntry::Print (Ptr<OutputStreamWrapper> stream) const
{
- os << m_ipv4Route->GetDestination () << "\t" << m_ipv4Route->GetGateway ()
+ std::ostream* os = stream->GetStream();
+ *os << m_ipv4Route->GetDestination () << "\t" << m_ipv4Route->GetGateway ()
<< "\t" << m_iface.GetLocal () << "\t";
switch (m_flag)
{
case VALID:
{
- os << "UP";
+ *os << "UP";
break;
}
case INVALID:
{
- os << "DOWN";
+ *os << "DOWN";
break;
}
case IN_SEARCH:
{
- os << "IN_SEARCH";
+ *os << "IN_SEARCH";
break;
}
}
- os << "\t" << (m_lifeTime - Simulator::Now ()).GetSeconds () << "\t"
- << m_hops << "\n";
+ *os << "\t";
+ *os << std::setiosflags (std::ios::fixed) <<
+ std::setiosflags (std::ios::left) << std::setprecision (2) <<
+ std::setw (14) << (m_lifeTime - Simulator::Now ()).GetSeconds ();
+ *os << "\t" << m_hops << "\n";
}
/*
@@ -378,6 +383,39 @@
}
}
+void
+RoutingTable::Purge (std::map<Ipv4Address, RoutingTableEntry> &table) const
+{
+ NS_LOG_FUNCTION (this);
+ if (table.empty ())
+ return;
+ for (std::map<Ipv4Address, RoutingTableEntry>::iterator i =
+ table.begin (); i != table.end ();)
+ {
+ if (i->second.GetLifeTime () < Seconds (0))
+ {
+ if (i->second.GetFlag () == INVALID)
+ {
+ std::map<Ipv4Address, RoutingTableEntry>::iterator tmp = i;
+ ++i;
+ table.erase (tmp);
+ }
+ else if (i->second.GetFlag () == VALID)
+ {
+ NS_LOG_LOGIC ("Invalidate route with destination address " << i->first);
+ i->second.Invalidate (m_badLinkLifetime);
+ ++i;
+ }
+ else
+ ++i;
+ }
+ else
+ {
+ ++i;
+ }
+ }
+}
+
bool
RoutingTable::MarkLinkAsUnidirectional (Ipv4Address neighbor, Time blacklistTimeout)
{
@@ -397,17 +435,18 @@
}
void
-RoutingTable::Print (std::ostream &os)
+RoutingTable::Print (Ptr<OutputStreamWrapper> stream) const
{
- Purge ();
- os << "\nAODV Routing table\n"
- << "Destination\tGateway\t\tInterface\tFlag\tExpire\tHops\n";
+ std::map<Ipv4Address, RoutingTableEntry> table = m_ipv4AddressEntry;
+ Purge (table);
+ *stream->GetStream () << "\nAODV Routing table\n"
+ << "Destination\tGateway\t\tInterface\tFlag\tExpire\t\tHops\n";
for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i =
- m_ipv4AddressEntry.begin (); i != m_ipv4AddressEntry.end (); ++i)
+ table.begin (); i != table.end (); ++i)
{
- i->second.Print (os);
+ i->second.Print (stream);
}
- os << "\n";
+ *stream->GetStream () << "\n";
}
}
--- a/src/routing/aodv/aodv-rtable.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/routing/aodv/aodv-rtable.h Tue Dec 21 17:46:35 2010 +0100
@@ -36,6 +36,7 @@
#include "ns3/ipv4-route.h"
#include "ns3/timer.h"
#include "ns3/net-device.h"
+#include "ns3/output-stream-wrapper.h"
namespace ns3 {
namespace aodv {
@@ -140,7 +141,7 @@
{
return (m_ipv4Route->GetDestination () == dst);
}
- void Print(std::ostream & os) const;
+ void Print(Ptr<OutputStreamWrapper> stream) const;
private:
/// Valid Destination Sequence Number flag
@@ -242,12 +243,14 @@
*/
bool MarkLinkAsUnidirectional(Ipv4Address neighbor, Time blacklistTimeout);
/// Print routing table
- void Print(std::ostream &os);
+ void Print(Ptr<OutputStreamWrapper> stream) const;
private:
std::map<Ipv4Address, RoutingTableEntry> m_ipv4AddressEntry;
/// Deletion time for invalid routes
Time m_badLinkLifetime;
+ /// const version of Purge, for use by Print() method
+ void Purge (std::map<Ipv4Address, RoutingTableEntry> &table) const;
};
}}
Binary file src/routing/aodv/test/aodv-chain-regression-test-0-0.pcap has changed
Binary file src/routing/aodv/test/aodv-chain-regression-test-1-0.pcap has changed
Binary file src/routing/aodv/test/aodv-chain-regression-test-2-0.pcap has changed
Binary file src/routing/aodv/test/aodv-chain-regression-test-3-0.pcap has changed
Binary file src/routing/aodv/test/aodv-chain-regression-test-4-0.pcap has changed
Binary file src/routing/aodv/test/bug-606-test-0-0.pcap has changed
Binary file src/routing/aodv/test/bug-606-test-1-0.pcap has changed
Binary file src/routing/aodv/test/bug-606-test-2-0.pcap has changed
Binary file src/routing/aodv/test/tcp-chain-test-0-0.pcap has changed
Binary file src/routing/aodv/test/tcp-chain-test-9-0.pcap has changed
Binary file src/routing/aodv/test/udp-chain-test-0-0.pcap has changed
Binary file src/routing/aodv/test/udp-chain-test-9-0.pcap has changed
--- a/src/routing/global-routing/model/ipv4-global-routing.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/routing/global-routing/model/ipv4-global-routing.cc Tue Dec 21 17:46:35 2010 +0100
@@ -16,6 +16,9 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
+#include <vector>
+#include <iomanip>
+#include "ns3/names.h"
#include "ns3/log.h"
#include "ns3/simulator.h"
#include "ns3/object.h"
@@ -26,7 +29,6 @@
#include "ns3/boolean.h"
#include "ipv4-global-routing.h"
#include "global-route-manager.h"
-#include <vector>
NS_LOG_COMPONENT_DEFINE ("Ipv4GlobalRouting");
@@ -240,7 +242,7 @@
}
uint32_t
-Ipv4GlobalRouting::GetNRoutes (void)
+Ipv4GlobalRouting::GetNRoutes (void) const
{
NS_LOG_FUNCTION_NOARGS ();
uint32_t n = 0;
@@ -251,7 +253,7 @@
}
Ipv4RoutingTableEntry *
-Ipv4GlobalRouting::GetRoute (uint32_t index)
+Ipv4GlobalRouting::GetRoute (uint32_t index) const
{
NS_LOG_FUNCTION (index);
if (index < m_hostRoutes.size ())
@@ -272,7 +274,7 @@
uint32_t tmp = 0;
if (index < m_networkRoutes.size())
{
- for (NetworkRoutesI j = m_networkRoutes.begin ();
+ for (NetworkRoutesCI j = m_networkRoutes.begin ();
j != m_networkRoutes.end ();
j++)
{
@@ -285,7 +287,7 @@
}
index -= m_networkRoutes.size();
tmp = 0;
- for (ASExternalRoutesI k = m_ASexternalRoutes.begin ();
+ for (ASExternalRoutesCI k = m_ASexternalRoutes.begin ();
k != m_ASexternalRoutes.end ();
k++)
{
@@ -382,6 +384,53 @@
Ipv4RoutingProtocol::DoDispose ();
}
+// Formatted like output of "route -n" command
+void
+Ipv4GlobalRouting::PrintRoutingTable(Ptr<OutputStreamWrapper> stream) const
+{
+ std::ostream* os = stream->GetStream();
+ if (GetNRoutes () > 0)
+ {
+ *os << "Destination Gateway Genmask Flags Metric Ref Use Iface" << std::endl;
+ for (uint32_t j = 0; j < GetNRoutes (); j++)
+ {
+ std::ostringstream dest, gw, mask, flags;
+ Ipv4RoutingTableEntry route = GetRoute (j);
+ dest << route.GetDest ();
+ *os << std::setiosflags (std::ios::left) << std::setw (16) << dest.str();
+ gw << route.GetGateway ();
+ *os << std::setiosflags (std::ios::left) << std::setw (16) << gw.str();
+ mask << route.GetDestNetworkMask ();
+ *os << std::setiosflags (std::ios::left) << std::setw (16) << mask.str();
+ flags << "U";
+ if (route.IsHost ())
+ {
+ flags << "H";
+ }
+ else if (route.IsGateway ())
+ {
+ flags << "G";
+ }
+ *os << std::setiosflags (std::ios::left) << std::setw (6) << flags.str();
+ // Metric not implemented
+ *os << "-" << " ";
+ // Ref ct not implemented
+ *os << "-" << " ";
+ // Use not implemented
+ *os << "-" << " ";
+ if (Names::FindName (m_ipv4->GetNetDevice (route.GetInterface ())) != "")
+ {
+ *os << Names::FindName (m_ipv4->GetNetDevice (route.GetInterface ()));
+ }
+ else
+ {
+ *os << route.GetInterface();
+ }
+ *os << std::endl;
+ }
+ }
+}
+
Ptr<Ipv4Route>
Ipv4GlobalRouting::RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr)
{
--- a/src/routing/global-routing/model/ipv4-global-routing.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/routing/global-routing/model/ipv4-global-routing.h Tue Dec 21 17:46:35 2010 +0100
@@ -92,6 +92,7 @@
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
/**
* \brief Add a host route to the global routing table.
@@ -168,7 +169,7 @@
*
* \warning The default route counts as one of the routes.
*/
- uint32_t GetNRoutes (void);
+ uint32_t GetNRoutes (void) const;
/**
* \brief Get a route from the global unicast routing table.
@@ -190,7 +191,7 @@
* \see Ipv4RoutingTableEntry
* \see Ipv4GlobalRouting::RemoveRoute
*/
- Ipv4RoutingTableEntry *GetRoute (uint32_t i);
+ Ipv4RoutingTableEntry *GetRoute (uint32_t i) const;
/**
* \brief Remove a route from the global unicast routing table.
--- a/src/routing/list-routing/model/ipv4-list-routing.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/routing/list-routing/model/ipv4-list-routing.cc Tue Dec 21 17:46:35 2010 +0100
@@ -69,6 +69,21 @@
}
void
+Ipv4ListRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
+{
+ *stream->GetStream () << "Node: " << m_ipv4->GetObject<Node> ()->GetId ()
+ << " Time: " << Simulator::Now().GetSeconds () << "s "
+ << "Ipv4ListRouting table" << std::endl;
+ for (Ipv4RoutingProtocolList::const_iterator i = m_routingProtocols.begin ();
+ i != m_routingProtocols.end (); i++)
+ {
+ *stream->GetStream () << " Priority: " << (*i).first << " Protocol: " << (*i).second->GetInstanceTypeId () << std::endl;
+ (*i).second->PrintRoutingTable (stream);
+ }
+ *stream->GetStream () << std::endl;
+}
+
+void
Ipv4ListRouting::DoStart (void)
{
for (Ipv4RoutingProtocolList::iterator rprotoIter = m_routingProtocols.begin ();
@@ -297,6 +312,7 @@
void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address) {}
void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address) {}
void SetIpv4 (Ptr<Ipv4> ipv4) {}
+ void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const {}
};
class Ipv4BRouting : public Ipv4RoutingProtocol {
@@ -310,6 +326,7 @@
void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address) {}
void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address) {}
void SetIpv4 (Ptr<Ipv4> ipv4) {}
+ void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const {}
};
class Ipv4ListRoutingNegativeTestCase : public TestCase
--- a/src/routing/list-routing/model/ipv4-list-routing.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/routing/list-routing/model/ipv4-list-routing.h Tue Dec 21 17:46:35 2010 +0100
@@ -21,6 +21,7 @@
#include <list>
#include "ns3/ipv4-routing-protocol.h"
+#include "ns3/simulator.h"
namespace ns3 {
@@ -85,6 +86,7 @@
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
protected:
void DoDispose (void);
--- a/src/routing/nix-vector-routing/ipv4-nix-vector-routing.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/routing/nix-vector-routing/ipv4-nix-vector-routing.cc Tue Dec 21 17:46:35 2010 +0100
@@ -19,9 +19,11 @@
*/
#include <queue>
+#include <iomanip>
#include "ns3/log.h"
#include "ns3/abort.h"
+#include "ns3/names.h"
#include "ns3/ipv4-list-routing.h"
#include "ipv4-nix-vector-routing.h"
@@ -657,6 +659,50 @@
return true;
}
+void
+Ipv4NixVectorRouting::PrintRoutingTable(Ptr<OutputStreamWrapper> stream) const
+{
+
+ std::ostream* os = stream->GetStream();
+ *os << "NixCache:" << std::endl;
+ if (m_nixCache.size () > 0)
+ {
+ *os << "Destination NixVector" << std::endl;
+ for (NixMap_t::const_iterator it = m_nixCache.begin (); it != m_nixCache.end (); it++)
+ {
+ std::ostringstream dest;
+ dest << it->first;
+ *os << std::setiosflags (std::ios::left) << std::setw (16) << dest.str();
+ *os << *(it->second) << std::endl;
+ }
+ }
+ *os << "Ipv4RouteCache:" << std::endl;
+ if (m_ipv4RouteCache.size () > 0)
+ {
+ *os << "Destination Gateway Source OutputDevice" << std::endl;
+ for (Ipv4RouteMap_t::const_iterator it = m_ipv4RouteCache.begin (); it != m_ipv4RouteCache.end (); it++)
+ {
+ std::ostringstream dest, gw, src;
+ dest << it->second->GetDestination ();
+ *os << std::setiosflags (std::ios::left) << std::setw (16) << dest.str();
+ gw << it->second->GetGateway ();
+ *os << std::setiosflags (std::ios::left) << std::setw (16) << gw.str();
+ src << it->second->GetSource ();
+ *os << std::setiosflags (std::ios::left) << std::setw (16) << src.str();
+ *os << " ";
+ if (Names::FindName (it->second->GetOutputDevice ()) != "")
+ {
+ *os << Names::FindName (it->second->GetOutputDevice ());
+ }
+ else
+ {
+ *os << it->second->GetOutputDevice ()->GetIfIndex ();
+ }
+ *os << std::endl;
+ }
+ }
+}
+
// virtual functions from Ipv4RoutingProtocol
void
Ipv4NixVectorRouting::NotifyInterfaceUp (uint32_t i)
--- a/src/routing/nix-vector-routing/ipv4-nix-vector-routing.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/routing/nix-vector-routing/ipv4-nix-vector-routing.h Tue Dec 21 17:46:35 2010 +0100
@@ -29,6 +29,7 @@
#include "ns3/net-device-container.h"
#include "ns3/ipv4-routing-protocol.h"
#include "ns3/ipv4-route.h"
+#include "ns3/nix-vector.h"
#include "ns3/bridge-net-device.h"
namespace ns3 {
@@ -149,6 +150,7 @@
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
/* cache stores nix-vectors based on destination ip */
--- a/src/routing/olsr/model/olsr-routing-protocol.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/routing/olsr/model/olsr-routing-protocol.cc Tue Dec 21 17:46:35 2010 +0100
@@ -38,6 +38,7 @@
#include "ns3/udp-socket-factory.h"
#include "ns3/simulator.h"
#include "ns3/log.h"
+#include "ns3/names.h"
#include "ns3/random-variable.h"
#include "ns3/inet-socket-address.h"
#include "ns3/ipv4-routing-protocol.h"
@@ -244,6 +245,31 @@
Ipv4RoutingProtocol::DoDispose ();
}
+void
+RoutingProtocol::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
+{
+ std::ostream* os = stream->GetStream();
+ *os << "Destination\tNextHop\t\tInterface\tDistance\n";
+
+ for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator iter = m_table.begin ();
+ iter != m_table.end (); iter++)
+ {
+ *os << iter->first << "\t";
+ *os << iter->second.nextAddr << "\t";
+ if (Names::FindName (m_ipv4->GetNetDevice (iter->second.interface)) != "")
+ {
+ *os << Names::FindName (m_ipv4->GetNetDevice (iter->second.interface)) << "\t\t";
+ }
+ else
+ {
+ *os << iter->second.interface << "\t\t";
+ }
+
+ *os << iter->second.distance << "\t";
+ *os << "\n";
+ }
+}
+
void RoutingProtocol::DoStart ()
{
if (m_mainAddress == Ipv4Address ())
--- a/src/routing/olsr/model/olsr-routing-protocol.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/routing/olsr/model/olsr-routing-protocol.h Tue Dec 21 17:46:35 2010 +0100
@@ -184,6 +184,7 @@
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
void DoDispose ();
Binary file src/routing/olsr/test/bug780-0-0.pcap has changed
Binary file src/routing/olsr/test/bug780-1-0.pcap has changed
Binary file src/routing/olsr/test/olsr-tc-regression-test-0-1.pcap has changed
Binary file src/routing/olsr/test/olsr-tc-regression-test-1-1.pcap has changed
Binary file src/routing/olsr/test/olsr-tc-regression-test-2-1.pcap has changed
--- a/src/routing/olsr/test/tc-regression-test.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/routing/olsr/test/tc-regression-test.cc Tue Dec 21 17:46:35 2010 +0100
@@ -21,6 +21,7 @@
#include "tc-regression-test.h"
#include "ns3/simulator.h"
#include "ns3/random-variable.h"
+#include "ns3/boolean.h"
#include "ns3/double.h"
#include "ns3/uinteger.h"
#include "ns3/string.h"
@@ -60,11 +61,11 @@
{
SeedManager::SetSeed(12345);
CreateNodes ();
-
+
Simulator::Stop (m_time);
Simulator::Run ();
Simulator::Destroy ();
-
+
if (!WRITE_VECTORS) CheckResults ();
return GetErrorStatus ();
}
@@ -75,25 +76,25 @@
// create 3 nodes
NodeContainer c;
c.Create (3);
-
+
// place nodes in the chain
MobilityHelper mobility;
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
- "MinX", DoubleValue (0.0),
- "MinY", DoubleValue (0.0),
- "DeltaX", DoubleValue (m_step),
- "DeltaY", DoubleValue (0),
- "GridWidth", UintegerValue (3),
- "LayoutType", StringValue ("RowFirst"));
+ "MinX", DoubleValue (0.0),
+ "MinY", DoubleValue (0.0),
+ "DeltaX", DoubleValue (m_step),
+ "DeltaY", DoubleValue (0),
+ "GridWidth", UintegerValue (3),
+ "LayoutType", StringValue ("RowFirst"));
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (c);
-
+
// install TCP/IP & OLSR
OlsrHelper olsr;
InternetStackHelper internet;
internet.SetRoutingHelper (olsr);
internet.Install (c);
-
+
// create wifi channel & devices
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
wifiMac.SetType ("ns3::AdhocWifiMac");
@@ -126,11 +127,11 @@
// File naming conventions are hard-coded here.
os1 << NS_TEST_SOURCEDIR << PREFIX << "-" << i << "-1.pcap";
os2 << GetTempDir () << PREFIX << "-" << i << "-1.pcap";
-
+
uint32_t sec(0), usec(0);
bool diff = PcapFile::Diff (os1.str(), os2.str(), sec, usec);
NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str() << " and " << os2.str()
- << " differ starting from " << sec << " s " << usec << " us");
+ << " differ starting from " << sec << " s " << usec << " us");
}
}
--- a/src/routing/static-routing/model/ipv4-static-routing.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/routing/static-routing/model/ipv4-static-routing.cc Tue Dec 21 17:46:35 2010 +0100
@@ -23,11 +23,14 @@
std::clog << Simulator::Now ().GetSeconds () \
<< " [node " << m_ipv4->GetObject<Node> ()->GetId () << "] "; }
+#include <iomanip>
#include "ns3/log.h"
+#include "ns3/names.h"
#include "ns3/packet.h"
#include "ns3/node.h"
#include "ns3/simulator.h"
#include "ns3/ipv4-route.h"
+#include "ns3/output-stream-wrapper.h"
#include "ipv4-static-routing.h"
#include "ipv4-routing-table-entry.h"
@@ -346,7 +349,7 @@
}
uint32_t
-Ipv4StaticRouting::GetNRoutes (void)
+Ipv4StaticRouting::GetNRoutes (void) const
{
NS_LOG_FUNCTION (this);
return m_networkRoutes.size ();;
@@ -391,11 +394,11 @@
}
Ipv4RoutingTableEntry
-Ipv4StaticRouting::GetRoute (uint32_t index)
+Ipv4StaticRouting::GetRoute (uint32_t index) const
{
NS_LOG_FUNCTION (this << index);
uint32_t tmp = 0;
- for (NetworkRoutesI j = m_networkRoutes.begin ();
+ for (NetworkRoutesCI j = m_networkRoutes.begin ();
j != m_networkRoutes.end ();
j++)
{
@@ -699,6 +702,53 @@
}
}
+// Formatted like output of "route -n" command
+void
+Ipv4StaticRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
+{
+ std::ostream* os = stream->GetStream();
+ if (GetNRoutes () > 0)
+ {
+ *os << "Destination Gateway Genmask Flags Metric Ref Use Iface" << std::endl;
+ for (uint32_t j = 0; j < GetNRoutes (); j++)
+ {
+ std::ostringstream dest, gw, mask, flags;
+ Ipv4RoutingTableEntry route = GetRoute (j);
+ dest << route.GetDest ();
+ *os << std::setiosflags (std::ios::left) << std::setw (16) << dest.str();
+ gw << route.GetGateway ();
+ *os << std::setiosflags (std::ios::left) << std::setw (16) << gw.str();
+ mask << route.GetDestNetworkMask ();
+ *os << std::setiosflags (std::ios::left) << std::setw (16) << mask.str();
+ flags << "U";
+ if (route.IsHost ())
+ {
+ flags << "HS";
+ }
+ else if (route.IsGateway ())
+ {
+ flags << "GS";
+ }
+ *os << std::setiosflags (std::ios::left) << std::setw (6) << flags.str();
+ // Metric not implemented
+ *os << "-" << " ";
+ // Ref ct not implemented
+ *os << "-" << " ";
+ // Use not implemented
+ *os << "-" << " ";
+ if (Names::FindName (m_ipv4->GetNetDevice (route.GetInterface ())) != "")
+ {
+ *os << Names::FindName (m_ipv4->GetNetDevice (route.GetInterface ()));
+ }
+ else
+ {
+ *os << route.GetInterface();
+ }
+ *os << std::endl;
+ }
+ }
+}
+
Ipv4Address
Ipv4StaticRouting::SourceAddressSelection (uint32_t interfaceIdx, Ipv4Address dest)
{
--- a/src/routing/static-routing/model/ipv4-static-routing.h Tue Dec 21 17:39:54 2010 +0100
+++ b/src/routing/static-routing/model/ipv4-static-routing.h Tue Dec 21 17:46:35 2010 +0100
@@ -85,6 +85,7 @@
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
/**
* \brief Add a network route to the static routing table.
@@ -177,7 +178,7 @@
*
* \warning The default route counts as one of the routes.
*/
- uint32_t GetNRoutes (void);
+ uint32_t GetNRoutes (void) const;
/**
* \brief Get the default route with lowest metric from the static routing table.
@@ -203,7 +204,7 @@
* \see Ipv4RoutingTableEntry
* \see Ipv4StaticRouting::RemoveRoute
*/
- Ipv4RoutingTableEntry GetRoute (uint32_t i);
+ Ipv4RoutingTableEntry GetRoute (uint32_t i) const;
/**
* \brief Get a metric for route from the static unicast routing table.
--- a/src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc Tue Dec 21 17:46:35 2010 +0100
@@ -345,14 +345,15 @@
// reflecting the change from LARGEST_CWND back to MSS
//
const uint32_t MSS = 536;
- const uint32_t N_EVENTS = 20;
+ const uint32_t N_EVENTS = 21;
CwndEvent event;
NS_TEST_ASSERT_MSG_EQ (m_responses.GetN (), N_EVENTS, "Unexpectedly low number of cwnd change events");
- for (uint32_t i = 0, from = MSS, to = MSS * 2; i < N_EVENTS; ++i, from += MSS, to += MSS)
+ // Ignore the first event logged (i=0) when m_cWnd goes from 0 to MSS bytes
+ for (uint32_t i = 1, from = MSS, to = MSS * 2; i < N_EVENTS; ++i, from += MSS, to += MSS)
{
event = m_responses.Get (i);
NS_TEST_ASSERT_MSG_EQ (event.m_oldCwnd, from, "Wrong old cwnd value in cwnd change event " << i);
@@ -507,54 +508,56 @@
// the congestion window as it opens up when the ns-3 TCP under test
// transmits its bits
//
- // From inspecting the results, we know that we should see 31 congestion
- // window change events. On the tenth change event, the window should go back
- // to one segment due to 3 dup acks. It should then slow start again for
- // 4 events and then enter congestion avoidance. On change event 30
- // (29 zero-based indexing), it should go back to one segment, because of triple dup ack.
+ // From inspecting the results, we know that we should see N_EVENTS congestion
+ // window change events. On the tenth change event, the window should
+ // be cut from 5360 to 4288 due to 3 dup acks (NewReno behavior is to
+ // cut in half, and then add 3 segments (5360/2 + 3*536 = 4288)
+ // It should then increment cwnd by one segment per ack throughout
+ // the fast recovery phase. The trace shows that three segments are lost
+ // within the fast recovery window (with sequence numbers starting at
+ // 9113, 10721, and 12329). This last segment (12329) is not recovered
+ // by a fast retransmit and consequently, a coarse timeout is taken and
+ // cwnd is reset to MSS at event index 32. It slow starts again, and takes
+ // another fast retransmit at index 42.
//
const uint32_t MSS = 536;
+ const uint32_t N_EVENTS = 44;
CwndEvent event;
- NS_TEST_ASSERT_MSG_EQ (m_responses.GetN (), 31, "Unexpected number of cwnd change events");
+ NS_TEST_ASSERT_MSG_EQ (m_responses.GetN (), N_EVENTS, "Unexpected number of cwnd change events");
- for (uint32_t i = 0, from = MSS, to = MSS * 2; i < 9; ++i, from += MSS, to += MSS)
+ // Ignore the first event logged (i=0) when m_cWnd goes from 0 to MSS bytes
+ for (uint32_t i = 1, from = MSS, to = MSS * 2; i < 10; ++i, from += MSS, to += MSS)
{
event = m_responses.Get (i);
NS_TEST_ASSERT_MSG_EQ (event.m_oldCwnd, from, "Wrong old cwnd value in cwnd change event " << i);
NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, to, "Wrong new cwnd value in cwnd change event " << i);
}
- // Cwnd should be back to MSS
- event = m_responses.Get (9);
- NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, MSS, "Wrong new cwnd value in cwnd change event " << 9);
+ // Cwnd should be back to (10/2 + 3) = 8*MSS
+ event = m_responses.Get (10);
+ NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, 8*MSS, "Wrong new cwnd value in cwnd change event " << 10);
- // Another round of slow start
- for (uint32_t i = 10, from = MSS, to = MSS * 2; i < 14; ++i, from += MSS, to += MSS)
+ // Fast recovery
+ for (uint32_t i = 11, from = 8*MSS, to = 9 * MSS; i < 32; ++i, from += MSS, to += MSS)
{
event = m_responses.Get (i);
NS_TEST_ASSERT_MSG_EQ (event.m_oldCwnd, from, "Wrong old cwnd value in cwnd change event " << i);
NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, to, "Wrong new cwnd value in cwnd change event " << i);
}
- // Congestion Avoidance
- double adder;
- uint32_t from = 2680;
- for (uint32_t i = 14; i < 29; ++i)
+ // Slow start again after coarse timeout
+ for (uint32_t i = 33, from = MSS, to = MSS * 2; i < 42; ++i, from += MSS, to += MSS)
{
event = m_responses.Get (i);
NS_TEST_ASSERT_MSG_EQ (event.m_oldCwnd, from, "Wrong old cwnd value in cwnd change event " << i);
- adder = ((double) MSS * MSS) / event.m_oldCwnd;
- adder += event.m_oldCwnd;
- from = static_cast<uint32_t> (adder);
- NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, static_cast<uint32_t> (adder), "Wrong new cwnd value in cwnd change event "
- << i);
+ NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, to, "Wrong new cwnd value in cwnd change event " << i);
}
- // Cwnd should be back to MSS
- event = m_responses.Get (29);
- NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, MSS, "Wrong new cwnd value in cwnd change event " << 29);
+ // Fast retransmit again; cwnd should be back to 8*MSS
+ event = m_responses.Get (42);
+ NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, 8*MSS, "Wrong new cwnd value in cwnd change event " << 42);
return GetErrorStatus ();
}
Binary file src/test/ns3tcp/ns3tcp-interop-response-vectors.pcap has changed
--- a/src/test/ns3wifi/wifi-msdu-aggregator-test-suite.cc Tue Dec 21 17:39:54 2010 +0100
+++ b/src/test/ns3wifi/wifi-msdu-aggregator-test-suite.cc Tue Dec 21 17:46:35 2010 +0100
@@ -84,7 +84,7 @@
// and thus has an aggregator on AC_BE.
NodeContainer ap;
ap.Create (1);
- wifiMac.SetType ("ns3::QapWifiMac",
+ wifiMac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true),
"BeaconInterval", TimeValue (MicroSeconds (102400)));
@@ -95,7 +95,7 @@
// Setup one STA, which will be the sink for traffic in this test.
NodeContainer sta;
sta.Create (1);
- wifiMac.SetType ("ns3::QstaWifiMac",
+ wifiMac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false));
NetDeviceContainer staDev = wifi.Install (wifiPhy, wifiMac, sta);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/doc/readme.txt Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,9 @@
+NS-3 PyViz is a live simulation visualizer, meaning that it uses no
+trace files. It can be most useful for debugging purposes, i.e. to
+figure out if mobility models are what you expect, where packets are
+being dropped, etc. There's also a builtin interactive python console
+that can be used to debug the state of the running objects. Although
+it is mostly written in Python, it works both with Python and pure C++
+simulations.
+
+For more information, see http://www.nsnam.org/wiki/index.php/PyViz
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/examples/readme.txt Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,3 @@
+For activating the visualizer, with any example, just pass the option
+--SimulatorImplementationType=ns3::VisualSimulatorImpl to it, assuming
+the script uses ns-3's command line parser (class CommandLine).
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/model/pyviz.cc Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,1406 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 INESC Porto
+ *
+ * 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: Gustavo Carneiro <gjc@inescporto.pt>
+ */
+
+#include <stdlib.h>
+#include "pyviz.h"
+#include "ns3/simulator.h"
+#include "ns3/config.h"
+#include "ns3/node-list.h"
+#include "ns3/wifi-net-device.h"
+#include "ns3/ppp-header.h"
+#include "ns3/wifi-mac-header.h"
+#include "ns3/ethernet-header.h"
+#include "ns3/log.h"
+#include "ns3/abort.h"
+
+#include "visual-simulator-impl.h"
+
+#include <sstream>
+
+NS_LOG_COMPONENT_DEFINE ("PyViz");
+#define NUM_LAST_PACKETS 10
+
+static
+std::vector<std::string>
+PathSplit (std::string str)
+{
+ std::vector<std::string> results;
+ size_t cutAt;
+ while ((cutAt = str.find_first_of('/')) != str.npos)
+ {
+ if(cutAt > 0)
+ {
+ results.push_back(str.substr(0,cutAt));
+ }
+ str = str.substr(cutAt+1);
+ }
+ if (str.length() > 0)
+ {
+ results.push_back(str);
+ }
+ return results;
+}
+
+
+namespace ns3 {
+
+static PyViz* g_visualizer = NULL;
+
+
+
+struct PyVizPacketTag : public Tag
+{
+ static TypeId GetTypeId (void);
+ virtual TypeId GetInstanceTypeId (void) const;
+ virtual uint32_t GetSerializedSize (void) const;
+ virtual void Serialize (TagBuffer buf) const;
+ virtual void Deserialize (TagBuffer buf);
+ virtual void Print (std::ostream &os) const;
+ PyVizPacketTag ();
+
+ uint32_t m_packetId;
+};
+
+
+TypeId
+PyVizPacketTag::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::PyVizPacketTag")
+ .SetParent<Tag> ()
+ .AddConstructor<PyVizPacketTag> ()
+ ;
+ return tid;
+}
+TypeId
+PyVizPacketTag::GetInstanceTypeId (void) const
+{
+ return GetTypeId ();
+}
+uint32_t
+PyVizPacketTag::GetSerializedSize (void) const
+{
+ return 4;
+}
+void
+PyVizPacketTag::Serialize (TagBuffer buf) const
+{
+ buf.WriteU32 (m_packetId);
+}
+void
+PyVizPacketTag::Deserialize (TagBuffer buf)
+{
+ m_packetId = buf.ReadU32 ();
+}
+void
+PyVizPacketTag::Print (std::ostream &os) const
+{
+ os << "PacketId=" << m_packetId;
+}
+PyVizPacketTag::PyVizPacketTag ()
+ : Tag ()
+{}
+
+
+
+PyViz::PyViz ()
+{
+ NS_LOG_FUNCTION_NOARGS ();
+ NS_ASSERT (g_visualizer == NULL);
+ g_visualizer = this;
+
+ Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MacTx",
+ MakeCallback (&PyViz::TraceNetDevTxWifi, this));
+
+ Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MacRx",
+ MakeCallback (&PyViz::TraceNetDevRxWifi, this));
+
+ Config::Connect ("/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/MacTx",
+ MakeCallback (&PyViz::TraceNetDevTxCsma, this));
+
+ Config::Connect ("/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/MacRx",
+ MakeCallback (&PyViz::TraceNetDevRxCsma, this));
+
+ Config::Connect ("/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/MacPromiscRx",
+ MakeCallback (&PyViz::TraceNetDevPromiscRxCsma, this));
+
+ Config::Connect ("/NodeList/*/DeviceList/*/TxQueue/Drop",
+ MakeCallback (&PyViz::TraceDevQueueDrop, this));
+
+ Config::Connect ("/NodeList/*/$ns3::Ipv4L3Protocol/Drop",
+ MakeCallback (&PyViz::TraceIpv4Drop, this));
+
+ Config::Connect ("/NodeList/*/DeviceList/*/$ns3::PointToPointNetDevice/MacTx",
+ MakeCallback (&PyViz::TraceNetDevTxPointToPoint, this));
+
+ Config::Connect ("/NodeList/*/DeviceList/*/$ns3::PointToPointNetDevice/MacRx",
+ MakeCallback (&PyViz::TraceNetDevRxPointToPoint, this));
+
+ Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WimaxNetDevice/Tx",
+ MakeCallback (&PyViz::TraceNetDevTxWimax, this));
+
+ Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WimaxNetDevice/Rx",
+ MakeCallback (&PyViz::TraceNetDevRxWimax, this));
+
+}
+
+void
+PyViz::RegisterCsmaLikeDevice (std::string const &deviceTypeName)
+{
+ TypeId::LookupByName (deviceTypeName); // this will assert if the type name is invalid
+
+ std::ostringstream sstream;
+ sstream << "/NodeList/*/DeviceList/*/$" << deviceTypeName << "/MacTx";
+ Config::Connect (sstream.str (), MakeCallback (&PyViz::TraceNetDevTxCsma, this));
+
+ sstream.str ("");
+ sstream << "/NodeList/*/DeviceList/*/$" << deviceTypeName << "/Rx";
+ Config::Connect (sstream.str (), MakeCallback (&PyViz::TraceNetDevRxCsma, this));
+
+ sstream.str ("");
+ sstream << "/NodeList/*/DeviceList/*/$" << deviceTypeName << "/PromiscRx";
+ Config::Connect (sstream.str (), MakeCallback (&PyViz::TraceNetDevPromiscRxCsma, this));
+}
+
+void
+PyViz::RegisterWifiLikeDevice (std::string const &deviceTypeName)
+{
+ TypeId::LookupByName (deviceTypeName); // this will assert if the type name is invalid
+
+ std::ostringstream sstream;
+ sstream << "/NodeList/*/DeviceList/*/$" << deviceTypeName << "/Tx";
+ Config::Connect (sstream.str (), MakeCallback (&PyViz::TraceNetDevTxWifi, this));
+
+ sstream.str ("");
+ sstream <<"/NodeList/*/DeviceList/*/$" << deviceTypeName << "/Rx";
+ Config::Connect (sstream.str (), MakeCallback (&PyViz::TraceNetDevRxWifi, this));
+}
+
+void
+PyViz::RegisterPointToPointLikeDevice (std::string const &deviceTypeName)
+{
+ TypeId::LookupByName (deviceTypeName); // this will assert if the type name is invalid
+
+ std::ostringstream sstream;
+ sstream << "/NodeList/*/DeviceList/*/$" << deviceTypeName << "/TxQueue/Dequeue";
+ Config::Connect (sstream.str (), MakeCallback (&PyViz::TraceNetDevTxPointToPoint, this));
+
+ sstream.str ("");
+ sstream << "/NodeList/*/DeviceList/*/$" << deviceTypeName << "/Rx";
+ Config::Connect (sstream.str (), MakeCallback (&PyViz::TraceNetDevRxPointToPoint, this));
+}
+
+void
+PyViz::SetPacketCaptureOptions (uint32_t nodeId, PacketCaptureOptions options)
+{
+ NS_LOG_DEBUG (" SetPacketCaptureOptions " << nodeId
+ << " PacketCaptureOptions (headers size = " << options.headers.size ()
+ << " mode = " << options.mode << " numLastPackets = " << options.numLastPackets
+ << ")");
+ m_packetCaptureOptions[nodeId] = options;
+}
+
+void
+PyViz::RegisterDropTracePath (std::string const &tracePath)
+{
+ Config::Connect (tracePath, MakeCallback (&PyViz::TraceDevQueueDrop, this));
+}
+
+PyViz::~PyViz ()
+{
+ NS_LOG_FUNCTION_NOARGS ();
+
+ NS_ASSERT (g_visualizer == this);
+ g_visualizer = NULL;
+}
+
+void PyViz::DoPause (std::string const &message)
+{
+ m_pauseMessages.push_back (message);
+ m_stop = true;
+ NS_LOG_LOGIC (Simulator::Now ().GetSeconds () << ": Have "
+ << g_visualizer->m_pauseMessages.size () << " pause messages");
+}
+
+void PyViz::Pause (std::string const &message)
+{
+ NS_ASSERT (g_visualizer);
+ g_visualizer->DoPause (message);
+}
+
+std::vector<std::string>
+PyViz::GetPauseMessages () const
+{
+ NS_LOG_LOGIC (Simulator::Now ().GetSeconds () << ": GetPauseMessages: have "
+ << g_visualizer->m_pauseMessages.size () << " pause messages");
+ return m_pauseMessages;
+}
+
+
+void
+PyViz::CallbackStopSimulation ()
+{
+ NS_LOG_FUNCTION_NOARGS ();
+ Simulator::Stop (Seconds (0)); // Stop right now
+ m_stop = true;
+}
+
+void
+PyViz::SimulatorRunUntil (Time time)
+{
+ NS_LOG_LOGIC ("SimulatorRunUntil " << time << " (now is " << Simulator::Now () << ")");
+
+ m_pauseMessages.clear ();
+ m_transmissionSamples.clear ();
+ m_packetDrops.clear ();
+
+ Time expirationTime = Simulator::Now () - Seconds (10);
+
+ // Clear very old transmission records
+ for (std::map<TxRecordKey, TxRecordValue>::iterator iter = m_txRecords.begin ();
+ iter != m_txRecords.end ();)
+ {
+ if (iter->second.time < expirationTime)
+ {
+ m_txRecords.erase (iter++);
+ }
+ else
+ {
+ iter++;
+ }
+ }
+
+ // Clear very old packets of interest
+ for (std::map<uint32_t, Time>::iterator iter = m_packetsOfInterest.begin ();
+ iter != m_packetsOfInterest.end ();)
+ {
+ if (iter->second < expirationTime)
+ {
+ m_packetsOfInterest.erase (iter++);
+ }
+ else
+ {
+ iter++;
+ }
+ }
+
+ if (Simulator::Now () >= time)
+ {
+ return;
+ }
+ // Schedule a dummy callback function for the target time, to make
+ // sure we stop at the right time. Otherwise, simulations with few
+ // events just appear to "jump" big chunks of time.
+ NS_LOG_LOGIC ("Schedule dummy callback to be called in " << (time - Simulator::Now ()));
+ m_stop = false;
+ Simulator::Cancel (m_stopCallbackEvent);
+ m_stopCallbackEvent = Simulator::Schedule (time - Simulator::Now (), &PyViz::CallbackStopSimulation, this);
+
+ Ptr<SimulatorImpl> impl = Simulator::GetImplementation ();
+ Ptr<VisualSimulatorImpl> visualImpl = DynamicCast<VisualSimulatorImpl> (impl);
+ if (visualImpl)
+ {
+ visualImpl->RunRealSimulator ();
+ }
+ else
+ {
+ impl->Run ();
+ }
+}
+
+bool PyViz::TransmissionSampleKey::operator < (PyViz::TransmissionSampleKey const &other) const
+{
+ if (this->transmitter < other.transmitter)
+ {
+ return true;
+ }
+ if (this->transmitter != other.transmitter)
+ {
+ return false;
+ }
+ if (this->receiver < other.receiver)
+ {
+ return true;}
+ if (this->receiver != other.receiver)
+ {
+ return false;
+ }
+ if (this->channel < other.channel)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+bool PyViz::TransmissionSampleKey::operator == (PyViz::TransmissionSampleKey const &other) const
+{
+ bool retval = (transmitter == other.transmitter) &&
+ (receiver == other.receiver) &&
+ (channel == other.channel);
+ return retval;
+}
+
+
+PyViz::NetDeviceStatistics &
+PyViz::FindNetDeviceStatistics (int node, int interface)
+{
+ std::map<uint32_t, std::vector<NetDeviceStatistics> >::iterator nodeStatsIter = m_nodesStatistics.find (node);
+ std::vector<NetDeviceStatistics> *stats;
+ if (nodeStatsIter == m_nodesStatistics.end ())
+ {
+ stats = &m_nodesStatistics[node];
+ stats->resize (NodeList::GetNode (node)->GetNDevices ());
+ }
+ else
+ {
+ stats = &(nodeStatsIter->second);
+ }
+ NetDeviceStatistics &devStats = (*stats)[interface];
+ return devStats;
+}
+
+bool PyViz::GetPacketCaptureOptions (uint32_t nodeId, const PacketCaptureOptions **outOptions) const
+{
+ std::map<uint32_t, PacketCaptureOptions>::const_iterator iter = m_packetCaptureOptions.find (nodeId);
+ if (iter == m_packetCaptureOptions.end ())
+ {
+ return false;
+ }
+ else
+ {
+ *outOptions = &iter->second;
+ return true;
+ }
+}
+
+bool PyViz::FilterPacket (Ptr<const Packet> packet, const PacketCaptureOptions &options)
+{
+ switch (options.mode)
+ {
+ case PACKET_CAPTURE_DISABLED:
+ return false;
+
+ case PACKET_CAPTURE_FILTER_HEADERS_OR:
+ {
+ PacketMetadata::ItemIterator metadataIterator = packet->BeginItem ();
+ while (metadataIterator.HasNext ())
+ {
+ PacketMetadata::Item item = metadataIterator.Next ();
+ if (options.headers.find (item.tid) != options.headers.end ())
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ case PACKET_CAPTURE_FILTER_HEADERS_AND:
+ {
+ std::set<TypeId> missingHeaders (options.headers);
+ PacketMetadata::ItemIterator metadataIterator = packet->BeginItem ();
+ while (metadataIterator.HasNext ())
+ {
+ PacketMetadata::Item item = metadataIterator.Next ();
+ std::set<TypeId>::iterator missingIter = missingHeaders.find (item.tid);
+ if (missingIter != missingHeaders.end ())
+ {
+ missingHeaders.erase (missingIter);
+ }
+ }
+ if (missingHeaders.size () == 0)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ default:
+ NS_FATAL_ERROR ("should not be reached");
+ return false;
+ }
+}
+
+void
+PyViz::TraceDevQueueDrop (std::string context, Ptr<const Packet> packet)
+{
+ NS_LOG_FUNCTION (context << packet->GetUid ());
+ std::vector<std::string> splitPath = PathSplit (context);
+ int nodeIndex = atoi (splitPath[1].c_str ());
+ Ptr<Node> node = NodeList::GetNode (nodeIndex);
+
+ if (m_nodesOfInterest.find (nodeIndex) == m_nodesOfInterest.end ())
+ {
+ // if the transmitting node is not "of interest", we still
+ // record the transmission if it is a packet of interest.
+ if (m_packetsOfInterest.find (packet->GetUid ()) == m_packetsOfInterest.end ())
+ {
+ NS_LOG_DEBUG ("Packet " << packet->GetUid () << " is not of interest");
+ return;
+ }
+ }
+
+ // ---- "last packets"
+ const PacketCaptureOptions *captureOptions;
+ if (GetPacketCaptureOptions (nodeIndex, &captureOptions) && FilterPacket (packet, *captureOptions))
+ {
+ LastPacketsSample &last = m_lastPackets[nodeIndex];
+ PacketSample lastPacket;
+ lastPacket.time = Simulator::Now ();
+ lastPacket.packet = packet->Copy ();
+ lastPacket.device = NULL;
+ last.lastDroppedPackets.push_back (lastPacket);
+ while (last.lastDroppedPackets.size () > captureOptions->numLastPackets)
+ {
+ last.lastDroppedPackets.erase (last.lastDroppedPackets.begin ());
+ }
+ }
+
+ std::map<Ptr<Node>, uint32_t>::iterator iter = m_packetDrops.find (node);
+ if (iter == m_packetDrops.end ())
+ {
+ m_packetDrops[node] = packet->GetSize ();
+ }
+ else
+ {
+ iter->second += packet->GetSize ();
+ }
+}
+
+void
+PyViz::TraceIpv4Drop (std::string context, ns3::Ipv4Header const &hdr, Ptr<const Packet> packet,
+ ns3::Ipv4L3Protocol::DropReason reason, Ptr<Ipv4> dummy_ipv4, uint32_t interface)
+{
+ Ptr<Packet> packetCopy = packet->Copy ();
+ packetCopy->AddHeader (hdr);
+ TraceDevQueueDrop (context, packetCopy);
+}
+
+
+ // --------- TX device tracing -------------------
+
+void
+PyViz::TraceNetDevTxCommon (std::string const &context, Ptr<const Packet> packet,
+ Mac48Address const &destinationAddress)
+{
+ NS_LOG_FUNCTION (context << packet->GetUid () << *packet);
+
+ std::vector<std::string> splitPath = PathSplit (context);
+ int nodeIndex = atoi (splitPath[1].c_str ());
+ int devIndex = atoi (splitPath[3].c_str ());
+ Ptr<Node> node = NodeList::GetNode (nodeIndex);
+ Ptr<NetDevice> device = node->GetDevice (devIndex);
+
+ // ---- statistics
+ NetDeviceStatistics &stats = FindNetDeviceStatistics (nodeIndex, devIndex);
+ ++stats.transmittedPackets;
+ stats.transmittedBytes += packet->GetSize ();
+
+ // ---- "last packets"
+ const PacketCaptureOptions *captureOptions;
+ if (GetPacketCaptureOptions (nodeIndex, &captureOptions) && FilterPacket (packet, *captureOptions))
+ {
+ LastPacketsSample &last = m_lastPackets[nodeIndex];
+ TxPacketSample lastPacket;
+ lastPacket.time = Simulator::Now ();
+ lastPacket.packet = packet->Copy ();
+ lastPacket.device = device;
+ lastPacket.to = destinationAddress;
+ last.lastTransmittedPackets.push_back (lastPacket);
+ while (last.lastTransmittedPackets.size () > captureOptions->numLastPackets)
+ {
+ last.lastTransmittedPackets.erase (last.lastTransmittedPackets.begin ());
+ }
+ }
+
+ // ---- transmissions records
+
+ if (m_nodesOfInterest.find (nodeIndex) == m_nodesOfInterest.end ())
+ {
+ // if the transmitting node is not "of interest", we still
+ // record the transmission if it is a packet of interest.
+ if (m_packetsOfInterest.find (packet->GetUid ()) == m_packetsOfInterest.end ())
+ {
+ NS_LOG_DEBUG ("Packet " << packet->GetUid () << " is not of interest");
+ return;
+ }
+ }
+ else
+ {
+ // We will follow this packet throughout the network.
+ m_packetsOfInterest[packet->GetUid ()] = Simulator::Now ();
+ }
+
+ TxRecordValue record = { Simulator::Now (), node, false };
+ if (destinationAddress == device->GetBroadcast ())
+ {
+ record.isBroadcast = true;
+ }
+
+ m_txRecords[TxRecordKey (device->GetChannel (), packet->GetUid ())] = record;
+
+ PyVizPacketTag tag;
+ //packet->RemovePacketTag (tag);
+ tag.m_packetId = packet->GetUid ();
+ packet->AddByteTag (tag);
+}
+
+void
+PyViz::TraceNetDevTxWifi (std::string context, Ptr<const Packet> packet)
+{
+ NS_LOG_FUNCTION (context << packet->GetUid () << *packet);
+
+ /*
+ * To DS From DS Address 1 Address 2 Address 3 Address 4
+ *----------------------------------------------------------------------
+ * 0 0 Destination Source BSSID N/A
+ * 0 1 Destination BSSID Source N/A
+ * 1 0 BSSID Source Destination N/A
+ * 1 1 Receiver Transmitter Destination Source
+ */
+ WifiMacHeader hdr;
+ NS_ABORT_IF (packet->PeekHeader (hdr) == 0);
+ Mac48Address destinationAddress;
+ if (hdr.IsToDs () && !hdr.IsFromDs ())
+ {
+ destinationAddress = hdr.GetAddr3 ();
+ }
+ else if (!hdr.IsToDs () && hdr.IsFromDs ())
+ {
+ destinationAddress = hdr.GetAddr1 ();
+ }
+ else if (!hdr.IsToDs () && !hdr.IsFromDs ())
+ {
+ destinationAddress = hdr.GetAddr1 ();
+ }
+ else
+ {
+ destinationAddress = hdr.GetAddr3 ();
+ }
+ TraceNetDevTxCommon (context, packet, destinationAddress);
+}
+
+
+void
+PyViz::TraceNetDevTxCsma (std::string context, Ptr<const Packet> packet)
+{
+ EthernetHeader ethernetHeader;
+ NS_ABORT_IF (packet->PeekHeader (ethernetHeader) == 0);
+ TraceNetDevTxCommon (context, packet, ethernetHeader.GetDestination ());
+}
+
+void
+PyViz::TraceNetDevTxPointToPoint (std::string context, Ptr<const Packet> packet)
+{
+ TraceNetDevTxCommon (context, packet, Mac48Address ());
+}
+
+
+
+
+ // --------- RX device tracing -------------------
+
+void
+PyViz::TraceNetDevRxCommon (std::string const &context, Ptr<const Packet> packet, Mac48Address const &from)
+{
+ uint32_t uid;
+ PyVizPacketTag tag;
+ if (packet->FindFirstMatchingByteTag (tag))
+ {
+ uid = tag.m_packetId;
+ }
+ else
+ {
+ //NS_ASSERT (0);
+ NS_LOG_WARN ("Packet has no byte tag; wimax link?");
+ uid = packet->GetUid ();
+ }
+
+ NS_LOG_FUNCTION (context << uid);
+ std::vector<std::string> splitPath = PathSplit (context);
+ int nodeIndex = atoi (splitPath[1].c_str ());
+ int devIndex = atoi (splitPath[3].c_str ());
+
+ // ---- statistics
+ NetDeviceStatistics &stats = FindNetDeviceStatistics (nodeIndex, devIndex);
+ ++stats.receivedPackets;
+ stats.receivedBytes += packet->GetSize ();
+
+ Ptr<Node> node = NodeList::GetNode (nodeIndex);
+ Ptr<NetDevice> device = node->GetDevice (devIndex);
+
+ // ---- "last packets"
+ const PacketCaptureOptions *captureOptions;
+ if (GetPacketCaptureOptions (nodeIndex, &captureOptions) && FilterPacket (packet, *captureOptions))
+ {
+ LastPacketsSample &last = m_lastPackets[nodeIndex];
+ RxPacketSample lastPacket;
+ lastPacket.time = Simulator::Now ();
+ lastPacket.packet = packet->Copy ();
+ lastPacket.device = device;
+ lastPacket.from = from;
+ last.lastReceivedPackets.push_back (lastPacket);
+ while (last.lastReceivedPackets.size () > captureOptions->numLastPackets)
+ {
+ last.lastReceivedPackets.erase (last.lastReceivedPackets.begin ());
+ }
+ }
+
+ // ---- transmissions
+ if (m_packetsOfInterest.find (uid) == m_packetsOfInterest.end ())
+ {
+ NS_LOG_DEBUG ("RX Packet " << uid << " is not of interest");
+ return;
+ }
+
+ Ptr<Channel> channel = device->GetChannel ();
+
+ std::map<TxRecordKey, TxRecordValue>::iterator recordIter =
+ m_txRecords.find (TxRecordKey (channel, uid));
+
+ if (recordIter == m_txRecords.end ())
+ {
+ NS_LOG_DEBUG ("RX Packet " << uid << " was not transmitted?!");
+ return;
+ }
+
+ TxRecordValue &record = recordIter->second;
+
+ if (record.srcNode == node)
+ {
+ NS_LOG_WARN ("Node " << node->GetId () << " receiving back the same packet (UID=" << uid
+ << ") it had previously transmitted, on the same channel!");
+ return;
+ }
+
+ TransmissionSampleKey key = { record.srcNode, node, channel };
+
+#ifdef NS3_LOG_ENABLE
+ NS_LOG_DEBUG("m_transmissionSamples begin:");
+ if (g_log.IsEnabled (ns3::LOG_DEBUG))
+ {
+ for (std::map<TransmissionSampleKey,TransmissionSampleValue>::const_iterator iter
+ = m_transmissionSamples.begin (); iter != m_transmissionSamples.end (); iter++)
+ {
+ NS_LOG_DEBUG(iter->first.transmitter<<"/"<<iter->first.transmitter->GetId () << ", "
+ << iter->first.receiver<<"/"<<iter->first.receiver->GetId ()
+ << ", " << iter->first.channel << " => " << iter->second.bytes << " (@ " << &iter->second << ")");
+ }
+ }
+ NS_LOG_DEBUG("m_transmissionSamples end.");
+#endif
+
+ std::map<TransmissionSampleKey,TransmissionSampleValue>::iterator
+ iter = m_transmissionSamples.find (key);
+
+ if (iter == m_transmissionSamples.end ())
+ {
+ TransmissionSampleValue sample = { packet->GetSize () };
+ NS_LOG_DEBUG ("RX: from " << key.transmitter<<"/"<<key.transmitter->GetId() << " to "
+ << key.receiver<<"/"<<key.receiver->GetId()
+ << " channel " << channel << ": " << packet->GetSize ()
+ << " bytes more. => new sample with " << packet->GetSize () << " bytes.");
+ m_transmissionSamples[key] = sample;
+ }
+ else
+ {
+ TransmissionSampleValue &sample = iter->second;
+ NS_LOG_DEBUG ("RX: from " << key.transmitter<<"/"<<key.transmitter->GetId() << " to "
+ << key.receiver<<"/"<<key.receiver->GetId()
+ << " channel " << channel << ": " << packet->GetSize ()
+ << " bytes more. => sample " << &sample << " with bytes " << sample.bytes);
+
+ sample.bytes += packet->GetSize ();
+ }
+}
+
+void
+PyViz::TraceNetDevRxWifi (std::string context, Ptr<const Packet> packet)
+{
+ NS_LOG_FUNCTION (context << packet->GetUid ());
+
+
+ /*
+ * To DS From DS Address 1 Address 2 Address 3 Address 4
+ *----------------------------------------------------------------------
+ * 0 0 Destination Source BSSID N/A
+ * 0 1 Destination BSSID Source N/A
+ * 1 0 BSSID Source Destination N/A
+ * 1 1 Receiver Transmitter Destination Source
+ */
+ WifiMacHeader hdr;
+ NS_ABORT_IF (packet->PeekHeader (hdr) == 0);
+ Mac48Address sourceAddress;
+ if (hdr.IsToDs () && !hdr.IsFromDs ())
+ {
+ sourceAddress = hdr.GetAddr2 ();
+ }
+ else if (!hdr.IsToDs () && hdr.IsFromDs ())
+ {
+ sourceAddress = hdr.GetAddr3 ();
+ }
+ else if (!hdr.IsToDs () && !hdr.IsFromDs ())
+ {
+ sourceAddress = hdr.GetAddr2 ();
+ }
+ else
+ {
+ sourceAddress = hdr.GetAddr4 ();
+ }
+
+ TraceNetDevRxCommon (context, packet, sourceAddress);
+}
+
+
+
+void
+PyViz::TraceNetDevRxCsma (std::string context, Ptr<const Packet> packet)
+{
+ EthernetHeader ethernetHeader;
+ NS_ABORT_IF (packet->PeekHeader (ethernetHeader) == 0);
+ TraceNetDevRxCommon (context, packet, ethernetHeader.GetSource ());
+}
+
+void
+PyViz::TraceNetDevRxPointToPoint (std::string context, Ptr<const Packet> packet)
+{
+ TraceNetDevRxCommon (context, packet, Mac48Address ());
+}
+
+void
+PyViz::TraceNetDevPromiscRxCsma (std::string context, Ptr<const Packet> packet)
+{
+ EthernetHeader ethernetHeader;
+ NS_ABORT_IF (packet->PeekHeader (ethernetHeader) == 0);
+
+ NetDevice::PacketType packetType = NetDevice::PACKET_OTHERHOST; // FIXME
+
+ // Other packet types are already being received by
+ // TraceNetDevRxCsma; we don't want to receive them twice.
+ if (packetType == NetDevice::PACKET_OTHERHOST)
+ {
+ TraceNetDevRxCommon (context, packet, ethernetHeader.GetDestination ());
+ }
+}
+
+void
+PyViz::TraceNetDevTxWimax (std::string context, Ptr<const Packet> packet, Mac48Address const &destination)
+{
+ NS_LOG_FUNCTION (context);
+ TraceNetDevTxCommon (context, packet, destination);
+}
+
+void
+PyViz::TraceNetDevRxWimax (std::string context, Ptr<const Packet> packet, Mac48Address const &source)
+{
+ NS_LOG_FUNCTION (context);
+ TraceNetDevRxCommon (context, packet, source);
+}
+
+
+ // ---------------------
+
+PyViz::TransmissionSampleList
+PyViz::GetTransmissionSamples () const
+{
+ NS_LOG_DEBUG ("GetTransmissionSamples BEGIN");
+ TransmissionSampleList list;
+ for (std::map<TransmissionSampleKey, TransmissionSampleValue>::const_iterator
+ iter = m_transmissionSamples.begin ();
+ iter != m_transmissionSamples.end ();
+ iter++)
+ {
+ TransmissionSample sample;
+ sample.transmitter = iter->first.transmitter;
+ sample.receiver = iter->first.receiver;
+ sample.channel = iter->first.channel;
+ sample.bytes = iter->second.bytes;
+ NS_LOG_DEBUG ("from " << sample.transmitter->GetId() << " to " << sample.receiver->GetId()
+ << ": " << sample.bytes << " bytes.");
+ list.push_back (sample);
+ }
+ NS_LOG_DEBUG ("GetTransmissionSamples END");
+ return list;
+}
+
+PyViz::PacketDropSampleList
+PyViz::GetPacketDropSamples () const
+{
+ NS_LOG_DEBUG ("GetPacketDropSamples BEGIN");
+ PacketDropSampleList list;
+ for (std::map<Ptr<Node>, uint32_t>::const_iterator
+ iter = m_packetDrops.begin ();
+ iter != m_packetDrops.end ();
+ iter++)
+ {
+ PacketDropSample sample;
+ sample.transmitter = iter->first;
+ sample.bytes = iter->second;
+ NS_LOG_DEBUG ("in " << sample.transmitter->GetId()
+ << ": " << sample.bytes << " bytes dropped.");
+ list.push_back (sample);
+ }
+ NS_LOG_DEBUG ("GetPacketDropSamples END");
+ return list;
+}
+
+void
+PyViz::SetNodesOfInterest (std::set<uint32_t> nodes)
+{
+ m_nodesOfInterest = nodes;
+}
+
+std::vector<PyViz::NodeStatistics>
+PyViz::GetNodesStatistics () const
+{
+ std::vector<PyViz::NodeStatistics> retval;
+ for (std::map<uint32_t, std::vector<NetDeviceStatistics> >::const_iterator iter = m_nodesStatistics.begin ();
+ iter != m_nodesStatistics.end (); iter++)
+ {
+ NodeStatistics stats = { iter->first, iter->second };
+ retval.push_back (stats);
+ }
+ return retval;
+}
+
+
+PyViz::LastPacketsSample
+PyViz::GetLastPackets (uint32_t nodeId) const
+{
+ NS_LOG_DEBUG ("GetLastPackets: " << nodeId);
+
+ std::map<uint32_t, LastPacketsSample>::const_iterator
+ iter = m_lastPackets.find(nodeId);
+ if (iter != m_lastPackets.end ())
+ {
+ return iter->second;
+ }
+ else
+ {
+ return LastPacketsSample ();
+ }
+}
+
+
+
+
+
+
+namespace
+{
+ // Adapted from http://en.wikipedia.org/w/index.php?title=Line_clipping&oldid=248609574
+ class FastClipping
+ {
+ public:
+ struct Vector2
+ {
+ double x;
+ double y;
+ };
+
+ Vector2 m_clipMin, m_clipMax;
+
+ struct Line
+ {
+ Vector2 start, end;
+ double dx, dy;
+ };
+
+ private:
+
+ void ClipStartTop (Line &line)
+ {
+ line.start.x += line.dx * (m_clipMin.y - line.start.y) / line.dy;
+ line.start.y = m_clipMin.y;
+ }
+
+ void ClipStartBottom (Line &line)
+ {
+ line.start.x += line.dx * (m_clipMax.y - line.start.y) / line.dy;
+ line.start.y = m_clipMax.y;
+ }
+
+ void ClipStartRight (Line &line)
+ {
+ line.start.y += line.dy * (m_clipMax.x - line.start.x) / line.dx;
+ line.start.x = m_clipMax.x;
+ }
+
+ void ClipStartLeft (Line &line)
+ {
+ line.start.y += line.dy * (m_clipMin.x - line.start.x) / line.dx;
+ line.start.x = m_clipMin.x;
+ }
+
+ void ClipEndTop (Line &line)
+ {
+ line.end.x += line.dx * (m_clipMin.y - line.end.y) / line.dy;
+ line.end.y = m_clipMin.y;
+ }
+
+ void ClipEndBottom (Line &line) {
+ line.end.x += line.dx * (m_clipMax.y - line.end.y) / line.dy;
+ line.end.y = m_clipMax.y;
+ }
+
+ void ClipEndRight (Line &line)
+ {
+ line.end.y += line.dy * (m_clipMax.x - line.end.x) / line.dx;
+ line.end.x = m_clipMax.x;
+ }
+
+ void ClipEndLeft (Line &line)
+ {
+ line.end.y += line.dy * (m_clipMin.x - line.end.x) / line.dx;
+ line.end.x = m_clipMin.x;
+ }
+
+ public:
+ FastClipping (Vector2 clipMin, Vector2 clipMax)
+ : m_clipMin (clipMin), m_clipMax (clipMax)
+ {
+ }
+
+
+ bool ClipLine (Line &line)
+ {
+ uint8_t lineCode = 0;
+
+ if (line.end.y < m_clipMin.y)
+ lineCode |= 8;
+ else if (line.end.y > m_clipMax.y)
+ lineCode |= 4;
+
+ if (line.end.x > m_clipMax.x)
+ lineCode |= 2;
+ else if (line.end.x < m_clipMin.x)
+ lineCode |= 1;
+
+ if (line.start.y < m_clipMin.y)
+ lineCode |= 128;
+ else if (line.start.y > m_clipMax.y)
+ lineCode |= 64;
+
+ if (line.start.x > m_clipMax.x)
+ lineCode |= 32;
+ else if (line.start.x < m_clipMin.x)
+ lineCode |= 16;
+
+ // 9 - 8 - A
+ // | | |
+ // 1 - 0 - 2
+ // | | |
+ // 5 - 4 - 6
+ switch (lineCode)
+ {
+ // center
+ case 0x00:
+ return true;
+
+ case 0x01:
+ ClipEndLeft (line);
+ return true;
+
+ case 0x02:
+ ClipEndRight (line);
+ return true;
+
+ case 0x04:
+ ClipEndBottom (line);
+ return true;
+
+ case 0x05:
+ ClipEndLeft (line);
+ if (line.end.y > m_clipMax.y)
+ ClipEndBottom (line);
+ return true;
+
+ case 0x06:
+ ClipEndRight (line);
+ if (line.end.y > m_clipMax.y)
+ ClipEndBottom (line);
+ return true;
+
+ case 0x08:
+ ClipEndTop (line);
+ return true;
+
+ case 0x09:
+ ClipEndLeft (line);
+ if (line.end.y < m_clipMin.y)
+ ClipEndTop (line);
+ return true;
+
+ case 0x0A:
+ ClipEndRight (line);
+ if (line.end.y < m_clipMin.y)
+ ClipEndTop (line);
+ return true;
+
+ // left
+ case 0x10:
+ ClipStartLeft (line);
+ return true;
+
+ case 0x12:
+ ClipStartLeft (line);
+ ClipEndRight (line);
+ return true;
+
+ case 0x14:
+ ClipStartLeft (line);
+ if (line.start.y > m_clipMax.y)
+ return false;
+ ClipEndBottom (line);
+ return true;
+
+ case 0x16:
+ ClipStartLeft (line);
+ if (line.start.y > m_clipMax.y)
+ return false;
+ ClipEndBottom (line);
+ if (line.end.x > m_clipMax.x)
+ ClipEndRight (line);
+ return true;
+
+ case 0x18:
+ ClipStartLeft (line);
+ if (line.start.y < m_clipMin.y)
+ return false;
+ ClipEndTop (line);
+ return true;
+
+ case 0x1A:
+ ClipStartLeft (line);
+ if (line.start.y < m_clipMin.y)
+ return false;
+ ClipEndTop (line);
+ if (line.end.x > m_clipMax.x)
+ ClipEndRight (line);
+ return true;
+
+ // right
+ case 0x20:
+ ClipStartRight (line);
+ return true;
+
+ case 0x21:
+ ClipStartRight (line);
+ ClipEndLeft (line);
+ return true;
+
+ case 0x24:
+ ClipStartRight (line);
+ if (line.start.y > m_clipMax.y)
+ return false;
+ ClipEndBottom (line);
+ return true;
+
+ case 0x25:
+ ClipStartRight (line);
+ if (line.start.y > m_clipMax.y)
+ return false;
+ ClipEndBottom (line);
+ if (line.end.x < m_clipMin.x)
+ ClipEndLeft (line);
+ return true;
+
+ case 0x28:
+ ClipStartRight (line);
+ if (line.start.y < m_clipMin.y)
+ return false;
+ ClipEndTop (line);
+ return true;
+
+ case 0x29:
+ ClipStartRight (line);
+ if (line.start.y < m_clipMin.y)
+ return false;
+ ClipEndTop (line);
+ if (line.end.x < m_clipMin.x)
+ ClipEndLeft (line);
+ return true;
+
+ // bottom
+ case 0x40:
+ ClipStartBottom (line);
+ return true;
+
+ case 0x41:
+ ClipStartBottom (line);
+ if (line.start.x < m_clipMin.x)
+ return false;
+ ClipEndLeft (line);
+ if (line.end.y > m_clipMax.y)
+ ClipEndBottom (line);
+ return true;
+
+ case 0x42:
+ ClipStartBottom (line);
+ if (line.start.x > m_clipMax.x)
+ return false;
+ ClipEndRight (line);
+ return true;
+
+ case 0x48:
+ ClipStartBottom (line);
+ ClipEndTop (line);
+ return true;
+
+ case 0x49:
+ ClipStartBottom (line);
+ if (line.start.x < m_clipMin.x)
+ return false;
+ ClipEndLeft (line);
+ if (line.end.y < m_clipMin.y)
+ ClipEndTop (line);
+ return true;
+
+ case 0x4A:
+ ClipStartBottom (line);
+ if (line.start.x > m_clipMax.x)
+ return false;
+ ClipEndRight (line);
+ if (line.end.y < m_clipMin.y)
+ ClipEndTop (line);
+ return true;
+
+ // bottom-left
+ case 0x50:
+ ClipStartLeft (line);
+ if (line.start.y > m_clipMax.y)
+ ClipStartBottom (line);
+ return true;
+
+ case 0x52:
+ ClipEndRight (line);
+ if (line.end.y > m_clipMax.y)
+ return false;
+ ClipStartBottom (line);
+ if (line.start.x < m_clipMin.x)
+ ClipStartLeft (line);
+ return true;
+
+ case 0x58:
+ ClipEndTop (line);
+ if (line.end.x < m_clipMin.x)
+ return false;
+ ClipStartBottom (line);
+ if (line.start.x < m_clipMin.x)
+ ClipStartLeft (line);
+ return true;
+
+ case 0x5A:
+ ClipStartLeft (line);
+ if (line.start.y < m_clipMin.y)
+ return false;
+ ClipEndRight (line);
+ if (line.end.y > m_clipMax.y)
+ return false;
+ if (line.start.y > m_clipMax.y)
+ ClipStartBottom (line);
+ if (line.end.y < m_clipMin.y)
+ ClipEndTop (line);
+ return true;
+
+ // bottom-right
+ case 0x60:
+ ClipStartRight (line);
+ if (line.start.y > m_clipMax.y)
+ ClipStartBottom (line);
+ return true;
+
+ case 0x61:
+ ClipEndLeft (line);
+ if (line.end.y > m_clipMax.y)
+ return false;
+ ClipStartBottom (line);
+ if (line.start.x > m_clipMax.x)
+ ClipStartRight (line);
+ return true;
+
+ case 0x68:
+ ClipEndTop (line);
+ if (line.end.x > m_clipMax.x)
+ return false;
+ ClipStartRight (line);
+ if (line.start.y > m_clipMax.y)
+ ClipStartBottom (line);
+ return true;
+
+ case 0x69:
+ ClipEndLeft (line);
+ if (line.end.y > m_clipMax.y)
+ return false;
+ ClipStartRight (line);
+ if (line.start.y < m_clipMin.y)
+ return false;
+ if (line.end.y < m_clipMin.y)
+ ClipEndTop (line);
+ if (line.start.y > m_clipMax.y)
+ ClipStartBottom (line);
+ return true;
+
+ // top
+ case 0x80:
+ ClipStartTop (line);
+ return true;
+
+ case 0x81:
+ ClipStartTop (line);
+ if (line.start.x < m_clipMin.x)
+ return false;
+ ClipEndLeft (line);
+ return true;
+
+ case 0x82:
+ ClipStartTop (line);
+ if (line.start.x > m_clipMax.x)
+ return false;
+ ClipEndRight (line);
+ return true;
+
+ case 0x84:
+ ClipStartTop (line);
+ ClipEndBottom (line);
+ return true;
+
+ case 0x85:
+ ClipStartTop (line);
+ if (line.start.x < m_clipMin.x)
+ return false;
+ ClipEndLeft (line);
+ if (line.end.y > m_clipMax.y)
+ ClipEndBottom (line);
+ return true;
+
+ case 0x86:
+ ClipStartTop (line);
+ if (line.start.x > m_clipMax.x)
+ return false;
+ ClipEndRight (line);
+ if (line.end.y > m_clipMax.y)
+ ClipEndBottom (line);
+ return true;
+
+ // top-left
+ case 0x90:
+ ClipStartLeft (line);
+ if (line.start.y < m_clipMin.y)
+ ClipStartTop (line);
+ return true;
+
+ case 0x92:
+ ClipEndRight (line);
+ if (line.end.y < m_clipMin.y)
+ return false;
+ ClipStartTop (line);
+ if (line.start.x < m_clipMin.x)
+ ClipStartLeft (line);
+ return true;
+
+ case 0x94:
+ ClipEndBottom (line);
+ if (line.end.x < m_clipMin.x)
+ return false;
+ ClipStartLeft (line);
+ if (line.start.y < m_clipMin.y)
+ ClipStartTop (line);
+ return true;
+
+ case 0x96:
+ ClipStartLeft (line);
+ if (line.start.y > m_clipMax.y)
+ return false;
+ ClipEndRight (line);
+ if (line.end.y < m_clipMin.y)
+ return false;
+ if (line.start.y < m_clipMin.y)
+ ClipStartTop (line);
+ if (line.end.y > m_clipMax.y)
+ ClipEndBottom (line);
+ return true;
+
+ // top-right
+ case 0xA0:
+ ClipStartRight (line);
+ if (line.start.y < m_clipMin.y)
+ ClipStartTop (line);
+ return true;
+
+ case 0xA1:
+ ClipEndLeft (line);
+ if (line.end.y < m_clipMin.y)
+ return false;
+ ClipStartTop (line);
+ if (line.start.x > m_clipMax.x)
+ ClipStartRight (line);
+ return true;
+
+ case 0xA4:
+ ClipEndBottom (line);
+ if (line.end.x > m_clipMax.x)
+ return false;
+ ClipStartRight (line);
+ if (line.start.y < m_clipMin.y)
+ ClipStartTop (line);
+ return true;
+
+ case 0xA5:
+ ClipEndLeft (line);
+ if (line.end.y < m_clipMin.y)
+ return false;
+ ClipStartRight (line);
+ if (line.start.y > m_clipMax.y)
+ return false;
+ if (line.end.y > m_clipMax.y)
+ ClipEndBottom (line);
+ if (line.start.y < m_clipMin.y)
+ ClipStartTop (line);
+ return true;
+ }
+
+ return false;
+ }
+ };
+}
+
+void
+PyViz::LineClipping (double boundsX1, double boundsY1, double boundsX2, double boundsY2,
+ double &lineX1, double &lineY1, double &lineX2, double &lineY2)
+{
+ FastClipping::Vector2 clipMin = {boundsX1, boundsY1}, clipMax = {boundsX2, boundsY2};
+ FastClipping::Line line = { { lineX1, lineY1 }, { lineX2, lineY2 }, (lineX2-lineX1), (lineY2-lineY1) };
+
+ FastClipping clipper (clipMin, clipMax);
+ clipper.ClipLine (line);
+ lineX1 = line.start.x;
+ lineX2 = line.end.x;
+ lineY1 = line.start.y;
+ lineY2 = line.end.y;
+}
+
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/model/pyviz.h Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,225 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 INESC Porto
+ *
+ * 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
+ *
+ * C++ helper functions for use by the python visualizer (for things
+ * Python is too slow at).
+ *
+ * Author: Gustavo Carneiro <gjc@inescporto.pt>
+ */
+#ifndef NS3_PYVIZ_H
+#define NS3_PYVIZ_H
+
+#include "ns3/nstime.h"
+#include "ns3/event-id.h"
+#include "ns3/node.h"
+#include "ns3/channel.h"
+#include "ns3/packet.h"
+#include "ns3/mac48-address.h"
+#include "ns3/ipv4-header.h"
+#include "ns3/ipv4-l3-protocol.h"
+
+#include <map>
+#include <set>
+
+namespace ns3 {
+
+/**
+ * \brief helper class to be used by the visualizer
+ * \internal
+ *
+ * This class is not meant to be used by simulations. It is only
+ * meant to be used by the visualizer tool (PyViz). The only reason
+ * it is public is because Python bindings for it are needed,
+ * otherwise it should be considered private.
+ **/
+class PyViz
+{
+public:
+ PyViz ();
+ ~PyViz ();
+
+ void RegisterDropTracePath (std::string const &tracePath);
+
+ void RegisterCsmaLikeDevice (std::string const &deviceTypeName);
+ void RegisterWifiLikeDevice (std::string const &deviceTypeName);
+ void RegisterPointToPointLikeDevice (std::string const &deviceTypeName);
+
+ // Run simulation until a given (simulated, absolute) time is reached
+ void SimulatorRunUntil (Time time);
+
+ static void Pause (std::string const &message);
+ std::vector<std::string> GetPauseMessages () const;
+
+ struct TransmissionSample
+ {
+ Ptr<Node> transmitter;
+ Ptr<Node> receiver; // NULL if broadcast
+ Ptr<Channel> channel;
+ uint32_t bytes;
+ };
+ typedef std::vector<TransmissionSample> TransmissionSampleList;
+ TransmissionSampleList GetTransmissionSamples () const;
+
+ struct PacketDropSample
+ {
+ Ptr<Node> transmitter;
+ uint32_t bytes;
+ };
+ typedef std::vector<PacketDropSample> PacketDropSampleList;
+ PacketDropSampleList GetPacketDropSamples () const;
+
+
+ struct PacketSample
+ {
+ Time time;
+ Ptr<Packet> packet;
+ Ptr<NetDevice> device;
+ };
+ struct TxPacketSample : PacketSample
+ {
+ Mac48Address to;
+ };
+ struct RxPacketSample : PacketSample
+ {
+ Mac48Address from;
+ };
+
+ struct LastPacketsSample
+ {
+ std::vector<RxPacketSample> lastReceivedPackets;
+ std::vector<TxPacketSample> lastTransmittedPackets;
+ std::vector<PacketSample> lastDroppedPackets;
+ };
+ LastPacketsSample GetLastPackets (uint32_t nodeId) const;
+
+
+ void SetNodesOfInterest (std::set<uint32_t> nodes);
+
+ struct NetDeviceStatistics
+ {
+ NetDeviceStatistics () : transmittedBytes (0), receivedBytes (0),
+ transmittedPackets (0), receivedPackets (0) {}
+ uint64_t transmittedBytes;
+ uint64_t receivedBytes;
+ uint32_t transmittedPackets;
+ uint32_t receivedPackets;
+ };
+
+ struct NodeStatistics
+ {
+ uint32_t nodeId;
+ std::vector<NetDeviceStatistics> statistics;
+ };
+
+ std::vector<NodeStatistics> GetNodesStatistics () const;
+
+ enum PacketCaptureMode {
+ PACKET_CAPTURE_DISABLED=1, // packet capture is disabled
+ PACKET_CAPTURE_FILTER_HEADERS_OR, // packet capture if any of the indicated headers is present
+ PACKET_CAPTURE_FILTER_HEADERS_AND, // packet capture if all of the indicated headers are present
+ };
+
+ struct PacketCaptureOptions
+ {
+ std::set<TypeId> headers;
+ uint32_t numLastPackets;
+ PacketCaptureMode mode;
+ };
+
+ void SetPacketCaptureOptions (uint32_t nodeId, PacketCaptureOptions options);
+
+
+ // Yes, I know, this is just a utility function, not really related to the class in any way.
+
+ // -#- @lineX1(direction=inout); @lineY1(direction=inout); @lineX2(direction=inout); @lineY2(direction=inout) -#-
+ static void LineClipping (double boundsX1, double boundsY1, double boundsX2, double boundsY2, double &lineX1, double &lineY1, double &lineX2, double &lineY2); // don't break this line or pybindgen will not be able to pick up the above annotation :(
+
+
+private:
+
+ bool GetPacketCaptureOptions (uint32_t nodeId, const PacketCaptureOptions **outOptions) const;
+ static bool FilterPacket (Ptr<const Packet> packet, const PacketCaptureOptions &options);
+
+
+ typedef std::pair<Ptr<Channel>, uint32_t> TxRecordKey;
+
+ struct TxRecordValue
+ {
+ Time time;
+ Ptr<Node> srcNode;
+ bool isBroadcast;
+ };
+
+ struct TransmissionSampleKey
+ {
+ bool operator < (TransmissionSampleKey const &other) const;
+ bool operator == (TransmissionSampleKey const &other) const;
+ Ptr<Node> transmitter;
+ Ptr<Node> receiver; // NULL if broadcast
+ Ptr<Channel> channel;
+ };
+
+ struct TransmissionSampleValue
+ {
+ uint32_t bytes;
+ };
+
+ // data
+ std::map<uint32_t, PacketCaptureOptions> m_packetCaptureOptions;
+ std::vector<std::string> m_pauseMessages;
+ std::map<TxRecordKey, TxRecordValue> m_txRecords;
+ std::map<TransmissionSampleKey, TransmissionSampleValue> m_transmissionSamples;
+ std::map<Ptr<Node>, uint32_t> m_packetDrops;
+ std::set<uint32_t> m_nodesOfInterest; // list of node IDs whose transmissions will be monitored
+ std::map<uint32_t, Time> m_packetsOfInterest; // list of packet UIDs that will be monitored
+ std::map<uint32_t, LastPacketsSample> m_lastPackets;
+ std::map<uint32_t, std::vector<NetDeviceStatistics> > m_nodesStatistics;
+
+ // Trace callbacks
+ void TraceNetDevTxCommon (std::string const &context, Ptr<const Packet> packet, Mac48Address const &destination);
+ void TraceNetDevRxCommon (std::string const &context, Ptr<const Packet> packet, Mac48Address const &source);
+
+ void TraceNetDevTxWifi (std::string context, Ptr<const Packet> packet);
+ void TraceNetDevRxWifi (std::string context, Ptr<const Packet> packet);
+
+ void TraceDevQueueDrop (std::string context, Ptr<const Packet> packet);
+ void TraceIpv4Drop (std::string context, ns3::Ipv4Header const &hdr, Ptr<const Packet> packet,
+ ns3::Ipv4L3Protocol::DropReason reason, Ptr<Ipv4> dummy_ipv4, uint32_t interface);
+
+ void TraceNetDevTxCsma (std::string context, Ptr<const Packet> packet);
+ void TraceNetDevRxCsma (std::string context, Ptr<const Packet> packet);
+ void TraceNetDevPromiscRxCsma (std::string context, Ptr<const Packet> packet);
+
+ void TraceNetDevTxPointToPoint (std::string context, Ptr<const Packet> packet);
+ void TraceNetDevRxPointToPoint (std::string context, Ptr<const Packet> packet);
+
+ void TraceNetDevTxWimax (std::string context, Ptr<const Packet> packet, Mac48Address const &destination);
+ void TraceNetDevRxWimax (std::string context, Ptr<const Packet> packet, Mac48Address const &source);
+
+ inline NetDeviceStatistics & FindNetDeviceStatistics (int node, int interface);
+
+ void DoPause (std::string const &message);
+
+ bool m_stop;
+ EventId m_stopCallbackEvent;
+ void CallbackStopSimulation ();
+};
+
+
+}
+
+#endif /* NS3_PYVIZ_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/model/visual-simulator-impl.cc Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,228 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Gustavo Carneiro
+ *
+ * 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: Gustavo Carneiro <gjcarneiro@gmail.com> <gjc@inescporto.pt>
+ */
+#include <Python.h>
+#include "visual-simulator-impl.h"
+#include "ns3/default-simulator-impl.h"
+#include "ns3/log.h"
+
+NS_LOG_COMPONENT_DEFINE ("VisualSimulatorImpl");
+
+namespace ns3 {
+
+
+
+NS_OBJECT_ENSURE_REGISTERED (VisualSimulatorImpl);
+
+namespace
+{
+ ObjectFactory
+ GetDefaultSimulatorImplFactory ()
+ {
+ ObjectFactory factory;
+ factory.SetTypeId (DefaultSimulatorImpl::GetTypeId ());
+ return factory;
+ }
+}
+
+
+TypeId
+VisualSimulatorImpl::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::VisualSimulatorImpl")
+ .SetParent<SimulatorImpl> ()
+ .AddConstructor<VisualSimulatorImpl> ()
+ .AddAttribute ("SimulatorImplFactory",
+ "Factory for the underlying simulator implementation used by the visualizer.",
+ ObjectFactoryValue (GetDefaultSimulatorImplFactory ()),
+ MakeObjectFactoryAccessor (&VisualSimulatorImpl::m_simulatorImplFactory),
+ MakeObjectFactoryChecker ())
+ ;
+ return tid;
+}
+
+
+VisualSimulatorImpl::VisualSimulatorImpl ()
+{
+}
+
+VisualSimulatorImpl::~VisualSimulatorImpl ()
+{}
+
+void
+VisualSimulatorImpl::DoDispose (void)
+{
+ if (m_simulator)
+ {
+ m_simulator->Dispose ();
+ m_simulator = NULL;
+ }
+ SimulatorImpl::DoDispose ();
+}
+
+void
+VisualSimulatorImpl::NotifyConstructionCompleted ()
+{
+ m_simulator = m_simulatorImplFactory.Create<SimulatorImpl> ();
+}
+
+
+void
+VisualSimulatorImpl::Destroy ()
+{
+ m_simulator->Destroy ();
+}
+
+void
+VisualSimulatorImpl::SetScheduler (ObjectFactory schedulerFactory)
+{
+ m_simulator->SetScheduler (schedulerFactory);
+}
+
+// System ID for non-distributed simulation is always zero
+uint32_t
+VisualSimulatorImpl::GetSystemId (void) const
+{
+ return m_simulator->GetSystemId ();
+}
+
+bool
+VisualSimulatorImpl::IsFinished (void) const
+{
+ return m_simulator->IsFinished ();
+}
+
+Time
+VisualSimulatorImpl::Next (void) const
+{
+ return m_simulator->Next ();
+}
+
+void
+VisualSimulatorImpl::Run (void)
+{
+ if (!Py_IsInitialized ())
+ {
+ const char *argv[] = {"python", NULL};
+ Py_Initialize();
+ PySys_SetArgv(1, (char**) argv);
+ }
+ PyRun_SimpleString(
+ "import visualizer\n"
+ "visualizer.start();\n"
+ );
+}
+
+void
+VisualSimulatorImpl::RunOneEvent (void)
+{
+ m_simulator->RunOneEvent ();
+}
+
+void
+VisualSimulatorImpl::Stop (void)
+{
+ m_simulator->Stop ();
+}
+
+void
+VisualSimulatorImpl::Stop (Time const &time)
+{
+ m_simulator->Stop (time);
+}
+
+//
+// Schedule an event for a _relative_ time in the future.
+//
+EventId
+VisualSimulatorImpl::Schedule (Time const &time, EventImpl *event)
+{
+ return m_simulator->Schedule (time, event);
+}
+
+void
+VisualSimulatorImpl::ScheduleWithContext (uint32_t context, Time const &time, EventImpl *event)
+{
+ m_simulator->ScheduleWithContext (context, time, event);
+}
+
+EventId
+VisualSimulatorImpl::ScheduleNow (EventImpl *event)
+{
+ return m_simulator->ScheduleNow (event);
+}
+
+EventId
+VisualSimulatorImpl::ScheduleDestroy (EventImpl *event)
+{
+ return m_simulator->ScheduleDestroy (event);
+}
+
+Time
+VisualSimulatorImpl::Now (void) const
+{
+ return m_simulator->Now ();
+}
+
+Time
+VisualSimulatorImpl::GetDelayLeft (const EventId &id) const
+{
+ return m_simulator->GetDelayLeft (id);
+}
+
+void
+VisualSimulatorImpl::Remove (const EventId &id)
+{
+ m_simulator->Remove (id);
+}
+
+void
+VisualSimulatorImpl::Cancel (const EventId &id)
+{
+ m_simulator->Cancel (id);
+}
+
+bool
+VisualSimulatorImpl::IsExpired (const EventId &ev) const
+{
+ return m_simulator->IsExpired (ev);
+}
+
+Time
+VisualSimulatorImpl::GetMaximumSimulationTime (void) const
+{
+ return m_simulator->GetMaximumSimulationTime ();
+}
+
+uint32_t
+VisualSimulatorImpl::GetContext (void) const
+{
+ return m_simulator->GetContext ();
+}
+
+void
+VisualSimulatorImpl::RunRealSimulator (void)
+{
+ m_simulator->Run ();
+}
+
+
+} // namespace ns3
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/model/visual-simulator-impl.h Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,82 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Gustavo Carneiro
+ *
+ * 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: Gustavo Carneiro <gjcarneiro@gmail.com>
+ */
+
+#ifndef VISUAL_SIMULATOR_IMPL_H
+#define VISUAL_SIMULATOR_IMPL_H
+
+#include "ns3/simulator-impl.h"
+
+namespace ns3 {
+
+
+/**
+ * \brief A replacement simulator that starts the visualizer
+ * \internal
+ *
+ * To use this class, run any ns-3 simulation with the command-line
+ * argument --SimulatorImplementationType=ns3::VisualSimulatorImpl.
+ * This causes the visualizer (PyViz) to start automatically.
+ **/
+class VisualSimulatorImpl : public SimulatorImpl
+{
+public:
+ static TypeId GetTypeId (void);
+
+ VisualSimulatorImpl ();
+ ~VisualSimulatorImpl ();
+
+ virtual void Destroy ();
+ virtual bool IsFinished (void) const;
+ virtual Time Next (void) const;
+ virtual void Stop (void);
+ virtual void Stop (Time const &time);
+ virtual EventId Schedule (Time const &time, EventImpl *event);
+ virtual void ScheduleWithContext (uint32_t context, Time const &time, EventImpl *event);
+ virtual EventId ScheduleNow (EventImpl *event);
+ virtual EventId ScheduleDestroy (EventImpl *event);
+ virtual void Remove (const EventId &ev);
+ virtual void Cancel (const EventId &ev);
+ virtual bool IsExpired (const EventId &ev) const;
+ virtual void Run (void);
+ virtual void RunOneEvent (void);
+ virtual Time Now (void) const;
+ virtual Time GetDelayLeft (const EventId &id) const;
+ virtual Time GetMaximumSimulationTime (void) const;
+ virtual void SetScheduler (ObjectFactory schedulerFactory);
+ virtual uint32_t GetSystemId (void) const;
+ virtual uint32_t GetContext (void) const;
+
+ /// calls Run() in the wrapped simulator
+ void RunRealSimulator (void);
+
+protected:
+ void DoDispose ();
+ void NotifyConstructionCompleted (void);
+
+private:
+ Ptr<SimulatorImpl> GetSim ();
+ Ptr<SimulatorImpl> m_simulator;
+ ObjectFactory m_simulatorImplFactory;
+
+};
+
+} // namespace ns3
+
+#endif /* DEFAULT_SIMULATOR_IMPL_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/model/visualizer-ideas.txt Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,16 @@
+- Add an Attribute browser plugin, simililar to Mathieu's GtkConfigStore;
+ - Right click on a node -> Show Attributes;
+ - Allow editing attributes too;
+- List of all nodes, navigator;
+- Represent individual NetDevices in Nodes;
+- Colorize flows; possible approaches:
+ - Apply color based on hash function of ethertype, IP packet type, L4 destination port;
+ - Programmatically marked flows;
+ - Packet tags?
+ - Present a GUI to show applications and set color for each one;
+ - Problems:
+ > How about multiple flows? How to represent them simultaneously?
+- Track down a Gtk+ bug preventing tooltips from working correctly with large zoom levels;
+- Possibly look for embedding an ipython shell as a widget inside the
+ main window: http://ipython.scipy.org/moin/Cookbook/EmbeddingInGTK
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/visualizer/__init__.py Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,3 @@
+
+from core import start, register_plugin, set_bounds, add_initialization_hook
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/visualizer/base.py Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,107 @@
+import ns3
+import gobject
+import os.path
+import sys
+
+PIXELS_PER_METER = 3.0 # pixels-per-meter, at 100% zoom level
+
+class PyVizObject(gobject.GObject):
+ __gtype_name__ = "PyVizObject"
+
+ def tooltip_query(self, tooltip):
+ tooltip.set_text("TODO: tooltip for %r" % self)
+
+class Link(PyVizObject):
+ pass
+
+
+class InformationWindow(object):
+ def update(self):
+ raise NotImplementedError
+
+class NetDeviceTraits(object):
+ def __init__(self, is_wireless=None, is_virtual=False):
+ assert is_virtual or is_wireless is not None
+ self.is_wireless = is_wireless
+ self.is_virtual = is_virtual
+
+netdevice_traits = {
+ ns3.PointToPointNetDevice: NetDeviceTraits(is_wireless=False),
+ ns3.CsmaNetDevice: NetDeviceTraits(is_wireless=False),
+ ns3.WifiNetDevice: NetDeviceTraits(is_wireless=True),
+ ns3.BridgeNetDevice: NetDeviceTraits(is_virtual=True),
+ ns3.LoopbackNetDevice: NetDeviceTraits(is_virtual=True, is_wireless=False),
+ ns3.MeshPointDevice: NetDeviceTraits(is_virtual=True),
+ ns3.SubscriberStationNetDevice: NetDeviceTraits(is_wireless=True),
+ ns3.BaseStationNetDevice: NetDeviceTraits(is_wireless=True),
+}
+
+def lookup_netdevice_traits(class_type):
+ try:
+ return netdevice_traits[class_type]
+ except KeyError:
+ sys.stderr.write("WARNING: no NetDeviceTraits registered for device type %r; "
+ "I will assume this is a non-virtual wireless device, "
+ "but you should edit %r, variable 'netdevice_traits',"
+ " to make sure.\n" % (class_type.__name__, __file__))
+ t = NetDeviceTraits(is_virtual=False, is_wireless=True)
+ netdevice_traits[class_type] = t
+ return t
+
+def transform_distance_simulation_to_canvas(d):
+ return d*PIXELS_PER_METER
+
+def transform_point_simulation_to_canvas(x, y):
+ return x*PIXELS_PER_METER, y*PIXELS_PER_METER
+
+def transform_distance_canvas_to_simulation(d):
+ return d/PIXELS_PER_METER
+
+def transform_point_canvas_to_simulation(x, y):
+ return x/PIXELS_PER_METER, y/PIXELS_PER_METER
+
+
+
+
+plugins = []
+plugin_modules = {}
+
+def register_plugin(plugin_init_func, plugin_name=None, plugin_module=None):
+ """
+ Register a plugin.
+
+ @param plugin: a callable object that will be invoked whenever a
+ Visualizer object is created, like this: plugin(visualizer)
+ """
+ assert callable(plugin_init_func)
+ plugins.append(plugin_init_func)
+ if plugin_module is not None:
+ plugin_modules[plugin_name] = plugin_module
+
+plugins_loaded = False
+def load_plugins():
+ global plugins_loaded
+ if plugins_loaded:
+ return
+ plugins_loaded = True
+ plugins_dir = os.path.join(os.path.dirname(__file__), 'plugins')
+ old_path = list(sys.path)
+ sys.path.insert(0, plugins_dir)
+ for filename in os.listdir(plugins_dir):
+ name, ext = os.path.splitext(filename)
+ if ext != '.py':
+ continue
+ try:
+ plugin_module = __import__(name)
+ except ImportError, ex:
+ print >> sys.stderr, "Could not load plugin %r: %s" % (filename, str(ex))
+ continue
+ try:
+ plugin_func = plugin_module.register
+ except AttributeError:
+ print >> sys.stderr, "Plugin %r has no 'register' function" % name
+ else:
+ #print >> sys.stderr, "Plugin %r registered" % name
+ register_plugin(plugin_func, name, plugin_module)
+ sys.path = old_path
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/visualizer/core.py Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,1470 @@
+# -*- Mode: python; coding: utf-8 -*-
+from __future__ import division
+#from __future__ import with_statement
+
+LAYOUT_ALGORITHM = 'neato' # ['neato'|'dot'|'twopi'|'circo'|'fdp'|'nop']
+REPRESENT_CHANNELS_AS_NODES = 1
+DEFAULT_NODE_SIZE = 3.0 # default node size in meters
+DEFAULT_TRANSMISSIONS_MEMORY = 5 # default number of of past intervals whose transmissions are remembered
+BITRATE_FONT_SIZE = 10
+
+# internal constants, normally not meant to be changed
+SAMPLE_PERIOD = 0.1
+PRIORITY_UPDATE_MODEL = -100
+PRIORITY_UPDATE_VIEW = 200
+
+import platform
+if platform.system() == "Windows":
+ SHELL_FONT = "Lucida Console 9"
+else:
+ SHELL_FONT = "Luxi Mono 10"
+
+
+import ns3
+import math
+import os
+import sys
+import gobject
+import time
+
+try:
+ import pygraphviz
+ import gtk
+ import pango
+ import goocanvas
+ import cairo
+ import threading
+ import hud
+ #import time
+ import cairo
+ from higcontainer import HIGContainer
+ gobject.threads_init()
+ try:
+ import svgitem
+ except ImportError:
+ svgitem = None
+except ImportError, _import_error:
+ import dummy_threading as threading
+else:
+ _import_error = None
+
+try:
+ import ipython_view
+except ImportError:
+ ipython_view = None
+
+from base import InformationWindow, PyVizObject, Link, lookup_netdevice_traits, PIXELS_PER_METER
+from base import transform_distance_simulation_to_canvas, transform_point_simulation_to_canvas
+from base import transform_distance_canvas_to_simulation, transform_point_canvas_to_simulation
+from base import load_plugins, register_plugin, plugins
+
+PI_OVER_2 = math.pi/2
+PI_TIMES_2 = math.pi*2
+
+class Node(PyVizObject):
+
+ __gsignals__ = {
+
+ # signal emitted whenever a tooltip is about to be shown for the node
+ # the first signal parameter is a python list of strings, to which information can be appended
+ 'query-extra-tooltip-info': (gobject.SIGNAL_RUN_LAST, None, (object,)),
+
+ }
+
+ def __init__(self, visualizer, node_index):
+ super(Node, self).__init__()
+
+ self.visualizer = visualizer
+ self.node_index = node_index
+ self.canvas_item = goocanvas.Ellipse()
+ self.canvas_item.set_data("pyviz-object", self)
+ self.links = []
+ self._has_mobility = None
+ self._selected = False
+ self._highlighted = False
+ self._color = 0x808080ff
+ self._size = DEFAULT_NODE_SIZE
+ self.canvas_item.connect("enter-notify-event", self.on_enter_notify_event)
+ self.canvas_item.connect("leave-notify-event", self.on_leave_notify_event)
+ self.menu = None
+ self.svg_item = None
+ self.svg_align_x = None
+ self.svg_align_y = None
+ self._label = None
+ self._label_canvas_item = None
+
+ self._update_appearance() # call this last
+
+ def set_svg_icon(self, file_base_name, width=None, height=None, align_x=0.5, align_y=0.5):
+ """
+ Set a background SVG icon for the node.
+
+ @param file_base_name: base file name, including .svg
+ extension, of the svg file. Place the file in the folder
+ src/contrib/visualizer/resource.
+
+ @param width: scale to the specified width, in meters
+ @param width: scale to the specified height, in meters
+
+ @param align_x: horizontal alignment of the icon relative to
+ the node position, from 0 (icon fully to the left of the node)
+ to 1.0 (icon fully to the right of the node)
+
+ @param align_y: vertical alignment of the icon relative to the
+ node position, from 0 (icon fully to the top of the node) to
+ 1.0 (icon fully to the bottom of the node)
+
+ """
+ if width is None and height is None:
+ raise ValueError("either width or height must be given")
+ rsvg_handle = svgitem.rsvg_handle_factory(file_base_name)
+ x = self.canvas_item.props.center_x
+ y = self.canvas_item.props.center_y
+ self.svg_item = svgitem.SvgItem(x, y, rsvg_handle)
+ self.svg_item.props.parent = self.visualizer.canvas.get_root_item()
+ self.svg_item.props.pointer_events = 0
+ self.svg_item.lower(None)
+ self.svg_item.props.visibility = goocanvas.ITEM_VISIBLE_ABOVE_THRESHOLD
+ if width is not None:
+ self.svg_item.props.width = transform_distance_simulation_to_canvas(width)
+ if height is not None:
+ self.svg_item.props.height = transform_distance_simulation_to_canvas(height)
+
+ #threshold1 = 10.0/self.svg_item.props.height
+ #threshold2 = 10.0/self.svg_item.props.width
+ #self.svg_item.props.visibility_threshold = min(threshold1, threshold2)
+
+ self.svg_align_x = align_x
+ self.svg_align_y = align_y
+ self._update_svg_position(x, y)
+ self._update_appearance()
+
+ def set_label(self, label):
+ assert isinstance(label, basestring)
+ self._label = label
+ self._update_appearance()
+
+ def _update_svg_position(self, x, y):
+ w = self.svg_item.width
+ h = self.svg_item.height
+ self.svg_item.set_properties(x=(x - (1-self.svg_align_x)*w),
+ y=(y - (1-self.svg_align_y)*h))
+
+
+ def tooltip_query(self, tooltip):
+ self.visualizer.simulation.lock.acquire()
+ try:
+ ns3_node = ns3.NodeList.GetNode(self.node_index)
+ ipv4 = ns3_node.GetObject(ns3.Ipv4.GetTypeId())
+ lines = ['<b><u>Node %i</u></b>' % self.node_index]
+ lines.append('')
+
+ self.emit("query-extra-tooltip-info", lines)
+
+ mob = ns3_node.GetObject(ns3.MobilityModel.GetTypeId())
+ if mob is not None:
+ lines.append(' <b>Mobility Model</b>: %s' % mob.GetInstanceTypeId().GetName())
+
+ for devI in range(ns3_node.GetNDevices()):
+ lines.append('')
+ lines.append(' <u>NetDevice %i:</u>' % devI)
+ dev = ns3_node.GetDevice(devI)
+ name = ns3.Names.FindName(dev)
+ if name:
+ lines.append(' <b>Name:</b> %s' % name)
+ devname = dev.GetInstanceTypeId().GetName()
+ lines.append(' <b>Type:</b> %s' % devname)
+ if ipv4 is not None:
+ ipv4_idx = ipv4.GetInterfaceForDevice(dev)
+ if ipv4_idx != -1:
+ addresses = [
+ '%s/%s' % (ipv4.GetAddress(ipv4_idx, i).GetLocal(),
+ ipv4.GetAddress(ipv4_idx, i).GetMask())
+ for i in range(ipv4.GetNAddresses(ipv4_idx))]
+ lines.append(' <b>IPv4 Addresses:</b> %s' % '; '.join(addresses))
+
+ lines.append(' <b>MAC Address:</b> %s' % (dev.GetAddress(),))
+
+ tooltip.set_markup('\n'.join(lines))
+ finally:
+ self.visualizer.simulation.lock.release()
+
+ def on_enter_notify_event(self, view, target, event):
+ self.highlighted = True
+ def on_leave_notify_event(self, view, target, event):
+ self.highlighted = False
+
+ def _set_selected(self, value):
+ self._selected = value
+ self._update_appearance()
+ def _get_selected(self):
+ return self._selected
+ selected = property(_get_selected, _set_selected)
+
+ def _set_highlighted(self, value):
+ self._highlighted = value
+ self._update_appearance()
+ def _get_highlighted(self):
+ return self._highlighted
+ highlighted = property(_get_highlighted, _set_highlighted)
+
+ def set_size(self, size):
+ self._size = size
+ self._update_appearance()
+
+ def _update_appearance(self):
+ """Update the node aspect to reflect the selected/highlighted state"""
+
+ size = transform_distance_simulation_to_canvas(self._size)
+ if self.svg_item is not None:
+ alpha = 0x80
+ else:
+ alpha = 0xff
+ fill_color_rgba = (self._color & 0xffffff00) | alpha
+ self.canvas_item.set_properties(radius_x=size, radius_y=size,
+ fill_color_rgba=fill_color_rgba)
+ if self._selected:
+ line_width = size*.3
+ else:
+ line_width = size*.15
+ if self.highlighted:
+ stroke_color = 'yellow'
+ else:
+ stroke_color = 'black'
+ self.canvas_item.set_properties(line_width=line_width, stroke_color=stroke_color)
+
+ if self._label is not None:
+ if self._label_canvas_item is None:
+ self._label_canvas_item = goocanvas.Text(visibility_threshold=0.5,
+ font="Sans Serif 10",
+ fill_color_rgba=0x808080ff,
+ alignment=pango.ALIGN_CENTER,
+ anchor=gtk.ANCHOR_N,
+ parent=self.visualizer.canvas.get_root_item(),
+ pointer_events=0)
+ self._label_canvas_item.lower(None)
+
+ self._label_canvas_item.set_properties(visibility=goocanvas.ITEM_VISIBLE_ABOVE_THRESHOLD,
+ text=self._label)
+ self._update_position()
+
+ def set_position(self, x, y):
+ self.canvas_item.set_property("center_x", x)
+ self.canvas_item.set_property("center_y", y)
+ if self.svg_item is not None:
+ self._update_svg_position(x, y)
+
+ for link in self.links:
+ link.update_points()
+
+ if self._label_canvas_item is not None:
+ self._label_canvas_item.set_properties(x=x, y=(y+self._size*3))
+
+ def get_position(self):
+ return (self.canvas_item.get_property("center_x"), self.canvas_item.get_property("center_y"))
+
+ def _update_position(self):
+ x, y = self.get_position()
+ self.set_position(x, y)
+
+ def set_color(self, color):
+ if isinstance(color, str):
+ color = gtk.gdk.color_parse(color)
+ color = ((color.red>>8) << 24) | ((color.green>>8) << 16) | ((color.blue>>8) << 8) | 0xff
+ self._color = color
+ self._update_appearance()
+
+ def add_link(self, link):
+ assert isinstance(link, Link)
+ self.links.append(link)
+
+ def remove_link(self, link):
+ assert isinstance(link, Link)
+ self.links.remove(link)
+
+ @property
+ def has_mobility(self):
+ if self._has_mobility is None:
+ node = ns3.NodeList.GetNode(self.node_index)
+ mobility = node.GetObject(ns3.MobilityModel.GetTypeId())
+ self._has_mobility = (mobility is not None)
+ return self._has_mobility
+
+
+class Channel(PyVizObject):
+ def __init__(self, channel):
+ self.channel = channel
+ self.canvas_item = goocanvas.Ellipse(radius_x=30, radius_y=30,
+ fill_color="white",
+ stroke_color="grey", line_width=2.0,
+ line_dash=goocanvas.LineDash([10.0, 10.0 ]),
+ visibility=goocanvas.ITEM_VISIBLE)
+ self.canvas_item.set_data("pyviz-object", self)
+ self.links = []
+
+ def set_position(self, x, y):
+ self.canvas_item.set_property("center_x", x)
+ self.canvas_item.set_property("center_y", y)
+
+ for link in self.links:
+ link.update_points()
+
+ def get_position(self):
+ return (self.canvas_item.get_property("center_x"), self.canvas_item.get_property("center_y"))
+
+
+class WiredLink(Link):
+ def __init__(self, node1, node2):
+ assert isinstance(node1, Node)
+ assert isinstance(node2, (Node, Channel))
+ self.node1 = node1
+ self.node2 = node2
+ self.canvas_item = goocanvas.Path(line_width=1.0, stroke_color="black")
+ self.canvas_item.set_data("pyviz-object", self)
+ self.node1.links.append(self)
+ self.node2.links.append(self)
+
+ def update_points(self):
+ pos1_x, pos1_y = self.node1.get_position()
+ pos2_x, pos2_y = self.node2.get_position()
+ self.canvas_item.set_property("data", "M %r %r L %r %r" % (pos1_x, pos1_y, pos2_x, pos2_y))
+
+
+
+class SimulationThread(threading.Thread):
+ def __init__(self, viz):
+ super(SimulationThread, self).__init__()
+ assert isinstance(viz, Visualizer)
+ self.viz = viz # Visualizer object
+ self.lock = threading.Lock()
+ self.go = threading.Event()
+ self.go.clear()
+ self.target_time = 0 # in seconds
+ self.quit = False
+ self.sim_helper = ns3.PyViz()
+ self.pause_messages = []
+
+ def set_nodes_of_interest(self, nodes):
+ self.lock.acquire()
+ try:
+ self.sim_helper.SetNodesOfInterest(nodes)
+ finally:
+ self.lock.release()
+
+ def run(self):
+ while not self.quit:
+ #print "sim: Wait for go"
+ self.go.wait() # wait until the main (view) thread gives us the go signal
+ self.go.clear()
+ if self.quit:
+ break
+ #self.go.clear()
+ #print "sim: Acquire lock"
+ self.lock.acquire()
+ try:
+ if 0:
+ if ns3.Simulator.IsFinished():
+ self.viz.play_button.set_sensitive(False)
+ break
+ #print "sim: Current time is %f; Run until: %f" % (ns3.Simulator.Now ().GetSeconds (), self.target_time)
+ #if ns3.Simulator.Now ().GetSeconds () > self.target_time:
+ # print "skipping, model is ahead of view!"
+ self.sim_helper.SimulatorRunUntil(ns3.Seconds(self.target_time))
+ #print "sim: Run until ended at current time: ", ns3.Simulator.Now ().GetSeconds ()
+ self.pause_messages.extend(self.sim_helper.GetPauseMessages())
+ gobject.idle_add(self.viz.update_model, priority=PRIORITY_UPDATE_MODEL)
+ #print "sim: Run until: ", self.target_time, ": finished."
+ finally:
+ self.lock.release()
+ #print "sim: Release lock, loop."
+
+# enumeration
+class ShowTransmissionsMode(object):
+ __slots__ = []
+ShowTransmissionsMode.ALL = ShowTransmissionsMode()
+ShowTransmissionsMode.NONE = ShowTransmissionsMode()
+ShowTransmissionsMode.SELECTED = ShowTransmissionsMode()
+
+class Visualizer(gobject.GObject):
+ INSTANCE = None
+
+ if _import_error is None:
+ __gsignals__ = {
+
+ # signal emitted whenever a right-click-on-node popup menu is being constructed
+ 'populate-node-menu': (gobject.SIGNAL_RUN_LAST, None, (object, gtk.Menu,)),
+
+ # signal emitted after every simulation period (SAMPLE_PERIOD seconds of simulated time)
+ # the simulation lock is acquired while the signal is emitted
+ 'simulation-periodic-update': (gobject.SIGNAL_RUN_LAST, None, ()),
+
+ # signal emitted right after the topology is scanned
+ 'topology-scanned': (gobject.SIGNAL_RUN_LAST, None, ()),
+
+ # signal emitted when it's time to update the view objects
+ 'update-view': (gobject.SIGNAL_RUN_LAST, None, ()),
+
+ }
+
+ def __init__(self):
+ assert Visualizer.INSTANCE is None
+ Visualizer.INSTANCE = self
+ super(Visualizer, self).__init__()
+ self.nodes = {} # node index -> Node
+ self.channels = {} # id(ns3.Channel) -> Channel
+ self.window = None # toplevel window
+ self.canvas = None # goocanvas.Canvas
+ self.time_label = None # gtk.Label
+ self.play_button = None # gtk.ToggleButton
+ self.zoom = None # gtk.Adjustment
+ self._scrolled_window = None # gtk.ScrolledWindow
+
+ self.links_group = goocanvas.Group()
+ self.channels_group = goocanvas.Group()
+ self.nodes_group = goocanvas.Group()
+
+ self._update_timeout_id = None
+ self.simulation = SimulationThread(self)
+ self.selected_node = None # node currently selected
+ self.speed = 1.0
+ self.information_windows = []
+ self._transmission_arrows = []
+ self._last_transmissions = []
+ self._drop_arrows = []
+ self._last_drops = []
+ self._show_transmissions_mode = None
+ self.set_show_transmissions_mode(ShowTransmissionsMode.ALL)
+ self._panning_state = None
+ self.node_size_adjustment = None
+ self.transmissions_smoothing_adjustment = None
+ self.sample_period = SAMPLE_PERIOD
+ self.node_drag_state = None
+ self.follow_node = None
+ self.shell_window = None
+
+ self.create_gui()
+
+ for plugin in plugins:
+ plugin(self)
+
+ def set_show_transmissions_mode(self, mode):
+ assert isinstance(mode, ShowTransmissionsMode)
+ self._show_transmissions_mode = mode
+ if self._show_transmissions_mode == ShowTransmissionsMode.ALL:
+ self.simulation.set_nodes_of_interest(range(ns3.NodeList.GetNNodes()))
+ elif self._show_transmissions_mode == ShowTransmissionsMode.NONE:
+ self.simulation.set_nodes_of_interest([])
+ elif self._show_transmissions_mode == ShowTransmissionsMode.SELECTED:
+ if self.selected_node is None:
+ self.simulation.set_nodes_of_interest([])
+ else:
+ self.simulation.set_nodes_of_interest([self.selected_node.node_index])
+
+ def _create_advanced_controls(self):
+ expander = gtk.Expander("Advanced")
+ expander.show()
+
+ main_vbox = gobject.new(gtk.VBox, border_width=8, visible=True)
+ expander.add(main_vbox)
+
+ main_hbox1 = gobject.new(gtk.HBox, border_width=8, visible=True)
+ main_vbox.pack_start(main_hbox1)
+
+ show_transmissions_group = HIGContainer("Show transmissions")
+ show_transmissions_group.show()
+ main_hbox1.pack_start(show_transmissions_group, False, False, 8)
+
+ vbox = gtk.VBox(True, 4)
+ vbox.show()
+ show_transmissions_group.add(vbox)
+
+ all_nodes = gtk.RadioButton(None)
+ all_nodes.set_label("All nodes")
+ all_nodes.set_active(True)
+ all_nodes.show()
+ vbox.add(all_nodes)
+
+ selected_node = gtk.RadioButton(all_nodes)
+ selected_node.show()
+ selected_node.set_label("Selected node")
+ selected_node.set_active(False)
+ vbox.add(selected_node)
+
+ no_node = gtk.RadioButton(all_nodes)
+ no_node.show()
+ no_node.set_label("Disabled")
+ no_node.set_active(False)
+ vbox.add(no_node)
+
+ def toggled(radio):
+ if radio.get_active():
+ self.set_show_transmissions_mode(ShowTransmissionsMode.ALL)
+ all_nodes.connect("toggled", toggled)
+
+ def toggled(radio):
+ if radio.get_active():
+ self.set_show_transmissions_mode(ShowTransmissionsMode.NONE)
+ no_node.connect("toggled", toggled)
+
+ def toggled(radio):
+ if radio.get_active():
+ self.set_show_transmissions_mode(ShowTransmissionsMode.SELECTED)
+ selected_node.connect("toggled", toggled)
+
+
+ # -- misc settings
+ misc_settings_group = HIGContainer("Misc Settings")
+ misc_settings_group.show()
+ main_hbox1.pack_start(misc_settings_group, False, False, 8)
+ settings_hbox = gobject.new(gtk.HBox, border_width=8, visible=True)
+ misc_settings_group.add(settings_hbox)
+
+ # --> node size
+ vbox = gobject.new(gtk.VBox, border_width=0, visible=True)
+ scale = gobject.new(gtk.HScale, visible=True, digits=2)
+ vbox.pack_start(scale, True, True, 0)
+ vbox.pack_start(gobject.new(gtk.Label, label="Node Size", visible=True), True, True, 0)
+ settings_hbox.pack_start(vbox, False, False, 6)
+ self.node_size_adjustment = scale.get_adjustment()
+ def node_size_changed(adj):
+ for node in self.nodes.itervalues():
+ node.set_size(adj.value)
+ self.node_size_adjustment.connect("value-changed", node_size_changed)
+ self.node_size_adjustment.set_all(DEFAULT_NODE_SIZE, 0.01, 20, 0.1)
+
+ # --> transmissions smooth factor
+ vbox = gobject.new(gtk.VBox, border_width=0, visible=True)
+ scale = gobject.new(gtk.HScale, visible=True, digits=1)
+ vbox.pack_start(scale, True, True, 0)
+ vbox.pack_start(gobject.new(gtk.Label, label="Tx. Smooth Factor (s)", visible=True), True, True, 0)
+ settings_hbox.pack_start(vbox, False, False, 6)
+ self.transmissions_smoothing_adjustment = scale.get_adjustment()
+ self.transmissions_smoothing_adjustment.set_all(DEFAULT_TRANSMISSIONS_MEMORY*0.1, 0.1, 10, 0.1)
+
+ return expander
+
+ class _PanningState(object):
+ __slots__ = ['initial_mouse_pos', 'initial_canvas_pos', 'motion_signal']
+
+ def _begin_panning(self, widget, event):
+ self.canvas.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.FLEUR))
+ self._panning_state = self._PanningState()
+ x, y, dummy = widget.window.get_pointer()
+ self._panning_state.initial_mouse_pos = (x, y)
+ x = self._scrolled_window.get_hadjustment().value
+ y = self._scrolled_window.get_vadjustment().value
+ self._panning_state.initial_canvas_pos = (x, y)
+ self._panning_state.motion_signal = self.canvas.connect("motion-notify-event", self._panning_motion)
+
+ def _end_panning(self, event):
+ if self._panning_state is None:
+ return
+ self.canvas.window.set_cursor(None)
+ self.canvas.disconnect(self._panning_state.motion_signal)
+ self._panning_state = None
+
+ def _panning_motion(self, widget, event):
+ assert self._panning_state is not None
+ if event.is_hint:
+ x, y, dummy = widget.window.get_pointer()
+ else:
+ x, y = event.x, event.y
+
+ hadj = self._scrolled_window.get_hadjustment()
+ vadj = self._scrolled_window.get_vadjustment()
+ mx0, my0 = self._panning_state.initial_mouse_pos
+ cx0, cy0 = self._panning_state.initial_canvas_pos
+
+ dx = x - mx0
+ dy = y - my0
+ hadj.value = cx0 - dx
+ vadj.value = cy0 - dy
+ return True
+
+ def _canvas_button_press(self, widget, event):
+ if event.button == 2:
+ self._begin_panning(widget, event)
+ return True
+ return False
+
+ def _canvas_button_release(self, dummy_widget, event):
+ if event.button == 2:
+ self._end_panning(event)
+ return True
+ return False
+
+ def _canvas_scroll_event(self, dummy_widget, event):
+ if event.direction == gtk.gdk.SCROLL_UP:
+ self.zoom.value *= 1.25
+ return True
+ elif event.direction == gtk.gdk.SCROLL_DOWN:
+ self.zoom.value /= 1.25
+ return True
+ return False
+
+ def get_hadjustment(self):
+ return self._scrolled_window.get_hadjustment()
+ def get_vadjustment(self):
+ return self._scrolled_window.get_vadjustment()
+
+ def create_gui(self):
+ self.window = gtk.Window()
+ vbox = gtk.VBox(); vbox.show()
+ self.window.add(vbox)
+
+ # canvas
+ self.canvas = goocanvas.Canvas()
+ self.canvas.connect_after("button-press-event", self._canvas_button_press)
+ self.canvas.connect_after("button-release-event", self._canvas_button_release)
+ self.canvas.connect("scroll-event", self._canvas_scroll_event)
+ self.canvas.props.has_tooltip = True
+ self.canvas.connect("query-tooltip", self._canvas_tooltip_cb)
+ self.canvas.show()
+ sw = gtk.ScrolledWindow(); sw.show()
+ self._scrolled_window = sw
+ sw.add(self.canvas)
+ vbox.pack_start(sw, True, True, 4)
+ self.canvas.set_size_request(600, 450)
+ self.canvas.set_bounds(-10000, -10000, 10000, 10000)
+ self.canvas.scroll_to(0, 0)
+
+
+ self.canvas.get_root_item().add_child(self.links_group)
+ self.links_group.set_property("visibility", goocanvas.ITEM_VISIBLE)
+
+ self.canvas.get_root_item().add_child(self.channels_group)
+ self.channels_group.set_property("visibility", goocanvas.ITEM_VISIBLE)
+ self.channels_group.raise_(self.links_group)
+
+ self.canvas.get_root_item().add_child(self.nodes_group)
+ self.nodes_group.set_property("visibility", goocanvas.ITEM_VISIBLE)
+ self.nodes_group.raise_(self.channels_group)
+
+ self.hud = hud.Axes(self)
+
+ hbox = gtk.HBox(); hbox.show()
+ vbox.pack_start(hbox, False, False, 4)
+
+ # zoom
+ zoom_adj = gtk.Adjustment(1.0, 0.01, 10.0, 0.02, 1.0, 0)
+ self.zoom = zoom_adj
+ def _zoom_changed(adj):
+ self.canvas.set_scale(adj.value)
+ zoom_adj.connect("value-changed", _zoom_changed)
+ zoom = gtk.SpinButton(zoom_adj)
+ zoom.set_digits(3)
+ zoom.show()
+ hbox.pack_start(gobject.new(gtk.Label, label=" Zoom:", visible=True), False, False, 4)
+ hbox.pack_start(zoom, False, False, 4)
+ _zoom_changed(zoom_adj)
+
+ # speed
+ speed_adj = gtk.Adjustment(1.0, 0.01, 10.0, 0.02, 1.0, 0)
+ def _speed_changed(adj):
+ self.speed = adj.value
+ self.sample_period = SAMPLE_PERIOD*adj.value
+ self._start_update_timer()
+ speed_adj.connect("value-changed", _speed_changed)
+ speed = gtk.SpinButton(speed_adj)
+ speed.set_digits(3)
+ speed.show()
+ hbox.pack_start(gobject.new(gtk.Label, label=" Speed:", visible=True), False, False, 4)
+ hbox.pack_start(speed, False, False, 4)
+ _speed_changed(speed_adj)
+
+ # Current time
+ self.time_label = gobject.new(gtk.Label, label=" Speed:", visible=True)
+ self.time_label.set_width_chars(20)
+ hbox.pack_start(self.time_label, False, False, 4)
+
+ # Screenshot button
+ screenshot_button = gobject.new(gtk.Button,
+ label="Snapshot",
+ relief=gtk.RELIEF_NONE, focus_on_click=False,
+ visible=True)
+ hbox.pack_start(screenshot_button, False, False, 4)
+
+ def load_button_icon(button, icon_name):
+ try:
+ import gnomedesktop
+ except ImportError:
+ sys.stderr.write("Could not load icon %s due to missing gnomedesktop Python module\n" % icon_name)
+ else:
+ icon = gnomedesktop.find_icon(gtk.icon_theme_get_default(), icon_name, 16, 0)
+ if icon is not None:
+ button.props.image = gobject.new(gtk.Image, file=icon, visible=True)
+
+ load_button_icon(screenshot_button, "applets-screenshooter")
+ screenshot_button.connect("clicked", self._take_screenshot)
+
+ # Shell button
+ if ipython_view is not None:
+ shell_button = gobject.new(gtk.Button,
+ label="Shell",
+ relief=gtk.RELIEF_NONE, focus_on_click=False,
+ visible=True)
+ hbox.pack_start(shell_button, False, False, 4)
+ load_button_icon(shell_button, "gnome-terminal")
+ shell_button.connect("clicked", self._start_shell)
+
+ # Play button
+ self.play_button = gobject.new(gtk.ToggleButton,
+ image=gobject.new(gtk.Image, stock=gtk.STOCK_MEDIA_PLAY, visible=True),
+ label="Simulate (F3)",
+ relief=gtk.RELIEF_NONE, focus_on_click=False,
+ use_stock=True, visible=True)
+ accel_group = gtk.AccelGroup()
+ self.window.add_accel_group(accel_group)
+ self.play_button.add_accelerator("clicked", accel_group,
+ gtk.keysyms.F3, 0, gtk.ACCEL_VISIBLE)
+ self.play_button.connect("toggled", self._on_play_button_toggled)
+ hbox.pack_start(self.play_button, False, False, 4)
+
+ self.canvas.get_root_item().connect("button-press-event", self.on_root_button_press_event)
+
+ vbox.pack_start(self._create_advanced_controls(), False, False, 4)
+
+ self.window.show()
+
+ def scan_topology(self):
+ print "scanning topology: %i nodes..." % (ns3.NodeList.GetNNodes(),)
+ graph = pygraphviz.AGraph()
+ seen_nodes = 0
+ for nodeI in range(ns3.NodeList.GetNNodes()):
+ seen_nodes += 1
+ if seen_nodes == 100:
+ print "scan topology... %i nodes visited (%.1f%%)" % (nodeI, 100*nodeI/ns3.NodeList.GetNNodes())
+ seen_nodes = 0
+ node = ns3.NodeList.GetNode(nodeI)
+ node_name = "Node %i" % nodeI
+ node_view = self.get_node(nodeI)
+
+ mobility = node.GetObject(ns3.MobilityModel.GetTypeId())
+ if mobility is not None:
+ node_view.set_color("red")
+ pos = mobility.GetPosition()
+ node_view.set_position(*transform_point_simulation_to_canvas(pos.x, pos.y))
+ #print "node has mobility position -> ", "%f,%f" % (pos.x, pos.y)
+ else:
+ graph.add_node(node_name)
+
+ for devI in range(node.GetNDevices()):
+ device = node.GetDevice(devI)
+ device_traits = lookup_netdevice_traits(type(device))
+ if device_traits.is_wireless:
+ continue
+ if device_traits.is_virtual:
+ continue
+ channel = device.GetChannel()
+ if channel.GetNDevices() > 2:
+ if REPRESENT_CHANNELS_AS_NODES:
+ # represent channels as white nodes
+ if mobility is None:
+ channel_name = "Channel %s" % id(channel)
+ graph.add_edge(node_name, channel_name)
+ self.get_channel(channel)
+ self.create_link(self.get_node(nodeI), self.get_channel(channel))
+ else:
+ # don't represent channels, just add links between nodes in the same channel
+ for otherDevI in range(channel.GetNDevices()):
+ otherDev = channel.GetDevice(otherDevI)
+ otherNode = otherDev.GetNode()
+ otherNodeView = self.get_node(otherNode.GetId())
+ if otherNode is not node:
+ if mobility is None and not otherNodeView.has_mobility:
+ other_node_name = "Node %i" % otherNode.GetId()
+ graph.add_edge(node_name, other_node_name)
+ self.create_link(self.get_node(nodeI), otherNodeView)
+ else:
+ for otherDevI in range(channel.GetNDevices()):
+ otherDev = channel.GetDevice(otherDevI)
+ otherNode = otherDev.GetNode()
+ otherNodeView = self.get_node(otherNode.GetId())
+ if otherNode is not node:
+ if mobility is None and not otherNodeView.has_mobility:
+ other_node_name = "Node %i" % otherNode.GetId()
+ graph.add_edge(node_name, other_node_name)
+ self.create_link(self.get_node(nodeI), otherNodeView)
+
+ print "scanning topology: calling graphviz layout"
+ graph.layout(LAYOUT_ALGORITHM)
+ for node in graph.iternodes():
+ #print node, "=>", node.attr['pos']
+ node_type, node_id = node.split(' ')
+ pos_x, pos_y = [float(s) for s in node.attr['pos'].split(',')]
+ if node_type == 'Node':
+ obj = self.nodes[int(node_id)]
+ elif node_type == 'Channel':
+ obj = self.channels[int(node_id)]
+ obj.set_position(pos_x, pos_y)
+
+ print "scanning topology: all done."
+ self.emit("topology-scanned")
+
+ def get_node(self, index):
+ try:
+ return self.nodes[index]
+ except KeyError:
+ node = Node(self, index)
+ self.nodes[index] = node
+ self.nodes_group.add_child(node.canvas_item)
+ node.canvas_item.connect("button-press-event", self.on_node_button_press_event, node)
+ node.canvas_item.connect("button-release-event", self.on_node_button_release_event, node)
+ return node
+
+ def get_channel(self, ns3_channel):
+ try:
+ return self.channels[id(ns3_channel)]
+ except KeyError:
+ channel = Channel(ns3_channel)
+ self.channels[id(ns3_channel)] = channel
+ self.channels_group.add_child(channel.canvas_item)
+ return channel
+
+ def create_link(self, node, node_or_channel):
+ link = WiredLink(node, node_or_channel)
+ self.links_group.add_child(link.canvas_item)
+ link.canvas_item.lower(None)
+
+ def update_view(self):
+ #print "update_view"
+
+ self.time_label.set_text("Time: %f s" % ns3.Simulator.Now().GetSeconds())
+
+ self._update_node_positions()
+
+ # Update information
+ for info_win in self.information_windows:
+ info_win.update()
+
+ self._update_transmissions_view()
+ self._update_drops_view()
+
+ self.emit("update-view")
+
+ def _update_node_positions(self):
+ for node in self.nodes.itervalues():
+ if node.has_mobility:
+ ns3_node = ns3.NodeList.GetNode(node.node_index)
+ mobility = ns3_node.GetObject(ns3.MobilityModel.GetTypeId())
+ if mobility is not None:
+ pos = mobility.GetPosition()
+ x, y = transform_point_simulation_to_canvas(pos.x, pos.y)
+ node.set_position(x, y)
+ if node is self.follow_node:
+ hadj = self._scrolled_window.get_hadjustment()
+ vadj = self._scrolled_window.get_vadjustment()
+ px, py = self.canvas.convert_to_pixels(x, y)
+ hadj.value = px - hadj.page_size/2
+ vadj.value = py - vadj.page_size/2
+
+ def center_on_node(self, node):
+ if isinstance(node, ns3.Node):
+ node = self.nodes[node.GetId()]
+ elif isinstance(node, (int, long)):
+ node = self.nodes[node]
+ elif isinstance(node, Node):
+ pass
+ else:
+ raise TypeError("expected int, viz.Node or ns3.Node, not %r" % node)
+
+ x, y = node.get_position()
+ hadj = self._scrolled_window.get_hadjustment()
+ vadj = self._scrolled_window.get_vadjustment()
+ px, py = self.canvas.convert_to_pixels(x, y)
+ hadj.value = px - hadj.page_size/2
+ vadj.value = py - vadj.page_size/2
+
+
+ def update_model(self):
+ self.simulation.lock.acquire()
+ try:
+ self.emit("simulation-periodic-update")
+ finally:
+ self.simulation.lock.release()
+
+ def do_simulation_periodic_update(self):
+ smooth_factor = int(self.transmissions_smoothing_adjustment.value*10)
+
+ transmissions = self.simulation.sim_helper.GetTransmissionSamples()
+ self._last_transmissions.append(transmissions)
+ while len(self._last_transmissions) > smooth_factor:
+ self._last_transmissions.pop(0)
+
+ drops = self.simulation.sim_helper.GetPacketDropSamples()
+ self._last_drops.append(drops)
+ while len(self._last_drops) > smooth_factor:
+ self._last_drops.pop(0)
+
+ def _get_label_over_line_position(self, pos1_x, pos1_y, pos2_x, pos2_y):
+ hadj = self._scrolled_window.get_hadjustment()
+ vadj = self._scrolled_window.get_vadjustment()
+ bounds_x1, bounds_y1 = self.canvas.convert_from_pixels(hadj.value, vadj.value)
+ bounds_x2, bounds_y2 = self.canvas.convert_from_pixels(hadj.value + hadj.page_size,
+ vadj.value + vadj.page_size)
+ pos1_x, pos1_y, pos2_x, pos2_y = ns3.PyViz.LineClipping(bounds_x1, bounds_y1,
+ bounds_x2, bounds_y2,
+ pos1_x, pos1_y,
+ pos2_x, pos2_y)
+ return (pos1_x + pos2_x)/2, (pos1_y + pos2_y)/2
+
+ def _update_transmissions_view(self):
+ transmissions_average = {}
+ for transmission_set in self._last_transmissions:
+ for transmission in transmission_set:
+ key = (transmission.transmitter.GetId(), transmission.receiver.GetId())
+ rx_bytes, count = transmissions_average.get(key, (0, 0))
+ rx_bytes += transmission.bytes
+ count += 1
+ transmissions_average[key] = rx_bytes, count
+
+ old_arrows = self._transmission_arrows
+ for arrow, label in old_arrows:
+ arrow.set_property("visibility", goocanvas.ITEM_HIDDEN)
+ label.set_property("visibility", goocanvas.ITEM_HIDDEN)
+ new_arrows = []
+
+ k = self.node_size_adjustment.value/5
+
+ for (transmitter_id, receiver_id), (rx_bytes, rx_count) in transmissions_average.iteritems():
+ transmitter = self.get_node(transmitter_id)
+ receiver = self.get_node(receiver_id)
+ try:
+ arrow, label = old_arrows.pop()
+ except IndexError:
+ arrow = goocanvas.Polyline(line_width=2.0, stroke_color_rgba=0x00C000C0, close_path=False, end_arrow=True)
+ arrow.set_property("parent", self.canvas.get_root_item())
+ arrow.props.pointer_events = 0
+ arrow.raise_(None)
+
+ label = goocanvas.Text(parent=self.canvas.get_root_item(), pointer_events=0)
+ label.raise_(None)
+
+ arrow.set_property("visibility", goocanvas.ITEM_VISIBLE)
+ line_width = max(0.1, math.log(float(rx_bytes)/rx_count/self.sample_period)*k)
+ arrow.set_property("line-width", line_width)
+
+ pos1_x, pos1_y = transmitter.get_position()
+ pos2_x, pos2_y = receiver.get_position()
+ points = goocanvas.Points([(pos1_x, pos1_y), (pos2_x, pos2_y)])
+ arrow.set_property("points", points)
+
+ kbps = float(rx_bytes*8)/1e3/rx_count/self.sample_period
+ label.set_properties(visibility=goocanvas.ITEM_VISIBLE_ABOVE_THRESHOLD,
+ visibility_threshold=0.5,
+ font=("Sans Serif %f" % int(1+BITRATE_FONT_SIZE*k)))
+ angle = math.atan2((pos2_y - pos1_y), (pos2_x - pos1_x))
+ if -PI_OVER_2 <= angle <= PI_OVER_2:
+ label.set_properties(text=("%.2f kbit/s →" % (kbps,)),
+ alignment=pango.ALIGN_CENTER,
+ anchor=gtk.ANCHOR_S,
+ x=0, y=-line_width/2)
+ M = cairo.Matrix()
+ M.translate(*self._get_label_over_line_position(pos1_x, pos1_y, pos2_x, pos2_y))
+ M.rotate(angle)
+ label.set_transform(M)
+ else:
+ label.set_properties(text=("← %.2f kbit/s" % (kbps,)),
+ alignment=pango.ALIGN_CENTER,
+ anchor=gtk.ANCHOR_N,
+ x=0, y=line_width/2)
+ M = cairo.Matrix()
+ M.translate(*self._get_label_over_line_position(pos1_x, pos1_y, pos2_x, pos2_y))
+ M.rotate(angle)
+ M.scale(-1, -1)
+ label.set_transform(M)
+
+ new_arrows.append((arrow, label))
+
+ self._transmission_arrows = new_arrows + old_arrows
+
+
+ def _update_drops_view(self):
+ drops_average = {}
+ for drop_set in self._last_drops:
+ for drop in drop_set:
+ key = drop.transmitter.GetId()
+ drop_bytes, count = drops_average.get(key, (0, 0))
+ drop_bytes += drop.bytes
+ count += 1
+ drops_average[key] = drop_bytes, count
+
+ old_arrows = self._drop_arrows
+ for arrow, label in old_arrows:
+ arrow.set_property("visibility", goocanvas.ITEM_HIDDEN)
+ label.set_property("visibility", goocanvas.ITEM_HIDDEN)
+ new_arrows = []
+
+ # get the coordinates for the edge of screen
+ vadjustment = self._scrolled_window.get_vadjustment()
+ bottom_y = vadjustment.value + vadjustment.page_size
+ dummy, edge_y = self.canvas.convert_from_pixels(0, bottom_y)
+
+ k = self.node_size_adjustment.value/5
+
+ for transmitter_id, (drop_bytes, drop_count) in drops_average.iteritems():
+ transmitter = self.get_node(transmitter_id)
+ try:
+ arrow, label = old_arrows.pop()
+ except IndexError:
+ arrow = goocanvas.Polyline(line_width=2.0, stroke_color_rgba=0xC00000C0, close_path=False, end_arrow=True)
+ arrow.props.pointer_events = 0
+ arrow.set_property("parent", self.canvas.get_root_item())
+ arrow.raise_(None)
+
+ label = goocanvas.Text()#, fill_color_rgba=0x00C000C0)
+ label.props.pointer_events = 0
+ label.set_property("parent", self.canvas.get_root_item())
+ label.raise_(None)
+
+ arrow.set_property("visibility", goocanvas.ITEM_VISIBLE)
+ arrow.set_property("line-width", max(0.1, math.log(float(drop_bytes)/drop_count/self.sample_period)*k))
+ pos1_x, pos1_y = transmitter.get_position()
+ pos2_x, pos2_y = pos1_x, edge_y
+ points = goocanvas.Points([(pos1_x, pos1_y), (pos2_x, pos2_y)])
+ arrow.set_property("points", points)
+
+ label.set_properties(visibility=goocanvas.ITEM_VISIBLE_ABOVE_THRESHOLD,
+ visibility_threshold=0.5,
+ font=("Sans Serif %i" % int(1+BITRATE_FONT_SIZE*k)),
+ text=("%.2f kbit/s" % (float(drop_bytes*8)/1e3/drop_count/self.sample_period,)),
+ alignment=pango.ALIGN_CENTER,
+ x=(pos1_x + pos2_x)/2,
+ y=(pos1_y + pos2_y)/2)
+
+ new_arrows.append((arrow, label))
+
+ self._drop_arrows = new_arrows + old_arrows
+
+
+ def update_view_timeout(self):
+ #print "view: update_view_timeout called at real time ", time.time()
+
+ # while the simulator is busy, run the gtk event loop
+ while not self.simulation.lock.acquire(False):
+ while gtk.events_pending():
+ gtk.main_iteration()
+ pause_messages = self.simulation.pause_messages
+ self.simulation.pause_messages = []
+ try:
+ self.update_view()
+ self.simulation.target_time = ns3.Simulator.Now ().GetSeconds () + self.sample_period
+ #print "view: target time set to %f" % self.simulation.target_time
+ finally:
+ self.simulation.lock.release()
+
+ if pause_messages:
+ #print pause_messages
+ dialog = gtk.MessageDialog(parent=self.window, flags=0, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK,
+ message_format='\n'.join(pause_messages))
+ dialog.connect("response", lambda d, r: d.destroy())
+ dialog.show()
+ self.play_button.set_active(False)
+
+ # if we're paused, stop the update timer
+ if not self.play_button.get_active():
+ self._update_timeout_id = None
+ return False
+
+ #print "view: self.simulation.go.set()"
+ self.simulation.go.set()
+ #print "view: done."
+ return True
+
+ def _start_update_timer(self):
+ if self._update_timeout_id is not None:
+ gobject.source_remove(self._update_timeout_id)
+ #print "start_update_timer"
+ self._update_timeout_id = gobject.timeout_add(int(SAMPLE_PERIOD/min(self.speed, 1)*1e3),
+ self.update_view_timeout,
+ priority=PRIORITY_UPDATE_VIEW)
+
+ def _on_play_button_toggled(self, button):
+ if button.get_active():
+ self._start_update_timer()
+ else:
+ if self._update_timeout_id is not None:
+ gobject.source_remove(self._update_timeout_id)
+
+ def _quit(self, *dummy_args):
+ if self._update_timeout_id is not None:
+ gobject.source_remove(self._update_timeout_id)
+ self._update_timeout_id = None
+ self.simulation.quit = True
+ self.simulation.go.set()
+ self.simulation.join()
+ gtk.main_quit()
+
+ def _monkey_patch_ipython(self):
+ # The user may want to access the NS 3 simulation state, but
+ # NS 3 is not thread safe, so it could cause serious problems.
+ # To work around this, monkey-patch IPython to automatically
+ # acquire and release the simulation lock around each code
+ # that is executed.
+
+ original_runcode = __IPYTHON__.runcode
+ def runcode(ip, *args):
+ #print "lock"
+ self.simulation.lock.acquire()
+ try:
+ return original_runcode(*args)
+ finally:
+ #print "unlock"
+ self.simulation.lock.release()
+ import types
+ __IPYTHON__.runcode = types.MethodType(runcode, __IPYTHON__)
+
+ def autoscale_view(self):
+ self._update_node_positions()
+ positions = [node.get_position() for node in self.nodes.itervalues()]
+ min_x, min_y = min(x for (x,y) in positions), min(y for (x,y) in positions)
+ max_x, max_y = max(x for (x,y) in positions), max(y for (x,y) in positions)
+ min_x_px, min_y_px = self.canvas.convert_to_pixels(min_x, min_y)
+ max_x_px, max_y_px = self.canvas.convert_to_pixels(max_x, max_y)
+ dx = max_x - min_x
+ dy = max_y - min_y
+ dx_px = max_x_px - min_x_px
+ dy_px = max_y_px - min_y_px
+ hadj = self._scrolled_window.get_hadjustment()
+ vadj = self._scrolled_window.get_vadjustment()
+ new_dx, new_dy = 1.5*dx_px, 1.5*dy_px
+
+ if new_dx == 0 or new_dy == 0:
+ return
+
+ self.zoom.value = min(hadj.page_size/new_dx, vadj.page_size/new_dy)
+
+ x1, y1 = self.canvas.convert_from_pixels(hadj.value, vadj.value)
+ x2, y2 = self.canvas.convert_from_pixels(hadj.value+hadj.page_size, vadj.value+vadj.page_size)
+ width = x2 - x1
+ height = y2 - y1
+ center_x = (min_x + max_x) / 2
+ center_y = (min_y + max_y) / 2
+
+ self.canvas.scroll_to(center_x - width/2, center_y - height/2)
+
+ return False
+
+ def start(self):
+ self.scan_topology()
+ self.window.connect("delete-event", self._quit)
+ #self._start_update_timer()
+ gobject.timeout_add(200, self.autoscale_view)
+ self.simulation.start()
+
+ try:
+ __IPYTHON__
+ except NameError:
+ pass
+ else:
+ self._monkey_patch_ipython()
+
+ gtk.main()
+
+
+ def on_root_button_press_event(self, view, target, event):
+ if event.button == 1:
+ self.select_node(None)
+ return True
+
+ def on_node_button_press_event(self, view, target, event, node):
+ if event.button == 1:
+ self.select_node(node)
+ return True
+ elif event.button == 3:
+ self.popup_node_menu(node, event)
+ return True
+ elif event.button == 2:
+ self.begin_node_drag(node)
+ return True
+ return False
+
+ def on_node_button_release_event(self, view, target, event, node):
+ if event.button == 2:
+ self.end_node_drag(node)
+ return True
+ return False
+
+ class NodeDragState(object):
+ def __init__(self, canvas_x0, canvas_y0, sim_x0, sim_y0):
+ self.canvas_x0 = canvas_x0
+ self.canvas_y0 = canvas_y0
+ self.sim_x0 = sim_x0
+ self.sim_y0 = sim_y0
+ self.motion_signal = None
+
+ def begin_node_drag(self, node):
+ self.simulation.lock.acquire()
+ try:
+ ns3_node = ns3.NodeList.GetNode(node.node_index)
+ mob = ns3_node.GetObject(ns3.MobilityModel.GetTypeId())
+ if mob is None:
+ return
+ if self.node_drag_state is not None:
+ return
+ pos = mob.GetPosition()
+ finally:
+ self.simulation.lock.release()
+ x, y, dummy = self.canvas.window.get_pointer()
+ x0, y0 = self.canvas.convert_from_pixels(x, y)
+ self.node_drag_state = self.NodeDragState(x0, y0, pos.x, pos.y)
+ self.node_drag_state.motion_signal = node.canvas_item.connect("motion-notify-event", self.node_drag_motion, node)
+
+ def node_drag_motion(self, item, targe_item, event, node):
+ self.simulation.lock.acquire()
+ try:
+ ns3_node = ns3.NodeList.GetNode(node.node_index)
+ mob = ns3_node.GetObject(ns3.MobilityModel.GetTypeId())
+ if mob is None:
+ return False
+ if self.node_drag_state is None:
+ return False
+ x, y, dummy = self.canvas.window.get_pointer()
+ canvas_x, canvas_y = self.canvas.convert_from_pixels(x, y)
+ dx = (canvas_x - self.node_drag_state.canvas_x0)
+ dy = (canvas_y - self.node_drag_state.canvas_y0)
+ pos = mob.GetPosition()
+ pos.x = self.node_drag_state.sim_x0 + transform_distance_canvas_to_simulation(dx)
+ pos.y = self.node_drag_state.sim_y0 + transform_distance_canvas_to_simulation(dy)
+ #print "SetPosition(%G, %G)" % (pos.x, pos.y)
+ mob.SetPosition(pos)
+ node.set_position(*transform_point_simulation_to_canvas(pos.x, pos.y))
+ finally:
+ self.simulation.lock.release()
+ return True
+
+ def end_node_drag(self, node):
+ if self.node_drag_state is None:
+ return
+ node.canvas_item.disconnect(self.node_drag_state.motion_signal)
+ self.node_drag_state = None
+
+ def popup_node_menu(self, node, event):
+ menu = gtk.Menu()
+ self.emit("populate-node-menu", node, menu)
+ menu.popup(None, None, None, event.button, event.time)
+
+ def _update_ipython_selected_node(self):
+ # If we are running under ipython -gthread, make this new
+ # selected node available as a global 'selected_node'
+ # variable.
+ try:
+ __IPYTHON__
+ except NameError:
+ pass
+ else:
+ if self.selected_node is None:
+ ns3_node = None
+ else:
+ self.simulation.lock.acquire()
+ try:
+ ns3_node = ns3.NodeList.GetNode(self.selected_node.node_index)
+ finally:
+ self.simulation.lock.release()
+ __IPYTHON__.user_ns['selected_node'] = ns3_node
+
+
+ def select_node(self, node):
+ if isinstance(node, ns3.Node):
+ node = self.nodes[node.GetId()]
+ elif isinstance(node, (int, long)):
+ node = self.nodes[node]
+ elif isinstance(node, Node):
+ pass
+ elif node is None:
+ pass
+ else:
+ raise TypeError("expected None, int, viz.Node or ns3.Node, not %r" % node)
+
+ if node is self.selected_node:
+ return
+
+ if self.selected_node is not None:
+ self.selected_node.selected = False
+ self.selected_node = node
+ if self.selected_node is not None:
+ self.selected_node.selected = True
+
+ if self._show_transmissions_mode == ShowTransmissionsMode.SELECTED:
+ if self.selected_node is None:
+ self.simulation.set_nodes_of_interest([])
+ else:
+ self.simulation.set_nodes_of_interest([self.selected_node.node_index])
+
+ self._update_ipython_selected_node()
+
+
+ def add_information_window(self, info_win):
+ self.information_windows.append(info_win)
+ self.simulation.lock.acquire()
+ try:
+ info_win.update()
+ finally:
+ self.simulation.lock.release()
+
+ def remove_information_window(self, info_win):
+ self.information_windows.remove(info_win)
+
+ def _canvas_tooltip_cb(self, canvas, x, y, keyboard_mode, tooltip):
+ #print "tooltip query: ", x, y
+ hadj = self._scrolled_window.get_hadjustment()
+ vadj = self._scrolled_window.get_vadjustment()
+ x, y = self.canvas.convert_from_pixels(hadj.value + x, vadj.value + y)
+ item = self.canvas.get_item_at(x, y, True)
+ #print "items at (%f, %f): %r | keyboard_mode=%r" % (x, y, item, keyboard_mode)
+ if not item:
+ return False
+ while item is not None:
+ obj = item.get_data("pyviz-object")
+ if obj is not None:
+ obj.tooltip_query(tooltip)
+ return True
+ item = item.props.parent
+ return False
+
+ def _get_export_file_name(self):
+ sel = gtk.FileChooserDialog("Save...", self.canvas.get_toplevel(),
+ gtk.FILE_CHOOSER_ACTION_SAVE,
+ (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
+ gtk.STOCK_SAVE, gtk.RESPONSE_OK))
+ sel.set_default_response(gtk.RESPONSE_OK)
+ sel.set_local_only(True)
+ sel.set_do_overwrite_confirmation(True)
+ sel.set_current_name("Unnamed.pdf")
+
+ filter = gtk.FileFilter()
+ filter.set_name("Embedded PostScript")
+ filter.add_mime_type("image/x-eps")
+ sel.add_filter(filter)
+
+ filter = gtk.FileFilter()
+ filter.set_name("Portable Document Graphics")
+ filter.add_mime_type("application/pdf")
+ sel.add_filter(filter)
+
+ filter = gtk.FileFilter()
+ filter.set_name("Scalable Vector Graphics")
+ filter.add_mime_type("image/svg+xml")
+ sel.add_filter(filter)
+
+ resp = sel.run()
+ if resp != gtk.RESPONSE_OK:
+ sel.destroy()
+ return None
+
+ file_name = sel.get_filename()
+ sel.destroy()
+ return file_name
+
+ def _take_screenshot(self, dummy_button):
+ #print "Cheese!"
+ file_name = self._get_export_file_name()
+ if file_name is None:
+ return
+
+ # figure out the correct bounding box for what is visible on screen
+ x1 = self._scrolled_window.get_hadjustment().value
+ y1 = self._scrolled_window.get_vadjustment().value
+ x2 = x1 + self._scrolled_window.get_hadjustment().page_size
+ y2 = y1 + self._scrolled_window.get_vadjustment().page_size
+ bounds = goocanvas.Bounds()
+ bounds.x1, bounds.y1 = self.canvas.convert_from_pixels(x1, y1)
+ bounds.x2, bounds.y2 = self.canvas.convert_from_pixels(x2, y2)
+ dest_width = bounds.x2 - bounds.x1
+ dest_height = bounds.y2 - bounds.y1
+ #print bounds.x1, bounds.y1, " -> ", bounds.x2, bounds.y2
+
+ dummy, extension = os.path.splitext(file_name)
+ extension = extension.lower()
+ if extension == '.eps':
+ surface = cairo.PSSurface(file_name, dest_width, dest_height)
+ elif extension == '.pdf':
+ surface = cairo.PDFSurface(file_name, dest_width, dest_height)
+ elif extension == '.svg':
+ surface = cairo.SVGSurface(file_name, dest_width, dest_height)
+ else:
+ dialog = gtk.MessageDialog(parent = self.canvas.get_toplevel(),
+ flags = gtk.DIALOG_DESTROY_WITH_PARENT,
+ type = gtk.MESSAGE_ERROR,
+ buttons = gtk.BUTTONS_OK,
+ message_format = "Unknown extension '%s' (valid extensions are '.eps', '.svg', and '.pdf')"
+ % (extension,))
+ dialog.run()
+ dialog.destroy()
+ return
+
+ # draw the canvas to a printing context
+ cr = cairo.Context(surface)
+ cr.translate(-bounds.x1, -bounds.y1)
+ self.canvas.render(cr, bounds, self.zoom.value)
+ cr.show_page()
+ surface.finish()
+
+ def set_follow_node(self, node):
+ if isinstance(node, ns3.Node):
+ node = self.nodes[node.GetId()]
+ self.follow_node = node
+
+ def _start_shell(self, dummy_button):
+ if self.shell_window is not None:
+ self.shell_window.present()
+ return
+
+ self.shell_window = gtk.Window()
+ self.shell_window.set_size_request(750,550)
+ self.shell_window.set_resizable(True)
+ scrolled_window = gtk.ScrolledWindow()
+ scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
+ ipython = ipython_view.IPythonView()
+ ipython.modify_font(pango.FontDescription(SHELL_FONT))
+ ipython.set_wrap_mode(gtk.WRAP_CHAR)
+ ipython.show()
+ scrolled_window.add(ipython)
+ scrolled_window.show()
+ self.shell_window.add(scrolled_window)
+ self.shell_window.show()
+ self.shell_window.connect('destroy', self._on_shell_window_destroy)
+
+ self._update_ipython_selected_node()
+ __IPYTHON__.user_ns['viz'] = self
+
+
+ def _on_shell_window_destroy(self, window):
+ self.shell_window = None
+
+
+initialization_hooks = []
+
+def add_initialization_hook(hook, *args):
+ """
+ Adds a callback to be called after
+ the visualizer is initialized, like this::
+ initialization_hook(visualizer, *args)
+ """
+ global initialization_hooks
+ initialization_hooks.append((hook, args))
+
+
+def set_bounds(x1, y1, x2, y2):
+ assert x2>x1
+ assert y2>y1
+ def hook(viz):
+ cx1, cy1 = transform_point_simulation_to_canvas(x1, y1)
+ cx2, cy2 = transform_point_simulation_to_canvas(x2, y2)
+ viz.canvas.set_bounds(cx1, cy1, cx2, cy2)
+ add_initialization_hook(hook)
+
+
+def start():
+ assert Visualizer.INSTANCE is None
+ if _import_error is not None:
+ import sys
+ print >> sys.stderr, "No visualization support (%s)." % (str(_import_error),)
+ ns3.Simulator.Run()
+ return
+ load_plugins()
+ viz = Visualizer()
+ for hook, args in initialization_hooks:
+ gobject.idle_add(hook, viz, *args)
+ ns3.Packet.EnablePrinting()
+ viz.start()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/visualizer/higcontainer.py Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,97 @@
+import gtk
+import gobject
+try:
+ from gazpacho.widgets.base.base import SimpleContainerAdaptor
+except ImportError:
+ pass
+
+#root_library = 'hig'
+
+
+class HIGContainer(gtk.Bin):
+ __gtype_name__ = 'HIGContainer'
+ __gproperties__ = {
+ 'title': (str, 'Group Title', 'the group title',
+ '', gobject.PARAM_READWRITE|gobject.PARAM_CONSTRUCT),
+ }
+
+ def __init__(self, title=None):
+ self.__title_text = None
+ gtk.widget_push_composite_child()
+ self.__title = gobject.new(gtk.Label, visible=True, xalign=0, yalign=0.5)
+ self.__indent = gobject.new(gtk.Label, visible=True, label=' ')
+ gtk.widget_pop_composite_child()
+ gtk.Bin.__init__(self)
+ self.__title.set_parent(self)
+ self.__indent.set_parent(self)
+ if title is not None:
+ self.props.title = title
+
+ def do_size_request(self, requisition):
+ title_req = gtk.gdk.Rectangle(0, 0, *self.__title.size_request())
+ indent_req = gtk.gdk.Rectangle(0, 0, *self.__indent.size_request())
+ if self.child is None:
+ child_req = gtk.gdk.Rectangle()
+ else:
+ child_req = gtk.gdk.Rectangle(0, 0, *self.child.size_request())
+ requisition.height = (title_req.height + 6 +
+ max(child_req.height, indent_req.height))
+ requisition.width = max(title_req.width, indent_req.width + child_req.width)
+
+ def do_size_allocate(self, allocation):
+ self.allocation = allocation
+
+ ## title
+ title_req = gtk.gdk.Rectangle(0, 0, *self.__title.get_child_requisition())
+ title_alloc = gtk.gdk.Rectangle()
+ title_alloc.x = allocation.x
+ title_alloc.y = allocation.y
+ title_alloc.width = min(title_req.width, allocation.width)
+ title_alloc.height = min(title_req.height, allocation.height)
+ self.__title.size_allocate(title_alloc)
+
+ ## child
+ if self.child is None:
+ return
+ indent_req = gtk.gdk.Rectangle(0, 0, *self.__indent.get_child_requisition())
+ child_req = gtk.gdk.Rectangle(0, 0, *self.child.get_child_requisition())
+ child_alloc = gtk.gdk.Rectangle()
+ child_alloc.x = allocation.x + indent_req.width
+ child_alloc.y = allocation.y + title_alloc.height + 6
+ child_alloc.width = allocation.width - indent_req.width
+ child_alloc.height = allocation.height - 6 - title_alloc.height
+ self.child.size_allocate(child_alloc)
+
+ def do_forall(self, internal, callback, data):
+ if internal:
+ callback(self.__title, data)
+ callback(self.__indent, data)
+ if self.child is not None:
+ callback(self.child, data)
+
+ def do_set_property(self, pspec, value):
+ if pspec.name == 'title':
+ self.__title.set_markup('<span weight="bold">%s</span>' %
+ gobject.markup_escape_text(value))
+ self.__title_text = value
+ else:
+ raise AttributeError, 'unknown property %s' % pspec.name
+
+ def do_get_property(self, pspec):
+ if pspec.name == 'title':
+ return self.__title_text
+ else:
+ raise AttributeError, 'unknown property %s' % pspec.name
+
+if __name__ == '__main__':
+ frame = gtk.Frame()
+ group = gobject.new(HIGContainer, title="Hello")
+ frame.add(group)
+ check = gtk.CheckButton("foobar")
+ group.add(check)
+ w = gtk.Window()
+ w.add(frame)
+ w.show_all()
+ w.connect("destroy", lambda w: gtk.main_quit())
+ gtk.main()
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/visualizer/hud.py Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,144 @@
+import goocanvas
+import core
+import math
+import pango
+import gtk
+
+
+class Axes(object):
+ def __init__(self, viz):
+ self.viz = viz
+ self.color = 0x8080C0FF
+ self.hlines = goocanvas.Path(parent=viz.canvas.get_root_item(), stroke_color_rgba=self.color)
+ self.hlines.lower(None)
+ self.vlines = goocanvas.Path(parent=viz.canvas.get_root_item(), stroke_color_rgba=self.color)
+ self.vlines.lower(None)
+ self.labels = []
+ hadj = self.viz.get_hadjustment()
+ vadj = self.viz.get_vadjustment()
+ def update(adj):
+ if self.visible:
+ self.update_view()
+ hadj.connect("value-changed", update)
+ vadj.connect("value-changed", update)
+ hadj.connect("changed", update)
+ vadj.connect("changed", update)
+ self.visible = True
+ self.update_view()
+
+ def set_visible(self, visible):
+ self.visible = visible
+ if self.visible:
+ self.hlines.props.visibility = goocanvas.ITEM_VISIBLE
+ self.vlines.props.visibility = goocanvas.ITEM_VISIBLE
+ else:
+ self.hlines.props.visibility = goocanvas.ITEM_HIDDEN
+ self.vlines.props.visibility = goocanvas.ITEM_HIDDEN
+ for label in self.labels:
+ label.props.visibility = goocanvas.ITEM_HIDDEN
+
+ def _compute_divisions(self, xi, xf):
+ assert xf > xi
+ dx = xf - xi
+ size = dx
+ ndiv = 5
+ text_width = dx/ndiv/2
+
+ def rint(x):
+ return math.floor(x+0.5)
+
+ dx_over_ndiv = dx / ndiv
+ for n in range(5): # iterate 5 times to find optimum division size
+ #/* div: length of each division */
+ tbe = math.log10(dx_over_ndiv)#; /* looking for approx. 'ndiv' divisions in a length 'dx' */
+ div = pow(10, rint(tbe))#; /* div: power of 10 closest to dx/ndiv */
+ if math.fabs(div/2 - dx_over_ndiv) < math.fabs(div - dx_over_ndiv): #/* test if div/2 is closer to dx/ndiv */
+ div /= 2
+ elif math.fabs(div*2 - dx_over_ndiv) < math.fabs(div - dx_over_ndiv):
+ div *= 2 # /* test if div*2 is closer to dx/ndiv */
+ x0 = div*math.ceil(xi / div) - div
+ if n > 1:
+ ndiv = rint(size / text_width)
+ return x0, div
+
+
+ def update_view(self):
+ if self.viz.zoom is None:
+ return
+
+ unused_labels = self.labels
+ self.labels = []
+ for label in unused_labels:
+ label.set_property("visibility", goocanvas.ITEM_HIDDEN)
+ def get_label():
+ try:
+ label = unused_labels.pop(0)
+ except IndexError:
+ label = goocanvas.Text(parent=self.viz.canvas.get_root_item(), stroke_color_rgba=self.color)
+ else:
+ label.set_property("visibility", goocanvas.ITEM_VISIBLE)
+ label.lower(None)
+ self.labels.append(label)
+ return label
+
+ hadj = self.viz.get_hadjustment()
+ vadj = self.viz.get_vadjustment()
+ zoom = self.viz.zoom.value
+ offset = 10/zoom
+
+ x1, y1 = self.viz.canvas.convert_from_pixels(hadj.value, vadj.value)
+ x2, y2 = self.viz.canvas.convert_from_pixels(hadj.value + hadj.page_size, vadj.value + vadj.page_size)
+ line_width = 5.0/self.viz.zoom.value
+
+ # draw the horizontal axis
+ self.hlines.set_property("line-width", line_width)
+ yc = y2 - line_width/2
+
+ sim_x1 = x1/core.PIXELS_PER_METER
+ sim_x2 = x2/core.PIXELS_PER_METER
+ x0, xdiv = self._compute_divisions(sim_x1, sim_x2)
+ path = ["M %r %r L %r %r" % (x1, yc, x2, yc)]
+ x = x0
+ while x < sim_x2:
+ path.append("M %r %r L %r %r" % (core.PIXELS_PER_METER*x, yc - offset, core.PIXELS_PER_METER*x, yc))
+ label = get_label()
+ label.set_properties(font=("Sans Serif %f" % int(12/zoom)),
+ text=("%G" % x),
+ fill_color_rgba=self.color,
+ alignment=pango.ALIGN_CENTER,
+ anchor=gtk.ANCHOR_S,
+ x=core.PIXELS_PER_METER*x,
+ y=(yc - offset))
+ x += xdiv
+ del x
+
+ self.hlines.set_property("data", " ".join(path))
+
+ # draw the vertical axis
+ self.vlines.set_property("line-width", line_width)
+ xc = x1 + line_width/2
+
+ sim_y1 = y1/core.PIXELS_PER_METER
+ sim_y2 = y2/core.PIXELS_PER_METER
+
+
+ y0, ydiv = self._compute_divisions(sim_y1, sim_y2)
+ path = ["M %r %r L %r %r" % (xc, y1, xc, y2)]
+ y = y0
+ while y < sim_y2:
+ path.append("M %r %r L %r %r" % (xc, core.PIXELS_PER_METER*y, xc + offset, core.PIXELS_PER_METER*y))
+ label = get_label()
+ label.set_properties(font=("Sans Serif %f" % int(12/zoom)),
+ text=("%G" % y),
+ fill_color_rgba=self.color,
+ alignment=pango.ALIGN_LEFT,
+ anchor=gtk.ANCHOR_W,
+ x=xc + offset,
+ y=core.PIXELS_PER_METER*y)
+ y += ydiv
+
+ self.vlines.set_property("data", " ".join(path))
+
+
+
+ self.labels.extend(unused_labels)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/visualizer/ipython_view.py Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,296 @@
+"""
+Backend to the console plugin.
+
+@author: Eitan Isaacson
+@organization: IBM Corporation
+@copyright: Copyright (c) 2007 IBM Corporation
+@license: BSD
+
+All rights reserved. This program and the accompanying materials are made
+available under the terms of the BSD which accompanies this distribution, and
+is available at U{http://www.opensource.org/licenses/bsd-license.php}
+"""
+# this file is a modified version of source code from the Accerciser project
+# http://live.gnome.org/accerciser
+
+import gtk
+import re
+import sys
+import os
+import pango
+from StringIO import StringIO
+import IPython
+
+ansi_colors = {'0;30': 'Black',
+ '0;31': 'Red',
+ '0;32': 'Green',
+ '0;33': 'Brown',
+ '0;34': 'Blue',
+ '0;35': 'Purple',
+ '0;36': 'Cyan',
+ '0;37': 'LightGray',
+ '1;30': 'DarkGray',
+ '1;31': 'DarkRed',
+ '1;32': 'SeaGreen',
+ '1;33': 'Yellow',
+ '1;34': 'LightBlue',
+ '1;35': 'MediumPurple',
+ '1;36': 'LightCyan',
+ '1;37': 'White'}
+
+class IterableIPShell:
+ def __init__(self,argv=None,user_ns=None,user_global_ns=None,
+ cin=None, cout=None,cerr=None, input_func=None):
+ if input_func:
+ IPython.iplib.raw_input_original = input_func
+ if cin:
+ IPython.Shell.Term.cin = cin
+ if cout:
+ IPython.Shell.Term.cout = cout
+ if cerr:
+ IPython.Shell.Term.cerr = cerr
+
+ if argv is None:
+ argv=[]
+
+ # This is to get rid of the blockage that occurs during
+ # IPython.Shell.InteractiveShell.user_setup()
+ IPython.iplib.raw_input = lambda x: None
+
+ self.term = IPython.genutils.IOTerm(cin=cin, cout=cout, cerr=cerr)
+ os.environ['TERM'] = 'dumb'
+ excepthook = sys.excepthook
+ self.IP = IPython.Shell.make_IPython(argv,user_ns=user_ns,
+ user_global_ns=user_global_ns,
+ embedded=True,
+ shell_class=IPython.Shell.InteractiveShell)
+ self.IP.system = lambda cmd: self.shell(self.IP.var_expand(cmd),
+ header='IPython system call: ',
+ verbose=self.IP.rc.system_verbose)
+ sys.excepthook = excepthook
+ self.iter_more = 0
+ self.history_level = 0
+ self.complete_sep = re.compile('[\s\{\}\[\]\(\)]')
+
+ def execute(self):
+ self.history_level = 0
+ orig_stdout = sys.stdout
+ sys.stdout = IPython.Shell.Term.cout
+ try:
+ line = self.IP.raw_input(None, self.iter_more)
+ if self.IP.autoindent:
+ self.IP.readline_startup_hook(None)
+ except KeyboardInterrupt:
+ self.IP.write('\nKeyboardInterrupt\n')
+ self.IP.resetbuffer()
+ # keep cache in sync with the prompt counter:
+ self.IP.outputcache.prompt_count -= 1
+
+ if self.IP.autoindent:
+ self.IP.indent_current_nsp = 0
+ self.iter_more = 0
+ except:
+ self.IP.showtraceback()
+ else:
+ self.iter_more = self.IP.push(line)
+ if (self.IP.SyntaxTB.last_syntax_error and
+ self.IP.rc.autoedit_syntax):
+ self.IP.edit_syntax_error()
+ if self.iter_more:
+ self.prompt = str(self.IP.outputcache.prompt2).strip()
+ if self.IP.autoindent:
+ self.IP.readline_startup_hook(self.IP.pre_readline)
+ else:
+ self.prompt = str(self.IP.outputcache.prompt1).strip()
+ sys.stdout = orig_stdout
+
+ def historyBack(self):
+ self.history_level -= 1
+ return self._getHistory()
+
+ def historyForward(self):
+ self.history_level += 1
+ return self._getHistory()
+
+ def _getHistory(self):
+ try:
+ rv = self.IP.user_ns['In'][self.history_level].strip('\n')
+ except IndexError:
+ self.history_level = 0
+ rv = ''
+ return rv
+
+ def updateNamespace(self, ns_dict):
+ self.IP.user_ns.update(ns_dict)
+
+ def complete(self, line):
+ split_line = self.complete_sep.split(line)
+ possibilities = self.IP.complete(split_line[-1])
+ if possibilities:
+ common_prefix = reduce(self._commonPrefix, possibilities)
+ completed = line[:-len(split_line[-1])]+common_prefix
+ else:
+ completed = line
+ return completed, possibilities
+
+ def _commonPrefix(self, str1, str2):
+ for i in range(len(str1)):
+ if not str2.startswith(str1[:i+1]):
+ return str1[:i]
+ return str1
+
+ def shell(self, cmd,verbose=0,debug=0,header=''):
+ stat = 0
+ if verbose or debug: print header+cmd
+ # flush stdout so we don't mangle python's buffering
+ if not debug:
+ input, output = os.popen4(cmd)
+ print output.read()
+ output.close()
+ input.close()
+
+class ConsoleView(gtk.TextView):
+ def __init__(self):
+ gtk.TextView.__init__(self)
+ self.modify_font(pango.FontDescription('Mono'))
+ self.set_cursor_visible(True)
+ self.text_buffer = self.get_buffer()
+ self.mark = self.text_buffer.create_mark('scroll_mark',
+ self.text_buffer.get_end_iter(),
+ False)
+ for code in ansi_colors:
+ self.text_buffer.create_tag(code,
+ foreground=ansi_colors[code],
+ weight=700)
+ self.text_buffer.create_tag('0')
+ self.text_buffer.create_tag('notouch', editable=False)
+ self.color_pat = re.compile('\x01?\x1b\[(.*?)m\x02?')
+ self.line_start = \
+ self.text_buffer.create_mark('line_start',
+ self.text_buffer.get_end_iter(), True
+ )
+ self.connect('key-press-event', self._onKeypress)
+ self.last_cursor_pos = 0
+
+ def write(self, text, editable=False):
+ segments = self.color_pat.split(text)
+ segment = segments.pop(0)
+ start_mark = self.text_buffer.create_mark(None,
+ self.text_buffer.get_end_iter(),
+ True)
+ self.text_buffer.insert(self.text_buffer.get_end_iter(), segment)
+
+ if segments:
+ ansi_tags = self.color_pat.findall(text)
+ for tag in ansi_tags:
+ i = segments.index(tag)
+ self.text_buffer.insert_with_tags_by_name(self.text_buffer.get_end_iter(),
+ segments[i+1], tag)
+ segments.pop(i)
+ if not editable:
+ self.text_buffer.apply_tag_by_name('notouch',
+ self.text_buffer.get_iter_at_mark(start_mark),
+ self.text_buffer.get_end_iter())
+ self.text_buffer.delete_mark(start_mark)
+ self.scroll_mark_onscreen(self.mark)
+
+ def showPrompt(self, prompt):
+ self.write(prompt)
+ self.text_buffer.move_mark(self.line_start,self.text_buffer.get_end_iter())
+
+ def changeLine(self, text):
+ iter = self.text_buffer.get_iter_at_mark(self.line_start)
+ iter.forward_to_line_end()
+ self.text_buffer.delete(self.text_buffer.get_iter_at_mark(self.line_start), iter)
+ self.write(text, True)
+
+ def getCurrentLine(self):
+ rv = self.text_buffer.get_slice(self.text_buffer.get_iter_at_mark(self.line_start),
+ self.text_buffer.get_end_iter(), False)
+ return rv
+
+ def showReturned(self, text):
+ iter = self.text_buffer.get_iter_at_mark(self.line_start)
+ iter.forward_to_line_end()
+ self.text_buffer.apply_tag_by_name('notouch',
+ self.text_buffer.get_iter_at_mark(self.line_start),
+ iter)
+ self.write('\n'+text)
+ if text:
+ self.write('\n')
+ self.showPrompt(self.prompt)
+ self.text_buffer.move_mark(self.line_start,self.text_buffer.get_end_iter())
+ self.text_buffer.place_cursor(self.text_buffer.get_end_iter())
+
+ def _onKeypress(self, obj, event):
+ if not event.string:
+ return
+ insert_mark = self.text_buffer.get_insert()
+ insert_iter = self.text_buffer.get_iter_at_mark(insert_mark)
+ selection_mark = self.text_buffer.get_selection_bound()
+ selection_iter = self.text_buffer.get_iter_at_mark(selection_mark)
+ start_iter = self.text_buffer.get_iter_at_mark(self.line_start)
+ if start_iter.compare(insert_iter) <= 0 and \
+ start_iter.compare(selection_iter) <= 0:
+ return
+ elif start_iter.compare(insert_iter) > 0 and \
+ start_iter.compare(selection_iter) > 0:
+ self.text_buffer.place_cursor(start_iter)
+ elif insert_iter.compare(selection_iter) < 0:
+ self.text_buffer.move_mark(insert_mark, start_iter)
+ elif insert_iter.compare(selection_iter) > 0:
+ self.text_buffer.move_mark(selection_mark, start_iter)
+
+
+class IPythonView(ConsoleView, IterableIPShell):
+ def __init__(self):
+ ConsoleView.__init__(self)
+ self.cout = StringIO()
+ IterableIPShell.__init__(self, cout=self.cout,cerr=self.cout,
+ input_func=self.raw_input)
+ self.connect('key_press_event', self.keyPress)
+ self.execute()
+ self.cout.truncate(0)
+ self.showPrompt(self.prompt)
+ self.interrupt = False
+
+ def raw_input(self, prompt=''):
+ if self.interrupt:
+ self.interrupt = False
+ raise KeyboardInterrupt
+ return self.getCurrentLine()
+
+ def keyPress(self, widget, event):
+ if event.state & gtk.gdk.CONTROL_MASK and event.keyval == 99:
+ self.interrupt = True
+ self._processLine()
+ return True
+ elif event.keyval == gtk.keysyms.Return:
+ self._processLine()
+ return True
+ elif event.keyval == gtk.keysyms.Up:
+ self.changeLine(self.historyBack())
+ return True
+ elif event.keyval == gtk.keysyms.Down:
+ self.changeLine(self.historyForward())
+ return True
+ elif event.keyval == gtk.keysyms.Tab:
+ if not self.getCurrentLine().strip():
+ return False
+ completed, possibilities = self.complete(self.getCurrentLine())
+ if len(possibilities) > 1:
+ slice = self.getCurrentLine()
+ self.write('\n')
+ for symbol in possibilities:
+ self.write(symbol+'\n')
+ self.showPrompt(self.prompt)
+ self.changeLine(completed or slice)
+ return True
+
+ def _processLine(self):
+ self.history_pos = 0
+ self.execute()
+ rv = self.cout.getvalue()
+ if rv: rv = rv.strip('\n')
+ self.showReturned(rv)
+ self.cout.truncate(0)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/visualizer/plugins/interface_statistics.py Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,167 @@
+import gtk
+import ns3
+from visualizer.base import InformationWindow
+
+NODE_STATISTICS_MEMORY = 10
+
+
+class StatisticsCollector(object):
+ """
+ Collects interface statistics for all nodes.
+ """
+
+ class NetDevStats(object):
+ __slots__ = ['rxPackets', 'rxBytes', 'txPackets', 'txBytes',
+ 'rxPacketRate', 'rxBitRate', 'txPacketRate', 'txBitRate']
+
+ def __init__(self, visualizer):
+ self.node_statistics = {} # nodeid -> list(raw statistics)
+ self.visualizer = visualizer
+
+ def simulation_periodic_update(self, viz):
+ nodes_statistics = viz.simulation.sim_helper.GetNodesStatistics()
+ for stats in nodes_statistics:
+ try:
+ raw_stats_list = self.node_statistics[stats.nodeId]
+ except KeyError:
+ raw_stats_list = []
+ self.node_statistics[stats.nodeId] = raw_stats_list
+ raw_stats_list.append(stats.statistics)
+ while len(raw_stats_list) > NODE_STATISTICS_MEMORY:
+ raw_stats_list.pop(0)
+
+ def get_interface_statistics(self, nodeId):
+ try:
+ raw_stats_list = self.node_statistics[nodeId]
+ except KeyError:
+ return []
+
+ if len(raw_stats_list) < NODE_STATISTICS_MEMORY:
+ return []
+ assert len(raw_stats_list) == NODE_STATISTICS_MEMORY
+ tx_packets1 = [] # transmitted packets, one value per interface
+ rx_packets1 = []
+ tx_bytes1 = []
+ rx_bytes1 = []
+ for iface, stats in enumerate(raw_stats_list[0]):
+ tx_packets1.append(stats.transmittedPackets)
+ tx_bytes1.append(stats.transmittedBytes)
+ rx_packets1.append(stats.receivedPackets)
+ rx_bytes1.append(stats.receivedBytes)
+
+ retval = []
+
+ k = self.visualizer.sample_period*(NODE_STATISTICS_MEMORY-1)
+ for iface, stats in enumerate(raw_stats_list[-1]):
+ outStat = self.NetDevStats()
+ outStat.txPackets = stats.transmittedPackets
+ outStat.txBytes = stats.transmittedBytes
+ outStat.rxPackets = stats.receivedPackets
+ outStat.rxBytes = stats.receivedBytes
+
+ outStat.txPacketRate = (stats.transmittedPackets - tx_packets1[iface])/k
+ outStat.rxPacketRate = (stats.receivedPackets - rx_packets1[iface])/k
+ outStat.txBitRate = (stats.transmittedBytes - tx_bytes1[iface])*8/k
+ outStat.rxBitRate = (stats.receivedBytes - rx_bytes1[iface])*8/k
+ retval.append(outStat)
+ return retval
+
+
+class ShowInterfaceStatistics(InformationWindow):
+ (
+ COLUMN_INTERFACE,
+
+ COLUMN_TX_PACKETS,
+ COLUMN_TX_BYTES,
+ COLUMN_TX_PACKET_RATE,
+ COLUMN_TX_BIT_RATE,
+
+ COLUMN_RX_PACKETS,
+ COLUMN_RX_BYTES,
+ COLUMN_RX_PACKET_RATE,
+ COLUMN_RX_BIT_RATE,
+
+ ) = range(9)
+
+ def __init__(self, visualizer, node_index, statistics_collector):
+ InformationWindow.__init__(self)
+ self.win = gtk.Dialog(parent=visualizer.window,
+ flags=gtk.DIALOG_DESTROY_WITH_PARENT|gtk.DIALOG_NO_SEPARATOR,
+ buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
+ self.win.connect("response", self._response_cb)
+ self.win.set_title("Statistics for node %i" % node_index)
+ self.visualizer = visualizer
+ self.statistics_collector = statistics_collector
+ self.node_index = node_index
+ self.viz_node = visualizer.get_node(node_index)
+
+ self.table_model = gtk.ListStore(*([str]*13))
+
+ treeview = gtk.TreeView(self.table_model)
+ treeview.show()
+ self.win.vbox.add(treeview)
+
+ def add_column(descr, colid):
+ column = gtk.TreeViewColumn(descr, gtk.CellRendererText(), text=colid)
+ treeview.append_column(column)
+
+ add_column("Interface", self.COLUMN_INTERFACE)
+
+ add_column("Tx Packets", self.COLUMN_TX_PACKETS)
+ add_column("Tx Bytes", self.COLUMN_TX_BYTES)
+ add_column("Tx pkt/1s", self.COLUMN_TX_PACKET_RATE)
+ add_column("Tx bit/1s", self.COLUMN_TX_BIT_RATE)
+
+ add_column("Rx Packets", self.COLUMN_RX_PACKETS)
+ add_column("Rx Bytes", self.COLUMN_RX_BYTES)
+ add_column("Rx pkt/1s", self.COLUMN_RX_PACKET_RATE)
+ add_column("Rx bit/1s", self.COLUMN_RX_BIT_RATE)
+
+ self.visualizer.add_information_window(self)
+ self.win.show()
+
+ def _response_cb(self, win, response):
+ self.win.destroy()
+ self.visualizer.remove_information_window(self)
+
+ def update(self):
+ node = ns3.NodeList.GetNode(self.node_index)
+ stats_list = self.statistics_collector.get_interface_statistics(self.node_index)
+ self.table_model.clear()
+ for iface, stats in enumerate(stats_list):
+ tree_iter = self.table_model.append()
+ netdevice = node.GetDevice(iface)
+ interface_name = ns3.Names.FindName(netdevice)
+ if not interface_name:
+ interface_name = "(interface %i)" % iface
+ self.table_model.set(tree_iter,
+ self.COLUMN_INTERFACE, interface_name,
+
+ self.COLUMN_TX_PACKETS, str(stats.txPackets),
+ self.COLUMN_TX_BYTES, str(stats.txBytes),
+ self.COLUMN_TX_PACKET_RATE, str(stats.txPacketRate),
+ self.COLUMN_TX_BIT_RATE, str(stats.txBitRate),
+
+ self.COLUMN_RX_PACKETS, str(stats.rxPackets),
+ self.COLUMN_RX_BYTES, str(stats.rxBytes),
+ self.COLUMN_RX_PACKET_RATE, str(stats.rxPacketRate),
+ self.COLUMN_RX_BIT_RATE, str(stats.rxBitRate)
+ )
+
+
+def populate_node_menu(viz, node, menu, statistics_collector):
+
+ menu_item = gtk.MenuItem("Show Interface Statistics")
+ menu_item.show()
+
+ def _show_it(dummy_menu_item):
+ ShowInterfaceStatistics(viz, node.node_index, statistics_collector)
+
+ menu_item.connect("activate", _show_it)
+ menu.add(menu_item)
+
+
+def register(viz):
+ statistics_collector = StatisticsCollector(viz)
+ viz.connect("populate-node-menu", populate_node_menu, statistics_collector)
+ viz.connect("simulation-periodic-update", statistics_collector.simulation_periodic_update)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/visualizer/plugins/ipv4_routing_table.py Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,95 @@
+import gtk
+import ns3
+from visualizer.base import InformationWindow
+
+class ShowIpv4RoutingTable(InformationWindow):
+ (
+ COLUMN_DESTINATION,
+ COLUMN_NEXT_HOP,
+ COLUMN_INTERFACE,
+ ) = range(3)
+
+ def __init__(self, visualizer, node_index):
+ InformationWindow.__init__(self)
+ self.win = gtk.Dialog(parent=visualizer.window,
+ flags=gtk.DIALOG_DESTROY_WITH_PARENT|gtk.DIALOG_NO_SEPARATOR,
+ buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
+ self.win.connect("response", self._response_cb)
+ self.win.set_title("IPv4 routing table for node %i" % node_index)
+ self.visualizer = visualizer
+ self.node_index = node_index
+
+ self.table_model = gtk.ListStore(str, str, str)
+
+ treeview = gtk.TreeView(self.table_model)
+ treeview.show()
+ self.win.vbox.add(treeview)
+
+ # Dest.
+ column = gtk.TreeViewColumn('Destination', gtk.CellRendererText(),
+ text=self.COLUMN_DESTINATION)
+ treeview.append_column(column)
+
+ # Next hop
+ column = gtk.TreeViewColumn('Next hop', gtk.CellRendererText(),
+ text=self.COLUMN_NEXT_HOP)
+ treeview.append_column(column)
+
+ # Interface
+ column = gtk.TreeViewColumn('Interface', gtk.CellRendererText(),
+ text=self.COLUMN_INTERFACE)
+ treeview.append_column(column)
+
+ self.visualizer.add_information_window(self)
+ self.win.show()
+
+ def _response_cb(self, win, response):
+ self.win.destroy()
+ self.visualizer.remove_information_window(self)
+
+ def update(self):
+ node = ns3.NodeList.GetNode(self.node_index)
+ ipv4 = node.GetObject(ns3.Ipv4.GetTypeId())
+ routing = ipv4.GetRoutingProtocol()
+ if routing is None:
+ return
+ if isinstance(routing, ns3.Ipv4StaticRouting):
+ ipv4_routing = routing
+ elif isinstance(routing, ns3.Ipv4ListRouting):
+ for rI in range(routing.GetNRoutingProtocols()):
+ ipv4_routing, prio = routing.GetRoutingProtocol(rI)
+ if isinstance(ipv4_routing, ns3.Ipv4StaticRouting):
+ break
+ else:
+ return
+ else:
+ return
+ self.table_model.clear()
+ for routeI in range(ipv4_routing.GetNRoutes()):
+ route = ipv4_routing.GetRoute(routeI)
+ tree_iter = self.table_model.append()
+ netdevice = ipv4.GetNetDevice(route.GetInterface())
+ if netdevice is None:
+ interface_name = 'lo'
+ else:
+ interface_name = ns3.Names.FindName(netdevice)
+ if not interface_name:
+ interface_name = "(interface %i)" % route.GetInterface()
+ self.table_model.set(tree_iter,
+ self.COLUMN_DESTINATION, str(route.GetDest()),
+ self.COLUMN_NEXT_HOP, str(route.GetGateway()),
+ self.COLUMN_INTERFACE, interface_name)
+
+
+def populate_node_menu(viz, node, menu):
+ menu_item = gtk.MenuItem("Show IPv4 Routing Table")
+ menu_item.show()
+
+ def _show_ipv4_routing_table(dummy_menu_item):
+ ShowIpv4RoutingTable(viz, node.node_index)
+
+ menu_item.connect("activate", _show_ipv4_routing_table)
+ menu.add(menu_item)
+
+def register(viz):
+ viz.connect("populate-node-menu", populate_node_menu)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/visualizer/plugins/olsr.py Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,102 @@
+import gtk
+import ns3
+from visualizer.base import InformationWindow
+
+class ShowOlsrRoutingTable(InformationWindow):
+ (
+ COLUMN_DESTINATION,
+ COLUMN_NEXT_HOP,
+ COLUMN_INTERFACE,
+ COLUMN_NUM_HOPS,
+ ) = range(4)
+
+ def __init__(self, visualizer, node_index):
+ InformationWindow.__init__(self)
+ self.win = gtk.Dialog(parent=visualizer.window,
+ flags=gtk.DIALOG_DESTROY_WITH_PARENT|gtk.DIALOG_NO_SEPARATOR,
+ buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
+ self.win.set_default_size(gtk.gdk.screen_width()/2, gtk.gdk.screen_height()/2)
+ self.win.connect("response", self._response_cb)
+ self.win.set_title("OLSR routing table for node %i" % node_index)
+ self.visualizer = visualizer
+ self.node_index = node_index
+
+ self.table_model = gtk.ListStore(str, str, str, int)
+
+ treeview = gtk.TreeView(self.table_model)
+ treeview.show()
+ sw = gtk.ScrolledWindow()
+ sw.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC,
+ vscrollbar_policy=gtk.POLICY_AUTOMATIC)
+ sw.show()
+ sw.add(treeview)
+ self.win.vbox.add(sw)
+
+ # Dest.
+ column = gtk.TreeViewColumn('Destination', gtk.CellRendererText(),
+ text=self.COLUMN_DESTINATION)
+ treeview.append_column(column)
+
+ # Next hop
+ column = gtk.TreeViewColumn('Next hop', gtk.CellRendererText(),
+ text=self.COLUMN_NEXT_HOP)
+ treeview.append_column(column)
+
+ # Interface
+ column = gtk.TreeViewColumn('Interface', gtk.CellRendererText(),
+ text=self.COLUMN_INTERFACE)
+ treeview.append_column(column)
+
+ # Num. Hops
+ column = gtk.TreeViewColumn('Num. Hops', gtk.CellRendererText(),
+ text=self.COLUMN_NUM_HOPS)
+ treeview.append_column(column)
+
+ self.visualizer.add_information_window(self)
+ self.win.show()
+
+ def _response_cb(self, win, response):
+ self.win.destroy()
+ self.visualizer.remove_information_window(self)
+
+ def update(self):
+ node = ns3.NodeList.GetNode(self.node_index)
+ olsr = node.GetObject(ns3.olsr.RoutingProtocol.GetTypeId())
+ ipv4 = node.GetObject(ns3.Ipv4.GetTypeId())
+ if olsr is None:
+ return
+ self.table_model.clear()
+ for route in olsr.GetRoutingTableEntries():
+ tree_iter = self.table_model.append()
+ netdevice = ipv4.GetNetDevice(route.interface)
+ if netdevice is None:
+ interface_name = 'lo'
+ else:
+ interface_name = ns3.Names.FindName(netdevice)
+ if not interface_name:
+ interface_name = "(interface %i)" % route.interface
+ self.table_model.set(tree_iter,
+ self.COLUMN_DESTINATION, str(route.destAddr),
+ self.COLUMN_NEXT_HOP, str(route.nextAddr),
+ self.COLUMN_INTERFACE, interface_name,
+ self.COLUMN_NUM_HOPS, route.distance)
+
+
+def populate_node_menu(viz, node, menu):
+ ns3_node = ns3.NodeList.GetNode(node.node_index)
+ olsr = ns3_node.GetObject(ns3.olsr.RoutingProtocol.GetTypeId())
+ if olsr is None:
+ print "No OLSR"
+ return
+
+ menu_item = gtk.MenuItem("Show OLSR Routing Table")
+ menu_item.show()
+
+ def _show_ipv4_routing_table(dummy_menu_item):
+ ShowOlsrRoutingTable(viz, node.node_index)
+
+ menu_item.connect("activate", _show_ipv4_routing_table)
+ menu.add(menu_item)
+
+def register(viz):
+ viz.connect("populate-node-menu", populate_node_menu)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/visualizer/plugins/show_last_packets.py Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,231 @@
+import gobject
+import gtk
+import ns3
+from visualizer.base import InformationWindow
+from visualizer.higcontainer import HIGContainer
+from kiwi.ui.objectlist import ObjectList, Column
+
+class ShowLastPackets(InformationWindow):
+ class PacketList(gtk.ScrolledWindow):
+ (
+ COLUMN_TIME,
+ COLUMN_INTERFACE,
+ COLUMN_SIZE,
+ COLUMN_CONTENTS,
+ ) = range(4)
+
+ def __init__(self):
+ super(ShowLastPackets.PacketList, self).__init__()
+ self.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC,
+ vscrollbar_policy=gtk.POLICY_AUTOMATIC)
+ self.table_model = gtk.ListStore(*([str]*4))
+ treeview = gtk.TreeView(self.table_model)
+ treeview.show()
+ self.add(treeview)
+
+ def add_column(descr, colid):
+ column = gtk.TreeViewColumn(descr, gtk.CellRendererText(), text=colid)
+ treeview.append_column(column)
+
+ add_column("Time", self.COLUMN_TIME)
+ add_column("Interface", self.COLUMN_INTERFACE)
+ add_column("Size", self.COLUMN_SIZE)
+ add_column("Contents", self.COLUMN_CONTENTS)
+
+ def update(self, node, packet_list):
+ self.table_model.clear()
+ for sample in packet_list:
+ tree_iter = self.table_model.append()
+ if sample.device is None:
+ interface_name = "(unknown)"
+ else:
+ interface_name = ns3.Names.FindName(sample.device)
+ if not interface_name:
+ interface_name = "(interface %i)" % sample.device.GetIfIndex()
+ self.table_model.set(tree_iter,
+ self.COLUMN_TIME, str(sample.time.GetSeconds()),
+ self.COLUMN_INTERFACE, interface_name,
+ self.COLUMN_SIZE, str(sample.packet.GetSize ()),
+ self.COLUMN_CONTENTS, str(sample.packet)
+ )
+
+
+ def __init__(self, visualizer, node_index):
+ InformationWindow.__init__(self)
+ self.win = gtk.Dialog(parent=visualizer.window,
+ flags=gtk.DIALOG_DESTROY_WITH_PARENT|gtk.DIALOG_NO_SEPARATOR,
+ buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
+ self.win.connect("response", self._response_cb)
+ self.win.set_title("Last packets for node %i" % node_index)
+ self.visualizer = visualizer
+ self.viz_node = visualizer.get_node(node_index)
+ self.node = ns3.NodeList.GetNode(node_index)
+
+ def smart_expand(expander, vbox):
+ if expander.get_expanded():
+ vbox.set_child_packing(expander, expand=True, fill=True, padding=0, pack_type=gtk.PACK_START)
+ else:
+ vbox.set_child_packing(expander, expand=False, fill=False, padding=0, pack_type=gtk.PACK_START)
+
+ main_hbox = gtk.HBox(False, 4)
+ main_hbox.show()
+ main_vbox = gtk.VBox(False, 4)
+ main_vbox.show()
+ self.win.vbox.add(main_hbox)
+ main_hbox.add(main_vbox)
+
+ self.tx_list = self.PacketList()
+ self.tx_list.show()
+ group = gtk.Expander("Last transmitted packets")
+ group.show()
+ group.add(self.tx_list)
+ main_vbox.pack_start(group, expand=False, fill=False)
+ group.connect_after("activate", smart_expand, main_vbox)
+
+ self.rx_list = self.PacketList()
+ self.rx_list.show()
+ group = gtk.Expander("Last received packets")
+ group.show()
+ group.add(self.rx_list)
+ main_vbox.pack_start(group, expand=False, fill=False)
+ group.connect_after("activate", smart_expand, main_vbox)
+
+ self.drop_list = self.PacketList()
+ self.drop_list.show()
+ group = gtk.Expander("Last dropped packets")
+ group.show()
+ group.add(self.drop_list)
+ main_vbox.pack_start(group, expand=False, fill=False)
+ group.connect_after("activate", smart_expand, main_vbox)
+
+
+ # Packet Filter
+
+ # - options
+ self.packet_capture_options = ns3.PyViz.PacketCaptureOptions()
+ self.packet_capture_options.numLastPackets = 100
+
+ packet_filter_vbox = gtk.VBox(False, 4)
+ packet_filter_vbox.show()
+ main_hbox.add(packet_filter_vbox)
+
+ sel_buttons_box = gtk.HButtonBox()
+ sel_buttons_box.show()
+ packet_filter_vbox.pack_start(sel_buttons_box, False, False, 4)
+ select_all_button = gobject.new(gtk.Button, label="Sel. All", visible=True)
+ select_none_button = gobject.new(gtk.Button, label="Sel. None", visible=True)
+ sel_buttons_box.add(select_all_button)
+ sel_buttons_box.add(select_none_button)
+
+ self.packet_filter_widget = ObjectList([
+ Column('selected', title="Sel.", data_type=bool, editable=True),
+ Column('name', title="Header"),
+ ], sortable=True)
+ self.packet_filter_widget.show()
+ packet_filter_vbox.pack_start(self.packet_filter_widget, True, True, 4)
+
+ class TypeIdConfig(object):
+ __slots__ = ['name', 'selected', 'typeid']
+
+ self.packet_filter_list = [] # list of TypeIdConfig instances
+
+ Header = ns3.TypeId.LookupByName("ns3::Header")
+ Trailer = ns3.TypeId.LookupByName("ns3::Trailer")
+ for typeid_i in range(ns3.TypeId.GetRegisteredN()):
+ typeid = ns3.TypeId.GetRegistered(typeid_i)
+ # check if this is a header or trailer subtype
+ typeid_tmp = typeid
+ type_is_good = False
+ while 1:
+ if typeid_tmp == Header or typeid_tmp == Trailer:
+ type_is_good = True
+ break
+ if typeid_tmp.HasParent():
+ typeid_tmp = typeid_tmp.GetParent()
+ else:
+ break
+ if not type_is_good:
+ continue
+ if typeid in [Header, Trailer]:
+ continue
+ c = TypeIdConfig()
+ c.selected = True
+ c.name = typeid.GetName()
+ c.typeid = typeid
+ self.packet_filter_list.append(c)
+ self.packet_filter_widget.add_list(self.packet_filter_list)
+
+ def update_capture_options():
+ if self.op_AND_button.props.active:
+ self.packet_capture_options.mode = ns3.PyViz.PACKET_CAPTURE_FILTER_HEADERS_AND
+ else:
+ self.packet_capture_options.mode = ns3.PyViz.PACKET_CAPTURE_FILTER_HEADERS_OR
+ self.packet_capture_options.numLastPackets = 100
+ self.packet_capture_options.headers = [c.typeid for c in self.packet_filter_list if c.selected]
+ self.visualizer.simulation.lock.acquire()
+ try:
+ self.visualizer.simulation.sim_helper.SetPacketCaptureOptions(
+ self.node.GetId(), self.packet_capture_options)
+ finally:
+ self.visualizer.simulation.lock.release()
+
+ def sel_all_cb(bt):
+ for c in self.packet_filter_list:
+ c.selected = True
+ self.packet_filter_widget.refresh()
+ update_capture_options()
+
+ def sel_none_cb(bt):
+ for c in self.packet_filter_list:
+ c.selected = False
+ self.packet_filter_widget.refresh()
+ update_capture_options()
+
+ select_all_button.connect("clicked", sel_all_cb)
+ select_none_button.connect("clicked", sel_none_cb)
+
+ op_buttons_box = gtk.HButtonBox()
+ op_buttons_box.show()
+ packet_filter_vbox.pack_start(op_buttons_box, False, False, 4)
+ self.op_AND_button = gobject.new(gtk.RadioButton, label="AND", visible=True)
+ self.op_OR_button = gobject.new(gtk.RadioButton, label="OR", visible=True, group=self.op_AND_button)
+ op_buttons_box.add(self.op_AND_button)
+ op_buttons_box.add(self.op_OR_button)
+ self.op_OR_button.props.active = True
+
+ self.op_AND_button.connect("toggled", lambda b: update_capture_options())
+
+ def cell_edited(l, obj, attribute):
+ update_capture_options()
+ self.packet_filter_widget.connect("cell-edited", cell_edited)
+
+ update_capture_options()
+
+ self.visualizer.add_information_window(self)
+ self.win.set_default_size(600, 300)
+ self.win.show()
+
+ def _response_cb(self, win, response):
+ self.win.destroy()
+ self.visualizer.remove_information_window(self)
+
+ def update(self):
+ last_packets = self.visualizer.simulation.sim_helper.GetLastPackets(self.node.GetId())
+
+ self.tx_list.update(self.node, last_packets.lastTransmittedPackets)
+ self.rx_list.update(self.node, last_packets.lastReceivedPackets)
+ self.drop_list.update(self.node, last_packets.lastDroppedPackets)
+
+
+def populate_node_menu(viz, node, menu):
+ menu_item = gtk.MenuItem("Show Last Packets")
+ menu_item.show()
+
+ def _show_it(dummy_menu_item):
+ ShowLastPackets(viz, node.node_index)
+
+ menu_item.connect("activate", _show_it)
+ menu.add(menu_item)
+
+def register(viz):
+ viz.connect("populate-node-menu", populate_node_menu)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/visualizer/plugins/wifi_intrastructure_link.py Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,117 @@
+import math
+import ns3
+import goocanvas
+from visualizer.base import Link, transform_distance_canvas_to_simulation
+
+class WifiLink(Link):
+ def __init__(self, parent_canvas_item, sta, dev):
+ self.node1 = sta
+ self.dev = dev
+ self.node2 = None # ap
+ self.canvas_item = goocanvas.Group(parent=parent_canvas_item)
+ self.invisible_line = goocanvas.Polyline(parent=self.canvas_item,
+ line_width=25.0,
+ visibility=goocanvas.ITEM_HIDDEN)
+ self.visible_line = goocanvas.Polyline(parent=self.canvas_item,
+ line_width=1.0,
+ stroke_color_rgba=0xC00000FF,
+ line_dash=goocanvas.LineDash([2.0, 2.0 ]))
+ self.invisible_line.props.pointer_events = (goocanvas.EVENTS_STROKE_MASK
+ |goocanvas.EVENTS_FILL_MASK
+ |goocanvas.EVENTS_PAINTED_MASK)
+ self.canvas_item.set_data("pyviz-object", self)
+ self.canvas_item.lower(None)
+ self.set_ap(None)
+
+ def set_ap(self, ap):
+ if ap is self.node2:
+ return
+ if self.node2 is not None:
+ self.node2.remove_link(self)
+ self.node2 = ap
+ if self.node2 is None:
+ self.canvas_item.set_property("visibility", goocanvas.ITEM_HIDDEN)
+ else:
+ self.node2.add_link(self)
+ self.canvas_item.set_property("visibility", goocanvas.ITEM_VISIBLE)
+ self.update_points()
+
+ def update_points(self):
+ if self.node2 is None:
+ return
+ pos1_x, pos1_y = self.node1.get_position()
+ pos2_x, pos2_y = self.node2.get_position()
+ points = goocanvas.Points([(pos1_x, pos1_y), (pos2_x, pos2_y)])
+ self.visible_line.set_property("points", points)
+ self.invisible_line.set_property("points", points)
+
+ def destroy(self):
+ self.canvas_item.destroy()
+ self.node1 = None
+ self.node2 = None
+
+ def tooltip_query(self, tooltip):
+ pos1_x, pos1_y = self.node1.get_position()
+ pos2_x, pos2_y = self.node2.get_position()
+ dx = pos2_x - pos1_x
+ dy = pos2_y - pos1_y
+ d = transform_distance_canvas_to_simulation(math.sqrt(dx*dx + dy*dy))
+ mac = self.dev.GetMac()
+ tooltip.set_text(("WiFi link between STA Node %i and AP Node %i; distance=%.2f m.\n"
+ "SSID: %s\n"
+ "BSSID: %s")
+ % (self.node1.node_index, self.node2.node_index, d,
+ mac.GetSsid(), mac.GetBssid()))
+
+
+class WifiLinkMonitor(object):
+ def __init__(self, dummy_viz):
+ self.access_points = {} # bssid -> node
+ self.stations = [] # list of (sta_netdevice, viz_node, wifi_link)
+
+ def scan_nodes(self, viz):
+ for (sta_netdevice, viz_node, wifi_link) in self.stations:
+ wifi_link.destroy()
+
+ self.access_points = {}
+ self.stations = []
+
+ for node in viz.nodes.itervalues():
+ ns3_node = ns3.NodeList.GetNode(node.node_index)
+ for devI in range(ns3_node.GetNDevices()):
+ dev = ns3_node.GetDevice(devI)
+ if not isinstance(dev, ns3.WifiNetDevice):
+ continue
+ wifi_mac = dev.GetMac()
+ if isinstance(wifi_mac, ns3.NqstaWifiMac):
+ wifi_link = WifiLink(viz.links_group, node, dev)
+ self.stations.append((dev, node, wifi_link))
+ elif isinstance(wifi_mac, ns3.NqapWifiMac):
+ bssid = ns3.Mac48Address.ConvertFrom(dev.GetAddress())
+ self.access_points[str(bssid)] = node
+ #print "APs: ", self.access_points
+ #print "STAs: ", self.stations
+
+ def simulation_periodic_update(self, viz):
+ for (sta_netdevice, viz_node, wifi_link) in self.stations:
+ if not sta_netdevice.IsLinkUp():
+ wifi_link.set_ap(None)
+ continue
+ bssid = str(sta_netdevice.GetMac().GetBssid())
+ if bssid == '00:00:00:00:00:00':
+ wifi_link.set_ap(None)
+ continue
+ ap = self.access_points[bssid]
+ wifi_link.set_ap(ap)
+
+ def update_view(self, viz):
+ for (dummy_sta_netdevice, dummy_viz_node, wifi_link) in self.stations:
+ if wifi_link is not None:
+ wifi_link.update_points()
+
+
+def register(viz):
+ link_monitor = WifiLinkMonitor(viz)
+ viz.connect("simulation-periodic-update", link_monitor.simulation_periodic_update)
+ viz.connect("update-view", link_monitor.update_view)
+ viz.connect("topology-scanned", link_monitor.scan_nodes)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/visualizer/resource/Basurero_Palm_Z22.svg Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,311 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="122.87033"
+ height="185.93257"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docname="Basurero_Palm_Z22.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ version="1.0">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3237">
+ <stop
+ style="stop-color: rgb(156, 156, 156); stop-opacity: 1;"
+ offset="0"
+ id="stop3239" />
+ <stop
+ id="stop3245"
+ offset="0.5"
+ style="stop-color: rgb(220, 220, 220); stop-opacity: 1;" />
+ <stop
+ style="stop-color: rgb(168, 168, 168); stop-opacity: 1;"
+ offset="1"
+ id="stop3241" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2911">
+ <stop
+ style="stop-color: rgb(175, 193, 225); stop-opacity: 1;"
+ offset="0"
+ id="stop2913" />
+ <stop
+ style="stop-color: rgb(92, 144, 233); stop-opacity: 1;"
+ offset="1"
+ id="stop2915" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2911"
+ id="linearGradient3229"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-89.3787,74.9628)"
+ x1="157.91194"
+ y1="149.28284"
+ x2="151.2318"
+ y2="223.88245" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3237"
+ id="linearGradient3243"
+ x1="59.830921"
+ y1="241.51917"
+ x2="200.76509"
+ y2="179.29376"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-89.3787,74.9628)" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.59688333"
+ inkscape:cx="428.4488"
+ inkscape:cy="185.26469"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1280"
+ inkscape:window-height="753"
+ inkscape:window-x="0"
+ inkscape:window-y="47"
+ showgrid="false"
+ showguides="true"
+ inkscape:guide-bbox="true" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/publicdomain/">
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Reproduction" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Distribution" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Capa 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(-160.08253,-45.555814)">
+ <g
+ id="g3261"
+ inkscape:export-filename="/home/e288288/imagen/svg/palm_z22.png"
+ inkscape:export-xdpi="75"
+ inkscape:export-ydpi="75"
+ transform="translate(89.3787,-74.9628)">
+ <rect
+ ry="22.210958"
+ rx="22.210958"
+ y="120.88235"
+ x="71.067566"
+ height="185.20511"
+ width="122.14287"
+ id="rect2176"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.72746599;stroke-linecap:butt;stroke-linejoin:miter;marker:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ style="fill:url(#linearGradient3243);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.72746599;stroke-linecap:butt;stroke-linejoin:miter;marker:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect2856"
+ width="119.34706"
+ height="182.73219"
+ x="72.215469"
+ y="121.8688"
+ rx="20.444592"
+ ry="20.444592" />
+ <rect
+ ry="18.259377"
+ rx="18.259377"
+ y="124.17456"
+ x="74.340469"
+ height="178.12067"
+ width="115.09706"
+ id="rect3235"
+ style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#a1a1a1;stroke-width:0.72746599;stroke-linecap:butt;stroke-linejoin:miter;marker:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="6.9516835"
+ rx="6.9516835"
+ y="135.9494"
+ x="84.825104"
+ height="125.89838"
+ width="94.6278"
+ id="rect2839"
+ style="fill:#e3e3e3;fill-opacity:1;fill-rule:evenodd;stroke:#a1a1a1;stroke-width:0.72746599;stroke-linecap:butt;stroke-linejoin:miter;marker:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#a4a4a4;stroke-width:0.72746599;stroke-linecap:butt;stroke-linejoin:miter;marker:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect2841"
+ width="81.335205"
+ height="111.10477"
+ x="91.471397"
+ y="142.06659"
+ rx="1.7201494"
+ ry="1.7201494" />
+ <rect
+ ry="0"
+ rx="0"
+ y="143.58203"
+ x="92.920067"
+ height="79.936684"
+ width="78.437866"
+ id="rect2843"
+ style="fill:url(#linearGradient3229);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.72746599;stroke-linecap:butt;stroke-linejoin:miter;marker:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <g
+ id="g3257">
+ <path
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#a2a2a2;stroke-width:0.72746599;stroke-linecap:butt;stroke-linejoin:miter;marker:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 73.133883,261.125 L 73.133883,279.3125 L 74.196383,279.3125 C 79.236007,279.3125 83.290129,275.25837 83.290133,270.21875 C 83.290133,265.17913 79.236011,261.125 74.196383,261.125 L 73.133883,261.125 z"
+ id="rect2875" />
+ <rect
+ style="fill:#164532;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.72746599;stroke-linecap:butt;stroke-linejoin:miter;marker:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect2884"
+ width="1.8988454"
+ height="5.4946771"
+ x="78.096237"
+ y="267.47141" />
+ </g>
+ <g
+ transform="translate(-3.8147e-6,0)"
+ id="g3095">
+ <rect
+ ry="10.619836"
+ rx="10.619836"
+ y="272.72806"
+ x="89.104172"
+ height="21.239672"
+ width="86.069664"
+ id="rect2847"
+ style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#a1a1a1;stroke-width:1.10249996;stroke-linecap:butt;stroke-linejoin:miter;marker:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ id="rect2845"
+ style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#a1a1a1;stroke-width:1.10249996;stroke-linecap:butt;stroke-linejoin:miter;marker:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 129.26628,274.47992 L 135.01173,274.47992 C 139.92459,274.47992 143.87971,278.43504 143.87971,283.34789 C 143.87971,288.26075 139.92459,292.21587 135.01173,292.21587 L 129.26628,292.21587 C 124.35342,292.21587 120.39831,288.26075 120.39831,283.34789 C 120.39831,278.43504 124.35342,274.47992 129.26628,274.47992 z M 127.49374,268.95493 L 136.78426,268.95493 C 144.72845,268.95493 151.12396,275.37419 151.12396,283.34789 C 151.12396,291.3216 144.72845,297.74086 136.78426,297.74086 L 127.49374,297.74086 C 119.54955,297.74086 113.15404,291.3216 113.15404,283.34789 C 113.15404,275.37419 119.54955,268.95493 127.49374,268.95493 z" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#a1a1a1;stroke-width:1.17324996;stroke-linecap:butt;stroke-linejoin:miter;marker:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path2873"
+ sodipodi:cx="99.667305"
+ sodipodi:cy="282.88821"
+ sodipodi:rx="8.7876797"
+ sodipodi:ry="8.7876797"
+ d="M 108.45498,282.88821 A 8.7876797,8.7876797 0 1 1 90.879625,282.88821 A 8.7876797,8.7876797 0 1 1 108.45498,282.88821 z"
+ transform="matrix(0.939699,0,0,0.939699,5.30354,17.5183)" />
+ <path
+ transform="matrix(0.939699,0,0,0.939699,70.8358,17.5183)"
+ d="M 108.45498,282.88821 A 8.7876797,8.7876797 0 1 1 90.879625,282.88821 A 8.7876797,8.7876797 0 1 1 108.45498,282.88821 z"
+ sodipodi:ry="8.7876797"
+ sodipodi:rx="8.7876797"
+ sodipodi:cy="282.88821"
+ sodipodi:cx="99.667305"
+ id="path2896"
+ style="opacity:1;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#a1a1a1;stroke-width:1.17324996;stroke-linecap:butt;stroke-linejoin:miter;marker:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc" />
+ </g>
+ <g
+ transform="translate(-138.895,0)"
+ id="g3076">
+ <g
+ transform="translate(-8.39025,0)"
+ id="g3042">
+ <path
+ id="path3044"
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#a1a1a1;stroke-width:0.72750002;stroke-linecap:round;stroke-linejoin:round;marker:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 251.74434,230.02968 L 247.09281,226.05818 L 242.23893,230.0407 C 243.96351,230.02965 244.22246,229.99149 244.24454,230.64788 L 244.24454,233.6507 C 244.24454,234.04213 244.55966,234.35725 244.95109,234.35725 L 249.19037,234.35725 C 249.5818,234.35725 249.89692,234.04213 249.89692,233.6507 L 249.89692,230.64788"
+ sodipodi:nodetypes="ccccccccc" />
+ <rect
+ style="opacity:1;fill:#a1a1a1;fill-opacity:1;fill-rule:evenodd;stroke:#a1a1a1;stroke-width:0.72750002;stroke-linecap:round;stroke-linejoin:round;marker:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect3046"
+ width="1.1260595"
+ height="2.2521191"
+ x="246.4286"
+ y="232.10513" />
+ </g>
+ <g
+ transform="matrix(0.847116,0,0,0.847116,36.3844,36.8906)"
+ id="g3048">
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#a1a1a1;stroke-width:1.18048px;stroke-linecap:square;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 243.32987,241.79807 L 234.14142,241.79807"
+ id="path3050" />
+ <path
+ id="path3052"
+ d="M 239.3129,244.33722 L 235.75172,244.33722"
+ style="fill:none;fill-rule:evenodd;stroke:#a1a1a1;stroke-width:1.18048px;stroke-linecap:square;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#a1a1a1;stroke-width:1.18048px;stroke-linecap:square;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 239.3129,246.43478 L 235.75172,246.43478"
+ id="path3054" />
+ <path
+ id="path3056"
+ d="M 239.48636,248.88562 L 234.09189,248.88562 L 234.09189,243.45405"
+ style="fill:none;fill-rule:evenodd;stroke:#a1a1a1;stroke-width:1.18048px;stroke-linecap:square;stroke-linejoin:round;stroke-opacity:1"
+ sodipodi:nodetypes="ccc" />
+ <path
+ style="opacity:1;fill:#a1a1a1;fill-opacity:1;fill-rule:evenodd;stroke:#a1a1a1;stroke-width:0.858796;stroke-linecap:square;stroke-linejoin:round;marker:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 241.24351,243.98638 L 241.24351,246.04888 L 240.43101,246.04888 L 241.96226,247.58013 L 243.49351,246.04888 L 242.64976,246.04888 L 242.64976,243.98638 L 241.24351,243.98638 z"
+ id="path3058" />
+ </g>
+ <path
+ id="path3060"
+ d="M 245.43681,225.79037 L 245.43681,252.3742"
+ style="fill:none;fill-rule:evenodd;stroke:#a1a1a1;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#a1a1a1;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 298.33953,225.79037 L 298.33953,252.3742"
+ id="path3062" />
+ <g
+ transform="matrix(0.842444,-0.225732,0.225732,0.842444,-7.44249,107.397)"
+ id="g3064">
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#a1a1a1;stroke-width:1.16912997;stroke-linecap:square;stroke-linejoin:round;marker:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path3066"
+ sodipodi:cx="293.76904"
+ sodipodi:cy="243.16701"
+ sodipodi:rx="2.9365864"
+ sodipodi:ry="2.9365864"
+ d="M 296.70563,243.16701 A 2.9365864,2.9365864 0 1 1 290.83246,243.16701 A 2.9365864,2.9365864 0 1 1 296.70563,243.16701 z"
+ transform="matrix(0.81203,0,0,0.81203,68.3571,45.3769)" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#a1a1a1;stroke-width:1.14657998px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 304.01429,244.66842 L 300.87837,246.47894"
+ id="path3068" />
+ </g>
+ <path
+ d="M 304.43441,227.375 C 302.53928,227.375 301.00444,228.90984 301.00443,230.80498 C 301.00443,232.67076 302.49414,234.18843 304.34866,234.23495 L 305.6349,231.97689 L 306.17798,232.2913 L 305.77781,230.69064 L 304.14858,231.09081 L 304.72024,231.43381 L 303.54833,233.40604 C 302.71926,232.84537 302.17634,231.87806 302.17634,230.80498 C 302.17635,229.33317 303.23075,228.15568 304.60591,227.83233 L 304.83804,227.41022 C 304.59686,227.39462 304.55861,227.375 304.43441,227.375 z M 305.15315,234.23495 C 307.04829,234.23495 308.58312,232.70011 308.58312,230.80498 C 308.58312,228.93918 307.09342,227.42152 305.23891,227.375 L 303.95265,229.63306 L 303.40958,229.31865 L 303.80975,230.91931 L 305.43898,230.51915 L 304.86732,230.17615 L 306.03923,228.2039 C 306.8683,228.76457 307.41122,229.73189 307.41122,230.80498 C 307.41121,232.27677 306.35681,233.45426 304.98165,233.77762 L 304.74953,234.19973 C 304.99069,234.21533 305.02895,234.23495 305.15315,234.23495 z"
+ style="fill:#a1a1a1;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.228;stroke-linecap:butt;stroke-linejoin:miter;marker:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path3070" />
+ <path
+ id="path3072"
+ d="M 275.27017,248.65837 L 275.27017,252.84071"
+ style="fill:none;fill-rule:evenodd;stroke:#a1a1a1;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#a1a1a1;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 275.27017,225.34016 L 275.27017,227.98729"
+ id="path3074" />
+ </g>
+ </g>
+ </g>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/visualizer/resource/adriankierman_cell_phone_tower.svg Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://web.resource.org/cc/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="54.71582" height="243.43661" id="svg5560" sodipodi:version="0.32" inkscape:version="0.45.1" version="1.0" sodipodi:docbase="/root/workspace/svg/clipart" sodipodi:docname="simple_cellular_tower.svg" inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs id="defs5562"/>
+ <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" gridtolerance="10000" guidetolerance="10" objecttolerance="10" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.35" inkscape:cx="375" inkscape:cy="520" inkscape:document-units="px" inkscape:current-layer="layer1" inkscape:window-width="826" inkscape:window-height="622" inkscape:window-x="5" inkscape:window-y="73"/>
+ <metadata id="metadata5565">
+ <rdf:RDF>
+ <cc:Work rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" transform="translate(-241.214, -213.501)">
+ <g id="g5542" transform="translate(-505.802, 139.945)">
+ <rect y="74.055664" x="769.73621" height="242.43661" width="10.101525" id="rect4253" style="opacity: 0.535519; fill: rgb(102, 102, 102); fill-opacity: 1; stroke: rgb(0, 0, 0); stroke-opacity: 1;"/>
+ <g transform="matrix(-1, 0, 0, 1, 1549.23, 0)" id="g5232">
+ <rect style="opacity: 0.535519; fill: rgb(0, 0, 0); fill-opacity: 1; stroke: rgb(0, 0, 0); stroke-opacity: 1;" id="rect5226" width="16.667517" height="3.0304577" x="752.56366" y="87.187645"/>
+ <rect style="opacity: 0.535519; fill: rgb(230, 230, 230); fill-opacity: 1; stroke: rgb(0, 0, 0); stroke-opacity: 1;" id="rect5228" width="3.0304713" height="26.263954" x="748.01801" y="75.570892"/>
+ </g>
+ <g transform="matrix(-1, 0, 0, 1, 1549.25, 32.9924)" id="g5236">
+ <rect style="opacity: 0.535519; fill: rgb(0, 0, 0); fill-opacity: 1; stroke: rgb(0, 0, 0); stroke-opacity: 1;" id="rect5238" width="16.667517" height="3.0304577" x="752.56366" y="87.187645"/>
+ <rect style="opacity: 0.535519; fill: rgb(230, 230, 230); fill-opacity: 1; stroke: rgb(0, 0, 0); stroke-opacity: 1;" id="rect5240" width="3.0304713" height="26.263954" x="748.01801" y="75.570892"/>
+ </g>
+ <g transform="translate(-0.48229, 0.313456)" id="g5242">
+ <rect style="opacity: 0.535519; fill: rgb(0, 0, 0); fill-opacity: 1; stroke: rgb(0, 0, 0); stroke-opacity: 1;" id="rect5244" width="16.667517" height="3.0304577" x="752.56366" y="87.187645"/>
+ <rect style="opacity: 0.535519; fill: rgb(230, 230, 230); fill-opacity: 1; stroke: rgb(0, 0, 0); stroke-opacity: 1;" id="rect5246" width="3.0304713" height="26.263954" x="748.01801" y="75.570892"/>
+ </g>
+ <g transform="translate(-0.50263, 33.3059)" id="g5248">
+ <rect style="opacity: 0.535519; fill: rgb(0, 0, 0); fill-opacity: 1; stroke: rgb(0, 0, 0); stroke-opacity: 1;" id="rect5250" width="16.667517" height="3.0304577" x="752.56366" y="87.187645"/>
+ <rect style="opacity: 0.535519; fill: rgb(230, 230, 230); fill-opacity: 1; stroke: rgb(0, 0, 0); stroke-opacity: 1;" id="rect5252" width="3.0304713" height="26.263954" x="748.01801" y="75.570892"/>
+ </g>
+ <path transform="translate(-3.01015, 3.03046)" d="M 776.80727 152.84756 A 7.0710678 12.12183 0 1 1 762.66514,152.84756 A 7.0710678 12.12183 0 1 1 776.80727 152.84756 z" sodipodi:ry="12.12183" sodipodi:rx="7.0710678" sodipodi:cy="152.84756" sodipodi:cx="769.73621" id="path5254" style="opacity: 1; fill: rgb(128, 128, 128); fill-opacity: 1; stroke: rgb(0, 0, 0); stroke-opacity: 1;" sodipodi:type="arc"/>
+ <path transform="translate(11.1117, -46.467)" d="M 776.80727 152.84756 A 7.0710678 12.12183 0 1 1 762.66514,152.84756 A 7.0710678 12.12183 0 1 1 776.80727 152.84756 z" sodipodi:ry="12.12183" sodipodi:rx="7.0710678" sodipodi:cy="152.84756" sodipodi:cx="769.73621" id="path5256" style="opacity: 1; fill: rgb(128, 128, 128); fill-opacity: 1; stroke: rgb(0, 0, 0); stroke-opacity: 1;" sodipodi:type="arc"/>
+ <path transform="translate(11.132, 3.03045)" d="M 776.80727 152.84756 A 7.0710678 12.12183 0 1 1 762.66514,152.84756 A 7.0710678 12.12183 0 1 1 776.80727 152.84756 z" sodipodi:ry="12.12183" sodipodi:rx="7.0710678" sodipodi:cy="152.84756" sodipodi:cx="769.73621" id="path5258" style="opacity: 1; fill: rgb(128, 128, 128); fill-opacity: 1; stroke: rgb(0, 0, 0); stroke-opacity: 1;" sodipodi:type="arc"/>
+ </g>
+ </g>
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/visualizer/resource/bobocal_Yellow_Bus.svg Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.0" width="993.7254" height="310.89276" id="svg2160">
+ <defs id="defs2162"/>
+ <g transform="translate(-31.7463, -366.985)" id="layer1">
+ <g id="g2386">
+ <path d="M 32.325515,677.29858 L 1024.8925,677.29858" style="fill: none; fill-rule: evenodd; stroke: rgb(0, 0, 0); stroke-width: 1.15842px; stroke-linecap: butt; stroke-linejoin: miter; stroke-opacity: 1;" id="path2175"/>
+ <path d="M 268.79664,628.66538 A 35.70126,35.70126 0 1 1 273.83521,598.26515 L 239.54393,608.19934 z" transform="translate(34.5496)" style="opacity: 0; fill: rgb(230, 230, 230); fill-opacity: 1; fill-rule: nonzero; stroke: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: 2, 2; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="path2177"/>
+ <path d="M 89.0625,367.875 C 69.163607,367.875 53.15625,383.75548 53.15625,403.46875 L 53.15625,609.15625 C 53.15625,628.86953 69.163611,644.75 89.0625,644.75 L 975.40625,644.75 C 995.30514,644.75 1011.3125,628.86955 1011.3125,609.15625 L 1011.3125,403.46875 C 1011.3125,402.85271 1011.3121,402.23319 1011.2813,401.625 L 1011.2813,552 C 1011.2805,553.76879 1009.8625,555.1875 1008.0938,555.1875 L 990.90625,555.1875 C 989.13747,555.18752 987.6875,553.76879 987.6875,552 L 987.6875,399.5625 C 987.6875,397.79372 989.13746,396.375 990.90625,396.375 L 1008.0938,396.375 C 1009.3388,396.375 1010.3796,397.08915 1010.9063,398.125 C 1008.321,380.9619 993.47184,367.875 975.40625,367.875 L 89.0625,367.875 z M 846,388.46875 L 897.875,388.46875 C 898.5113,388.46875 899.11956,388.53428 899.71875,388.65625 C 900.30819,388.77624 900.8956,388.96112 901.4375,389.1875 C 901.44596,389.19107 901.4603,389.18391 901.46875,389.1875 C 902.01063,389.41591 902.51759,389.70788 903,390.03125 C 903.97724,390.69034 904.84091,391.55401 905.5,392.53125 C 905.82337,393.01366 906.11534,393.52062 906.34375,394.0625 C 906.34734,394.07095 906.34018,394.08529 906.34375,394.09375 C 906.57013,394.63565 906.75501,395.22307 906.875,395.8125 C 906.9024,395.94709 906.9159,396.08303 906.9375,396.21875 C 907.6293,391.82302 911.40379,388.46876 916,388.46875 L 967.875,388.46875 C 972.96536,388.46875 977.06251,392.56592 977.0625,397.65625 L 977.0625,616.53125 C 977.06251,621.62157 972.96535,625.71873 967.875,625.71875 L 916,625.71875 C 911.38062,625.71872 907.57016,622.36596 906.90625,617.9375 C 906.87063,618.14482 906.85874,618.35754 906.8125,618.5625 C 906.69252,619.09427 906.55109,619.63312 906.34375,620.125 C 906.23319,620.38729 906.10226,620.65719 905.96875,620.90625 C 905.96211,620.9185 905.94419,620.92528 905.9375,620.9375 C 905.7964,621.19791 905.66477,621.44319 905.5,621.6875 C 905.00568,622.42043 904.39885,623.06421 903.71875,623.625 C 902.58525,624.55966 901.21674,625.22631 899.71875,625.53125 C 899.11956,625.65323 898.51129,625.71875 897.875,625.71875 L 846,625.71875 C 845.37436,625.71875 844.74612,625.64927 844.15625,625.53125 C 844.14649,625.52926 844.13475,625.53327 844.125,625.53125 C 843.23571,625.35022 842.3994,625.04152 841.625,624.625 C 841.61734,624.62085 841.6014,624.62917 841.59375,624.625 C 841.08026,624.34677 840.60429,623.99242 840.15625,623.625 C 840.15031,623.62011 840.13092,623.62991 840.125,623.625 C 839.66523,623.24588 839.28415,622.83582 838.90625,622.375 C 838.71932,622.1483 838.53977,621.93181 838.375,621.6875 C 838.205,621.43544 838.05102,621.17541 837.90625,620.90625 C 837.76515,620.64585 837.64716,620.39998 837.53125,620.125 C 837.29555,619.56583 837.12204,618.98496 837,618.375 C 836.88198,617.78513 836.8125,617.15689 836.8125,616.53125 L 836.8125,397.65625 C 836.8125,397.01995 836.87803,396.41169 837,395.8125 C 837.06297,395.50315 837.12571,395.20327 837.21875,394.90625 C 837.30505,394.62758 837.41993,394.36021 837.53125,394.09375 C 837.53493,394.08503 837.52755,394.07121 837.53125,394.0625 C 837.64716,393.78752 837.76515,393.54165 837.90625,393.28125 C 838.05132,393.01352 838.20493,392.75069 838.375,392.5 C 838.53977,392.25569 838.71932,392.0392 838.90625,391.8125 C 839.6626,390.89524 840.56851,390.12884 841.625,389.5625 C 841.8854,389.4214 842.13127,389.30341 842.40625,389.1875 C 842.89813,388.98016 843.43698,388.83873 843.96875,388.71875 C 844.61866,388.57397 845.30518,388.46875 846,388.46875 z M 169.15625,389.03125 L 272.09375,389.03125 C 277.1841,389.03125 281.28125,393.12841 281.28125,398.21875 L 281.28125,464.53125 C 281.28124,469.62158 277.18409,473.71875 272.09375,473.71875 L 169.15625,473.71875 C 164.06591,473.71876 159.96875,469.62159 159.96875,464.53125 L 159.96875,398.21875 C 159.96875,393.12839 164.06591,389.03125 169.15625,389.03125 z M 305.3125,389.03125 L 408.28125,389.03125 C 413.37158,389.03125 417.46875,393.12841 417.46875,398.21875 L 417.46875,464.53125 C 417.46876,469.62158 413.37159,473.71875 408.28125,473.71875 L 305.3125,473.71875 C 300.22218,473.71876 296.125,469.62159 296.125,464.53125 L 296.125,398.21875 C 296.125,393.12839 300.22216,389.03125 305.3125,389.03125 z M 441.46875,389.03125 L 544.4375,389.03125 C 549.52786,389.03125 553.625,393.12841 553.625,398.21875 L 553.625,464.53125 C 553.62501,469.62158 549.52784,473.71875 544.4375,473.71875 L 441.46875,473.71875 C 436.37843,473.71876 432.28125,469.62159 432.28125,464.53125 L 432.28125,398.21875 C 432.28125,393.12839 436.37841,389.03125 441.46875,389.03125 z M 577.65625,389.03125 L 680.59375,389.03125 C 685.68408,389.03125 689.78125,393.12841 689.78125,398.21875 L 689.78125,464.53125 C 689.78123,469.62158 685.68409,473.71875 680.59375,473.71875 L 577.65625,473.71875 C 572.56589,473.71876 568.4375,469.62159 568.4375,464.53125 L 568.4375,398.21875 C 568.4375,393.12839 572.56591,389.03125 577.65625,389.03125 z M 713.8125,389.03125 L 816.78125,389.03125 C 821.87158,389.03125 825.96875,393.12841 825.96875,398.21875 L 825.96875,464.53125 C 825.96873,469.62158 821.87159,473.71875 816.78125,473.71875 L 713.8125,473.71875 C 708.72214,473.71876 704.625,469.62159 704.625,464.53125 L 704.625,398.21875 C 704.625,393.12839 708.72216,389.03125 713.8125,389.03125 z " style="fill: rgb(255, 255, 0); fill-opacity: 1; fill-rule: nonzero; stroke: rgb(0, 0, 0); stroke-width: 1.77992; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="rect3179"/>
+ <path d="M 177.12517,635.35797 A 27.063858,27.063858 0 1 1 229.40853,635.35797" transform="matrix(2.19149, 0, 0, 2.19149, -207.641, -748.676)" style="opacity: 1; fill: rgb(77, 77, 77); fill-opacity: 1; fill-rule: nonzero; stroke: rgb(0, 0, 0); stroke-width: 2.00004; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="path3167"/>
+ <path d="M 230.3307 628.35333 A 27.063858 27.063858 0 1 1 176.20299,628.35333 A 27.063858 27.063858 0 1 1 230.3307 628.35333 z" transform="matrix(1.80851, 0, 0, 1.80851, -129.794, -508.03)" style="opacity: 1; fill: rgb(0, 0, 0); fill-opacity: 1; fill-rule: nonzero; stroke: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: 2, 2; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="path3152"/>
+ <path d="M 230.3307 628.35333 A 27.063858 27.063858 0 1 1 176.20299,628.35333 A 27.063858 27.063858 0 1 1 230.3307 628.35333 z" transform="matrix(0.787234, 0, 0, 0.787234, 77.7979, 133.692)" style="opacity: 1; fill: rgb(204, 204, 204); fill-opacity: 1; fill-rule: nonzero; stroke: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: 2, 2; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="path3156"/>
+ <path d="M 268.79664,628.66538 A 35.70126,35.70126 0 1 1 273.83521,598.26515 L 239.54393,608.19934 z" transform="translate(560.207)" style="opacity: 0; fill: rgb(230, 230, 230); fill-opacity: 1; fill-rule: nonzero; stroke: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: 2, 2; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="path3169"/>
+ <path d="M 177.12517,635.35797 A 27.063858,27.063858 0 1 1 229.40853,635.35797" transform="matrix(2.19149, 0, 0, 2.19149, 318.017, -748.676)" style="opacity: 1; fill: rgb(77, 77, 77); fill-opacity: 1; fill-rule: nonzero; stroke: rgb(0, 0, 0); stroke-width: 2.00004; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="path3171"/>
+ <path d="M 230.3307 628.35333 A 27.063858 27.063858 0 1 1 176.20299,628.35333 A 27.063858 27.063858 0 1 1 230.3307 628.35333 z" transform="matrix(1.80851, 0, 0, 1.80851, 395.864, -508.03)" style="opacity: 1; fill: rgb(0, 0, 0); fill-opacity: 1; fill-rule: nonzero; stroke: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: 2, 2; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="path3173"/>
+ <path d="M 230.3307 628.35333 A 27.063858 27.063858 0 1 1 176.20299,628.35333 A 27.063858 27.063858 0 1 1 230.3307 628.35333 z" transform="matrix(0.787234, 0, 0, 0.787234, 603.456, 133.692)" style="opacity: 1; fill: rgb(204, 204, 204); fill-opacity: 1; fill-rule: nonzero; stroke: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: 2, 2; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="path3175"/>
+ <rect width="121.33695" height="84.691566" rx="9.1883392" ry="9.1883392" x="159.95827" y="389.04138" style="opacity: 0.6; fill: rgb(204, 204, 204); fill-opacity: 1; fill-rule: nonzero; stroke: rgb(0, 0, 0); stroke-width: 1.77165; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="rect3181"/>
+ <rect width="23.578625" height="158.81502" rx="3.1927617" ry="3.1927617" x="987.69922" y="396.37573" style="opacity: 0.6; fill: rgb(204, 204, 204); fill-opacity: 1; fill-rule: nonzero; stroke: rgb(0, 0, 0); stroke-width: 1.00874; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="rect4170"/>
+ <rect width="40.307938" height="41.459484" rx="4.8945279" ry="5.6405392" x="980.63293" y="608.1994" style="opacity: 1; fill: rgb(40, 11, 11); fill-opacity: 1; fill-rule: nonzero; stroke: rgb(0, 0, 0); stroke-width: 1.77165; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="rect4176"/>
+ <rect width="114.01376" height="41.459484" rx="4.8945279" ry="5.6405392" x="47.217747" y="608.1994" style="opacity: 1; fill: rgb(40, 11, 11); fill-opacity: 1; fill-rule: nonzero; stroke: rgb(0, 0, 0); stroke-width: 1.77165; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="rect4178"/>
+ <rect width="161.23149" height="78.312439" rx="7.9438462" ry="7.9438462" x="499.61023" y="560.98157" style="opacity: 1; fill: none; fill-opacity: 1; fill-rule: nonzero; stroke: rgb(0, 0, 0); stroke-width: 1.77165; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="rect4184"/>
+ <rect width="161.23149" height="78.312439" rx="7.9438462" ry="7.9438462" x="330.31717" y="560.98157" style="opacity: 1; fill: none; fill-opacity: 1; fill-rule: nonzero; stroke: rgb(0, 0, 0); stroke-width: 1.77165; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="rect4186"/>
+ <rect width="121.33695" height="84.691566" rx="9.1883392" ry="9.1883392" x="296.12302" y="389.04138" style="opacity: 0.6; fill: rgb(204, 204, 204); fill-opacity: 1; fill-rule: nonzero; stroke: rgb(0, 0, 0); stroke-width: 1.77165; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="rect2197"/>
+ <rect width="121.33695" height="84.691566" rx="9.1883392" ry="9.1883392" x="432.28775" y="389.04138" style="opacity: 0.6; fill: rgb(204, 204, 204); fill-opacity: 1; fill-rule: nonzero; stroke: rgb(0, 0, 0); stroke-width: 1.77165; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="rect2199"/>
+ <rect width="121.33695" height="84.691566" rx="9.1883392" ry="9.1883392" x="568.45251" y="389.04138" style="opacity: 0.6; fill: rgb(204, 204, 204); fill-opacity: 1; fill-rule: nonzero; stroke: rgb(0, 0, 0); stroke-width: 1.77165; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="rect2201"/>
+ <rect width="121.33695" height="84.691566" rx="9.1883392" ry="9.1883392" x="704.61719" y="388.48038" style="opacity: 0.6; fill: rgb(204, 204, 204); fill-opacity: 1; fill-rule: nonzero; stroke: rgb(0, 0, 0); stroke-width: 1.77165; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="rect2203"/>
+ <g transform="translate(-0.000273234, 0.000265655)" id="g2378">
+ <g id="g2370">
+ <path d="M 915.98701,388.48039 C 910.89667,388.48039 906.79951,392.57753 906.79951,397.66789 L 906.79951,616.54289 C 906.79951,621.63323 910.89665,625.73036 915.98701,625.73039 L 967.86201,625.73039 C 972.95235,625.73039 977.04952,621.63321 977.04951,616.54289 L 977.04951,397.66789 C 977.04951,392.57755 972.95237,388.48039 967.86201,388.48039 L 915.98701,388.48039 z M 924.04951,397.69914 L 960.95576,397.69914 C 966.04613,397.69914 970.14326,401.7963 970.14326,406.88664 L 970.14326,519.79289 C 970.14327,524.8832 966.0461,528.98039 960.95576,528.98039 L 924.04951,528.98039 C 918.95915,528.98041 914.86201,524.88323 914.86201,519.79289 L 914.86201,406.88664 C 914.86201,401.79632 918.95917,397.69914 924.04951,397.69914 z " style="fill: rgb(255, 255, 0); fill-opacity: 1; fill-rule: nonzero; stroke: rgb(0, 0, 0); stroke-width: 1.77165; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="path2351"/>
+ <rect width="55.279369" height="131.2885" rx="9.1883392" ry="9.1883392" x="914.87238" y="397.70074" style="opacity: 0.6; fill: rgb(204, 204, 204); fill-opacity: 1; fill-rule: nonzero; stroke: rgb(0, 0, 0); stroke-width: 1.77165; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="rect2353"/>
+ </g>
+ <g id="g2374">
+ <path d="M 845.9886,388.48039 C 840.89826,388.48039 836.8011,392.57753 836.8011,397.66789 L 836.8011,616.54289 C 836.8011,621.63323 840.89824,625.73036 845.9886,625.73039 L 897.8636,625.73039 C 902.95394,625.73039 907.05111,621.63321 907.0511,616.54289 L 907.0511,397.66789 C 907.0511,392.57755 902.95396,388.48039 897.8636,388.48039 L 845.9886,388.48039 z M 854.0511,397.69914 L 890.95735,397.69914 C 896.04772,397.69914 900.14485,401.7963 900.14485,406.88664 L 900.14485,519.79289 C 900.14486,524.8832 896.04769,528.98039 890.95735,528.98039 L 854.0511,528.98039 C 848.96074,528.98041 844.8636,524.88323 844.8636,519.79289 L 844.8636,406.88664 C 844.8636,401.79632 848.96076,397.69914 854.0511,397.69914 z " style="fill: rgb(255, 255, 0); fill-opacity: 1; fill-rule: nonzero; stroke: rgb(0, 0, 0); stroke-width: 1.77165; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="path2284"/>
+ <rect width="55.279369" height="131.2885" rx="9.1883392" ry="9.1883392" x="844.87396" y="397.70074" style="opacity: 0.6; fill: rgb(204, 204, 204); fill-opacity: 1; fill-rule: nonzero; stroke: rgb(0, 0, 0); stroke-width: 1.77165; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;" id="rect2286"/>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/visualizer/resource/thilakarathna_Bus_Halt.svg Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://web.resource.org/cc/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="178.37129" height="264.19806" id="svg6213" sodipodi:version="0.32" inkscape:version="0.45" version="1.0" sodipodi:docbase="/home/fahad/Desktop" sodipodi:docname="thilakarathna_Bus_Halt.svg" inkscape:export-filename="/home/fahad/Desktop/Bus_Halt.png" inkscape:export-xdpi="150" inkscape:export-ydpi="150" inkscape:output_extension="org.inkscape.output.svg.inkscape" sodipodi:modified="TRUE">
+ <defs id="defs6215">
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient5456" id="linearGradient5498" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.83731, 0, 0, 0.83731, 122.117, -209.238)" x1="527.5" y1="-1917.553" x2="479.5" y2="-131.72624"/>
+ <linearGradient inkscape:collect="always" id="linearGradient5456">
+ <stop style="stop-color: rgb(0, 255, 255); stop-opacity: 1;" offset="0" id="stop5458"/>
+ <stop style="stop-color: rgb(0, 255, 255); stop-opacity: 0;" offset="1" id="stop5460"/>
+ </linearGradient>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient5456" id="linearGradient5496" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.508315, 0, 0, 0.508315, 196.577, -737.854)" x1="527.5" y1="-1917.553" x2="479.5" y2="-131.72624"/>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient5456" id="linearGradient6269" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.135991, 0, 0, 0.135991, 381.515, 500.095)" x1="527.5" y1="-1917.553" x2="479.5" y2="-131.72624"/>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient5456" id="linearGradient6282" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.0825575, 0, 0, 0.0825575, 393.609, 414.241)" x1="527.5" y1="-1917.553" x2="479.5" y2="-131.72624"/>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient5456" id="linearGradient6312" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.0825575, 0, 0, 0.0825575, 393.609, 414.241)" x1="527.5" y1="-1917.553" x2="479.5" y2="-131.72624"/>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient5456" id="linearGradient6314" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.135991, 0, 0, 0.135991, 381.515, 500.095)" x1="527.5" y1="-1917.553" x2="479.5" y2="-131.72624"/>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient5456" id="linearGradient6331" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.135991, 0, 0, 0.135991, 381.515, 500.095)" x1="527.5" y1="-1917.553" x2="479.5" y2="-131.72624"/>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient5456" id="linearGradient6344" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.0825575, 0, 0, 0.0825575, 393.609, 414.241)" x1="527.5" y1="-1917.553" x2="479.5" y2="-131.72624"/>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient5456" id="linearGradient6373" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.0825575, 0, 0, 0.0825575, 393.609, 414.241)" x1="527.5" y1="-1917.553" x2="479.5" y2="-131.72624"/>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient5456" id="linearGradient6375" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.135991, 0, 0, 0.135991, 381.515, 500.095)" x1="527.5" y1="-1917.553" x2="479.5" y2="-131.72624"/>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient5456" id="linearGradient1928" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.135991, 0, 0, 0.135991, 381.515, 500.095)" x1="527.5" y1="-1917.553" x2="479.5" y2="-131.72624"/>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient5456" id="linearGradient1941" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.0825575, 0, 0, 0.0825575, 393.609, 414.241)" x1="527.5" y1="-1917.553" x2="479.5" y2="-131.72624"/>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient5456" id="linearGradient2296" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.135991, 0, 0, 0.135991, 381.515, 500.095)" x1="527.5" y1="-1917.553" x2="479.5" y2="-131.72624"/>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient5456" id="linearGradient2312" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.0825575, 0, 0, 0.0825575, 393.609, 414.241)" x1="527.5" y1="-1917.553" x2="479.5" y2="-131.72624"/>
+ </defs>
+ <sodipodi:namedview inkscape:document-units="mm" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.86831672" inkscape:cx="303.71381" inkscape:cy="154.70921" inkscape:current-layer="layer1" id="namedview6217" inkscape:window-width="872" inkscape:window-height="622" inkscape:window-x="25" inkscape:window-y="49"/>
+ <metadata id="metadata6219">
+ <rdf:RDF>
+ <cc:Work rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
+ <dc:title>Bus Halt</dc:title>
+ <dc:date>07 th June 2008</dc:date>
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Kenneth Thilakarathna - UCSC - LK</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <cc:license rdf:resource="http://web.resource.org/cc/PublicDomain"/>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>bus-stop</rdf:li>
+ <rdf:li>bus-halt</rdf:li>
+ <rdf:li>bus stop</rdf:li>
+ <rdf:li>bus halt</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ </cc:Work>
+ <cc:License rdf:about="http://web.resource.org/cc/PublicDomain">
+ <cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
+ <cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/>
+ <cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" transform="translate(-323.107, -221.199)">
+ <g id="g2314">
+ <rect y="305.73587" x="399.18127" height="80.035286" width="59.441422" id="rect5464" style="fill: url(#linearGradient2312) rgb(0, 0, 0); fill-opacity: 1; stroke: rgb(7, 0, 0); stroke-width: 0.87758; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;"/>
+ <g transform="matrix(0.102737, 0, 0, 0.102737, 376.38, 502.333)" id="g5414">
+ <path sodipodi:type="arc" style="fill: rgb(10, 0, 0); fill-opacity: 1; stroke: rgb(7, 0, 0); stroke-width: 4.53543; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" id="path5416" sodipodi:cx="600" sodipodi:cy="-992.12592" sodipodi:rx="168" sodipodi:ry="38.267715" d="M 768 -992.12592 A 168 38.267715 0 1 1 432,-992.12592 A 168 38.267715 0 1 1 768 -992.12592 z" transform="translate(-0.5, 5.75398)"/>
+ <path style="fill: none; fill-rule: evenodd; stroke: rgb(0, 0, 0); stroke-width: 86.0315; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" d="M 595.50002,-946.1042 C 595.50002,-742.00971 595.50002,-742.00971 595.50002,-742.00971" id="path5418"/>
+ </g>
+ <g transform="matrix(0.0922068, 0, 0, 0.0922068, 376.384, 471.043)" id="g5420">
+ <path sodipodi:type="arc" style="fill: rgb(10, 0, 0); fill-opacity: 1; stroke: rgb(7, 0, 0); stroke-width: 4.53543; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" id="path5422" sodipodi:cx="600" sodipodi:cy="-992.12592" sodipodi:rx="168" sodipodi:ry="38.267715" d="M 768 -992.12592 A 168 38.267715 0 1 1 432,-992.12592 A 168 38.267715 0 1 1 768 -992.12592 z" transform="translate(-0.5, 5.75398)"/>
+ <path style="fill: none; fill-rule: evenodd; stroke: rgb(0, 0, 0); stroke-width: 86.0315; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" d="M 595.50002,-946.1042 C 595.50002,-742.00971 595.50002,-742.00971 595.50002,-742.00971" id="path5424"/>
+ </g>
+ <g transform="matrix(0.141346, 0, 0, 0.141346, 360.279, 565.272)" id="g5394">
+ <path sodipodi:type="arc" style="fill: rgb(10, 0, 0); fill-opacity: 1; stroke: rgb(7, 0, 0); stroke-width: 4.53543; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" id="path5390" sodipodi:cx="600" sodipodi:cy="-992.12592" sodipodi:rx="168" sodipodi:ry="38.267715" d="M 768 -992.12592 A 168 38.267715 0 1 1 432,-992.12592 A 168 38.267715 0 1 1 768 -992.12592 z" transform="translate(-0.5, 5.75398)"/>
+ <path style="fill: none; fill-rule: evenodd; stroke: rgb(0, 0, 0); stroke-width: 86.0315; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" d="M 595.50002,-946.1042 C 595.50002,-742.00971 595.50002,-742.00971 595.50002,-742.00971" id="path5392"/>
+ </g>
+ <path sodipodi:end="6.2814937" sodipodi:start="3.1458674" transform="matrix(0.139174, 0, 0, 0.125355, 348.828, 471.175)" d="M -143.99452,-1250.2431 A 600,701.57483 0 0 1 1055.9991,-1248.4308 L 456,-1247.244 z" sodipodi:ry="701.57483" sodipodi:rx="600" sodipodi:cy="-1247.244" sodipodi:cx="456" id="path5398" style="fill: rgb(85, 34, 0); fill-opacity: 1; stroke: rgb(7, 0, 0); stroke-width: 86.0315; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" sodipodi:type="arc"/>
+ <path id="path5402" d="M 495.51107,320.20041 C 495.51107,479.43124 495.51107,479.43124 495.51107,479.43124" style="fill: none; fill-rule: evenodd; stroke: rgb(0, 0, 0); stroke-width: 11.9325; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;"/>
+ <path id="path5410" d="M 478.53868,320.4603 C 478.53868,448.7526 478.53868,448.7526 478.53868,448.7526" style="fill: none; fill-rule: evenodd; stroke: rgb(0, 0, 0); stroke-width: 10.7107; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;"/>
+ <path id="path5412" d="M 462.94693,320.38103 C 462.94693,400.73806 462.94693,400.73806 462.94693,400.73806" style="fill: none; fill-rule: evenodd; stroke: rgb(0, 0, 0); stroke-width: 8.47674; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;"/>
+ <rect y="321.36346" x="390.69467" height="131.83618" width="97.913445" id="rect5454" style="fill: url(#linearGradient2296) rgb(0, 0, 0); fill-opacity: 1; stroke: rgb(7, 0, 0); stroke-width: 1.44557; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;"/>
+ <g transform="matrix(0.162414, 0, 0, 0.162414, 396.455, 615.534)" id="g5378">
+ <g id="g5366" transform="translate(-556.499, -494.074)">
+ <g transform="matrix(0.996807, 0.0798454, -0.0798454, 0.996807, -118.094, -58.9951)" id="g5360">
+ <g id="g5341" transform="matrix(0.999743, -0.022669, 0.022669, 0.999743, 34.3179, 14.9971)">
+ <path transform="matrix(0.998587, 0.0531485, -0.0531485, 0.998587, -560.394, 98.4307)" d="M 1248,-1479.685 L 1086.5899,-1467.0142 L 963.49616,-1572.1888 L 950.8254,-1733.5989 L 1056,-1856.6927 L 1217.4101,-1869.3634 L 1340.5038,-1764.1888 L 1353.1746,-1602.7788 L 1248,-1479.685 z " inkscape:randomized="0" inkscape:rounded="0" inkscape:flatsided="true" sodipodi:arg2="1.4924566" sodipodi:arg1="1.0997575" sodipodi:r2="171.14047" sodipodi:r1="211.54124" sodipodi:cy="-1668.1888" sodipodi:cx="1152" sodipodi:sides="8" id="path4558" style="fill: rgb(255, 0, 0);" sodipodi:type="star"/>
+ <g transform="matrix(0.998587, 0.0531485, -0.0531485, 0.998587, -79.0917, -38.1975)" id="g5338">
+ <path sodipodi:type="star" style="fill: rgb(255, 255, 255);" id="path4566" sodipodi:sides="8" sodipodi:cx="1152" sodipodi:cy="-1668.1888" sodipodi:r1="211.54124" sodipodi:r2="171.14047" sodipodi:arg1="1.0997575" sodipodi:arg2="1.4924566" inkscape:flatsided="true" inkscape:rounded="0" inkscape:randomized="0" d="M 1248,-1479.685 L 1086.5899,-1467.0142 L 963.49616,-1572.1888 L 950.8254,-1733.5989 L 1056,-1856.6927 L 1217.4101,-1869.3634 L 1340.5038,-1764.1888 L 1353.1746,-1602.7788 L 1248,-1479.685 z " transform="matrix(0.928634, 0, 0, 0.928634, -391.436, 43.3049)"/>
+ </g>
+ </g>
+ </g>
+ <path id="text5346" d="M 607.79673,-1572.4732 C 610.28949,-1572.4731 612.17962,-1573.021 613.46715,-1574.1167 C 614.75459,-1575.2124 615.39833,-1576.8286 615.39837,-1578.9654 C 615.39833,-1581.0746 614.75459,-1582.6771 613.46715,-1583.7729 C 612.17962,-1584.896 610.28949,-1585.4575 607.79673,-1585.4576 L 599.04458,-1585.4576 L 599.04458,-1572.4732 L 607.79673,-1572.4732 M 608.3309,-1545.6414 C 611.50849,-1545.6414 613.8917,-1546.3125 615.48055,-1547.6548 C 617.09672,-1548.9971 617.90482,-1551.0242 617.90486,-1553.7361 C 617.90482,-1556.3933 617.11041,-1558.3793 615.52164,-1559.6942 C 613.93279,-1561.0364 611.53588,-1561.7076 608.3309,-1561.7076 L 599.04458,-1561.7076 L 599.04458,-1545.6414 L 608.3309,-1545.6414 M 623.0411,-1567.7067 C 626.43782,-1566.7205 629.06757,-1564.8989 630.93037,-1562.2418 C 632.79306,-1559.5846 633.72443,-1556.3248 633.72449,-1552.4623 C 633.72443,-1546.5454 631.72472,-1542.1351 627.72536,-1539.2314 C 623.72589,-1536.3277 617.64458,-1534.8759 609.48142,-1534.8759 L 583.22495,-1534.8759 L 583.22495,-1596.2231 L 606.97494,-1596.2231 C 615.49421,-1596.2231 621.65769,-1594.9356 625.46541,-1592.3607 C 629.30042,-1589.7857 631.21794,-1585.663 631.218,-1579.9926 C 631.21794,-1577.0067 630.51942,-1574.4591 629.12241,-1572.3499 C 627.7253,-1570.268 625.6982,-1568.7202 623.0411,-1567.7067 M 647.32526,-1596.2231 L 663.14489,-1596.2231 L 663.14489,-1559.4476 C 663.14486,-1554.3799 663.96666,-1550.7503 665.61028,-1548.5588 C 667.28125,-1546.3947 669.99318,-1545.3127 673.74609,-1545.3127 C 677.52633,-1545.3127 680.23826,-1546.3947 681.8819,-1548.5588 C 683.55285,-1550.7503 684.38834,-1554.3799 684.38839,-1559.4476 L 684.38839,-1596.2231 L 700.20801,-1596.2231 L 700.20801,-1559.4476 C 700.20795,-1550.7639 698.03019,-1544.2991 693.67471,-1540.0532 C 689.31913,-1535.8072 682.67626,-1533.6842 673.74609,-1533.6842 C 664.84325,-1533.6842 658.21408,-1535.8072 653.85856,-1540.0532 C 649.50302,-1544.2991 647.32525,-1550.7639 647.32526,-1559.4476 L 647.32526,-1596.2231 M 758.39137,-1594.2919 L 758.39137,-1581.3075 C 755.02194,-1582.8141 751.73475,-1583.9509 748.52978,-1584.718 C 745.32473,-1585.4849 742.29777,-1585.8684 739.4489,-1585.8685 C 735.6686,-1585.8684 732.87449,-1585.3479 731.06656,-1584.3071 C 729.25858,-1583.2661 728.3546,-1581.6499 728.35462,-1579.4584 C 728.3546,-1577.8148 728.95725,-1576.5273 730.16258,-1575.596 C 731.39525,-1574.692 733.61411,-1573.9113 736.81915,-1573.2539 L 743.5579,-1571.8979 C 750.37879,-1570.5282 755.22739,-1568.4463 758.10374,-1565.6522 C 760.97998,-1562.8581 762.41813,-1558.8861 762.41818,-1553.7361 C 762.41813,-1546.97 760.40472,-1541.9296 756.37796,-1538.615 C 752.37849,-1535.3278 746.2561,-1533.6842 738.01076,-1533.6842 C 734.12088,-1533.6842 730.21734,-1534.0541 726.30012,-1534.7937 C 722.38287,-1535.5333 718.46563,-1536.629 714.5484,-1538.0809 L 714.5484,-1551.4351 C 718.46563,-1549.3532 722.2459,-1547.7781 725.88922,-1546.7098 C 729.5599,-1545.6688 733.09363,-1545.1483 736.49043,-1545.1483 C 739.94195,-1545.1483 742.5854,-1545.7236 744.42079,-1546.8741 C 746.2561,-1548.0246 747.17377,-1549.6682 747.17381,-1551.8049 C 747.17377,-1553.7224 746.54373,-1555.2017 745.28368,-1556.2426 C 744.05094,-1557.2835 741.57185,-1558.2149 737.8464,-1559.0367 L 731.72399,-1560.3927 C 725.58788,-1561.7076 721.09538,-1563.8031 718.24649,-1566.6795 C 715.42498,-1569.5557 714.01422,-1573.4319 714.01423,-1578.3079 C 714.01422,-1584.4166 715.98654,-1589.1145 719.93118,-1592.4018 C 723.8758,-1595.6889 729.54621,-1597.3325 736.94242,-1597.3326 C 740.31176,-1597.3325 743.77701,-1597.0723 747.33817,-1596.5519 C 750.89926,-1596.0587 754.58365,-1595.3054 758.39137,-1594.2919 M 596.9079,-1489.1017 L 596.9079,-1476.1172 C 593.53848,-1477.6238 590.25129,-1478.7606 587.04631,-1479.5277 C 583.84126,-1480.2947 580.81431,-1480.6782 577.96544,-1480.6782 C 574.18513,-1480.6782 571.39102,-1480.1577 569.58309,-1479.1168 C 567.77511,-1478.0758 566.87113,-1476.4596 566.87115,-1474.2682 C 566.87113,-1472.6246 567.47378,-1471.3371 568.67911,-1470.4057 C 569.91179,-1469.5017 572.13064,-1468.721 575.33568,-1468.0636 L 582.07443,-1466.7076 C 588.89532,-1465.3379 593.74393,-1463.2561 596.62027,-1460.462 C 599.49651,-1457.6678 600.93466,-1453.6958 600.93471,-1448.5459 C 600.93466,-1441.7797 598.92125,-1436.7394 594.89449,-1433.4248 C 590.89503,-1430.1376 584.77263,-1428.494 576.52729,-1428.494 C 572.63742,-1428.494 568.73387,-1428.8638 564.81666,-1429.6034 C 560.8994,-1430.343 556.98216,-1431.4388 553.06493,-1432.8906 L 553.06493,-1446.2449 C 556.98216,-1444.1629 560.76243,-1442.5878 564.40576,-1441.5195 C 568.07644,-1440.4786 571.61017,-1439.9581 575.00696,-1439.9581 C 578.45848,-1439.9581 581.10193,-1440.5333 582.93732,-1441.6839 C 584.77263,-1442.8344 585.69031,-1444.478 585.69035,-1446.6147 C 585.69031,-1448.5322 585.06026,-1450.0114 583.80021,-1451.0524 C 582.56747,-1452.0933 580.08838,-1453.0247 576.36293,-1453.8465 L 570.24053,-1455.2025 C 564.10441,-1456.5173 559.61192,-1458.6129 556.76303,-1461.4892 C 553.94151,-1464.3655 552.53076,-1468.2416 552.53076,-1473.1177 C 552.53076,-1479.2263 554.50307,-1483.9243 558.44772,-1487.2115 C 562.39233,-1490.4987 568.06274,-1492.1423 575.45895,-1492.1423 C 578.82829,-1492.1423 582.29354,-1491.882 585.85471,-1491.3616 C 589.41579,-1490.8685 593.10019,-1490.1152 596.9079,-1489.1017 M 607.5502,-1491.0329 L 664.08995,-1491.0329 L 664.08995,-1479.0757 L 643.75043,-1479.0757 L 643.75043,-1429.6856 L 627.93081,-1429.6856 L 627.93081,-1479.0757 L 607.5502,-1479.0757 L 607.5502,-1491.0329 M 700.24911,-1480.6782 C 695.42786,-1480.6782 691.68867,-1478.8976 689.03155,-1475.3365 C 686.37438,-1471.7754 685.04581,-1466.7624 685.04583,-1460.2976 C 685.04581,-1453.8602 686.37438,-1448.8609 689.03155,-1445.2998 C 691.68867,-1441.7386 695.42786,-1439.9581 700.24911,-1439.9581 C 705.09768,-1439.9581 708.85056,-1441.7386 711.50775,-1445.2998 C 714.16485,-1448.8609 715.49342,-1453.8602 715.49347,-1460.2976 C 715.49342,-1466.7624 714.16485,-1471.7754 711.50775,-1475.3365 C 708.85056,-1478.8976 705.09768,-1480.6782 700.24911,-1480.6782 M 700.24911,-1492.1423 C 710.11065,-1492.1423 717.83555,-1489.3207 723.42383,-1483.6778 C 729.012,-1478.0347 731.80611,-1470.2413 731.80618,-1460.2976 C 731.80611,-1450.3812 729.012,-1442.6015 723.42383,-1436.9585 C 717.83555,-1431.3155 710.11065,-1428.494 700.24911,-1428.494 C 690.41489,-1428.494 682.68999,-1431.3155 677.07438,-1436.9585 C 671.48614,-1442.6015 668.69203,-1450.3812 668.69203,-1460.2976 C 668.69203,-1470.2413 671.48614,-1478.0347 677.07438,-1483.6778 C 682.68999,-1489.3207 690.41489,-1492.1423 700.24911,-1492.1423 M 743.72226,-1491.0329 L 769.97873,-1491.0329 C 777.78578,-1491.0328 783.7712,-1489.2934 787.93503,-1485.8145 C 792.12615,-1482.3629 794.22174,-1477.4321 794.22179,-1471.0221 C 794.22174,-1464.5846 792.12615,-1459.6264 787.93503,-1456.1475 C 783.7712,-1452.6959 777.78578,-1450.9702 769.97873,-1450.9702 L 759.54188,-1450.9702 L 759.54188,-1429.6856 L 743.72226,-1429.6856 L 743.72226,-1491.0329 M 759.54188,-1479.5688 L 759.54188,-1462.4343 L 768.29404,-1462.4343 C 771.36205,-1462.4343 773.73157,-1463.1739 775.4026,-1464.6531 C 777.07355,-1466.1597 777.90905,-1468.2827 777.90909,-1471.0221 C 777.90905,-1473.7614 777.07355,-1475.8707 775.4026,-1477.3499 C 773.73157,-1478.8291 771.36205,-1479.5687 768.29404,-1479.5688 L 759.54188,-1479.5688" style="font-size: 84.1522px; font-style: normal; font-weight: bold; fill: rgb(255, 0, 0); fill-opacity: 1; stroke: none; stroke-width: 1px; stroke-linecap: butt; stroke-linejoin: miter; stroke-opacity: 1; font-family: Bitstream Vera Sans;"/>
+ </g>
+ <path style="fill: none; fill-opacity: 1; fill-rule: evenodd; stroke: rgb(252, 0, 0); stroke-width: 25.7953; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" d="M 115.5,-1811.5058 C 115.5,-842.05694 115.5,-842.05694 115.5,-842.05694" id="path5376"/>
+ </g>
+ </g>
+ </g>
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/visualizer/svgitem.py Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,156 @@
+import gobject
+import rsvg
+#import cairo
+import goocanvas
+import os.path
+
+
+class SvgItem(goocanvas.ItemSimple):
+ # setup our custom properties
+ __gproperties__ = {
+ 'x': (float, # property type
+ 'X', # property nick name
+ 'The x coordinate of a SVG image', # property description
+ -10e6, # property minimum value
+ 10e6, # property maximum value
+ 0, # property default value
+ gobject.PARAM_READWRITE), # property flags
+
+ 'y': (float,
+ 'Y',
+ 'The y coordinate of a SVG image',
+ -10e6,
+ 10e6,
+ 0,
+ gobject.PARAM_READWRITE),
+
+ 'width': (float,
+ 'Width',
+ 'The width of the SVG Image',
+ 0,
+ 10e6,
+ 0,
+ gobject.PARAM_READWRITE),
+
+ 'height': (float,
+ 'Height',
+ 'The width of the SVG Image',
+ 0,
+ 10e6,
+ 0,
+ gobject.PARAM_READWRITE),
+ }
+
+ def __init__(self, x, y, rsvg_handle, **kwargs):
+ super(SvgItem, self).__init__(**kwargs)
+ assert isinstance(rsvg_handle, rsvg.Handle)
+ self.x = x
+ self.y = y
+ self.sx = 1.0
+ self.sy = 1.0
+ self.handle = rsvg_handle
+ self.width = self.handle.props.width
+ self.height = self.handle.props.height
+ self.custom_width = None
+ self.custom_height = None
+
+ def do_set_property(self, pspec, value):
+ if pspec.name == 'x':
+ self.x = value
+
+ # make sure we update the display
+ self.changed(True)
+
+ elif pspec.name == 'y':
+ self.y = value
+
+ # make sure we update the display
+ self.changed(True)
+
+ elif pspec.name == 'width':
+ self.custom_width = value
+ self._size_changed()
+
+ # make sure we update the display
+ self.changed(True)
+
+ elif pspec.name == 'height':
+ self.custom_height = value
+ self._size_changed()
+
+ # make sure we update the display
+ self.changed(True)
+
+ else:
+ raise AttributeError, 'unknown property %s' % pspec.name
+
+ def _size_changed(self):
+ if self.custom_width is None and self.custom_height is None:
+ self.width = self.handle.props.width
+ self.height = self.handle.props.height
+ self.sx = 1.0
+ self.sy = 1.0
+ elif self.custom_width is not None and self.custom_height is None:
+ self.width = self.custom_width
+ self.sx = self.custom_width / self.handle.props.width
+ self.sy = self.sx
+ self.height = self.handle.props.height*self.sy
+ elif self.custom_width is None and self.custom_height is not None:
+ self.height = self.custom_height
+ self.sy = self.custom_height / self.handle.props.height
+ self.sx = self.sy
+ self.width = self.handle.props.width*self.sx
+ else:
+ self.width = self.custom_width
+ self.height = self.custom_height
+ self.sx = self.custom_width / self.handle.props.width
+ self.sy = self.custom_height / self.handle.props.height
+
+ def do_get_property(self, pspec):
+ if pspec.name == 'x':
+ return self.x
+
+ elif pspec.name == 'y':
+ return self.y
+
+ elif pspec.name == 'width':
+ self.width = self.handle.props.width
+ self.height = self.handle.props.height
+
+ return self.width
+
+ elif pspec.name == 'height':
+ return self.height
+
+ else:
+ raise AttributeError, 'unknown property %s' % pspec.name
+
+ def do_simple_paint(self, cr, bounds):
+ cr.translate(self.x, self.y)
+ cr.scale(self.sx, self.sy)
+ self.handle.render_cairo(cr)
+
+ def do_simple_update(self, cr):
+ self.bounds_x1 = float(self.x)
+ self.bounds_y1 = float(self.y)
+ self.bounds_x2 = float(self.x + self.width)
+ self.bounds_y2 = float(self.y + self.height)
+
+ def do_simple_is_item_at(self, x, y, cr, is_pointer_event):
+ if ((x < self.x) or (x > self.x + self.width)) or ((y < self.y) or (y > self.y + self.height)):
+ return False
+ else:
+ return True
+
+
+_rsvg_cache = dict()
+
+def rsvg_handle_factory(base_file_name):
+ try:
+ return _rsvg_cache[base_file_name]
+ except KeyError:
+ full_path = os.path.join(os.path.dirname(__file__), 'resource', base_file_name)
+ rsvg_handle = rsvg.Handle(full_path)
+ _rsvg_cache[base_file_name] = rsvg_handle
+ return rsvg_handle
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tools/visualizer/wscript Tue Dec 21 17:46:35 2010 +0100
@@ -0,0 +1,22 @@
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+def build(bld):
+ headers = bld.new_task_gen('ns3header')
+ headers.module = 'visualizer'
+ headers.source = [
+ ]
+
+ module = bld.create_ns3_module('visualizer', ['core'])
+ module.features.append('pyembed')
+ module.env.append_value('CXXFLAGS', module.env['shlib_CXXFLAGS'])
+ module.includes = '.'
+
+ if bld.env['ENABLE_PYTHON_BINDINGS']:
+ module.source = [
+ 'model/pyviz.cc',
+ 'model/visual-simulator-impl.cc',
+ ]
+ headers.source.append('model/pyviz.h')
+ else:
+ module.source = [
+ ]
--- a/src/wscript Tue Dec 21 17:39:54 2010 +0100
+++ b/src/wscript Tue Dec 21 17:46:35 2010 +0100
@@ -33,6 +33,7 @@
'applications/onoff',
'applications/packet-sink',
'applications/udp-echo',
+ 'applications/bulk-send',
'routing/nix-vector-routing',
'routing/olsr',
'routing/global-routing',
@@ -63,6 +64,7 @@
'mpi',
'contrib/topology-read',
'contrib/energy',
+ 'tools/visualizer',
)
def set_options(opt):
--- a/test.py Tue Dec 21 17:39:54 2010 +0100
+++ b/test.py Tue Dec 21 17:46:35 2010 +0100
@@ -102,6 +102,8 @@
("examples/emulation/emu-ping", "False", "True"),
("examples/emulation/emu-udp-echo", "False", "True"),
+ ("examples/energy/energy-model-example", "True", "True"),
+
("examples/error-model/simple-error-model", "True", "True"),
("examples/ipv6/icmpv6-redirect", "True", "True"),
--- a/wscript Tue Dec 21 17:39:54 2010 +0100
+++ b/wscript Tue Dec 21 17:46:35 2010 +0100
@@ -124,6 +124,9 @@
help=('Run a locally built program; argument can be a program name,'
' or a command starting with the program name.'),
type="string", default='', dest='run')
+ opt.add_option('--visualize',
+ help=('Modify --run arguments to enable the visualizer'),
+ action="store_true", default=False, dest='visualize')
opt.add_option('--command-template',
help=('Template of the command used to run the program given by --run;'
' It should be a shell command string containing %s inside,'
@@ -639,11 +642,13 @@
lcov_report()
if Options.options.run:
- wutils.run_program(Options.options.run, env, wutils.get_command_template(env))
+ wutils.run_program(Options.options.run, env, wutils.get_command_template(env),
+ visualize=Options.options.visualize)
raise SystemExit(0)
if Options.options.pyrun:
- wutils.run_python_program(Options.options.pyrun, env)
+ wutils.run_python_program(Options.options.pyrun, env,
+ visualize=Options.options.visualize)
raise SystemExit(0)
if Options.options.shell:
--- a/wutils.py Tue Dec 21 17:39:54 2010 +0100
+++ b/wutils.py Tue Dec 21 17:46:35 2010 +0100
@@ -100,10 +100,11 @@
proc_env[pathvar] = os.pathsep.join(list(env['NS3_MODULE_PATH']))
pymoddir = bld.path.find_dir('bindings/python').abspath(env)
+ pyvizdir = bld.path.find_dir('src/tools/visualizer').abspath()
if 'PYTHONPATH' in proc_env:
- proc_env['PYTHONPATH'] = os.pathsep.join([pymoddir] + [proc_env['PYTHONPATH']])
+ proc_env['PYTHONPATH'] = os.pathsep.join([pymoddir, pyvizdir] + [proc_env['PYTHONPATH']])
else:
- proc_env['PYTHONPATH'] = pymoddir
+ proc_env['PYTHONPATH'] = os.pathsep.join([pymoddir, pyvizdir])
if 'PATH' in proc_env:
proc_env['PATH'] = os.pathsep.join(list(env['NS3_EXECUTABLE_PATH']) + [proc_env['PATH']])
@@ -201,7 +202,7 @@
#print "%r ==shlex.split==> %r" % (command_template % (program_node.abspath(env),), execvec)
return program_name, execvec
-def run_program(program_string, env, command_template=None, cwd=None):
+def run_program(program_string, env, command_template=None, cwd=None, visualize=False):
"""
if command_template is not None, then program_string == program
name and argv is given by command_template with %s replaced by the
@@ -214,17 +215,21 @@
cwd = Options.options.cwd_launch
else:
cwd = Options.cwd_launch
+ if visualize:
+ execvec.append("--SimulatorImplementationType=ns3::VisualSimulatorImpl")
return run_argv(execvec, env, cwd=cwd)
-def run_python_program(program_string, env):
+def run_python_program(program_string, env, visualize=False):
env = bld.env
execvec = shlex.split(program_string)
if (Options.options.cwd_launch):
cwd = Options.options.cwd_launch
else:
cwd = Options.cwd_launch
+ if visualize:
+ execvec.append("--SimulatorImplementationType=ns3::VisualSimulatorImpl")
return run_argv([env['PYTHON']] + execvec, env, cwd=cwd)