From d1b501f370b61709a8613d507f551e24668ad1bd Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Wed, 18 Feb 2009 12:23:08 +0000 Subject: [PATCH 01/12] Python: wrap std::ostream/ofstream, for ascii tracing. --- bindings/python/ns3modulegen.py | 1 + .../python/ns3modulegen_core_customizations.py | 17 +++++++++++++++++ bindings/python/wscript | 2 +- examples/wifi-ap.py | 4 ++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/bindings/python/ns3modulegen.py b/bindings/python/ns3modulegen.py index a54fb5768..e3dd6790b 100755 --- a/bindings/python/ns3modulegen.py +++ b/bindings/python/ns3modulegen.py @@ -86,6 +86,7 @@ def main(): ns3modulegen_core_customizations.Simulator_customizations(root_module) ns3modulegen_core_customizations.CommandLine_customizations(root_module) ns3modulegen_core_customizations.TypeId_customizations(root_module) + ns3modulegen_core_customizations.add_std_ofstream(root_module) for local_module in LOCAL_MODULES: diff --git a/bindings/python/ns3modulegen_core_customizations.py b/bindings/python/ns3modulegen_core_customizations.py index d89c525b0..8ad75632f 100644 --- a/bindings/python/ns3modulegen_core_customizations.py +++ b/bindings/python/ns3modulegen_core_customizations.py @@ -530,3 +530,20 @@ def TypeId_customizations(module): flags=["METH_VARARGS", "METH_KEYWORDS", "METH_STATIC"]) +def add_std_ofstream(module): + module.add_include('') + ostream = module.add_class('ostream', foreign_cpp_namespace='::std') + ostream.set_cannot_be_constructed("abstract base class") + ofstream = module.add_class('ofstream', foreign_cpp_namespace='::std', parent=ostream) + ofstream.add_enum('openmode', [ + ('app', 'std::ios_base::app'), + ('ate', 'std::ios_base::ate'), + ('binary', 'std::ios_base::binary'), + ('in', 'std::ios_base::in'), + ('out', 'std::ios_base::out'), + ('trunc', 'std::ios_base::trunc'), + ]) + ofstream.add_constructor([Parameter.new("const char *", 'filename'), + Parameter.new("::std::ofstream::openmode", 'mode', default_value="std::ios_base::out")]) + ofstream.add_method('close', None, []) + diff --git a/bindings/python/wscript b/bindings/python/wscript index 403cbca07..d30b668c9 100644 --- a/bindings/python/wscript +++ b/bindings/python/wscript @@ -15,7 +15,7 @@ import Build import Utils ## https://launchpad.net/pybindgen/ -REQUIRED_PYBINDGEN_VERSION = (0, 9, 0, 605) +REQUIRED_PYBINDGEN_VERSION = (0, 10, 0, 626) REQUIRED_PYGCCXML_VERSION = (0, 9, 5) diff --git a/examples/wifi-ap.py b/examples/wifi-ap.py index 75f180d48..d02b5ad7b 100644 --- a/examples/wifi-ap.py +++ b/examples/wifi-ap.py @@ -154,9 +154,13 @@ def main(argv): # Config::Connect ("/NodeList/*/DeviceList/*/Phy/Tx", MakeCallback (&PhyTxTrace)); # Config::Connect ("/NodeList/*/DeviceList/*/Phy/State", MakeCallback (&PhyStateTrace)); + ascii = ns3.ofstream("wifi-ap.tr") + ns3.YansWifiPhyHelper.EnableAsciiAll(ascii) + ns3.Simulator.Run() ns3.Simulator.Destroy() + ascii.close() return 0 From 561ede7d42181c32bc5039ea51028c9ececcf9f6 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Wed, 18 Feb 2009 18:31:57 -0800 Subject: [PATCH 02/12] clean up transmit abort nonsense --- src/devices/csma/csma-net-device.cc | 61 ++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 9 deletions(-) diff --git a/src/devices/csma/csma-net-device.cc b/src/devices/csma/csma-net-device.cc index 9999d6df2..32f20b809 100644 --- a/src/devices/csma/csma-net-device.cc +++ b/src/devices/csma/csma-net-device.cc @@ -411,10 +411,15 @@ CsmaNetDevice::TransmitStart () { NS_LOG_FUNCTION_NOARGS (); + // + // This function is called to start the process of transmitting a packet. We + // expect that a Ptr to the packet to be transmitted has been placed in + // m_currentPkt. + NS_LOG_LOGIC ("m_currentPkt=" << m_currentPkt); NS_LOG_LOGIC ("UID is " << m_currentPkt->GetUid ()); + // - // This function is called to start the process of transmitting a packet. // We need to tell the channel that we've started wiggling the wire and // schedule an event that will be executed when it's time to tell the // channel that we're done wiggling the wire. @@ -487,20 +492,43 @@ CsmaNetDevice::TransmitAbort (void) { NS_LOG_FUNCTION_NOARGS (); + // + // When we started transmitting the current packet, it was placed in + // m_currentPkt. So we had better find one there. + // + NS_ASSERT_MSG (m_currentPkt != 0, "CsmaNetDevice::TransmitAbort(): m_currentPkt zero"); + NS_LOG_LOGIC ("m_currentPkt=" << m_currentPkt); NS_LOG_LOGIC ("Pkt UID is " << m_currentPkt->GetUid () << ")"); // - // Since we were transmitting a packet, that packet had better be on the transmit queue. + // Hit the drop trace source. // - m_currentPkt = m_queue->Dequeue (); - NS_ASSERT_MSG (m_currentPkt != 0, "No Packet on queue during CsmaNetDevice::TransmitAbort()"); + // XXX Should there be a separate transmit drop trace? + // + m_dropTrace (m_currentPkt); - // - // The last one failed. Let's try to transmit the next one (if there) + // + // We're done with that one, so reset the backoff algorithm and ready the + // transmit state machine. // m_backoff.ResetBackoffTime (); m_txMachineState = READY; - TransmitStart (); + + // + // If there is another packet on the input queue, we need to start trying to + // get that out. If the queue is empty we just wait until someone puts one + // in. + // + if (m_queue->IsEmpty ()) + { + return; + } + else + { + m_currentPkt = m_queue->Dequeue (); + NS_ASSERT_MSG (m_currentPkt != 0, "CsmaNetDevice::TransmitAbort(): IsEmpty false but no Packet on queue?"); + TransmitStart (); + } } void @@ -514,11 +542,18 @@ CsmaNetDevice::TransmitCompleteEvent (void) // schedule an event that will be executed when it's time to re-enable // the transmitter after the interframe gap. // - NS_ASSERT_MSG (m_txMachineState == BUSY, "Must be BUSY if transmitting"); + NS_ASSERT_MSG (m_txMachineState == BUSY, "CsmaNetDevice::transmitCompleteEvent(): Must be BUSY if transmitting"); NS_ASSERT (m_channel->GetState () == TRANSMITTING); m_txMachineState = GAP; + // + // When we started transmitting the current packet, it was placed in + // m_currentPkt. So we had better find one there. + // + NS_ASSERT_MSG (m_currentPkt != 0, "CsmaNetDevice::TransmitCompleteEvent(): m_currentPkt zero"); + NS_LOG_LOGIC ("m_currentPkt=" << m_currentPkt); NS_LOG_LOGIC ("Pkt UID is " << m_currentPkt->GetUid () << ")"); + m_channel->TransmitEnd (); NS_LOG_LOGIC ("Schedule TransmitReadyEvent in " << m_tInterframeGap.GetSeconds () << "sec"); @@ -536,9 +571,17 @@ CsmaNetDevice::TransmitReadyEvent (void) // gap has passed. If there are pending transmissions, we use this opportunity // to start the next transmit. // - NS_ASSERT_MSG (m_txMachineState == GAP, "Must be in interframe gap"); + NS_ASSERT_MSG (m_txMachineState == GAP, "CsmaNetDevice::TransmitReadyEvent(): Must be in interframe gap"); m_txMachineState = READY; + // + // When we started transmitting the current packet, it was placed in + // m_currentPkt. So we had better find one there. + // + NS_ASSERT_MSG (m_currentPkt != 0, "CsmaNetDevice::TransmitCompleteEvent(): m_currentPkt zero"); + NS_LOG_LOGIC ("m_currentPkt=" << m_currentPkt); + NS_LOG_LOGIC ("Pkt UID is " << m_currentPkt->GetUid () << ")"); + // // Get the next packet from the queue for transmitting // From be94ad4fed0a837b5d523b490b13a59bb145e7c1 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Wed, 18 Feb 2009 22:19:20 -0800 Subject: [PATCH 03/12] add byte mode --- src/node/drop-tail-queue.cc | 52 ++++++++++++++++++++++++++++++++++--- src/node/drop-tail-queue.h | 29 ++++++++++++++++++++- 2 files changed, 77 insertions(+), 4 deletions(-) diff --git a/src/node/drop-tail-queue.cc b/src/node/drop-tail-queue.cc index 5a119c9e6..cccf58cfc 100644 --- a/src/node/drop-tail-queue.cc +++ b/src/node/drop-tail-queue.cc @@ -17,6 +17,7 @@ */ #include "ns3/log.h" +#include "ns3/enum.h" #include "ns3/uinteger.h" #include "drop-tail-queue.h" @@ -31,10 +32,22 @@ TypeId DropTailQueue::GetTypeId (void) static TypeId tid = TypeId ("ns3::DropTailQueue") .SetParent () .AddConstructor () - .AddAttribute ("MaxPackets", "The maximum number of packets accepted by this DropTailQueue.", + .AddAttribute ("Mode", + "Whether to use Bytes (see MaxBytes) or Packets (see MaxPackets) as the maximum queue size metric.", + EnumValue (PACKETS), + MakeEnumAccessor (&DropTailQueue::SetMode), + MakeEnumChecker (BYTES, "Bytes", + PACKETS, "Packets")) + .AddAttribute ("MaxPackets", + "The maximum number of packets accepted by this DropTailQueue.", UintegerValue (100), MakeUintegerAccessor (&DropTailQueue::m_maxPackets), MakeUintegerChecker ()) + .AddAttribute ("MaxBytes", + "The maximum number of bytes accepted by this DropTailQueue.", + UintegerValue (100 * 65535), + MakeUintegerAccessor (&DropTailQueue::m_maxBytes), + MakeUintegerChecker ()) ; return tid; @@ -52,19 +65,45 @@ DropTailQueue::~DropTailQueue () NS_LOG_FUNCTION_NOARGS (); } + void +DropTailQueue::SetMode (enum Mode mode) +{ + NS_LOG_FUNCTION (mode); + m_mode = mode; +} + + DropTailQueue::Mode +DropTailQueue::GetMode (void) +{ + NS_LOG_FUNCTION_NOARGS (); + return m_mode; +} + bool DropTailQueue::DoEnqueue (Ptr p) { NS_LOG_FUNCTION (this << p); - if (m_packets.size () >= m_maxPackets) + if (m_mode == PACKETS && (m_packets.size () >= m_maxPackets)) { - NS_LOG_LOGIC ("Queue full -- droppping pkt"); + NS_LOG_LOGIC ("Queue full (at max packets) -- droppping pkt"); Drop (p); return false; } + if (m_mode == BYTES && (m_bytesInQueue + p->GetSize () >= m_maxBytes)) + { + NS_LOG_LOGIC ("Queue full (packet would exceed max bytes) -- droppping pkt"); + Drop (p); + return false; + } + + m_bytesInQueue += p->GetSize (); m_packets.push(p); + + NS_LOG_LOGIC ("Number packets " << m_packets.size ()); + NS_LOG_LOGIC ("Number bytes " << m_bytesInQueue); + return true; } @@ -81,9 +120,13 @@ DropTailQueue::DoDequeue (void) Ptr p = m_packets.front (); m_packets.pop (); + m_bytesInQueue -= p->GetSize (); NS_LOG_LOGIC ("Popped " << p); + NS_LOG_LOGIC ("Number packets " << m_packets.size ()); + NS_LOG_LOGIC ("Number bytes " << m_bytesInQueue); + return p; } @@ -100,6 +143,9 @@ DropTailQueue::DoPeek (void) const Ptr p = m_packets.front (); + NS_LOG_LOGIC ("Number packets " << m_packets.size ()); + NS_LOG_LOGIC ("Number bytes " << m_bytesInQueue); + return p; } diff --git a/src/node/drop-tail-queue.h b/src/node/drop-tail-queue.h index 17d97c85f..b534932b7 100644 --- a/src/node/drop-tail-queue.h +++ b/src/node/drop-tail-queue.h @@ -44,14 +44,41 @@ public: virtual ~DropTailQueue(); + /** + * Enumeration of the modes supported in the class. + * + */ + enum Mode { + ILLEGAL, /**< Mode not set */ + PACKETS, /**< Use number of packets for maximum queue size */ + BYTES, /**< Use number of bytes for maximum queue size */ + }; + + /** + * Set the operating mode of this device. + * + * \param mode The operating mode of this device. + * + */ + void SetMode (DropTailQueue::Mode mode); + + /** + * Get the encapsulation mode of this device. + * + * \returns The encapsulation mode of this device. + */ + DropTailQueue::Mode GetMode (void); + private: virtual bool DoEnqueue (Ptr p); virtual Ptr DoDequeue (void); virtual Ptr DoPeek (void) const; -private: std::queue > m_packets; uint32_t m_maxPackets; + uint32_t m_maxBytes; + uint32_t m_bytesInQueue; + Mode m_mode; }; }; // namespace ns3 From 9c653b5afafca699d84169f234a64c30bee12816 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Wed, 18 Feb 2009 22:32:09 -0800 Subject: [PATCH 04/12] quiet second.cc and third.cc when running as regression tests --- examples/second.cc | 11 +++++++++-- examples/third.cc | 12 ++++++++++-- regression/tests/test-second.py | 4 +++- regression/tests/test-third.py | 4 +++- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/examples/second.cc b/examples/second.cc index 7bfbea698..2bc3ceb67 100644 --- a/examples/second.cc +++ b/examples/second.cc @@ -36,16 +36,23 @@ NS_LOG_COMPONENT_DEFINE ("SecondScriptExample"); int main (int argc, char *argv[]) { - LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO); - LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO); + bool verbose = true; RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8); uint32_t nCsma = 3; CommandLine cmd; cmd.AddValue ("nCsma", "Number of \"extra\" CSMA nodes/devices", nCsma); + cmd.AddValue ("verbose", "Tell echo applications to log if true", verbose); + cmd.Parse (argc,argv); + if (verbose) + { + LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO); + LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO); + } + NodeContainer p2pNodes; p2pNodes.Create (2); diff --git a/examples/third.cc b/examples/third.cc index dbf652f29..7f7a98249 100644 --- a/examples/third.cc +++ b/examples/third.cc @@ -40,8 +40,8 @@ NS_LOG_COMPONENT_DEFINE ("ThirdScriptExample"); int main (int argc, char *argv[]) { - LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO); - LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO); + + bool verbose = true; RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8); @@ -50,8 +50,16 @@ main (int argc, char *argv[]) CommandLine cmd; cmd.AddValue ("nCsma", "Number of \"extra\" CSMA nodes/devices", nCsma); cmd.AddValue ("nWifi", "Number of wifi STA devices", nWifi); + cmd.AddValue ("verbose", "Tell echo applications to log if true", verbose); + cmd.Parse (argc,argv); + if (verbose) + { + LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO); + LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO); + } + NodeContainer p2pNodes; p2pNodes.Create (2); diff --git a/regression/tests/test-second.py b/regression/tests/test-second.py index 4c77bc125..9009f007c 100644 --- a/regression/tests/test-second.py +++ b/regression/tests/test-second.py @@ -1,4 +1,6 @@ #! /usr/bin/env python -"""Generic trace-comparison-type regression test.""" +"""Compare that Second generates correct traces.""" + +arguments = ["--verbose=0"] diff --git a/regression/tests/test-third.py b/regression/tests/test-third.py index 4c77bc125..73a96ee74 100644 --- a/regression/tests/test-third.py +++ b/regression/tests/test-third.py @@ -1,4 +1,6 @@ #! /usr/bin/env python -"""Generic trace-comparison-type regression test.""" +"""Compare that Third generates correct traces.""" + +arguments = ["--verbose=0"] From 6945d470687f9bd58679c01d2bcfd29025825b12 Mon Sep 17 00:00:00 2001 From: Aleksey Kovalenko Date: Sat, 21 Feb 2009 22:09:08 +0000 Subject: [PATCH 05/12] Optimize Send/SendFrom on BridgeNetDevice by using the learned MAC associations when possible, instead of flooding to all bridge ports. --- src/devices/bridge/bridge-net-device.cc | 26 ++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/devices/bridge/bridge-net-device.cc b/src/devices/bridge/bridge-net-device.cc index a8e018a10..fa314928b 100644 --- a/src/devices/bridge/bridge-net-device.cc +++ b/src/devices/bridge/bridge-net-device.cc @@ -370,22 +370,30 @@ bool BridgeNetDevice::Send (Ptr packet, const Address& dest, uint16_t protocolNumber) { NS_LOG_FUNCTION_NOARGS (); - for (std::vector< Ptr >::iterator iter = m_ports.begin (); - iter != m_ports.end (); iter++) - { - Ptr port = *iter; - port->SendFrom (packet, m_address, dest, protocolNumber); - } - - return true; + return SendFrom (packet, m_address, dest, protocolNumber); } bool BridgeNetDevice::SendFrom (Ptr packet, const Address& src, const Address& dest, uint16_t protocolNumber) { NS_LOG_FUNCTION_NOARGS (); + Mac48Address dst = Mac48Address::ConvertFrom (dest); + + // try to use the learned state if data is unicast + if (!dst.IsGroup ()) + { + Ptr outPort = GetLearnedState (dst); + if (outPort != NULL) + { + outPort->SendFrom (packet, src, dest, protocolNumber); + return true; + } + } + + // data was not unicast or no state has been learned for that mac + // address => flood through all ports. for (std::vector< Ptr >::iterator iter = m_ports.begin (); - iter != m_ports.end (); iter++) + iter != m_ports.end (); iter++) { Ptr port = *iter; port->SendFrom (packet, src, dest, protocolNumber); From ffdb250c3e0e57701cd0e64000cc94d83ee99207 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Sat, 21 Feb 2009 14:46:11 -0800 Subject: [PATCH 06/12] bug 506 -- remove name version of SetPositionAllocator --- src/helper/mobility-helper.cc | 7 +------ src/helper/mobility-helper.h | 7 ------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/helper/mobility-helper.cc b/src/helper/mobility-helper.cc index 1b71b3f14..34ad62e81 100644 --- a/src/helper/mobility-helper.cc +++ b/src/helper/mobility-helper.cc @@ -46,12 +46,7 @@ MobilityHelper::SetPositionAllocator (Ptr allocator) { m_position = allocator; } -void -MobilityHelper::SetPositionAllocator (std::string allocatorName) -{ - Ptr allocator = Names::Find (allocatorName); - m_position = allocator; -} + void MobilityHelper::SetPositionAllocator (std::string type, std::string n1, const AttributeValue &v1, diff --git a/src/helper/mobility-helper.h b/src/helper/mobility-helper.h index 011b5e8c3..99d4e9b61 100644 --- a/src/helper/mobility-helper.h +++ b/src/helper/mobility-helper.h @@ -50,13 +50,6 @@ public: * \param allocator allocate initial node positions */ void SetPositionAllocator (Ptr allocator); - /** - * Set the position allocator which will be used to allocate the initial - * position of every node initialized during MobilityModel::Install. - * - * \param allocator allocate initial node positions - */ - void SetPositionAllocator (std::string allocatorName); /** * \param type the type of mobility model to use. From a559b31710ee92007cba6704439b384ac24f148c Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Sat, 21 Feb 2009 22:50:04 +0000 Subject: [PATCH 07/12] For regression testing, use python modules filecmp and difflib instead of an external diff command, to improve portability (e.g. mingw). Closes #330. --- regression.py | 38 +++++++++++++++++++++++++++----------- wscript | 6 ------ 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/regression.py b/regression.py index fd0a6fdfe..161f8b79b 100644 --- a/regression.py +++ b/regression.py @@ -37,6 +37,30 @@ def _find_tests(testdir): tests.sort() return tests +def diff(dir1, dir2, verbose): + import filecmp + comp = filecmp.dircmp(dir1, dir2) + differ = (comp.left_only or comp.right_only or comp.diff_files) + if differ: + if verbose: + comp.report() + import difflib + for diff_fname in comp.diff_files: + if not (diff_fname.endswith(".tr") or diff_fname.endswith(".mob")): + print "The different file %r does not sound like a text file, not compared." % (diff_fname,) + diff_file1 = open(os.path.join(dir1, diff_fname), "rt").readlines() + diff_file2 = open(os.path.join(dir2, diff_fname), "rt").readlines() + diff = difflib.unified_diff(diff_file1, diff_file2) + count = 0 + print "Differences in file %r" % (diff_fname,) + for line in diff: + print line + count += 1 + if count > 100: + break + return 1 + else: + return 0 class regression_test_task(Task.TaskBase): after = 'cc cxx cc_link cxx_link' @@ -136,17 +160,7 @@ class regression_test_task(Task.TaskBase): print >> sys.stderr, ex return 1 - if Options.options.verbose: - #diffCmd = "diff traces " + refTestDirName + " | head" - diffCmd = subprocess.Popen([self.env['DIFF'], trace_output_path, reference_traces_path], - stdout=subprocess.PIPE) - headCmd = subprocess.Popen("head", stdin=diffCmd.stdout) - rc2 = headCmd.wait() - diffCmd.stdout.close() - rc1 = diffCmd.wait() - rc = rc1 or rc2 - else: - rc = subprocess.Popen([self.env['DIFF'], trace_output_path, reference_traces_path], stdout=dev_null()).wait() + rc = diff(trace_output_path, reference_traces_path, Options.options.verbose) if rc: print "----------" print "Traces differ in test: ", self.test_name @@ -154,6 +168,8 @@ class regression_test_task(Task.TaskBase): print "Traces in directory: " + trace_output_path print "Run the following command for details:" print "\tdiff -u %s %s" % (reference_traces_path, trace_output_path) + if not Options.options.verbose: + print "Or re-run regression testing with option -v" print "----------" return rc diff --git a/wscript b/wscript index c59d52d89..b1a288ddd 100644 --- a/wscript +++ b/wscript @@ -256,9 +256,6 @@ def configure(conf): conf.env['NS3_ENABLED_MODULES'] = ['ns3-'+mod for mod in Options.options.enable_modules.split(',')] - # we cannot run regression tests without diff - conf.find_program('diff', var='DIFF') - # for suid bits conf.find_program('sudo', var='SUDO') @@ -464,9 +461,6 @@ def build(bld): Options.options.compile_targets = os.path.basename(program_name) if Options.options.regression or Options.options.regression_generate: - if not env['DIFF']: - raise Utils.WafError("Cannot run regression tests: the 'diff' program is not installed.") - regression_traces = env['REGRESSION_TRACES'] if not regression_traces: raise Utils.WafError("Cannot run regression tests: reference traces directory not given" From f00e2d7b1189596d860d38f280438b065857b891 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Sat, 21 Feb 2009 23:19:18 +0000 Subject: [PATCH 08/12] Rescan python bindings. --- bindings/python/ns3_module_core.py | 59 +++++- bindings/python/ns3_module_helper.py | 195 +++++++++++++++++- bindings/python/ns3_module_node.py | 10 + bindings/python/ns3_module_simulator.py | 42 ++++ bindings/python/ns3_module_tap_bridge.py | 235 ++++++++++++++++++++++ bindings/python/ns3modulegen_generated.py | 170 +++++++++------- 6 files changed, 639 insertions(+), 72 deletions(-) create mode 100644 bindings/python/ns3_module_tap_bridge.py diff --git a/bindings/python/ns3_module_core.py b/bindings/python/ns3_module_core.py index dc4b76aec..70b24cfea 100644 --- a/bindings/python/ns3_module_core.py +++ b/bindings/python/ns3_module_core.py @@ -45,6 +45,8 @@ def register_types(module): module.add_class('IntToType', template_parameters=['6']) ## int-to-type.h: ns3::IntToType<6>::v_e [enumeration] module.add_enum('v_e', ['value'], outer_class=root_module['ns3::IntToType< 6 >']) + ## names.h: ns3::Names [class] + module.add_class('Names') ## object-base.h: ns3::ObjectBase [class] module.add_class('ObjectBase', allow_subclassing=True) ## object-factory.h: ns3::ObjectFactory [class] @@ -223,6 +225,7 @@ def register_methods(root_module): register_Ns3IntToType__4_methods(root_module, root_module['ns3::IntToType< 4 >']) register_Ns3IntToType__5_methods(root_module, root_module['ns3::IntToType< 5 >']) register_Ns3IntToType__6_methods(root_module, root_module['ns3::IntToType< 6 >']) + register_Ns3Names_methods(root_module, root_module['ns3::Names']) register_Ns3ObjectBase_methods(root_module, root_module['ns3::ObjectBase']) register_Ns3ObjectFactory_methods(root_module, root_module['ns3::ObjectFactory']) register_Ns3RandomVariable_methods(root_module, root_module['ns3::RandomVariable']) @@ -463,6 +466,58 @@ def register_Ns3IntToType__6_methods(root_module, cls): cls.add_constructor([]) return +def register_Ns3Names_methods(root_module, cls): + ## names.h: ns3::Names::Names(ns3::Names const & arg0) [copy constructor] + cls.add_constructor([param('ns3::Names const &', 'arg0')]) + ## names.h: ns3::Names::Names() [constructor] + cls.add_constructor([]) + ## names.h: static bool ns3::Names::Add(std::string name, ns3::Ptr obj) [member function] + cls.add_method('Add', + 'bool', + [param('std::string', 'name'), param('ns3::Ptr< ns3::Object >', 'obj')], + is_static=True) + ## names.h: static bool ns3::Names::Add(std::string path, std::string name, ns3::Ptr object) [member function] + cls.add_method('Add', + 'bool', + [param('std::string', 'path'), param('std::string', 'name'), param('ns3::Ptr< ns3::Object >', 'object')], + is_static=True) + ## names.h: static bool ns3::Names::Add(ns3::Ptr context, std::string name, ns3::Ptr object) [member function] + cls.add_method('Add', + 'bool', + [param('ns3::Ptr< ns3::Object >', 'context'), param('std::string', 'name'), param('ns3::Ptr< ns3::Object >', 'object')], + is_static=True) + ## names.h: static bool ns3::Names::Rename(std::string oldpath, std::string newname) [member function] + cls.add_method('Rename', + 'bool', + [param('std::string', 'oldpath'), param('std::string', 'newname')], + is_static=True) + ## names.h: static bool ns3::Names::Rename(std::string path, std::string oldname, std::string newname) [member function] + cls.add_method('Rename', + 'bool', + [param('std::string', 'path'), param('std::string', 'oldname'), param('std::string', 'newname')], + is_static=True) + ## names.h: static bool ns3::Names::Rename(ns3::Ptr context, std::string oldname, std::string newname) [member function] + cls.add_method('Rename', + 'bool', + [param('ns3::Ptr< ns3::Object >', 'context'), param('std::string', 'oldname'), param('std::string', 'newname')], + is_static=True) + ## names.h: static std::string ns3::Names::FindName(ns3::Ptr object) [member function] + cls.add_method('FindName', + 'std::string', + [param('ns3::Ptr< ns3::Object >', 'object')], + is_static=True) + ## names.h: static std::string ns3::Names::FindPath(ns3::Ptr object) [member function] + cls.add_method('FindPath', + 'std::string', + [param('ns3::Ptr< ns3::Object >', 'object')], + is_static=True) + ## names.h: static void ns3::Names::Delete() [member function] + cls.add_method('Delete', + 'void', + [], + is_static=True) + return + def register_Ns3ObjectBase_methods(root_module, cls): ## object-base.h: ns3::ObjectBase::ObjectBase(ns3::ObjectBase const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectBase const &', 'arg0')]) @@ -2062,7 +2117,7 @@ def register_functions(root_module): module.add_function('TypeNameGet', 'std::string', [], - template_parameters=['long long']) + template_parameters=['long']) ## type-name.h: extern std::string ns3::TypeNameGet() [free function] module.add_function('TypeNameGet', 'std::string', @@ -2082,7 +2137,7 @@ def register_functions(root_module): module.add_function('TypeNameGet', 'std::string', [], - template_parameters=['unsigned long long']) + template_parameters=['unsigned long']) ## type-name.h: extern std::string ns3::TypeNameGet() [free function] module.add_function('TypeNameGet', 'std::string', diff --git a/bindings/python/ns3_module_helper.py b/bindings/python/ns3_module_helper.py index 8744186c1..7fe0ad665 100644 --- a/bindings/python/ns3_module_helper.py +++ b/bindings/python/ns3_module_helper.py @@ -37,6 +37,8 @@ def register_types(module): module.add_class('PointToPointHelper', allow_subclassing=False) ## static-multicast-route-helper.h: ns3::StaticMulticastRouteHelper [class] module.add_class('StaticMulticastRouteHelper', allow_subclassing=False) + ## tap-bridge-helper.h: ns3::TapBridgeHelper [class] + module.add_class('TapBridgeHelper', allow_subclassing=False) ## udp-echo-helper.h: ns3::UdpEchoClientHelper [class] module.add_class('UdpEchoClientHelper', allow_subclassing=False) ## udp-echo-helper.h: ns3::UdpEchoServerHelper [class] @@ -110,6 +112,7 @@ def register_methods(root_module): register_Ns3PacketSocketHelper_methods(root_module, root_module['ns3::PacketSocketHelper']) register_Ns3PointToPointHelper_methods(root_module, root_module['ns3::PointToPointHelper']) register_Ns3StaticMulticastRouteHelper_methods(root_module, root_module['ns3::StaticMulticastRouteHelper']) + register_Ns3TapBridgeHelper_methods(root_module, root_module['ns3::TapBridgeHelper']) register_Ns3UdpEchoClientHelper_methods(root_module, root_module['ns3::UdpEchoClientHelper']) register_Ns3UdpEchoServerHelper_methods(root_module, root_module['ns3::UdpEchoServerHelper']) register_Ns3V4PingHelper_methods(root_module, root_module['ns3::V4PingHelper']) @@ -126,6 +129,8 @@ def register_Ns3ApplicationContainer_methods(root_module, cls): cls.add_constructor([]) ## application-container.h: ns3::ApplicationContainer::ApplicationContainer(ns3::Ptr application) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::Application >', 'application')]) + ## application-container.h: ns3::ApplicationContainer::ApplicationContainer(std::string name) [constructor] + cls.add_constructor([param('std::string', 'name')]) ## application-container.h: __gnu_cxx::__normal_iterator*,std::vector, std::allocator > > > ns3::ApplicationContainer::Begin() const [member function] cls.add_method('Begin', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Application > const, std::vector< ns3::Ptr< ns3::Application > > >', @@ -154,6 +159,10 @@ def register_Ns3ApplicationContainer_methods(root_module, cls): cls.add_method('Add', 'void', [param('ns3::Ptr< ns3::Application >', 'application')]) + ## application-container.h: void ns3::ApplicationContainer::Add(std::string name) [member function] + cls.add_method('Add', + 'void', + [param('std::string', 'name')]) ## application-container.h: void ns3::ApplicationContainer::Start(ns3::Time start) [member function] cls.add_method('Start', 'void', @@ -177,6 +186,10 @@ def register_Ns3BridgeHelper_methods(root_module, cls): cls.add_method('Install', 'ns3::NetDeviceContainer', [param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::NetDeviceContainer', 'c')]) + ## bridge-helper.h: ns3::NetDeviceContainer ns3::BridgeHelper::Install(std::string nodeName, ns3::NetDeviceContainer c) [member function] + cls.add_method('Install', + 'ns3::NetDeviceContainer', + [param('std::string', 'nodeName'), param('ns3::NetDeviceContainer', 'c')]) return def register_Ns3CsmaHelper_methods(root_module, cls): @@ -251,11 +264,31 @@ def register_Ns3CsmaHelper_methods(root_module, cls): 'ns3::NetDeviceContainer', [param('ns3::Ptr< ns3::Node >', 'node')], is_const=True) + ## csma-helper.h: ns3::NetDeviceContainer ns3::CsmaHelper::Install(std::string name) const [member function] + cls.add_method('Install', + 'ns3::NetDeviceContainer', + [param('std::string', 'name')], + is_const=True) ## csma-helper.h: ns3::NetDeviceContainer ns3::CsmaHelper::Install(ns3::Ptr node, ns3::Ptr channel) const [member function] cls.add_method('Install', 'ns3::NetDeviceContainer', [param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::Ptr< ns3::CsmaChannel >', 'channel')], is_const=True) + ## csma-helper.h: ns3::NetDeviceContainer ns3::CsmaHelper::Install(ns3::Ptr node, std::string channelName) const [member function] + cls.add_method('Install', + 'ns3::NetDeviceContainer', + [param('ns3::Ptr< ns3::Node >', 'node'), param('std::string', 'channelName')], + is_const=True) + ## csma-helper.h: ns3::NetDeviceContainer ns3::CsmaHelper::Install(std::string nodeName, ns3::Ptr channel) const [member function] + cls.add_method('Install', + 'ns3::NetDeviceContainer', + [param('std::string', 'nodeName'), param('ns3::Ptr< ns3::CsmaChannel >', 'channel')], + is_const=True) + ## csma-helper.h: ns3::NetDeviceContainer ns3::CsmaHelper::Install(std::string nodeName, std::string channelName) const [member function] + cls.add_method('Install', + 'ns3::NetDeviceContainer', + [param('std::string', 'nodeName'), param('std::string', 'channelName')], + is_const=True) ## csma-helper.h: ns3::NetDeviceContainer ns3::CsmaHelper::Install(ns3::NodeContainer const & c) const [member function] cls.add_method('Install', 'ns3::NetDeviceContainer', @@ -266,10 +299,19 @@ def register_Ns3CsmaHelper_methods(root_module, cls): 'ns3::NetDeviceContainer', [param('ns3::NodeContainer const &', 'c'), param('ns3::Ptr< ns3::CsmaChannel >', 'channel')], is_const=True) + ## csma-helper.h: ns3::NetDeviceContainer ns3::CsmaHelper::Install(ns3::NodeContainer const & c, std::string channelName) const [member function] + cls.add_method('Install', + 'ns3::NetDeviceContainer', + [param('ns3::NodeContainer const &', 'c'), param('std::string', 'channelName')], + is_const=True) ## csma-helper.h: void ns3::CsmaHelper::InstallStar(ns3::Ptr hub, ns3::NodeContainer spokes, ns3::NetDeviceContainer & hubDevices, ns3::NetDeviceContainer & spokeDevices) [member function] cls.add_method('InstallStar', 'void', [param('ns3::Ptr< ns3::Node >', 'hub'), param('ns3::NodeContainer', 'spokes'), param('ns3::NetDeviceContainer &', 'hubDevices'), param('ns3::NetDeviceContainer &', 'spokeDevices')]) + ## csma-helper.h: void ns3::CsmaHelper::InstallStar(std::string hubName, ns3::NodeContainer spokes, ns3::NetDeviceContainer & hubDevices, ns3::NetDeviceContainer & spokeDevices) [member function] + cls.add_method('InstallStar', + 'void', + [param('std::string', 'hubName'), param('ns3::NodeContainer', 'spokes'), param('ns3::NetDeviceContainer &', 'hubDevices'), param('ns3::NetDeviceContainer &', 'spokeDevices')]) return def register_Ns3EmuHelper_methods(root_module, cls): @@ -330,6 +372,11 @@ def register_Ns3EmuHelper_methods(root_module, cls): 'ns3::NetDeviceContainer', [param('ns3::Ptr< ns3::Node >', 'node')], is_const=True) + ## emu-helper.h: ns3::NetDeviceContainer ns3::EmuHelper::Install(std::string nodeName) const [member function] + cls.add_method('Install', + 'ns3::NetDeviceContainer', + [param('std::string', 'nodeName')], + is_const=True) ## emu-helper.h: ns3::NetDeviceContainer ns3::EmuHelper::Install(ns3::NodeContainer const & c) const [member function] cls.add_method('Install', 'ns3::NetDeviceContainer', @@ -342,6 +389,11 @@ def register_Ns3InternetStackHelper_methods(root_module, cls): cls.add_constructor([param('ns3::InternetStackHelper const &', 'arg0')]) ## internet-stack-helper.h: ns3::InternetStackHelper::InternetStackHelper() [constructor] cls.add_constructor([]) + ## internet-stack-helper.h: void ns3::InternetStackHelper::Install(std::string nodeName) const [member function] + cls.add_method('Install', + 'void', + [param('std::string', 'nodeName')], + is_const=True) ## internet-stack-helper.h: void ns3::InternetStackHelper::Install(ns3::Ptr node) const [member function] cls.add_method('Install', 'void', @@ -423,6 +475,10 @@ def register_Ns3Ipv4InterfaceContainer_methods(root_module, cls): cls.add_method('Add', 'void', [param('ns3::Ptr< ns3::Ipv4 >', 'ipv4'), param('uint32_t', 'interface')]) + ## ipv4-interface-container.h: void ns3::Ipv4InterfaceContainer::Add(std::string ipv4Name, uint32_t interface) [member function] + cls.add_method('Add', + 'void', + [param('std::string', 'ipv4Name'), param('uint32_t', 'interface')]) return def register_Ns3MobilityHelper_methods(root_module, cls): @@ -446,6 +502,10 @@ def register_Ns3MobilityHelper_methods(root_module, cls): cls.add_method('PushReferenceMobilityModel', 'void', [param('ns3::Ptr< ns3::Object >', 'reference')]) + ## mobility-helper.h: void ns3::MobilityHelper::PushReferenceMobilityModel(std::string referenceName) [member function] + cls.add_method('PushReferenceMobilityModel', + 'void', + [param('std::string', 'referenceName')]) ## mobility-helper.h: void ns3::MobilityHelper::PopReferenceMobilityModel() [member function] cls.add_method('PopReferenceMobilityModel', 'void', @@ -460,6 +520,11 @@ def register_Ns3MobilityHelper_methods(root_module, cls): 'void', [param('ns3::Ptr< ns3::Node >', 'node')], is_const=True) + ## mobility-helper.h: void ns3::MobilityHelper::Install(std::string nodeName) const [member function] + cls.add_method('Install', + 'void', + [param('std::string', 'nodeName')], + is_const=True) ## mobility-helper.h: void ns3::MobilityHelper::Install(ns3::NodeContainer container) const [member function] cls.add_method('Install', 'void', @@ -493,6 +558,8 @@ def register_Ns3NetDeviceContainer_methods(root_module, cls): cls.add_constructor([]) ## net-device-container.h: ns3::NetDeviceContainer::NetDeviceContainer(ns3::Ptr dev) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::NetDevice >', 'dev')]) + ## net-device-container.h: ns3::NetDeviceContainer::NetDeviceContainer(std::string devName) [constructor] + cls.add_constructor([param('std::string', 'devName')]) ## net-device-container.h: ns3::NetDeviceContainer::NetDeviceContainer(ns3::NetDeviceContainer const & a, ns3::NetDeviceContainer const & b) [constructor] cls.add_constructor([param('ns3::NetDeviceContainer const &', 'a'), param('ns3::NetDeviceContainer const &', 'b')]) ## net-device-container.h: __gnu_cxx::__normal_iterator*,std::vector, std::allocator > > > ns3::NetDeviceContainer::Begin() const [member function] @@ -523,6 +590,10 @@ def register_Ns3NetDeviceContainer_methods(root_module, cls): cls.add_method('Add', 'void', [param('ns3::Ptr< ns3::NetDevice >', 'device')]) + ## net-device-container.h: void ns3::NetDeviceContainer::Add(std::string deviceName) [member function] + cls.add_method('Add', + 'void', + [param('std::string', 'deviceName')]) return def register_Ns3NodeContainer_methods(root_module, cls): @@ -532,6 +603,8 @@ def register_Ns3NodeContainer_methods(root_module, cls): cls.add_constructor([]) ## node-container.h: ns3::NodeContainer::NodeContainer(ns3::Ptr node) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::Node >', 'node')]) + ## node-container.h: ns3::NodeContainer::NodeContainer(std::string nodeName) [constructor] + cls.add_constructor([param('std::string', 'nodeName')]) ## node-container.h: ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b) [constructor] cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b')]) ## node-container.h: ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b, ns3::NodeContainer const & c) [constructor] @@ -572,6 +645,10 @@ def register_Ns3NodeContainer_methods(root_module, cls): cls.add_method('Add', 'void', [param('ns3::Ptr< ns3::Node >', 'node')]) + ## node-container.h: void ns3::NodeContainer::Add(std::string nodeName) [member function] + cls.add_method('Add', + 'void', + [param('std::string', 'nodeName')]) ## node-container.h: static ns3::NodeContainer ns3::NodeContainer::GetGlobal() [member function] cls.add_method('GetGlobal', 'ns3::NodeContainer', @@ -608,6 +685,10 @@ def register_Ns3OlsrHelper_methods(root_module, cls): cls.add_method('Install', 'void', [param('ns3::Ptr< ns3::Node >', 'node')]) + ## olsr-helper.h: void ns3::OlsrHelper::Install(std::string nodeName) [member function] + cls.add_method('Install', + 'void', + [param('std::string', 'nodeName')]) ## olsr-helper.h: void ns3::OlsrHelper::InstallAll() [member function] cls.add_method('InstallAll', 'void', @@ -633,6 +714,11 @@ def register_Ns3OnOffHelper_methods(root_module, cls): 'ns3::ApplicationContainer', [param('ns3::Ptr< ns3::Node >', 'node')], is_const=True) + ## on-off-helper.h: ns3::ApplicationContainer ns3::OnOffHelper::Install(std::string nodeName) const [member function] + cls.add_method('Install', + 'ns3::ApplicationContainer', + [param('std::string', 'nodeName')], + is_const=True) return def register_Ns3PacketSinkHelper_methods(root_module, cls): @@ -654,6 +740,11 @@ def register_Ns3PacketSinkHelper_methods(root_module, cls): 'ns3::ApplicationContainer', [param('ns3::Ptr< ns3::Node >', 'node')], is_const=True) + ## packet-sink-helper.h: ns3::ApplicationContainer ns3::PacketSinkHelper::Install(std::string nodeName) const [member function] + cls.add_method('Install', + 'ns3::ApplicationContainer', + [param('std::string', 'nodeName')], + is_const=True) return def register_Ns3PacketSocketHelper_methods(root_module, cls): @@ -666,6 +757,11 @@ def register_Ns3PacketSocketHelper_methods(root_module, cls): 'void', [param('ns3::Ptr< ns3::Node >', 'node')], is_const=True) + ## packet-socket-helper.h: void ns3::PacketSocketHelper::Install(std::string nodeName) const [member function] + cls.add_method('Install', + 'void', + [param('std::string', 'nodeName')], + is_const=True) ## packet-socket-helper.h: void ns3::PacketSocketHelper::Install(ns3::NodeContainer c) const [member function] cls.add_method('Install', 'void', @@ -748,10 +844,26 @@ def register_Ns3PointToPointHelper_methods(root_module, cls): cls.add_method('Install', 'ns3::NetDeviceContainer', [param('ns3::Ptr< ns3::Node >', 'a'), param('ns3::Ptr< ns3::Node >', 'b')]) + ## point-to-point-helper.h: ns3::NetDeviceContainer ns3::PointToPointHelper::Install(ns3::Ptr a, std::string bName) [member function] + cls.add_method('Install', + 'ns3::NetDeviceContainer', + [param('ns3::Ptr< ns3::Node >', 'a'), param('std::string', 'bName')]) + ## point-to-point-helper.h: ns3::NetDeviceContainer ns3::PointToPointHelper::Install(std::string aName, ns3::Ptr b) [member function] + cls.add_method('Install', + 'ns3::NetDeviceContainer', + [param('std::string', 'aName'), param('ns3::Ptr< ns3::Node >', 'b')]) + ## point-to-point-helper.h: ns3::NetDeviceContainer ns3::PointToPointHelper::Install(std::string aNode, std::string bNode) [member function] + cls.add_method('Install', + 'ns3::NetDeviceContainer', + [param('std::string', 'aNode'), param('std::string', 'bNode')]) ## point-to-point-helper.h: void ns3::PointToPointHelper::InstallStar(ns3::Ptr hub, ns3::NodeContainer spokes, ns3::NetDeviceContainer & hubDevices, ns3::NetDeviceContainer & spokeDevices) [member function] cls.add_method('InstallStar', 'void', [param('ns3::Ptr< ns3::Node >', 'hub'), param('ns3::NodeContainer', 'spokes'), param('ns3::NetDeviceContainer &', 'hubDevices'), param('ns3::NetDeviceContainer &', 'spokeDevices')]) + ## point-to-point-helper.h: void ns3::PointToPointHelper::InstallStar(std::string hubName, ns3::NodeContainer spokes, ns3::NetDeviceContainer & hubDevices, ns3::NetDeviceContainer & spokeDevices) [member function] + cls.add_method('InstallStar', + 'void', + [param('std::string', 'hubName'), param('ns3::NodeContainer', 'spokes'), param('ns3::NetDeviceContainer &', 'hubDevices'), param('ns3::NetDeviceContainer &', 'spokeDevices')]) return def register_Ns3StaticMulticastRouteHelper_methods(root_module, cls): @@ -759,18 +871,73 @@ def register_Ns3StaticMulticastRouteHelper_methods(root_module, cls): cls.add_constructor([param('ns3::StaticMulticastRouteHelper const &', 'arg0')]) ## static-multicast-route-helper.h: ns3::StaticMulticastRouteHelper::StaticMulticastRouteHelper() [constructor] cls.add_constructor([]) - ## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::AddMulticastRoute(ns3::Ptr arg0, ns3::Ipv4Address source, ns3::Ipv4Address group, ns3::Ptr input, ns3::NetDeviceContainer output) [member function] + ## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::AddMulticastRoute(ns3::Ptr n, ns3::Ipv4Address source, ns3::Ipv4Address group, ns3::Ptr input, ns3::NetDeviceContainer output) [member function] cls.add_method('AddMulticastRoute', 'void', - [param('ns3::Ptr< ns3::Node >', 'arg0'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'group'), param('ns3::Ptr< ns3::NetDevice >', 'input'), param('ns3::NetDeviceContainer', 'output')]) + [param('ns3::Ptr< ns3::Node >', 'n'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'group'), param('ns3::Ptr< ns3::NetDevice >', 'input'), param('ns3::NetDeviceContainer', 'output')]) + ## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::AddMulticastRoute(std::string n, ns3::Ipv4Address source, ns3::Ipv4Address group, ns3::Ptr input, ns3::NetDeviceContainer output) [member function] + cls.add_method('AddMulticastRoute', + 'void', + [param('std::string', 'n'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'group'), param('ns3::Ptr< ns3::NetDevice >', 'input'), param('ns3::NetDeviceContainer', 'output')]) + ## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::AddMulticastRoute(ns3::Ptr n, ns3::Ipv4Address source, ns3::Ipv4Address group, std::string inputName, ns3::NetDeviceContainer output) [member function] + cls.add_method('AddMulticastRoute', + 'void', + [param('ns3::Ptr< ns3::Node >', 'n'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'group'), param('std::string', 'inputName'), param('ns3::NetDeviceContainer', 'output')]) + ## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::AddMulticastRoute(std::string nName, ns3::Ipv4Address source, ns3::Ipv4Address group, std::string inputName, ns3::NetDeviceContainer output) [member function] + cls.add_method('AddMulticastRoute', + 'void', + [param('std::string', 'nName'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'group'), param('std::string', 'inputName'), param('ns3::NetDeviceContainer', 'output')]) ## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::SetDefaultMulticastRoute(ns3::Ptr n, ns3::Ptr nd) [member function] cls.add_method('SetDefaultMulticastRoute', 'void', [param('ns3::Ptr< ns3::Node >', 'n'), param('ns3::Ptr< ns3::NetDevice >', 'nd')]) + ## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::SetDefaultMulticastRoute(ns3::Ptr n, std::string ndName) [member function] + cls.add_method('SetDefaultMulticastRoute', + 'void', + [param('ns3::Ptr< ns3::Node >', 'n'), param('std::string', 'ndName')]) + ## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::SetDefaultMulticastRoute(std::string nName, ns3::Ptr nd) [member function] + cls.add_method('SetDefaultMulticastRoute', + 'void', + [param('std::string', 'nName'), param('ns3::Ptr< ns3::NetDevice >', 'nd')]) + ## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::SetDefaultMulticastRoute(std::string nName, std::string ndName) [member function] + cls.add_method('SetDefaultMulticastRoute', + 'void', + [param('std::string', 'nName'), param('std::string', 'ndName')]) ## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::JoinMulticastGroup(ns3::Ptr n, ns3::Ipv4Address source, ns3::Ipv4Address group) [member function] cls.add_method('JoinMulticastGroup', 'void', [param('ns3::Ptr< ns3::Node >', 'n'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'group')]) + ## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::JoinMulticastGroup(std::string nName, ns3::Ipv4Address source, ns3::Ipv4Address group) [member function] + cls.add_method('JoinMulticastGroup', + 'void', + [param('std::string', 'nName'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'group')]) + return + +def register_Ns3TapBridgeHelper_methods(root_module, cls): + ## tap-bridge-helper.h: ns3::TapBridgeHelper::TapBridgeHelper(ns3::TapBridgeHelper const & arg0) [copy constructor] + cls.add_constructor([param('ns3::TapBridgeHelper const &', 'arg0')]) + ## tap-bridge-helper.h: ns3::TapBridgeHelper::TapBridgeHelper(ns3::Ipv4Address gateway) [constructor] + cls.add_constructor([param('ns3::Ipv4Address', 'gateway')]) + ## tap-bridge-helper.h: void ns3::TapBridgeHelper::SetAttribute(std::string n1, ns3::AttributeValue const & v1) [member function] + cls.add_method('SetAttribute', + 'void', + [param('std::string', 'n1'), param('ns3::AttributeValue const &', 'v1')]) + ## tap-bridge-helper.h: ns3::Ptr ns3::TapBridgeHelper::Install(ns3::Ptr node, ns3::Ptr nd) [member function] + cls.add_method('Install', + 'ns3::Ptr< ns3::NetDevice >', + [param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::Ptr< ns3::NetDevice >', 'nd')]) + ## tap-bridge-helper.h: ns3::Ptr ns3::TapBridgeHelper::Install(std::string nodeName, ns3::Ptr nd) [member function] + cls.add_method('Install', + 'ns3::Ptr< ns3::NetDevice >', + [param('std::string', 'nodeName'), param('ns3::Ptr< ns3::NetDevice >', 'nd')]) + ## tap-bridge-helper.h: ns3::Ptr ns3::TapBridgeHelper::Install(ns3::Ptr node, std::string ndName) [member function] + cls.add_method('Install', + 'ns3::Ptr< ns3::NetDevice >', + [param('ns3::Ptr< ns3::Node >', 'node'), param('std::string', 'ndName')]) + ## tap-bridge-helper.h: ns3::Ptr ns3::TapBridgeHelper::Install(std::string nodeName, std::string ndName) [member function] + cls.add_method('Install', + 'ns3::Ptr< ns3::NetDevice >', + [param('std::string', 'nodeName'), param('std::string', 'ndName')]) return def register_Ns3UdpEchoClientHelper_methods(root_module, cls): @@ -787,6 +954,11 @@ def register_Ns3UdpEchoClientHelper_methods(root_module, cls): 'ns3::ApplicationContainer', [param('ns3::Ptr< ns3::Node >', 'node')], is_const=True) + ## udp-echo-helper.h: ns3::ApplicationContainer ns3::UdpEchoClientHelper::Install(std::string nodeName) const [member function] + cls.add_method('Install', + 'ns3::ApplicationContainer', + [param('std::string', 'nodeName')], + is_const=True) ## udp-echo-helper.h: ns3::ApplicationContainer ns3::UdpEchoClientHelper::Install(ns3::NodeContainer c) const [member function] cls.add_method('Install', 'ns3::ApplicationContainer', @@ -808,6 +980,11 @@ def register_Ns3UdpEchoServerHelper_methods(root_module, cls): 'ns3::ApplicationContainer', [param('ns3::Ptr< ns3::Node >', 'node')], is_const=True) + ## udp-echo-helper.h: ns3::ApplicationContainer ns3::UdpEchoServerHelper::Install(std::string nodeName) const [member function] + cls.add_method('Install', + 'ns3::ApplicationContainer', + [param('std::string', 'nodeName')], + is_const=True) ## udp-echo-helper.h: ns3::ApplicationContainer ns3::UdpEchoServerHelper::Install(ns3::NodeContainer c) const [member function] cls.add_method('Install', 'ns3::ApplicationContainer', @@ -834,6 +1011,11 @@ def register_Ns3V4PingHelper_methods(root_module, cls): 'ns3::ApplicationContainer', [param('ns3::Ptr< ns3::Node >', 'node')], is_const=True) + ## v4ping-helper.h: ns3::ApplicationContainer ns3::V4PingHelper::Install(std::string nodeName) const [member function] + cls.add_method('Install', + 'ns3::ApplicationContainer', + [param('std::string', 'nodeName')], + is_const=True) return def register_Ns3WifiHelper_methods(root_module, cls): @@ -864,6 +1046,11 @@ def register_Ns3WifiHelper_methods(root_module, cls): 'ns3::NetDeviceContainer', [param('ns3::WifiPhyHelper const &', 'phy'), param('ns3::Ptr< ns3::Node >', 'node')], is_const=True) + ## wifi-helper.h: ns3::NetDeviceContainer ns3::WifiHelper::Install(ns3::WifiPhyHelper const & phy, std::string nodeName) const [member function] + cls.add_method('Install', + 'ns3::NetDeviceContainer', + [param('ns3::WifiPhyHelper const &', 'phy'), param('std::string', 'nodeName')], + is_const=True) return def register_Ns3WifiPhyHelper_methods(root_module, cls): @@ -917,6 +1104,10 @@ def register_Ns3YansWifiPhyHelper_methods(root_module, cls): cls.add_method('SetChannel', 'void', [param('ns3::Ptr< ns3::YansWifiChannel >', 'channel')]) + ## yans-wifi-helper.h: void ns3::YansWifiPhyHelper::SetChannel(std::string channelName) [member function] + cls.add_method('SetChannel', + 'void', + [param('std::string', 'channelName')]) ## yans-wifi-helper.h: void ns3::YansWifiPhyHelper::Set(std::string name, ns3::AttributeValue const & v) [member function] cls.add_method('Set', 'void', diff --git a/bindings/python/ns3_module_node.py b/bindings/python/ns3_module_node.py index 2e50f5842..b214fcda6 100644 --- a/bindings/python/ns3_module_node.py +++ b/bindings/python/ns3_module_node.py @@ -109,6 +109,8 @@ def register_types(module): module.add_class('Channel', parent=root_module['ns3::Object']) ## drop-tail-queue.h: ns3::DropTailQueue [class] module.add_class('DropTailQueue', parent=root_module['ns3::Queue']) + ## drop-tail-queue.h: ns3::DropTailQueue::Mode [enumeration] + module.add_enum('Mode', ['ILLEGAL', 'PACKETS', 'BYTES'], outer_class=root_module['ns3::DropTailQueue']) ## ethernet-header.h: ns3::EthernetHeader [class] module.add_class('EthernetHeader', parent=root_module['ns3::Header']) ## ethernet-trailer.h: ns3::EthernetTrailer [class] @@ -2340,6 +2342,14 @@ def register_Ns3DropTailQueue_methods(root_module, cls): is_static=True) ## drop-tail-queue.h: ns3::DropTailQueue::DropTailQueue() [constructor] cls.add_constructor([]) + ## drop-tail-queue.h: void ns3::DropTailQueue::SetMode(ns3::DropTailQueue::Mode mode) [member function] + cls.add_method('SetMode', + 'void', + [param('ns3::DropTailQueue::Mode', 'mode')]) + ## drop-tail-queue.h: ns3::DropTailQueue::Mode ns3::DropTailQueue::GetMode() [member function] + cls.add_method('GetMode', + 'ns3::DropTailQueue::Mode', + []) ## drop-tail-queue.h: bool ns3::DropTailQueue::DoEnqueue(ns3::Ptr p) [member function] cls.add_method('DoEnqueue', 'bool', diff --git a/bindings/python/ns3_module_simulator.py b/bindings/python/ns3_module_simulator.py index da1d6eb39..78bef44f9 100644 --- a/bindings/python/ns3_module_simulator.py +++ b/bindings/python/ns3_module_simulator.py @@ -55,6 +55,8 @@ def register_types(module): module.add_class('ListScheduler', parent=root_module['ns3::Scheduler']) ## map-scheduler.h: ns3::MapScheduler [class] module.add_class('MapScheduler', parent=root_module['ns3::Scheduler']) + ## ns2-calendar-scheduler.h: ns3::Ns2CalendarScheduler [class] + module.add_class('Ns2CalendarScheduler', parent=root_module['ns3::Scheduler']) ## realtime-simulator-impl.h: ns3::RealtimeSimulatorImpl [class] module.add_class('RealtimeSimulatorImpl', parent=root_module['ns3::SimulatorImpl']) ## realtime-simulator-impl.h: ns3::RealtimeSimulatorImpl::SynchronizationMode [enumeration] @@ -127,6 +129,7 @@ def register_methods(root_module): register_Ns3HeapScheduler_methods(root_module, root_module['ns3::HeapScheduler']) register_Ns3ListScheduler_methods(root_module, root_module['ns3::ListScheduler']) register_Ns3MapScheduler_methods(root_module, root_module['ns3::MapScheduler']) + register_Ns3Ns2CalendarScheduler_methods(root_module, root_module['ns3::Ns2CalendarScheduler']) register_Ns3RealtimeSimulatorImpl_methods(root_module, root_module['ns3::RealtimeSimulatorImpl']) return @@ -726,7 +729,9 @@ def register_Ns3SchedulerEvent_methods(root_module, cls): return def register_Ns3SchedulerEventKey_methods(root_module, cls): + cls.add_binary_comparison_operator('!=') cls.add_binary_comparison_operator('<') + cls.add_binary_comparison_operator('>') ## scheduler.h: ns3::Scheduler::EventKey::EventKey() [constructor] cls.add_constructor([]) ## scheduler.h: ns3::Scheduler::EventKey::EventKey(ns3::Scheduler::EventKey const & arg0) [copy constructor] @@ -1309,6 +1314,43 @@ def register_Ns3MapScheduler_methods(root_module, cls): is_virtual=True) return +def register_Ns3Ns2CalendarScheduler_methods(root_module, cls): + ## ns2-calendar-scheduler.h: ns3::Ns2CalendarScheduler::Ns2CalendarScheduler(ns3::Ns2CalendarScheduler const & arg0) [copy constructor] + cls.add_constructor([param('ns3::Ns2CalendarScheduler const &', 'arg0')]) + ## ns2-calendar-scheduler.h: static ns3::TypeId ns3::Ns2CalendarScheduler::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) + ## ns2-calendar-scheduler.h: ns3::Ns2CalendarScheduler::Ns2CalendarScheduler() [constructor] + cls.add_constructor([]) + ## ns2-calendar-scheduler.h: void ns3::Ns2CalendarScheduler::Insert(ns3::Scheduler::Event const & ev) [member function] + cls.add_method('Insert', + 'void', + [param('ns3::Scheduler::Event const &', 'ev')], + is_virtual=True) + ## ns2-calendar-scheduler.h: bool ns3::Ns2CalendarScheduler::IsEmpty() const [member function] + cls.add_method('IsEmpty', + 'bool', + [], + is_const=True, is_virtual=True) + ## ns2-calendar-scheduler.h: ns3::Scheduler::Event ns3::Ns2CalendarScheduler::PeekNext() const [member function] + cls.add_method('PeekNext', + 'ns3::Scheduler::Event', + [], + is_const=True, is_virtual=True) + ## ns2-calendar-scheduler.h: ns3::Scheduler::Event ns3::Ns2CalendarScheduler::RemoveNext() [member function] + cls.add_method('RemoveNext', + 'ns3::Scheduler::Event', + [], + is_virtual=True) + ## ns2-calendar-scheduler.h: void ns3::Ns2CalendarScheduler::Remove(ns3::Scheduler::Event const & ev) [member function] + cls.add_method('Remove', + 'void', + [param('ns3::Scheduler::Event const &', 'ev')], + is_virtual=True) + return + def register_Ns3RealtimeSimulatorImpl_methods(root_module, cls): ## realtime-simulator-impl.h: ns3::RealtimeSimulatorImpl::RealtimeSimulatorImpl(ns3::RealtimeSimulatorImpl const & arg0) [copy constructor] cls.add_constructor([param('ns3::RealtimeSimulatorImpl const &', 'arg0')]) diff --git a/bindings/python/ns3_module_tap_bridge.py b/bindings/python/ns3_module_tap_bridge.py new file mode 100644 index 000000000..66185dc52 --- /dev/null +++ b/bindings/python/ns3_module_tap_bridge.py @@ -0,0 +1,235 @@ +from pybindgen import Module, FileCodeSink, param, retval, cppclass + +def register_types(module): + root_module = module.get_root() + + ## tap-bridge.h: ns3::TapBridge [class] + module.add_class('TapBridge', parent=root_module['ns3::NetDevice']) + + ## 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 TimeStepPrecision + + nested_module = module.add_cpp_namespace('TimeStepPrecision') + register_types_ns3_TimeStepPrecision(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_TimeStepPrecision(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_Ns3TapBridge_methods(root_module, root_module['ns3::TapBridge']) + return + +def register_Ns3TapBridge_methods(root_module, cls): + ## tap-bridge.h: ns3::TapBridge::TapBridge(ns3::TapBridge const & arg0) [copy constructor] + cls.add_constructor([param('ns3::TapBridge const &', 'arg0')]) + ## tap-bridge.h: static ns3::TypeId ns3::TapBridge::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) + ## tap-bridge.h: ns3::TapBridge::TapBridge() [constructor] + cls.add_constructor([]) + ## tap-bridge.h: ns3::Ptr ns3::TapBridge::GetBridgedNetDevice() [member function] + cls.add_method('GetBridgedNetDevice', + 'ns3::Ptr< ns3::NetDevice >', + []) + ## tap-bridge.h: void ns3::TapBridge::SetBridgedNetDevice(ns3::Ptr bridgedDevice) [member function] + cls.add_method('SetBridgedNetDevice', + 'void', + [param('ns3::Ptr< ns3::NetDevice >', 'bridgedDevice')]) + ## tap-bridge.h: void ns3::TapBridge::Start(ns3::Time tStart) [member function] + cls.add_method('Start', + 'void', + [param('ns3::Time', 'tStart')]) + ## tap-bridge.h: void ns3::TapBridge::Stop(ns3::Time tStop) [member function] + cls.add_method('Stop', + 'void', + [param('ns3::Time', 'tStop')]) + ## tap-bridge.h: void ns3::TapBridge::SetName(std::string const name) [member function] + cls.add_method('SetName', + 'void', + [param('std::string const', 'name')], + is_virtual=True) + ## tap-bridge.h: std::string ns3::TapBridge::GetName() const [member function] + cls.add_method('GetName', + 'std::string', + [], + is_const=True, is_virtual=True) + ## tap-bridge.h: void ns3::TapBridge::SetIfIndex(uint32_t const index) [member function] + cls.add_method('SetIfIndex', + 'void', + [param('uint32_t const', 'index')], + is_virtual=True) + ## tap-bridge.h: uint32_t ns3::TapBridge::GetIfIndex() const [member function] + cls.add_method('GetIfIndex', + 'uint32_t', + [], + is_const=True, is_virtual=True) + ## tap-bridge.h: ns3::Ptr ns3::TapBridge::GetChannel() const [member function] + cls.add_method('GetChannel', + 'ns3::Ptr< ns3::Channel >', + [], + is_const=True, is_virtual=True) + ## tap-bridge.h: ns3::Address ns3::TapBridge::GetAddress() const [member function] + cls.add_method('GetAddress', + 'ns3::Address', + [], + is_const=True, is_virtual=True) + ## tap-bridge.h: bool ns3::TapBridge::SetMtu(uint16_t const mtu) [member function] + cls.add_method('SetMtu', + 'bool', + [param('uint16_t const', 'mtu')], + is_virtual=True) + ## tap-bridge.h: uint16_t ns3::TapBridge::GetMtu() const [member function] + cls.add_method('GetMtu', + 'uint16_t', + [], + is_const=True, is_virtual=True) + ## tap-bridge.h: bool ns3::TapBridge::IsLinkUp() const [member function] + cls.add_method('IsLinkUp', + 'bool', + [], + is_const=True, is_virtual=True) + ## tap-bridge.h: void ns3::TapBridge::SetLinkChangeCallback(ns3::Callback callback) [member function] + cls.add_method('SetLinkChangeCallback', + 'void', + [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')], + is_virtual=True) + ## tap-bridge.h: bool ns3::TapBridge::IsBroadcast() const [member function] + cls.add_method('IsBroadcast', + 'bool', + [], + is_const=True, is_virtual=True) + ## tap-bridge.h: ns3::Address ns3::TapBridge::GetBroadcast() const [member function] + cls.add_method('GetBroadcast', + 'ns3::Address', + [], + is_const=True, is_virtual=True) + ## tap-bridge.h: bool ns3::TapBridge::IsMulticast() const [member function] + cls.add_method('IsMulticast', + 'bool', + [], + is_const=True, is_virtual=True) + ## tap-bridge.h: ns3::Address ns3::TapBridge::GetMulticast(ns3::Ipv4Address multicastGroup) const [member function] + cls.add_method('GetMulticast', + 'ns3::Address', + [param('ns3::Ipv4Address', 'multicastGroup')], + is_const=True, is_virtual=True) + ## tap-bridge.h: bool ns3::TapBridge::IsPointToPoint() const [member function] + cls.add_method('IsPointToPoint', + 'bool', + [], + is_const=True, is_virtual=True) + ## tap-bridge.h: bool ns3::TapBridge::IsBridge() const [member function] + cls.add_method('IsBridge', + 'bool', + [], + is_const=True, is_virtual=True) + ## tap-bridge.h: bool ns3::TapBridge::Send(ns3::Ptr packet, ns3::Address const & dest, uint16_t protocolNumber) [member function] + cls.add_method('Send', + 'bool', + [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')], + is_virtual=True) + ## tap-bridge.h: bool ns3::TapBridge::SendFrom(ns3::Ptr packet, ns3::Address const & source, ns3::Address const & dest, uint16_t protocolNumber) [member function] + cls.add_method('SendFrom', + 'bool', + [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'source'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')], + is_virtual=True) + ## tap-bridge.h: ns3::Ptr ns3::TapBridge::GetNode() const [member function] + cls.add_method('GetNode', + 'ns3::Ptr< ns3::Node >', + [], + is_const=True, is_virtual=True) + ## tap-bridge.h: void ns3::TapBridge::SetNode(ns3::Ptr node) [member function] + cls.add_method('SetNode', + 'void', + [param('ns3::Ptr< ns3::Node >', 'node')], + is_virtual=True) + ## tap-bridge.h: bool ns3::TapBridge::NeedsArp() const [member function] + cls.add_method('NeedsArp', + 'bool', + [], + is_const=True, is_virtual=True) + ## tap-bridge.h: void ns3::TapBridge::SetReceiveCallback(ns3::Callback, ns3::Ptr, unsigned short, ns3::Address const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> cb) [member function] + cls.add_method('SetReceiveCallback', + 'void', + [param('ns3::Callback< 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 >', 'cb')], + is_virtual=True) + ## tap-bridge.h: void ns3::TapBridge::SetPromiscReceiveCallback(ns3::Callback, ns3::Ptr, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty> cb) [member function] + cls.add_method('SetPromiscReceiveCallback', + 'void', + [param('ns3::Callback< 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 >', 'cb')], + is_virtual=True) + ## tap-bridge.h: bool ns3::TapBridge::SupportsSendFrom() const [member function] + cls.add_method('SupportsSendFrom', + 'bool', + [], + is_const=True, is_virtual=True) + ## tap-bridge.h: ns3::Address ns3::TapBridge::GetMulticast(ns3::Ipv6Address addr) const [member function] + cls.add_method('GetMulticast', + 'ns3::Address', + [param('ns3::Ipv6Address', 'addr')], + is_const=True, is_virtual=True) + ## tap-bridge.h: void ns3::TapBridge::DoDispose() [member function] + cls.add_method('DoDispose', + 'void', + [], + visibility='protected', is_virtual=True) + ## tap-bridge.h: void ns3::TapBridge::ReceiveFromBridgedDevice(ns3::Ptr device, ns3::Ptr packet, uint16_t protocol, ns3::Address const & src, ns3::Address const & dst, ns3::NetDevice::PacketType packetType) [member function] + cls.add_method('ReceiveFromBridgedDevice', + 'void', + [param('ns3::Ptr< ns3::NetDevice >', 'device'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('uint16_t', 'protocol'), param('ns3::Address const &', 'src'), param('ns3::Address const &', 'dst'), param('ns3::NetDevice::PacketType', 'packetType')], + visibility='protected') + return + +def register_functions(root_module): + module = root_module + register_functions_ns3_Config(module.get_submodule('Config'), root_module) + register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module) + register_functions_ns3_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_TimeStepPrecision(module, root_module): + return + +def register_functions_ns3_internal(module, root_module): + return + +def register_functions_ns3_olsr(module, root_module): + return + diff --git a/bindings/python/ns3modulegen_generated.py b/bindings/python/ns3modulegen_generated.py index 4a256c7b8..5d682396c 100644 --- a/bindings/python/ns3modulegen_generated.py +++ b/bindings/python/ns3modulegen_generated.py @@ -20,17 +20,18 @@ import ns3_module_node import ns3_module_contrib import ns3_module_point_to_point import ns3_module_stats +import ns3_module_tap_bridge import ns3_module_internet_stack import ns3_module_wifi import ns3_module_csma import ns3_module_emu import ns3_module_bridge +import ns3_module_onoff import ns3_module_packet_sink import ns3_module_v4ping import ns3_module_global_routing -import ns3_module_onoff -import ns3_module_olsr import ns3_module_udp_echo +import ns3_module_olsr import ns3_module_helper def module_init(): @@ -128,6 +129,17 @@ def register_types(module): ns3_module_stats__local.register_types(module) root_module.end_section('ns3_module_stats') + root_module.begin_section('ns3_module_tap_bridge') + ns3_module_tap_bridge.register_types(module) + + try: + import ns3_module_tap_bridge__local + except ImportError: + pass + else: + ns3_module_tap_bridge__local.register_types(module) + + root_module.end_section('ns3_module_tap_bridge') root_module.begin_section('ns3_module_internet_stack') ns3_module_internet_stack.register_types(module) @@ -183,6 +195,17 @@ def register_types(module): ns3_module_bridge__local.register_types(module) root_module.end_section('ns3_module_bridge') + root_module.begin_section('ns3_module_onoff') + ns3_module_onoff.register_types(module) + + try: + import ns3_module_onoff__local + except ImportError: + pass + else: + ns3_module_onoff__local.register_types(module) + + root_module.end_section('ns3_module_onoff') root_module.begin_section('ns3_module_packet_sink') ns3_module_packet_sink.register_types(module) @@ -216,28 +239,6 @@ def register_types(module): ns3_module_global_routing__local.register_types(module) root_module.end_section('ns3_module_global_routing') - root_module.begin_section('ns3_module_onoff') - ns3_module_onoff.register_types(module) - - try: - import ns3_module_onoff__local - except ImportError: - pass - else: - ns3_module_onoff__local.register_types(module) - - root_module.end_section('ns3_module_onoff') - root_module.begin_section('ns3_module_olsr') - ns3_module_olsr.register_types(module) - - try: - import ns3_module_olsr__local - except ImportError: - pass - else: - ns3_module_olsr__local.register_types(module) - - root_module.end_section('ns3_module_olsr') root_module.begin_section('ns3_module_udp_echo') ns3_module_udp_echo.register_types(module) @@ -249,6 +250,17 @@ def register_types(module): ns3_module_udp_echo__local.register_types(module) root_module.end_section('ns3_module_udp_echo') + root_module.begin_section('ns3_module_olsr') + ns3_module_olsr.register_types(module) + + try: + import ns3_module_olsr__local + except ImportError: + pass + else: + ns3_module_olsr__local.register_types(module) + + root_module.end_section('ns3_module_olsr') root_module.begin_section('ns3_module_helper') ns3_module_helper.register_types(module) @@ -393,6 +405,17 @@ def register_methods(root_module): ns3_module_stats__local.register_methods(root_module) root_module.end_section('ns3_module_stats') + root_module.begin_section('ns3_module_tap_bridge') + ns3_module_tap_bridge.register_methods(root_module) + + try: + import ns3_module_tap_bridge__local + except ImportError: + pass + else: + ns3_module_tap_bridge__local.register_methods(root_module) + + root_module.end_section('ns3_module_tap_bridge') root_module.begin_section('ns3_module_internet_stack') ns3_module_internet_stack.register_methods(root_module) @@ -448,6 +471,17 @@ def register_methods(root_module): ns3_module_bridge__local.register_methods(root_module) root_module.end_section('ns3_module_bridge') + root_module.begin_section('ns3_module_onoff') + ns3_module_onoff.register_methods(root_module) + + try: + import ns3_module_onoff__local + except ImportError: + pass + else: + ns3_module_onoff__local.register_methods(root_module) + + root_module.end_section('ns3_module_onoff') root_module.begin_section('ns3_module_packet_sink') ns3_module_packet_sink.register_methods(root_module) @@ -481,28 +515,6 @@ def register_methods(root_module): ns3_module_global_routing__local.register_methods(root_module) root_module.end_section('ns3_module_global_routing') - root_module.begin_section('ns3_module_onoff') - ns3_module_onoff.register_methods(root_module) - - try: - import ns3_module_onoff__local - except ImportError: - pass - else: - ns3_module_onoff__local.register_methods(root_module) - - root_module.end_section('ns3_module_onoff') - root_module.begin_section('ns3_module_olsr') - ns3_module_olsr.register_methods(root_module) - - try: - import ns3_module_olsr__local - except ImportError: - pass - else: - ns3_module_olsr__local.register_methods(root_module) - - root_module.end_section('ns3_module_olsr') root_module.begin_section('ns3_module_udp_echo') ns3_module_udp_echo.register_methods(root_module) @@ -514,6 +526,17 @@ def register_methods(root_module): ns3_module_udp_echo__local.register_methods(root_module) root_module.end_section('ns3_module_udp_echo') + root_module.begin_section('ns3_module_olsr') + ns3_module_olsr.register_methods(root_module) + + try: + import ns3_module_olsr__local + except ImportError: + pass + else: + ns3_module_olsr__local.register_methods(root_module) + + root_module.end_section('ns3_module_olsr') root_module.begin_section('ns3_module_helper') ns3_module_helper.register_methods(root_module) @@ -617,6 +640,17 @@ def register_functions(root_module): ns3_module_stats__local.register_functions(root_module) root_module.end_section('ns3_module_stats') + root_module.begin_section('ns3_module_tap_bridge') + ns3_module_tap_bridge.register_functions(root_module) + + try: + import ns3_module_tap_bridge__local + except ImportError: + pass + else: + ns3_module_tap_bridge__local.register_functions(root_module) + + root_module.end_section('ns3_module_tap_bridge') root_module.begin_section('ns3_module_internet_stack') ns3_module_internet_stack.register_functions(root_module) @@ -672,6 +706,17 @@ def register_functions(root_module): ns3_module_bridge__local.register_functions(root_module) root_module.end_section('ns3_module_bridge') + root_module.begin_section('ns3_module_onoff') + ns3_module_onoff.register_functions(root_module) + + try: + import ns3_module_onoff__local + except ImportError: + pass + else: + ns3_module_onoff__local.register_functions(root_module) + + root_module.end_section('ns3_module_onoff') root_module.begin_section('ns3_module_packet_sink') ns3_module_packet_sink.register_functions(root_module) @@ -705,28 +750,6 @@ def register_functions(root_module): ns3_module_global_routing__local.register_functions(root_module) root_module.end_section('ns3_module_global_routing') - root_module.begin_section('ns3_module_onoff') - ns3_module_onoff.register_functions(root_module) - - try: - import ns3_module_onoff__local - except ImportError: - pass - else: - ns3_module_onoff__local.register_functions(root_module) - - root_module.end_section('ns3_module_onoff') - root_module.begin_section('ns3_module_olsr') - ns3_module_olsr.register_functions(root_module) - - try: - import ns3_module_olsr__local - except ImportError: - pass - else: - ns3_module_olsr__local.register_functions(root_module) - - root_module.end_section('ns3_module_olsr') root_module.begin_section('ns3_module_udp_echo') ns3_module_udp_echo.register_functions(root_module) @@ -738,6 +761,17 @@ def register_functions(root_module): ns3_module_udp_echo__local.register_functions(root_module) root_module.end_section('ns3_module_udp_echo') + root_module.begin_section('ns3_module_olsr') + ns3_module_olsr.register_functions(root_module) + + try: + import ns3_module_olsr__local + except ImportError: + pass + else: + ns3_module_olsr__local.register_functions(root_module) + + root_module.end_section('ns3_module_olsr') root_module.begin_section('ns3_module_helper') ns3_module_helper.register_functions(root_module) From 127064f21a452ab35911c4d3a6411aaca9318486 Mon Sep 17 00:00:00 2001 From: Timo Bingmann Date: Sun, 22 Feb 2009 17:28:45 +0100 Subject: [PATCH 09/12] Print demangled callback signatures if they mismatch. bug #507 --- src/core/callback.cc | 50 ++++++++++++++++++++++++++++++++++++++++++++ src/core/callback.h | 8 ++++--- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/src/core/callback.cc b/src/core/callback.cc index bc5223cd8..63eef5ca1 100644 --- a/src/core/callback.cc +++ b/src/core/callback.cc @@ -35,4 +35,54 @@ CallbackValue::DeserializeFromString (std::string value, Ptr= 3) + +#include +#include "log.h" + +std::string +CallbackBase::Demangle(const std::string& mangled) +{ + int status; + char* demangled = abi::__cxa_demangle(mangled.c_str(), + NULL, NULL, &status); + + std::string ret; + if (status == 0) { + NS_ASSERT(demangled); + ret = demangled; + } + else if (status == -1) { + NS_LOG_UNCOND("Callback demangling failed: Memory allocation failure occured."); + ret = mangled; + } + else if (status == -2) { + NS_LOG_UNCOND("Callback demangling failed: Mangled name is not a valid under the C++ ABI mangling rules."); + ret = mangled; + } + else if (status == -3) { + NS_LOG_UNCOND("Callback demangling failed: One of the arguments is invalid."); + ret = mangled; + } + else { + NS_LOG_UNCOND("Callback demangling failed: status " << status); + ret = mangled; + } + + if (demangled) { + free(demangled); + } + return ret; +} + +#else + +std::string +CallbackBase::Demangle(const std::string& mangled) +{ + return mangled; +} + +#endif + } // namespace ns3 diff --git a/src/core/callback.h b/src/core/callback.h index abb18d993..eb4729a39 100644 --- a/src/core/callback.h +++ b/src/core/callback.h @@ -340,6 +340,8 @@ public: protected: CallbackBase (Ptr impl) : m_impl (impl) {} Ptr m_impl; + + static std::string Demangle(const std::string& mangled); }; /** @@ -476,9 +478,9 @@ private: void DoAssign (Ptr other) { if (!DoCheckType (other)) { - NS_FATAL_ERROR ("Incompatible types. (feed to \"c++filt -t\")" - " got=" << typeid (*other).name () << - ", expected=" << typeid (CallbackImpl *).name ()); + NS_FATAL_ERROR ("Incompatible types. (feed to \"c++filt -t\" if needed)" << std::endl << + "got=" << Demangle ( typeid (*other).name () ) << std::endl << + "expected=" << Demangle ( typeid (CallbackImpl *).name () )); } m_impl = const_cast (PeekPointer (other)); } From 7e8d2be1dabf81d5b82b26dd7809e59f3097df71 Mon Sep 17 00:00:00 2001 From: Timo Bingmann Date: Mon, 23 Feb 2009 11:33:14 +0100 Subject: [PATCH 10/12] Missing include of stdlib.h for free() in callback.cc --- src/core/callback.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/callback.cc b/src/core/callback.cc index 63eef5ca1..c2a188659 100644 --- a/src/core/callback.cc +++ b/src/core/callback.cc @@ -37,6 +37,7 @@ ATTRIBUTE_CHECKER_IMPLEMENT (Callback); #if (__GNUC__ >= 3) +#include #include #include "log.h" From cf2251854932b8635932dfae9fba1a8ef6e76b42 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Mon, 23 Feb 2009 06:56:52 -0800 Subject: [PATCH 11/12] tutorial fixes from Ruben Merz --- doc/manual/manual.texi | 4 ++-- doc/tutorial/tweaking.texi | 30 ++++++++++++++---------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/doc/manual/manual.texi b/doc/manual/manual.texi index 019054263..e99dbe3b6 100644 --- a/doc/manual/manual.texi +++ b/doc/manual/manual.texi @@ -10,7 +10,7 @@ Primary documentation for the @command{ns-3} project is available in four forms: @itemize @bullet @item @uref{http://www.nsnam.org/doxygen/index.html,,ns-3 Doxygen/Manual}: Documentation of the public APIs of the simulator -@item @uref{http://www.nsnam.org/tutorial/index.html,,ns-3 Tutorial} +@item @uref{http://www.nsnam.org/docs/tutorial/tutorial.html,,ns-3 Tutorial} @item Reference Manual (this document) @item @uref{http://www.nsnam.org/wiki/index.php,, ns-3 wiki} @end itemize @@ -27,7 +27,7 @@ This is an @command{ns-3} reference manual. Primary documentation for the @command{ns-3} project is available in four forms: @itemize @bullet -@item @uref{http://www.nsnam.org/tutorial/index.html,,ns-3 Tutorial} +@item @uref{http://www.nsnam.org/docs/tutorial/tutorial.html,,ns-3 Tutorial} @item @uref{http://www.nsnam.org/doxygen/index.html,,ns-3 Doxygen}: Documentation of the public APIs of the simulator @item Reference Manual (this document) @item @uref{http://www.nsnam.org/wiki/index.php,, ns-3 wiki} diff --git a/doc/tutorial/tweaking.texi b/doc/tutorial/tweaking.texi index 05edf3e89..6736655e9 100644 --- a/doc/tutorial/tweaking.texi +++ b/doc/tutorial/tweaking.texi @@ -272,21 +272,19 @@ If you run the script now, you should see the following output: ~/repos/ns-3-dev > ./waf --run scratch/first Entering directory `/home/craigdo/repos/ns-3-dev/build' Compilation finished successfully - 0ns UdpEchoServerApplication:UdpEchoServer() - 0ns UdpEchoClientApplication:UdpEchoClient() - 1000000000ns UdpEchoServerApplication:StartApplication() - 2000000000ns UdpEchoClientApplication:StartApplication() - 2000000000ns UdpEchoClientApplication:ScheduleTransmit() - 2000000000ns UdpEchoClientApplication:Send() - 2000000000ns UdpEchoClientApplication:Send(): Sent 1024 bytes to 10.1.1.2 - 2003686400ns UdpEchoServerApplication:HandleRead(): Received 1024 bytes - from 10.1.1.1 - 2003686400ns UdpEchoServerApplication:HandleRead(): Echoing packet - 2007372800ns UdpEchoClientApplication:HandleRead(0x62c8c0, 0x62d020) - 2007372800ns UdpEchoClientApplication:HandleRead(): Received 1024 bytes - from 10.1.1.2 - 10000000000ns UdpEchoServerApplication:StopApplication() - 10000000000ns UdpEchoClientApplication:StopApplication() + 0s UdpEchoServerApplication:UdpEchoServer() + 0s UdpEchoClientApplication:UdpEchoClient() + 1s UdpEchoServerApplication:StartApplication() + 2s UdpEchoClientApplication:StartApplication() + 2s UdpEchoClientApplication:ScheduleTransmit() + 2s UdpEchoClientApplication:Send() + 2s UdpEchoClientApplication:Send(): Sent 1024 bytes to 10.1.1.2 + 2.00369s UdpEchoServerApplication:HandleRead(): Received 1024 bytes from 10.1.1.1 + 2.00369s UdpEchoServerApplication:HandleRead(): Echoing packet + 2.00737s UdpEchoClientApplication:HandleRead(0x62c8c0, 0x62d020) + 2.00737s UdpEchoClientApplication:HandleRead(): Received 1024 bytes from 10.1.1.2 + 10s UdpEchoServerApplication:StopApplication() + 10s UdpEchoClientApplication:StopApplication() UdpEchoClientApplication:DoDispose() UdpEchoServerApplication:DoDispose() UdpEchoClientApplication:~UdpEchoClient() @@ -295,7 +293,7 @@ If you run the script now, you should see the following output: @end verbatim You can see that the constructor for the UdpEchoServer was called at a -simulation time of 0 nanoseconds. This is actually happening before the +simulation time of 0 seconds. This is actually happening before the simulation starts. The same for the UdpEchoClient constructor. Recall that the @code{first.cc} script started the echo server application at From 9cf0988230aa44193d5fc8f477fb853d7ec933eb Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Mon, 23 Feb 2009 16:07:46 +0000 Subject: [PATCH 12/12] Fix build of Python bindings on systems with no support for TabBridge --- bindings/python/ns3modulegen.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bindings/python/ns3modulegen.py b/bindings/python/ns3modulegen.py index e3dd6790b..12363b1e4 100755 --- a/bindings/python/ns3modulegen.py +++ b/bindings/python/ns3modulegen.py @@ -142,6 +142,10 @@ def main(): root_module.classes.remove(root_module['ns3::%s' % clsname]) root_module.enums.remove(root_module['ns3::RealtimeSimulatorImpl::SynchronizationMode']) + if 'TapBridge' not in enabled_features: + for clsname in ['TapBridge', 'TapBridgeHelper']: + root_module.classes.remove(root_module['ns3::%s' % clsname]) + root_module.generate(out, '_ns3') out.close()