code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
/* -*- 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 "packet-socket-helper.h" #include "ns3/packet-socket-factory.h" #include "ns3/names.h" namespace ns3 { void PacketSocketHelper::Install (NodeContainer c) const { for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i) { Install (*i); } } void PacketSocketHelper::Install (Ptr<Node> node) const { Ptr<PacketSocketFactory> factory = CreateObject<PacketSocketFactory> (); node->AggregateObject (factory); } void PacketSocketHelper::Install (std::string nodeName) const { Ptr<Node> node = Names::Find<Node> (nodeName); Install (node); } } // namespace ns3
zy901002-gpsr
src/network/helper/packet-socket-helper.cc
C++
gpl2
1,414
/* -*- 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 PACKET_SOCKET_HELPER_H #define PACKET_SOCKET_HELPER_H #include "ns3/node-container.h" namespace ns3 { /** * \brief Give ns3::PacketSocket powers to ns3::Node. */ class PacketSocketHelper { public: /** * Aggregate an instance of a ns3::PacketSocketFactory onto the provided * node. * * \param node Node on which to aggregate the ns3::PacketSocketFactory. */ void Install (Ptr<Node> node) const; /** * Aggregate an instance of a ns3::PacketSocketFactory onto the provided * node. * * \param nodeName The name of the node on which to aggregate the ns3::PacketSocketFactory. */ void Install (std::string nodeName) const; /** * For each node in the provided container, aggregate an instance of a * ns3::PacketSocketFactory. * * \param c NodeContainer of the set of nodes to aggregate the * ns3::PacketSocketFactory on. */ void Install (NodeContainer c) const; }; } // namespace ns3 #endif /* PACKET_SOCKET_HELPER_H */
zy901002-gpsr
src/network/helper/packet-socket-helper.h
C++
gpl2
1,806
/* -*- 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 "ns3/names.h" #include "application-container.h" namespace ns3 { ApplicationContainer::ApplicationContainer () { } ApplicationContainer::ApplicationContainer (Ptr<Application> app) { m_applications.push_back (app); } ApplicationContainer::ApplicationContainer (std::string name) { Ptr<Application> app = Names::Find<Application> (name); m_applications.push_back (app); } ApplicationContainer::Iterator ApplicationContainer::Begin (void) const { return m_applications.begin (); } ApplicationContainer::Iterator ApplicationContainer::End (void) const { return m_applications.end (); } uint32_t ApplicationContainer::GetN (void) const { return m_applications.size (); } Ptr<Application> ApplicationContainer::Get (uint32_t i) const { return m_applications[i]; } void ApplicationContainer::Add (ApplicationContainer other) { for (Iterator i = other.Begin (); i != other.End (); i++) { m_applications.push_back (*i); } } void ApplicationContainer::Add (Ptr<Application> application) { m_applications.push_back (application); } void ApplicationContainer::Add (std::string name) { Ptr<Application> application = Names::Find<Application> (name); m_applications.push_back (application); } void ApplicationContainer::Start (Time start) { for (Iterator i = Begin (); i != End (); ++i) { Ptr<Application> app = *i; app->SetStartTime (start); } } void ApplicationContainer::Stop (Time stop) { for (Iterator i = Begin (); i != End (); ++i) { Ptr<Application> app = *i; app->SetStopTime (stop); } } } // namespace ns3
zy901002-gpsr
src/network/helper/application-container.cc
C++
gpl2
2,426
/* -*- 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 * */ #ifndef NETWORK_H #define NETWORK_H /** * \defgroup network Network * * This section documents the API of the ns-3 network module. For a generic functional description, please refer to the ns-3 manual. */ #endif /* NETWORK_H */
zy901002-gpsr
src/network/doc/network.h
C
gpl2
959
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2005 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 "inet-socket-address.h" #include "ns3/assert.h" namespace ns3 { InetSocketAddress::InetSocketAddress (Ipv4Address ipv4, uint16_t port) : m_ipv4 (ipv4), m_port (port) { } InetSocketAddress::InetSocketAddress (Ipv4Address ipv4) : m_ipv4 (ipv4), m_port (0) { } InetSocketAddress::InetSocketAddress (const char *ipv4, uint16_t port) : m_ipv4 (Ipv4Address (ipv4)), m_port (port) { } InetSocketAddress::InetSocketAddress (const char * ipv4) : m_ipv4 (Ipv4Address (ipv4)), m_port (0) { } InetSocketAddress::InetSocketAddress (uint16_t port) : m_ipv4 (Ipv4Address::GetAny ()), m_port (port) { } uint16_t InetSocketAddress::GetPort (void) const { return m_port; } Ipv4Address InetSocketAddress::GetIpv4 (void) const { return m_ipv4; } void InetSocketAddress::SetPort (uint16_t port) { m_port = port; } void InetSocketAddress::SetIpv4 (Ipv4Address address) { m_ipv4 = address; } bool InetSocketAddress::IsMatchingType (const Address &address) { return address.CheckCompatible (GetType (), 6); } InetSocketAddress::operator Address () const { return ConvertTo (); } Address InetSocketAddress::ConvertTo (void) const { uint8_t buf[6]; m_ipv4.Serialize (buf); buf[4] = m_port & 0xff; buf[5] = (m_port >> 8) & 0xff; return Address (GetType (), buf, 6); } InetSocketAddress InetSocketAddress::ConvertFrom (const Address &address) { NS_ASSERT (address.CheckCompatible (GetType (), 6)); uint8_t buf[6]; address.CopyTo (buf); Ipv4Address ipv4 = Ipv4Address::Deserialize (buf); uint16_t port = buf[4] | (buf[5] << 8); return InetSocketAddress (ipv4, port); } uint8_t InetSocketAddress::GetType (void) { static uint8_t type = Address::Register (); return type; } } // namespace ns3
zy901002-gpsr
src/network/utils/inet-socket-address.cc
C++
gpl2
2,565
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ // // Copyright (c) 2006 Georgia Tech Research Corporation // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as // published by the Free Software Foundation; // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Author: Rajib Bhattacharjea<raj.b@gatech.edu> // #include "data-rate.h" #include "ns3/nstime.h" #include "ns3/fatal-error.h" static bool DoParse (const std::string s, uint64_t *v) { std::string::size_type n = s.find_first_not_of ("0123456789."); if (n != std::string::npos) { // Found non-numeric std::istringstream iss; iss.str (s.substr (0, n)); double r; iss >> r; std::string trailer = s.substr (n, std::string::npos); if (trailer == "bps") { // bit/s *v = (uint64_t)r; } else if (trailer == "b/s") { // bit/s *v = (uint64_t)r; } else if (trailer == "Bps") { // byte/s *v = (uint64_t)(r * 8); } else if (trailer == "B/s") { // byte/s *v = (uint64_t)(r * 8); } else if (trailer == "kbps") { // kilobits/s *v = (uint64_t)(r * 1000); } else if (trailer == "kb/s") { // kilobits/s *v = (uint64_t)(r * 1000); } else if (trailer == "Kbps") { // kilobits/s *v = (uint64_t)(r * 1000); } else if (trailer == "Kb/s") { // kilobits/s *v = (uint64_t)(r * 1000); } else if (trailer == "kBps") { // kiloByte/s *v = (uint64_t)(r * 8000); } else if (trailer == "kB/s") { // KiloByte/s *v = (uint64_t)(r * 8000); } else if (trailer == "KBps") { // kiloByte/s *v = (uint64_t)(r * 8000); } else if (trailer == "KB/s") { // KiloByte/s *v = (uint64_t)(r * 8000); } else if (trailer == "Kib/s") { // kibibit/s *v = (uint64_t)(r * 1024); } else if (trailer == "KiB/s") { // kibibyte/s *v = (uint64_t)(r * 8192); } else if (trailer == "Mbps") { // MegaBits/s *v = (uint64_t)(r * 1000000); } else if (trailer == "Mb/s") { // MegaBits/s *v = (uint64_t)(r * 1000000); } else if (trailer == "MBps") { // MegaBytes/s *v = (uint64_t)(r * 8000000); } else if (trailer == "MB/s") { // MegaBytes/s *v = (uint64_t)(r * 8000000); } else if (trailer == "Mib/s") { // MebiBits/s *v = (uint64_t)(r * 1048576); } else if (trailer == "MiB/s") { // MebiByte/s *v = (uint64_t)(r * 1048576 * 8); } else if (trailer == "Gbps") { // GigaBit/s *v = (uint64_t)(r * 1000000000); } else if (trailer == "Gb/s") { // GigaBit/s *v = (uint64_t)(r * 1000000000); } else if (trailer == "GBps") { // GigaByte/s *v = (uint64_t)(r * 8*1000000000); } else if (trailer == "GB/s") { // GigaByte/s *v = (uint64_t)(r * 8*1000000000); } else if (trailer == "Gib/s") { // GibiBits/s *v = (uint64_t)(r * 1048576 * 1024); } else if (trailer == "GiB/s") { // GibiByte/s *v = (uint64_t)(r * 1048576 * 1024 * 8); } else { return false; } return true; } std::istringstream iss; iss.str (s); iss >> *v; return true; } namespace ns3 { ATTRIBUTE_HELPER_CPP (DataRate); DataRate::DataRate () : m_bps (0) { } DataRate::DataRate(uint64_t bps) : m_bps (bps) { } bool DataRate::operator < (const DataRate& rhs) const { return m_bps<rhs.m_bps; } bool DataRate::operator <= (const DataRate& rhs) const { return m_bps<=rhs.m_bps; } bool DataRate::operator > (const DataRate& rhs) const { return m_bps>rhs.m_bps; } bool DataRate::operator >= (const DataRate& rhs) const { return m_bps>=rhs.m_bps; } bool DataRate::operator == (const DataRate& rhs) const { return m_bps==rhs.m_bps; } bool DataRate::operator != (const DataRate& rhs) const { return m_bps!=rhs.m_bps; } double DataRate::CalculateTxTime (uint32_t bytes) const { return static_cast<double>(bytes)*8/m_bps; } uint64_t DataRate::GetBitRate () const { return m_bps; } DataRate::DataRate (std::string rate) { bool ok = DoParse (rate, &m_bps); if (!ok) { NS_FATAL_ERROR ("Could not parse rate: "<<rate); } } std::ostream &operator << (std::ostream &os, const DataRate &rate) { os << rate.GetBitRate () << "bps"; return os; } std::istream &operator >> (std::istream &is, DataRate &rate) { std::string value; is >> value; uint64_t v; bool ok = DoParse (value, &v); if (!ok) { is.setstate (std::ios_base::failbit); } rate = DataRate (v); return is; } double operator* (const DataRate& lhs, const Time& rhs) { return rhs.GetSeconds ()*lhs.GetBitRate (); } double operator* (const Time& lhs, const DataRate& rhs) { return lhs.GetSeconds ()*rhs.GetBitRate (); } } // namespace ns3
zy901002-gpsr
src/network/utils/data-rate.cc
C++
gpl2
6,013
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 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 "address-utils.h" #include "inet-socket-address.h" namespace ns3 { void WriteTo (Buffer::Iterator &i, Ipv4Address ad) { i.WriteHtonU32 (ad.Get ()); } void WriteTo (Buffer::Iterator &i, Ipv6Address ad) { uint8_t buf[16]; ad.GetBytes (buf); i.Write (buf, 16); } void WriteTo (Buffer::Iterator &i, const Address &ad) { uint8_t mac[Address::MAX_SIZE]; ad.CopyTo (mac); i.Write (mac, ad.GetLength ()); } void WriteTo (Buffer::Iterator &i, Mac48Address ad) { uint8_t mac[6]; ad.CopyTo (mac); i.Write (mac, 6); } void ReadFrom (Buffer::Iterator &i, Ipv4Address &ad) { ad.Set (i.ReadNtohU32 ()); } void ReadFrom (Buffer::Iterator &i, Ipv6Address &ad) { uint8_t ipv6[16]; i.Read (ipv6, 16); ad.Set (ipv6); } void ReadFrom (Buffer::Iterator &i, Address &ad, uint32_t len) { uint8_t mac[Address::MAX_SIZE]; i.Read (mac, len); ad.CopyFrom (mac, len); } void ReadFrom (Buffer::Iterator &i, Mac48Address &ad) { uint8_t mac[6]; i.Read (mac, 6); ad.CopyFrom (mac); } namespace addressUtils { bool IsMulticast (const Address &ad) { if (InetSocketAddress::IsMatchingType (ad)) { InetSocketAddress inetAddr = InetSocketAddress::ConvertFrom (ad); Ipv4Address ipv4 = inetAddr.GetIpv4 (); return ipv4.IsMulticast (); } // IPv6 case can go here, in future return false; } } // namespace addressUtils } // namespace ns3
zy901002-gpsr
src/network/utils/address-utils.cc
C++
gpl2
2,198
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2005 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 LLC_SNAP_HEADER_H #define LLC_SNAP_HEADER_H #include <stdint.h> #include <string> #include "ns3/header.h" namespace ns3 { /** * The length in octects of the LLC/SNAP header */ static const uint16_t LLC_SNAP_HEADER_LENGTH = 8; /** * \ingroup network * * \brief Header for the LLC/SNAP encapsulation */ class LlcSnapHeader : public Header { public: LlcSnapHeader (); void SetType (uint16_t type); uint16_t GetType (void); static TypeId GetTypeId (void); virtual TypeId GetInstanceTypeId (void) const; virtual void Print (std::ostream &os) const; virtual uint32_t GetSerializedSize (void) const; virtual void Serialize (Buffer::Iterator start) const; virtual uint32_t Deserialize (Buffer::Iterator start); private: uint16_t m_etherType; }; } // namespace ns3 #endif /* LLC_SNAP_HEADER_H */
zy901002-gpsr
src/network/utils/llc-snap-header.h
C++
gpl2
1,646
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 INRIA * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> */ #ifndef MAC64_ADDRESS_H #define MAC64_ADDRESS_H #include <stdint.h> #include <ostream> namespace ns3 { class Address; /** * \ingroup address * * \brief an EUI-64 address * * This class can contain 64 bit IEEE addresses. */ class Mac64Address { public: Mac64Address (); /** * \param str a string representing the new Mac64Address * * The format of the string is "xx:xx:xx:xx:xx:xx" */ Mac64Address (const char *str); /** * \param buffer address in network order * * Copy the input address to our internal buffer. */ void CopyFrom (const uint8_t buffer[8]); /** * \param buffer address in network order * * Copy the internal address to the input buffer. */ void CopyTo (uint8_t buffer[8]) const; /** * \returns a new Address instance * * Convert an instance of this class to a polymorphic Address instance. */ operator Address () const; /** * \param address a polymorphic address * \returns a new Mac64Address from the polymorphic address * * This function performs a type check and asserts if the * type of the input address is not compatible with an * Mac64Address. */ static Mac64Address ConvertFrom (const Address &address); /** * \param address address to test * \returns true if the address matches, false otherwise. */ static bool IsMatchingType (const Address &address); /** * Allocate a new Mac64Address. */ static Mac64Address Allocate (void); private: /** * \returns a new Address instance * * Convert an instance of this class to a polymorphic Address instance. */ Address ConvertTo (void) const; static uint8_t GetType (void); uint8_t m_address[8]; }; bool operator == (const Mac64Address &a, const Mac64Address &b); bool operator != (const Mac64Address &a, const Mac64Address &b); std::ostream& operator<< (std::ostream& os, const Mac64Address & address); } // namespace ns3 #endif /* MAC64_ADDRESS_H */
zy901002-gpsr
src/network/utils/mac64-address.h
C++
gpl2
2,779
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 INRIA * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> */ #include "packet-socket-address.h" #include "ns3/net-device.h" namespace ns3 { PacketSocketAddress::PacketSocketAddress () { } void PacketSocketAddress::SetProtocol (uint16_t protocol) { m_protocol = protocol; } void PacketSocketAddress::SetAllDevices (void) { m_isSingleDevice = false; m_device = 0; } void PacketSocketAddress::SetSingleDevice (uint32_t index) { m_isSingleDevice = true; m_device = index; } void PacketSocketAddress::SetPhysicalAddress (const Address address) { m_address = address; } uint16_t PacketSocketAddress::GetProtocol (void) const { return m_protocol; } bool PacketSocketAddress::IsSingleDevice (void) const { return m_isSingleDevice; } uint32_t PacketSocketAddress::GetSingleDevice (void) const { return m_device; } Address PacketSocketAddress::GetPhysicalAddress (void) const { return m_address; } PacketSocketAddress::operator Address () const { return ConvertTo (); } Address PacketSocketAddress::ConvertTo (void) const { Address address; uint8_t buffer[Address::MAX_SIZE]; buffer[0] = m_protocol & 0xff; buffer[1] = (m_protocol >> 8) & 0xff; buffer[2] = (m_device >> 24) & 0xff; buffer[3] = (m_device >> 16) & 0xff; buffer[4] = (m_device >> 8) & 0xff; buffer[5] = (m_device >> 0) & 0xff; buffer[6] = m_isSingleDevice ? 1 : 0; uint32_t copied = m_address.CopyAllTo (buffer + 7, Address::MAX_SIZE - 7); return Address (GetType (), buffer, 7 + copied); } PacketSocketAddress PacketSocketAddress::ConvertFrom (const Address &address) { NS_ASSERT (IsMatchingType (address)); uint8_t buffer[Address::MAX_SIZE]; address.CopyTo (buffer); uint16_t protocol = buffer[0] | (buffer[1] << 8); uint32_t device = 0; device |= buffer[2]; device <<= 8; device |= buffer[3]; device <<= 8; device |= buffer[4]; device <<= 8; device |= buffer[5]; bool isSingleDevice = (buffer[6] == 1) ? true : false; Address physical; physical.CopyAllFrom (buffer + 7, Address::MAX_SIZE - 7); PacketSocketAddress ad; ad.SetProtocol (protocol); if (isSingleDevice) { ad.SetSingleDevice (device); } else { ad.SetAllDevices (); } ad.SetPhysicalAddress (physical); return ad; } bool PacketSocketAddress::IsMatchingType (const Address &address) { return address.IsMatchingType (GetType ()); } uint8_t PacketSocketAddress::GetType (void) { static uint8_t type = Address::Register (); return type; } } // namespace ns3
zy901002-gpsr
src/network/utils/packet-socket-address.cc
C++
gpl2
3,257
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ // // Copyright (c) 2006 Georgia Tech Research Corporation // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as // published by the Free Software Foundation; // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Author: Rajib Bhattacharjea<raj.b@gatech.edu> // #ifndef DATA_RATE_H #define DATA_RATE_H #include <string> #include <iostream> #include <stdint.h> #include "ns3/nstime.h" #include "ns3/attribute.h" #include "ns3/attribute-helper.h" namespace ns3 { /** * \ingroup network * \defgroup datarate Data Rate */ /** * \ingroup datarate * \brief Class for representing data rates * * Allows for natural and familiar use of data rates. Allows construction * from strings, natural multiplication e.g.: * \code * DataRate x("56kbps"); * double nBits = x*ns3::Seconds(19.2); * uint32_t nBytes = 20; * double txtime = x.CalclulateTxTime(nBytes); * \endcode * This class also supports the regular comparison operators <, >, <=, >=, ==, * and != * * Conventions used: * "b" stands for bits, "B" for bytes (8 bits) \n * "k" stands for 1000, "K" also stands for 1000, "Ki" stands for 1024 \n * "M" stand for 1000000, "Mib" stands for 1024 kibibits, or 1048576 bits \n * "G" stand for 10^9, "Gib" stands for 1024 mebibits \n * whitespace is allowed but not required between the numeric value and units * * Supported unit strings: * bps, b/s, Bps, B/s \n * kbps, kb/s, Kbps, Kb/s, kBps, kB/s, KBps, KB/s, Kib/s, KiB/s \n * Mbps, Mb/s, MBps, MB/s, Mib/s, MiB/s \n * Gbps, Gb/s, GBps, GB/s, Gib/s, GiB/s \n * * Examples: * "56kbps" = 56,000 bits/s \n * "128 kb/s" = 128,000 bits/s \n * "8Kib/s" = 1 KiB/s = 8192 bits/s \n * "1kB/s" = 8000 bits/s */ class DataRate { public: DataRate (); /** * \brief Integer constructor * * Construct a data rate from an integer. This class only supports positive * integer data rates in units of bits/s, meaning 1bit/s is the smallest * non-trivial bitrate available. * \param bps bit/s value */ DataRate (uint64_t bps); DataRate (std::string rate); bool operator < (const DataRate& rhs) const; bool operator <= (const DataRate& rhs) const; bool operator > (const DataRate& rhs) const; bool operator >= (const DataRate& rhs) const; bool operator == (const DataRate& rhs) const; bool operator != (const DataRate& rhs) const; /** * \brief Calculate transmission time * * Calculates the transmission time at this data rate * \param bytes The number of bytes (not bits) for which to calculate * \return The transmission time in seconds for the number of bytes specified */ double CalculateTxTime (uint32_t bytes) const; /** * Get the underlying bitrate * \return The underlying bitrate in bits per second */ uint64_t GetBitRate () const; private: uint64_t m_bps; static uint64_t Parse (const std::string); }; std::ostream &operator << (std::ostream &os, const DataRate &rate); std::istream &operator >> (std::istream &is, DataRate &rate); /** * \class ns3::DataRateValue * \brief hold objects of type ns3::DataRate */ ATTRIBUTE_HELPER_HEADER (DataRate); /** * \param lhs * \param rhs * \return Bits transmitted in rhs seconds at lhs b/s */ double operator* (const DataRate& lhs, const Time& rhs); double operator* (const Time& lhs, const DataRate& rhs); } // namespace ns3 #endif /* DATA_RATE_H */
zy901002-gpsr
src/network/utils/data-rate.h
C++
gpl2
3,933
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007,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: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr> */ #include <stdint.h> #include <list> #include "ns3/packet.h" #include "packet-burst.h" #include "ns3/log.h" NS_LOG_COMPONENT_DEFINE ("PacketBurst"); namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (PacketBurst); TypeId PacketBurst::GetTypeId (void) { static TypeId tid = TypeId ("ns3::PacketBurst") .SetParent<Object> () .AddConstructor<PacketBurst> () ; return tid; } PacketBurst::PacketBurst (void) { } PacketBurst::~PacketBurst (void) { for (std::list<Ptr<Packet> >::const_iterator iter = m_packets.begin (); iter != m_packets.end (); ++iter) { (*iter)->Unref (); } } void PacketBurst::DoDispose (void) { m_packets.clear (); } Ptr<PacketBurst> PacketBurst::Copy (void) const { Ptr<PacketBurst> burst = Create<PacketBurst> (); for (std::list<Ptr<Packet> >::const_iterator iter = m_packets.begin (); iter != m_packets.end (); ++iter) { Ptr<Packet> packet = (*iter)->Copy (); burst->AddPacket (packet); } return burst; } void PacketBurst::AddPacket (Ptr<Packet> packet) { if (packet) { m_packets.push_back (packet); } } std::list<Ptr<Packet> > PacketBurst::GetPackets (void) const { return m_packets; } uint32_t PacketBurst::GetNPackets (void) const { return m_packets.size (); } uint32_t PacketBurst::GetSize (void) const { uint32_t size = 0; for (std::list<Ptr<Packet> >::const_iterator iter = m_packets.begin (); iter != m_packets.end (); ++iter) { Ptr<Packet> packet = *iter; size += packet->GetSize (); } return size; } std::list<Ptr<Packet> >::const_iterator PacketBurst::Begin (void) const { return m_packets.begin (); } std::list<Ptr<Packet> >::const_iterator PacketBurst::End (void) const { return m_packets.end (); } } // namespace ns3
zy901002-gpsr
src/network/utils/packet-burst.cc
C++
gpl2
2,612
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2009 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Craig Dowell (craigdo@ee.washington.edu) */ #include <iostream> #include <cstring> #include "ns3/assert.h" #include "ns3/packet.h" #include "ns3/fatal-error.h" #include "ns3/fatal-impl.h" #include "ns3/header.h" #include "ns3/buffer.h" #include "pcap-file.h" // // This file is used as part of the ns-3 test framework, so please refrain from // adding any ns-3 specific constructs such as Packet to this file. // namespace ns3 { const uint32_t MAGIC = 0xa1b2c3d4; /**< Magic number identifying standard pcap file format */ const uint32_t SWAPPED_MAGIC = 0xd4c3b2a1; /**< Looks this way if byte swapping is required */ const uint32_t NS_MAGIC = 0xa1b23cd4; /**< Magic number identifying nanosec resolution pcap file format */ const uint32_t NS_SWAPPED_MAGIC = 0xd43cb2a1; /**< Looks this way if byte swapping is required */ const uint16_t VERSION_MAJOR = 2; /**< Major version of supported pcap file format */ const uint16_t VERSION_MINOR = 4; /**< Minor version of supported pcap file format */ const int32_t SIGFIGS_DEFAULT = 0; /**< Significant figures for timestamps (libpcap doesn't even bother) */ PcapFile::PcapFile () : m_file (), m_swapMode (false) { FatalImpl::RegisterStream (&m_file); } PcapFile::~PcapFile () { FatalImpl::UnregisterStream (&m_file); Close (); } bool PcapFile::Fail (void) const { return m_file.fail (); } bool PcapFile::Eof (void) const { return m_file.eof (); } void PcapFile::Clear (void) { m_file.clear (); } void PcapFile::Close (void) { m_file.close (); } uint32_t PcapFile::GetMagic (void) { return m_fileHeader.m_magicNumber; } uint16_t PcapFile::GetVersionMajor (void) { return m_fileHeader.m_versionMajor; } uint16_t PcapFile::GetVersionMinor (void) { return m_fileHeader.m_versionMinor; } int32_t PcapFile::GetTimeZoneOffset (void) { return m_fileHeader.m_zone; } uint32_t PcapFile::GetSigFigs (void) { return m_fileHeader.m_sigFigs; } uint32_t PcapFile::GetSnapLen (void) { return m_fileHeader.m_snapLen; } uint32_t PcapFile::GetDataLinkType (void) { return m_fileHeader.m_type; } bool PcapFile::GetSwapMode (void) { return m_swapMode; } uint8_t PcapFile::Swap (uint8_t val) { return val; } uint16_t PcapFile::Swap (uint16_t val) { return ((val >> 8) & 0x00ff) | ((val << 8) & 0xff00); } uint32_t PcapFile::Swap (uint32_t val) { return ((val >> 24) & 0x000000ff) | ((val >> 8) & 0x0000ff00) | ((val << 8) & 0x00ff0000) | ((val << 24) & 0xff000000); } void PcapFile::Swap (PcapFileHeader *from, PcapFileHeader *to) { to->m_magicNumber = Swap (from->m_magicNumber); to->m_versionMajor = Swap (from->m_versionMajor); to->m_versionMinor = Swap (from->m_versionMinor); to->m_zone = Swap (uint32_t (from->m_zone)); to->m_sigFigs = Swap (from->m_sigFigs); to->m_snapLen = Swap (from->m_snapLen); to->m_type = Swap (from->m_type); } void PcapFile::Swap (PcapRecordHeader *from, PcapRecordHeader *to) { to->m_tsSec = Swap (from->m_tsSec); to->m_tsUsec = Swap (from->m_tsUsec); to->m_inclLen = Swap (from->m_inclLen); to->m_origLen = Swap (from->m_origLen); } void PcapFile::WriteFileHeader (void) { // // If we're initializing the file, we need to write the pcap file header // at the start of the file. // m_file.seekp (0, std::ios::beg); // // We have the ability to write out the pcap file header in a foreign endian // format, so we need a temp place to swap on the way out. // PcapFileHeader header; // // the pointer headerOut selects either the swapped or non-swapped version of // the pcap file header. // PcapFileHeader *headerOut = 0; if (m_swapMode == false) { headerOut = &m_fileHeader; } else { Swap (&m_fileHeader, &header); headerOut = &header; } // // Watch out for memory alignment differences between machines, so write // them all individually. // m_file.write ((const char *)&headerOut->m_magicNumber, sizeof(headerOut->m_magicNumber)); m_file.write ((const char *)&headerOut->m_versionMajor, sizeof(headerOut->m_versionMajor)); m_file.write ((const char *)&headerOut->m_versionMinor, sizeof(headerOut->m_versionMinor)); m_file.write ((const char *)&headerOut->m_zone, sizeof(headerOut->m_zone)); m_file.write ((const char *)&headerOut->m_sigFigs, sizeof(headerOut->m_sigFigs)); m_file.write ((const char *)&headerOut->m_snapLen, sizeof(headerOut->m_snapLen)); m_file.write ((const char *)&headerOut->m_type, sizeof(headerOut->m_type)); } void PcapFile::ReadAndVerifyFileHeader (void) { // // Pcap file header is always at the start of the file // m_file.seekg (0, std::ios::beg); // // Watch out for memory alignment differences between machines, so read // them all individually. // m_file.read ((char *)&m_fileHeader.m_magicNumber, sizeof(m_fileHeader.m_magicNumber)); m_file.read ((char *)&m_fileHeader.m_versionMajor, sizeof(m_fileHeader.m_versionMajor)); m_file.read ((char *)&m_fileHeader.m_versionMinor, sizeof(m_fileHeader.m_versionMinor)); m_file.read ((char *)&m_fileHeader.m_zone, sizeof(m_fileHeader.m_zone)); m_file.read ((char *)&m_fileHeader.m_sigFigs, sizeof(m_fileHeader.m_sigFigs)); m_file.read ((char *)&m_fileHeader.m_snapLen, sizeof(m_fileHeader.m_snapLen)); m_file.read ((char *)&m_fileHeader.m_type, sizeof(m_fileHeader.m_type)); if (m_file.fail ()) { return; } // // There are four possible magic numbers that can be there. Normal and byte // swapped versions of the standard magic number, and normal and byte swapped // versions of the magic number indicating nanosecond resolution timestamps. // if (m_fileHeader.m_magicNumber != MAGIC && m_fileHeader.m_magicNumber != SWAPPED_MAGIC && m_fileHeader.m_magicNumber != NS_MAGIC && m_fileHeader.m_magicNumber != NS_SWAPPED_MAGIC) { m_file.setstate (std::ios::failbit); } // // If the magic number is swapped, then we can assume that everything else we read // is swapped. // m_swapMode = (m_fileHeader.m_magicNumber == SWAPPED_MAGIC || m_fileHeader.m_magicNumber == NS_SWAPPED_MAGIC) ? true : false; if (m_swapMode) { Swap (&m_fileHeader, &m_fileHeader); } // // We only deal with one version of the pcap file format. // if (m_fileHeader.m_versionMajor != VERSION_MAJOR || m_fileHeader.m_versionMinor != VERSION_MINOR) { m_file.setstate (std::ios::failbit); } // // A quick test of reasonablness for the time zone offset corresponding to // a real place on the planet. // if (m_fileHeader.m_zone < -12 || m_fileHeader.m_zone > 12) { m_file.setstate (std::ios::failbit); } if (m_file.fail ()) { m_file.close (); } } void PcapFile::Open (std::string const &filename, std::ios::openmode mode) { NS_ASSERT ((mode & std::ios::app) == 0); NS_ASSERT (!m_file.fail ()); // // All pcap files are binary files, so we just do this automatically. // mode |= std::ios::binary; m_file.open (filename.c_str (), mode); if (mode & std::ios::in) { // will set the fail bit if file header is invalid. ReadAndVerifyFileHeader (); } } void PcapFile::Init (uint32_t dataLinkType, uint32_t snapLen, int32_t timeZoneCorrection, bool swapMode) { // // Initialize the in-memory file header. // m_fileHeader.m_magicNumber = MAGIC; m_fileHeader.m_versionMajor = VERSION_MAJOR; m_fileHeader.m_versionMinor = VERSION_MINOR; m_fileHeader.m_zone = timeZoneCorrection; m_fileHeader.m_sigFigs = 0; m_fileHeader.m_snapLen = snapLen; m_fileHeader.m_type = dataLinkType; // // We use pcap files for regression testing. We do byte-for-byte comparisons // in those tests to determine pass or fail. If we allow big endian systems // to write big endian headers, they will end up byte-swapped and the // regression tests will fail. Until we get rid of the regression tests, we // have to pick an endianness and stick with it. The precedent is little // endian, so we set swap mode if required to pick little endian. // // We do want to allow a user or test suite to enable swapmode irrespective // of what we decide here, so we allow setting swapmode from formal parameter // as well. // // So, determine the endianness of the running system. // union { uint32_t a; uint8_t b[4]; } u; u.a = 1; bool bigEndian = u.b[3]; // // And set swap mode if requested or we are on a big-endian system. // m_swapMode = swapMode | bigEndian; WriteFileHeader (); } uint32_t PcapFile::WritePacketHeader (uint32_t tsSec, uint32_t tsUsec, uint32_t totalLen) { NS_ASSERT (m_file.good ()); uint32_t inclLen = totalLen > m_fileHeader.m_snapLen ? m_fileHeader.m_snapLen : totalLen; PcapRecordHeader header; header.m_tsSec = tsSec; header.m_tsUsec = tsUsec; header.m_inclLen = inclLen; header.m_origLen = totalLen; if (m_swapMode) { Swap (&header, &header); } // // Watch out for memory alignment differences between machines, so write // them all individually. // m_file.write ((const char *)&header.m_tsSec, sizeof(header.m_tsSec)); m_file.write ((const char *)&header.m_tsUsec, sizeof(header.m_tsUsec)); m_file.write ((const char *)&header.m_inclLen, sizeof(header.m_inclLen)); m_file.write ((const char *)&header.m_origLen, sizeof(header.m_origLen)); return inclLen; } void PcapFile::Write (uint32_t tsSec, uint32_t tsUsec, uint8_t const * const data, uint32_t totalLen) { uint32_t inclLen = WritePacketHeader (tsSec, tsUsec, totalLen); m_file.write ((const char *)data, inclLen); } void PcapFile::Write (uint32_t tsSec, uint32_t tsUsec, Ptr<const Packet> p) { uint32_t inclLen = WritePacketHeader (tsSec, tsUsec, p->GetSize ()); p->CopyData (&m_file, inclLen); } void PcapFile::Write (uint32_t tsSec, uint32_t tsUsec, Header &header, Ptr<const Packet> p) { uint32_t headerSize = header.GetSerializedSize (); uint32_t totalSize = headerSize + p->GetSize (); uint32_t inclLen = WritePacketHeader (tsSec, tsUsec, totalSize); Buffer headerBuffer; headerBuffer.AddAtStart (headerSize); header.Serialize (headerBuffer.Begin ()); uint32_t toCopy = std::min (headerSize, inclLen); headerBuffer.CopyData (&m_file, toCopy); inclLen -= toCopy; p->CopyData (&m_file, inclLen); } void PcapFile::Read ( uint8_t * const data, uint32_t maxBytes, uint32_t &tsSec, uint32_t &tsUsec, uint32_t &inclLen, uint32_t &origLen, uint32_t &readLen) { NS_ASSERT (m_file.good ()); PcapRecordHeader header; // // Watch out for memory alignment differences between machines, so read // them all individually. // m_file.read ((char *)&header.m_tsSec, sizeof(header.m_tsSec)); m_file.read ((char *)&header.m_tsUsec, sizeof(header.m_tsUsec)); m_file.read ((char *)&header.m_inclLen, sizeof(header.m_inclLen)); m_file.read ((char *)&header.m_origLen, sizeof(header.m_origLen)); if (m_file.fail ()) { return; } if (m_swapMode) { Swap (&header, &header); } tsSec = header.m_tsSec; tsUsec = header.m_tsUsec; inclLen = header.m_inclLen; origLen = header.m_origLen; // // We don't always want to force the client to keep a maximum length buffer // around so we allow her to specify a minimum number of bytes to read. // Usually 64 bytes is enough information to print all of the headers, so // it isn't typically necessary to read all thousand bytes of an echo packet, // for example, to figure out what is going on. // readLen = maxBytes < header.m_inclLen ? maxBytes : header.m_inclLen; m_file.read ((char *)data, readLen); // // To keep the file pointer pointed in the right place, however, we always // need to account for the entire packet as stored originally. // if (readLen < header.m_inclLen) { m_file.seekg (header.m_inclLen - readLen, std::ios::cur); } } bool PcapFile::Diff (std::string const & f1, std::string const & f2, uint32_t & sec, uint32_t & usec, uint32_t snapLen) { PcapFile pcap1, pcap2; pcap1.Open (f1, std::ios::in); pcap2.Open (f2, std::ios::in); bool bad = pcap1.Fail () || pcap2.Fail (); if (bad) { return true; } uint8_t *data1 = new uint8_t [snapLen] (); uint8_t *data2 = new uint8_t [snapLen] (); uint32_t tsSec1, tsSec2; uint32_t tsUsec1, tsUsec2; uint32_t inclLen1, inclLen2; uint32_t origLen1, origLen2; uint32_t readLen1, readLen2; bool diff = false; while (!pcap1.Eof () && !pcap2.Eof ()) { pcap1.Read (data1, snapLen, tsSec1, tsUsec1, inclLen1, origLen1, readLen1); pcap2.Read (data2, snapLen, tsSec2, tsUsec2, inclLen2, origLen2, readLen2); bool same = pcap1.Fail () == pcap2.Fail (); if (!same) { diff = true; break; } if (pcap1.Eof ()) { break; } if (tsSec1 != tsSec2 || tsUsec1 != tsUsec2) { diff = true; // Next packet timestamps do not match break; } if (readLen1 != readLen2) { diff = true; // Packet lengths do not match break; } if (std::memcmp (data1, data2, readLen1) != 0) { diff = true; // Packet data do not match break; } } sec = tsSec1; usec = tsUsec1; bad = pcap1.Fail () || pcap2.Fail (); bool eof = pcap1.Eof () && pcap2.Eof (); if (bad && !eof) { diff = true; } delete[] data1; delete[] data2; return diff; } } // namespace ns3
zy901002-gpsr
src/network/utils/pcap-file.cc
C++
gpl2
14,415
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 Emmanuelle Laprise, INRIA * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Authors: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca> * Mathieu Lacage <mathieu.lacage@sophia.inria.fr> */ #include "packet-socket.h" #include "packet-socket-address.h" #include "ns3/log.h" #include "ns3/node.h" #include "ns3/packet.h" #include "ns3/uinteger.h" #include "ns3/trace-source-accessor.h" #include <algorithm> NS_LOG_COMPONENT_DEFINE ("PacketSocket"); namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (PacketSocket); TypeId PacketSocket::GetTypeId (void) { static TypeId tid = TypeId ("ns3::PacketSocket") .SetParent<Socket> () .AddConstructor<PacketSocket> () .AddTraceSource ("Drop", "Drop packet due to receive buffer overflow", MakeTraceSourceAccessor (&PacketSocket::m_dropTrace)) .AddAttribute ("RcvBufSize", "PacketSocket maximum receive buffer size (bytes)", UintegerValue (131072), MakeUintegerAccessor (&PacketSocket::m_rcvBufSize), MakeUintegerChecker<uint32_t> ()) ; return tid; } PacketSocket::PacketSocket () : m_rxAvailable (0) { NS_LOG_FUNCTION (this); m_state = STATE_OPEN; m_shutdownSend = false; m_shutdownRecv = false; m_errno = ERROR_NOTERROR; m_isSingleDevice = false; m_device = 0; } void PacketSocket::SetNode (Ptr<Node> node) { NS_LOG_FUNCTION (this << node); m_node = node; } PacketSocket::~PacketSocket () { NS_LOG_FUNCTION (this); } void PacketSocket::DoDispose (void) { NS_LOG_FUNCTION (this); m_device = 0; } enum Socket::SocketErrno PacketSocket::GetErrno (void) const { NS_LOG_FUNCTION (this); return m_errno; } enum Socket::SocketType PacketSocket::GetSocketType (void) const { return NS3_SOCK_RAW; } Ptr<Node> PacketSocket::GetNode (void) const { NS_LOG_FUNCTION (this); return m_node; } int PacketSocket::Bind (void) { NS_LOG_FUNCTION (this); PacketSocketAddress address; address.SetProtocol (0); address.SetAllDevices (); return DoBind (address); } int PacketSocket::Bind (const Address &address) { NS_LOG_FUNCTION (this << address); if (!PacketSocketAddress::IsMatchingType (address)) { m_errno = ERROR_INVAL; return -1; } PacketSocketAddress ad = PacketSocketAddress::ConvertFrom (address); return DoBind (ad); } int PacketSocket::DoBind (const PacketSocketAddress &address) { NS_LOG_FUNCTION (this << address); if (m_state == STATE_BOUND || m_state == STATE_CONNECTED) { m_errno = ERROR_INVAL; return -1; } if (m_state == STATE_CLOSED) { m_errno = ERROR_BADF; return -1; } Ptr<NetDevice> dev; if (address.IsSingleDevice ()) { dev = m_node->GetDevice (address.GetSingleDevice ()); } else { dev = 0; } m_node->RegisterProtocolHandler (MakeCallback (&PacketSocket::ForwardUp, this), address.GetProtocol (), dev); m_state = STATE_BOUND; m_protocol = address.GetProtocol (); m_isSingleDevice = address.IsSingleDevice (); m_device = address.GetSingleDevice (); return 0; } int PacketSocket::ShutdownSend (void) { NS_LOG_FUNCTION (this); if (m_state == STATE_CLOSED) { m_errno = ERROR_BADF; return -1; } m_shutdownSend = true; return 0; } int PacketSocket::ShutdownRecv (void) { NS_LOG_FUNCTION (this); if (m_state == STATE_CLOSED) { m_errno = ERROR_BADF; return -1; } m_shutdownRecv = true; return 0; } int PacketSocket::Close (void) { NS_LOG_FUNCTION (this); if (m_state == STATE_CLOSED) { m_errno = ERROR_BADF; return -1; } else if (m_state == STATE_BOUND || m_state == STATE_CONNECTED) { m_node->UnregisterProtocolHandler (MakeCallback (&PacketSocket::ForwardUp, this)); } m_state = STATE_CLOSED; m_shutdownSend = true; m_shutdownRecv = true; return 0; } int PacketSocket::Connect (const Address &ad) { NS_LOG_FUNCTION (this << ad); PacketSocketAddress address; if (m_state == STATE_CLOSED) { m_errno = ERROR_BADF; goto error; } if (m_state == STATE_OPEN) { // connect should happen _after_ bind. m_errno = ERROR_INVAL; // generic error condition. goto error; } if (m_state == STATE_CONNECTED) { m_errno = ERROR_ISCONN; goto error; } if (!PacketSocketAddress::IsMatchingType (ad)) { m_errno = ERROR_AFNOSUPPORT; goto error; } m_destAddr = ad; m_state = STATE_CONNECTED; NotifyConnectionSucceeded (); return 0; error: NotifyConnectionFailed (); return -1; } int PacketSocket::Listen (void) { m_errno = Socket::ERROR_OPNOTSUPP; return -1; } int PacketSocket::Send (Ptr<Packet> p, uint32_t flags) { NS_LOG_FUNCTION (this << p << flags); if (m_state == STATE_OPEN || m_state == STATE_BOUND) { m_errno = ERROR_NOTCONN; return -1; } return SendTo (p, flags, m_destAddr); } uint32_t PacketSocket::GetMinMtu (PacketSocketAddress ad) const { if (ad.IsSingleDevice ()) { Ptr<NetDevice> device = m_node->GetDevice (ad.GetSingleDevice ()); return device->GetMtu (); } else { uint32_t minMtu = 0xffff; for (uint32_t i = 0; i < m_node->GetNDevices (); i++) { Ptr<NetDevice> device = m_node->GetDevice (i); minMtu = std::min (minMtu, (uint32_t)device->GetMtu ()); } return minMtu; } } uint32_t PacketSocket::GetTxAvailable (void) const { if (m_state == STATE_CONNECTED) { PacketSocketAddress ad = PacketSocketAddress::ConvertFrom (m_destAddr); return GetMinMtu (ad); } // If we are not connected, we return a 'safe' value by default. return 0xffff; } int PacketSocket::SendTo (Ptr<Packet> p, uint32_t flags, const Address &address) { NS_LOG_FUNCTION (this << p << flags << address); PacketSocketAddress ad; if (m_state == STATE_CLOSED) { NS_LOG_LOGIC ("ERROR_BADF"); m_errno = ERROR_BADF; return -1; } if (m_shutdownSend) { NS_LOG_LOGIC ("ERROR_SHUTDOWN"); m_errno = ERROR_SHUTDOWN; return -1; } if (!PacketSocketAddress::IsMatchingType (address)) { NS_LOG_LOGIC ("ERROR_AFNOSUPPORT"); m_errno = ERROR_AFNOSUPPORT; return -1; } ad = PacketSocketAddress::ConvertFrom (address); if (p->GetSize () > GetMinMtu (ad)) { m_errno = ERROR_MSGSIZE; return -1; } bool error = false; Address dest = ad.GetPhysicalAddress (); if (ad.IsSingleDevice ()) { Ptr<NetDevice> device = m_node->GetDevice (ad.GetSingleDevice ()); if (!device->Send (p, dest, ad.GetProtocol ())) { NS_LOG_LOGIC ("error: NetDevice::Send error"); error = true; } } else { for (uint32_t i = 0; i < m_node->GetNDevices (); i++) { Ptr<NetDevice> device = m_node->GetDevice (i); if (!device->Send (p, dest, ad.GetProtocol ())) { NS_LOG_LOGIC ("error: NetDevice::Send error"); error = true; } } } if (!error) { NotifyDataSent (p->GetSize ()); NotifySend (GetTxAvailable ()); } if (error) { NS_LOG_LOGIC ("ERROR_INVAL 2"); m_errno = ERROR_INVAL; return -1; } else { return 0; } } void PacketSocket::ForwardUp (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType) { NS_LOG_FUNCTION (this << device << packet << protocol << from << to << packetType); if (m_shutdownRecv) { return; } PacketSocketAddress address; address.SetPhysicalAddress (from); address.SetSingleDevice (device->GetIfIndex ()); address.SetProtocol (protocol); if ((m_rxAvailable + packet->GetSize ()) <= m_rcvBufSize) { Ptr<Packet> copy = packet->Copy (); SocketAddressTag tag; tag.SetAddress (address); copy->AddPacketTag (tag); m_deliveryQueue.push (copy); m_rxAvailable += packet->GetSize (); NS_LOG_LOGIC ("UID is " << packet->GetUid () << " PacketSocket " << this); NotifyDataRecv (); } else { // In general, this case should not occur unless the // receiving application reads data from this socket slowly // in comparison to the arrival rate // // drop and trace packet NS_LOG_WARN ("No receive buffer space available. Drop."); m_dropTrace (packet); } } uint32_t PacketSocket::GetRxAvailable (void) const { NS_LOG_FUNCTION (this); // We separately maintain this state to avoid walking the queue // every time this might be called return m_rxAvailable; } Ptr<Packet> PacketSocket::Recv (uint32_t maxSize, uint32_t flags) { NS_LOG_FUNCTION (this << maxSize << flags); if (m_deliveryQueue.empty () ) { return 0; } Ptr<Packet> p = m_deliveryQueue.front (); if (p->GetSize () <= maxSize) { m_deliveryQueue.pop (); m_rxAvailable -= p->GetSize (); } else { p = 0; } return p; } Ptr<Packet> PacketSocket::RecvFrom (uint32_t maxSize, uint32_t flags, Address &fromAddress) { NS_LOG_FUNCTION (this << maxSize << flags << fromAddress); Ptr<Packet> packet = Recv (maxSize, flags); if (packet != 0) { SocketAddressTag tag; bool found; found = packet->PeekPacketTag (tag); NS_ASSERT (found); //cast found to void, to suppress 'found' set but not used compiler warning //in optimized builds (void) found; fromAddress = tag.GetAddress (); } return packet; } int PacketSocket::GetSockName (Address &address) const { NS_LOG_FUNCTION (this << address); PacketSocketAddress ad = PacketSocketAddress::ConvertFrom (address); ad.SetProtocol (m_protocol); if (m_isSingleDevice) { Ptr<NetDevice> device = m_node->GetDevice (ad.GetSingleDevice ()); ad.SetPhysicalAddress (device->GetAddress ()); ad.SetSingleDevice (m_device); } else { ad.SetPhysicalAddress (Address ()); ad.SetAllDevices (); } address = ad; return 0; } bool PacketSocket::SetAllowBroadcast (bool allowBroadcast) { if (allowBroadcast) { return false; } return true; } bool PacketSocket::GetAllowBroadcast () const { return false; } } // namespace ns3
zy901002-gpsr
src/network/utils/packet-socket.cc
C++
gpl2
11,204
/* This code snippet was ripped out of the gcc * documentation and slightly modified to work * with gcc 4.x */ #ifndef SGI_HASHMAP_H #define SGI_HASHMAP_H /* To use gcc extensions. */ #ifdef __GNUC__ #if __GNUC__ < 3 #include <hash_map.h> namespace sgi { using ::hash_map; }; // inherit globals #else #if __GNUC__ < 4 #include <ext/hash_map> #if __GNUC_MINOR__ == 0 namespace sgi = std; // GCC 3.0 #else namespace sgi = ::__gnu_cxx; // GCC 3.1 and later #endif #else // gcc 4.x and later #if __GNUC_MINOR__ < 3 #include <ext/hash_map> namespace sgi = ::__gnu_cxx; #else #undef __DEPRECATED #include <backward/hash_map> namespace sgi = ::__gnu_cxx; #endif #endif #endif #else // ... there are other compilers, right? namespace sgi = std; #endif #endif /* SGI_HASHMAP_H */
zy901002-gpsr
src/network/utils/sgi-hashmap.h
C++
gpl2
890
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2005 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 <stdlib.h> #include "ns3/log.h" #include "ipv4-address.h" #include "ns3/assert.h" NS_LOG_COMPONENT_DEFINE ("Ipv4Address"); namespace ns3 { #define ASCII_DOT (0x2e) #define ASCII_ZERO (0x30) #define ASCII_SLASH (0x2f) static uint32_t AsciiToIpv4Host (char const *address) { uint32_t host = 0; while (true) { uint8_t byte = 0; while (*address != ASCII_DOT && *address != 0) { byte *= 10; byte += *address - ASCII_ZERO; address++; } host <<= 8; host |= byte; if (*address == 0) { break; } address++; } return host; } } // namespace ns3 namespace ns3 { Ipv4Mask::Ipv4Mask () : m_mask (0x66666666) { } Ipv4Mask::Ipv4Mask (uint32_t mask) : m_mask (mask) { } Ipv4Mask::Ipv4Mask (char const *mask) { if (*mask == ASCII_SLASH) { uint32_t plen = static_cast<uint32_t> (atoi (++mask)); NS_ASSERT (plen <= 32); if (plen > 0) { m_mask = 0xffffffff << (32 - plen); } else { m_mask = 0; } } else { m_mask = AsciiToIpv4Host (mask); } } bool Ipv4Mask::IsEqual (Ipv4Mask other) const { if (other.m_mask == m_mask) { return true; } else { return false; } } bool Ipv4Mask::IsMatch (Ipv4Address a, Ipv4Address b) const { if ((a.Get () & m_mask) == (b.Get () & m_mask)) { return true; } else { return false; } } uint32_t Ipv4Mask::Get (void) const { return m_mask; } void Ipv4Mask::Set (uint32_t mask) { m_mask = mask; } uint32_t Ipv4Mask::GetInverse (void) const { return ~m_mask; } void Ipv4Mask::Print (std::ostream &os) const { os << ((m_mask >> 24) & 0xff) << "." << ((m_mask >> 16) & 0xff) << "." << ((m_mask >> 8) & 0xff) << "." << ((m_mask >> 0) & 0xff); } Ipv4Mask Ipv4Mask::GetLoopback (void) { static Ipv4Mask loopback = Ipv4Mask ("255.0.0.0"); return loopback; } Ipv4Mask Ipv4Mask::GetZero (void) { static Ipv4Mask zero = Ipv4Mask ("0.0.0.0"); return zero; } Ipv4Mask Ipv4Mask::GetOnes (void) { static Ipv4Mask ones = Ipv4Mask ("255.255.255.255"); return ones; } uint16_t Ipv4Mask::GetPrefixLength (void) const { uint16_t tmp = 0; uint32_t mask = m_mask; while (mask != 0 ) { mask = mask << 1; tmp++; } return tmp; } Ipv4Address::Ipv4Address () : m_address (0x66666666) { } Ipv4Address::Ipv4Address (uint32_t address) { m_address = address; } Ipv4Address::Ipv4Address (char const *address) { m_address = AsciiToIpv4Host (address); } uint32_t Ipv4Address::Get (void) const { return m_address; } void Ipv4Address::Set (uint32_t address) { m_address = address; } void Ipv4Address::Set (char const *address) { m_address = AsciiToIpv4Host (address); } Ipv4Address Ipv4Address::CombineMask (Ipv4Mask const &mask) const { return Ipv4Address (Get () & mask.Get ()); } Ipv4Address Ipv4Address::GetSubnetDirectedBroadcast (Ipv4Mask const &mask) const { if (mask == Ipv4Mask::GetOnes ()) { NS_ASSERT_MSG (false, "Trying to get subnet-directed broadcast address with an all-ones netmask"); } return Ipv4Address (Get () | mask.GetInverse ()); } bool Ipv4Address::IsSubnetDirectedBroadcast (Ipv4Mask const &mask) const { if (mask == Ipv4Mask::GetOnes ()) { // If the mask is 255.255.255.255, there is no subnet directed // broadcast for this address. return false; } return ( (Get () | mask.GetInverse ()) == Get () ); } bool Ipv4Address::IsBroadcast (void) const { return (m_address == 0xffffffffU); } bool Ipv4Address::IsMulticast (void) const { // // Multicast addresses are defined as ranging from 224.0.0.0 through // 239.255.255.255 (which is E0000000 through EFFFFFFF in hex). // return (m_address >= 0xe0000000 && m_address <= 0xefffffff); } bool Ipv4Address::IsLocalMulticast (void) const { // Link-Local multicast address is 224.0.0.0/24 return (m_address & 0xffffff00) == 0xe0000000; } void Ipv4Address::Serialize (uint8_t buf[4]) const { buf[0] = (m_address >> 24) & 0xff; buf[1] = (m_address >> 16) & 0xff; buf[2] = (m_address >> 8) & 0xff; buf[3] = (m_address >> 0) & 0xff; } Ipv4Address Ipv4Address::Deserialize (const uint8_t buf[4]) { Ipv4Address ipv4; ipv4.m_address = 0; ipv4.m_address |= buf[0]; ipv4.m_address <<= 8; ipv4.m_address |= buf[1]; ipv4.m_address <<= 8; ipv4.m_address |= buf[2]; ipv4.m_address <<= 8; ipv4.m_address |= buf[3]; return ipv4; } void Ipv4Address::Print (std::ostream &os) const { os << ((m_address >> 24) & 0xff) << "." << ((m_address >> 16) & 0xff) << "." << ((m_address >> 8) & 0xff) << "." << ((m_address >> 0) & 0xff); } bool Ipv4Address::IsMatchingType (const Address &address) { return address.CheckCompatible (GetType (), 4); } Ipv4Address::operator Address () const { return ConvertTo (); } Address Ipv4Address::ConvertTo (void) const { uint8_t buf[4]; Serialize (buf); return Address (GetType (), buf, 4); } Ipv4Address Ipv4Address::ConvertFrom (const Address &address) { NS_ASSERT (address.CheckCompatible (GetType (), 4)); uint8_t buf[4]; address.CopyTo (buf); return Deserialize (buf); } uint8_t Ipv4Address::GetType (void) { static uint8_t type = Address::Register (); return type; } Ipv4Address Ipv4Address::GetZero (void) { static Ipv4Address zero ("0.0.0.0"); return zero; } Ipv4Address Ipv4Address::GetAny (void) { static Ipv4Address any ("0.0.0.0"); return any; } Ipv4Address Ipv4Address::GetBroadcast (void) { static Ipv4Address broadcast ("255.255.255.255"); return broadcast; } Ipv4Address Ipv4Address::GetLoopback (void) { Ipv4Address loopback ("127.0.0.1"); return loopback; } size_t Ipv4AddressHash::operator() (Ipv4Address const &x) const { return x.Get (); } std::ostream& operator<< (std::ostream& os, Ipv4Address const& address) { address.Print (os); return os; } std::ostream& operator<< (std::ostream& os, Ipv4Mask const& mask) { mask.Print (os); return os; } std::istream & operator >> (std::istream &is, Ipv4Address &address) { std::string str; is >> str; address = Ipv4Address (str.c_str ()); return is; } std::istream & operator >> (std::istream &is, Ipv4Mask &mask) { std::string str; is >> str; mask = Ipv4Mask (str.c_str ()); return is; } bool operator == (Ipv4Mask const &a, Ipv4Mask const &b) { return a.IsEqual (b); } bool operator != (Ipv4Mask const &a, Ipv4Mask const &b) { return !a.IsEqual (b); } ATTRIBUTE_HELPER_CPP (Ipv4Address); ATTRIBUTE_HELPER_CPP (Ipv4Mask); } // namespace ns3
zy901002-gpsr
src/network/utils/ipv4-address.cc
C++
gpl2
7,457
/* -*- 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 FLOW_ID_TAG_H #define FLOW_ID_TAG_H #include "ns3/tag.h" namespace ns3 { class FlowIdTag : public Tag { public: 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; FlowIdTag (); FlowIdTag (uint32_t flowId); void SetFlowId (uint32_t flowId); uint32_t GetFlowId (void) const; static uint32_t AllocateFlowId (void); private: uint32_t m_flowId; }; } // namespace ns3 #endif /* FLOW_ID_TAG_H */
zy901002-gpsr
src/network/utils/flow-id-tag.h
C++
gpl2
1,450
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007-2008 Louis Pasteur University * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr> */ #ifndef INET6_SOCKET_ADDRESS_H #define INET6_SOCKET_ADDRESS_H #include <stdint.h> #include "ns3/address.h" #include "ipv6-address.h" namespace ns3 { /** * \ingroup address * \class Inet6SocketAddress * \brief An Inet6 address class. */ class Inet6SocketAddress { public: /** * \brief Constructor. * \param ipv6 the IPv6 address * \param port the port */ Inet6SocketAddress (Ipv6Address ipv6, uint16_t port); /** * \brief Constructor (the port is set to zero). * \param ipv6 the IPv6 address */ Inet6SocketAddress (Ipv6Address ipv6); /** * \brief Constructor (the address is set to "any"). * \param port the port */ Inet6SocketAddress (uint16_t port); /** * \brief Constructor. * \param ipv6 string which represents an IPv6 address * \param port the port */ Inet6SocketAddress (const char* ipv6, uint16_t port); /** * \brief Constructor. * \param ipv6 string which represents an IPv6 address */ Inet6SocketAddress (const char* ipv6); /** * \brief Get the port. * \return the port */ uint16_t GetPort (void) const; /** * \brief Set the port * \param port the port */ void SetPort (uint16_t port); /** * \brief Get the IPv6 address. * \return the IPv6 address */ Ipv6Address GetIpv6 (void) const; /** * \brief Set the IPv6 address. * \param ipv6 the address */ void SetIpv6 (Ipv6Address ipv6); /** * \brief If the address match. * \param addr the address to test * \return true if the address match, false otherwise */ static bool IsMatchingType (const Address &addr); /** * \brief Get an Address instance which represents this * Inet6SocketAddress instance. */ operator Address (void) const; /** * \brief Convert the address to a InetSocketAddress. * \param addr the address to convert * \return an Inet6SocketAddress instance corresponding to address */ static Inet6SocketAddress ConvertFrom (const Address &addr); private: /** * \brief Convert to Address. * \return Address instance */ Address ConvertTo (void) const; /** * \brief Get the type. * \return the type of Inet6SocketAddress */ static uint8_t GetType (void); /** * \brief The IPv6 address. */ Ipv6Address m_ipv6; /** * \brief The port. */ uint16_t m_port; }; } /* namespace ns3 */ #endif /* INET6_SOCKET_ADDRESS_H */
zy901002-gpsr
src/network/utils/inet6-socket-address.h
C++
gpl2
3,258
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007-2008 Louis Pasteur University * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr> */ #ifndef IPV6_ADDRESS_H #define IPV6_ADDRESS_H #include <stdint.h> #include <string.h> #include <ostream> #include "ns3/attribute-helper.h" #include "ns3/address.h" namespace ns3 { class Ipv6Prefix; class Mac48Address; /** * \ingroup address * \class Ipv6Address * \brief Describes an IPv6 address. * \see Ipv6Prefix */ class Ipv6Address { public: /** * \brief Default constructor. */ Ipv6Address (); /** * \brief Constructs an Ipv6Address by parsing the input C-string. * \param address the C-string containing the IPv6 address (e.g. 2001:660:4701::1). */ Ipv6Address (char const* address); /** * \brief Constructs an Ipv6Address by using the input 16 bytes. * \param address the 128-bit address * \warning the parameter must point on a 16 bytes integer array! */ Ipv6Address (uint8_t address[16]); /** * \brief Copy constructor. * \param addr Ipv6Address object */ Ipv6Address (Ipv6Address const & addr); /** * \brief Copy constructor. * \param addr Ipv6Address pointer */ Ipv6Address (Ipv6Address const* addr); /** * \brief Destructor. */ ~Ipv6Address (); /** * \brief Sets an Ipv6Address by parsing the input C-string. * \param address the C-string containing the IPv6 address (e.g. 2001:660:4701::1). */ void Set (char const* address); /** * \brief Set an Ipv6Address by using the input 16 bytes. * * \param address the 128-bit address * \warning the parameter must point on a 16 bytes integer array! */ void Set (uint8_t address[16]); /** * \brief Comparison operation between two Ipv6Addresses. * * \param other the IPv6 address to which to compare thisaddress * \return true if the addresses are equal, false otherwise */ bool IsEqual (const Ipv6Address& other) const; /** * \brief Serialize this address to a 16-byte buffer. * \param buf the output buffer to which this address gets overwritten with this * Ipv6Address */ void Serialize (uint8_t buf[16]) const; /** * \brief Deserialize this address. * \param buf buffer to read address from * \return an Ipv6Address */ static Ipv6Address Deserialize (const uint8_t buf[16]); /** * \brief Make the solicited IPv6 address. * \param addr the IPv6 address * \return Solicited IPv6 address */ static Ipv6Address MakeSolicitedAddress (Ipv6Address addr); /** * \brief Make the autoconfigured IPv6 address with Mac48Address. * \param addr the MAC address (48 bits). * \param prefix the IPv6 prefix * \return autoconfigured IPv6 address */ static Ipv6Address MakeAutoconfiguredAddress (Mac48Address addr, Ipv6Address prefix); /** * \brief Make the autoconfigured link-local IPv6 address with Mac48Address. * \param mac the MAC address (48 bits). * \return autoconfigured link-local IPv6 address */ static Ipv6Address MakeAutoconfiguredLinkLocalAddress (Mac48Address mac); /** * \brief Print this address to the given output stream. * * The print format is in the typical "2001:660:4701::1". * \param os the output stream to which this Ipv6Address is printed */ void Print (std::ostream& os) const; /** * \brief If the IPv6 address is localhost (::1). * \return true if localhost, false otherwise */ bool IsLocalhost () const; /** * \brief If the IPv6 address is multicast (ff00::/8). * \return true if multicast, false otherwise */ bool IsMulticast () const; /** * \brief If the IPv6 address is "all nodes multicast" (ff02::1/8). * \return true if "all nodes multicast", false otherwise */ bool IsAllNodesMulticast () const; /** * \brief If the IPv6 address is "all routers multicast" (ff02::2/8). * \return true if "all routers multicast", false otherwise */ bool IsAllRoutersMulticast () const; /** * \brief If the IPv6 address is "all hosts multicast" (ff02::3/8). * \return true if "all hosts multicast", false otherwise */ bool IsAllHostsMulticast () const; /** * \brief If the IPv6 address is a link-local address (fe80::/64). * \return true if the address is link-local, false otherwise */ bool IsLinkLocal () const; /** * \brief If the IPv6 address is a Solicited multicast address. * \return true if it is, false otherwise */ bool IsSolicitedMulticast () const; /** * \brief If the IPv6 address is the "Any" address. * \return true if it is, false otherwise */ bool IsAny () const; /** * \brief Combine this address with a prefix. * \param prefix a IPv6 prefix * \return an IPv6 address that is this address combined * (bitwise AND) with a prefix, yielding an IPv6 network address. */ Ipv6Address CombinePrefix (Ipv6Prefix const & prefix); /** * \brief If the Address matches the type. * \param address other address * \return true if the type matches, false otherwise */ static bool IsMatchingType (const Address& address); /** * \brief Convert to Address object */ operator Address () const; /** * \brief Convert the Address object into an Ipv6Address ones. * \param address address to convert * \return an Ipv6Address */ static Ipv6Address ConvertFrom (const Address& address); /** * \brief Get the 0 (::) Ipv6Address. * \return the :: Ipv6Address representation */ static Ipv6Address GetZero (); /** * \brief Get the "any" (::) Ipv6Address. * \return the "any" (::) Ipv6Address */ static Ipv6Address GetAny (); /** * \brief Get the "all nodes multicast" address. * \return the "ff02::2/8" Ipv6Address representation */ static Ipv6Address GetAllNodesMulticast (); /** * \brief Get the "all routers multicast" address. * \return the "ff02::2/8" Ipv6Address representation */ static Ipv6Address GetAllRoutersMulticast (); /** * \brief Get the "all hosts multicast" address. * \return the "ff02::3/8" Ipv6Address representation */ static Ipv6Address GetAllHostsMulticast (); /** * \brief Get the loopback address. * \return the "::1/128" Ipv6Address representation. */ static Ipv6Address GetLoopback (); /** * \brief Get the "all-1" IPv6 address (ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff). * \return all-1 Ipv6Address representation */ static Ipv6Address GetOnes (); /** * \brief Get the bytes corresponding to the address. * \param buf buffer to store the data * \return bytes of the address */ void GetBytes (uint8_t buf[16]) const; private: /** * \brief convert the IPv6Address object to an Address object. * \return the Address object corresponding to this object. */ Address ConvertTo (void) const; /** * \brief Return the Type of address. * \return type of address */ static uint8_t GetType (void); /** * \brief The address representation on 128 bits (16 bytes). */ uint8_t m_address[16]; friend bool operator == (Ipv6Address const &a, Ipv6Address const &b); friend bool operator != (Ipv6Address const &a, Ipv6Address const &b); friend bool operator < (Ipv6Address const &a, Ipv6Address const &b); }; /** * \ingroup address * \class Ipv6Prefix * \brief Describes an IPv6 prefix. It is just a bitmask like Ipv4Mask. * \see Ipv6Address */ class Ipv6Prefix { public: /** * \brief Default constructor. */ Ipv6Prefix (); /** * \brief Constructs an Ipv6Prefix by using the input 16 bytes. * \param prefix the 128-bit prefix */ Ipv6Prefix (uint8_t prefix[16]); /** * \brief Constructs an Ipv6Prefix by using the input string. * \param prefix the 128-bit prefix */ Ipv6Prefix (char const* prefix); /** * \brief Constructs an Ipv6Prefix by using the input number of bits. * \param prefix number of bits of the prefix (0 - 128) * \note A valid number of bits is between 0 and 128). */ Ipv6Prefix (uint8_t prefix); /** * \brief Copy constructor. * \param prefix Ipv6Prefix object */ Ipv6Prefix (Ipv6Prefix const& prefix); /** * \brief Copy constructor. * \param prefix Ipv6Prefix pointer */ Ipv6Prefix (Ipv6Prefix const* prefix); /** * \brief Destructor. */ ~Ipv6Prefix (); /** * \brief If the Address match the type. * \param a a first address * \param b a second address * \return true if the type match, false otherwise */ bool IsMatch (Ipv6Address a, Ipv6Address b) const; /** * \brief Get the bytes corresponding to the prefix. * \param buf buffer to store the data */ void GetBytes (uint8_t buf[16]) const; /** * \brief Get prefix length. * \return prefix length */ uint8_t GetPrefixLength () const; /** * \brief Comparison operation between two Ipv6Prefix. * \param other the IPv6 prefix to which to compare this prefix * \return true if the prefixes are equal, false otherwise */ bool IsEqual (const Ipv6Prefix& other) const; /** * \brief Print this address to the given output stream. * * The print format is in the typical "2001:660:4701::1". * \param os the output stream to which this Ipv6Address is printed */ void Print (std::ostream &os) const; /** * \brief Get the loopback prefix ( /128). * \return a Ipv6Prefix corresponding to loopback prefix */ static Ipv6Prefix GetLoopback (); /** * \brief Get the "all-1" IPv6 mask (ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff). * \return /128 Ipv6Prefix representation */ static Ipv6Prefix GetOnes (); /** * \brief Get the zero prefix ( /0). * \return an Ipv6Prefix */ static Ipv6Prefix GetZero (); private: /** * \brief The prefix representation. */ uint8_t m_prefix[16]; }; /** * \class ns3::Ipv6AddressValue * \brief Hold objects of type ns3::Ipv6Address */ ATTRIBUTE_HELPER_HEADER (Ipv6Address); /** * \class ns3::Ipv6PrefixValue * \brief Hold objects of type ns3::Ipv6Prefix */ ATTRIBUTE_HELPER_HEADER (Ipv6Prefix); std::ostream& operator << (std::ostream& os, Ipv6Address const& address); std::ostream& operator<< (std::ostream& os, Ipv6Prefix const& prefix); std::istream & operator >> (std::istream &is, Ipv6Address &address); std::istream & operator >> (std::istream &is, Ipv6Prefix &prefix); inline bool operator == (const Ipv6Address& a, const Ipv6Address& b) { return (!memcmp (a.m_address, b.m_address, 16)); } inline bool operator != (const Ipv6Address& a, const Ipv6Address& b) { return memcmp (a.m_address, b.m_address, 16); } inline bool operator < (const Ipv6Address& a, const Ipv6Address& b) { return (memcmp (a.m_address, b.m_address, 16) < 0); } /** * \class Ipv6AddressHash * \brief Hash function class for IPv6 addresses. */ class Ipv6AddressHash : public std::unary_function<Ipv6Address, size_t> { public: /** * \brief Unary operator to hash IPv6 address. * \param x IPv6 address to hash */ size_t operator () (Ipv6Address const &x) const; }; bool operator == (Ipv6Prefix const &a, Ipv6Prefix const &b); bool operator != (Ipv6Prefix const &a, Ipv6Prefix const &b); } /* namespace ns3 */ #endif /* IPV6_ADDRESS_H */
zy901002-gpsr
src/network/utils/ipv6-address.h
C++
gpl2
11,955
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* vim: set ts=2 sw=2 sta expandtab ai si cin: */ /* * Copyright (c) 2009 Drexel University * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Tom Wambold <tom5760@gmail.com> */ /* These classes implement RFC 5444 - The Generalized Mobile Ad Hoc Network * (MANET) Packet/PbbMessage Format * See: http://tools.ietf.org/html/rfc5444 for details */ #include "ns3/ipv4-address.h" #include "ns3/ipv6-address.h" #include "ns3/assert.h" #include "packetbb.h" static const uint8_t VERSION = 0; /* Packet flags */ static const uint8_t PHAS_SEQ_NUM = 0x8; static const uint8_t PHAS_TLV = 0x4; /* PbbMessage flags */ static const uint8_t MHAS_ORIG = 0x80; static const uint8_t MHAS_HOP_LIMIT = 0x40; static const uint8_t MHAS_HOP_COUNT = 0x20; static const uint8_t MHAS_SEQ_NUM = 0x10; /* Address block flags */ static const uint8_t AHAS_HEAD = 0x80; static const uint8_t AHAS_FULL_TAIL = 0x40; static const uint8_t AHAS_ZERO_TAIL = 0x20; static const uint8_t AHAS_SINGLE_PRE_LEN = 0x10; static const uint8_t AHAS_MULTI_PRE_LEN = 0x08; /* TLV Flags */ static const uint8_t THAS_TYPE_EXT = 0x80; static const uint8_t THAS_SINGLE_INDEX = 0x40; static const uint8_t THAS_MULTI_INDEX = 0x20; static const uint8_t THAS_VALUE = 0x10; static const uint8_t THAS_EXT_LEN = 0x08; static const uint8_t TIS_MULTIVALUE = 0x04; namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (PbbPacket); PbbTlvBlock::PbbTlvBlock (void) { return; } PbbTlvBlock::~PbbTlvBlock (void) { Clear (); } PbbTlvBlock::Iterator PbbTlvBlock::Begin (void) { return m_tlvList.begin (); } PbbTlvBlock::ConstIterator PbbTlvBlock::Begin (void) const { return m_tlvList.begin (); } PbbTlvBlock::Iterator PbbTlvBlock::End (void) { return m_tlvList.end (); } PbbTlvBlock::ConstIterator PbbTlvBlock::End (void) const { return m_tlvList.end (); } int PbbTlvBlock::Size (void) const { return m_tlvList.size (); } bool PbbTlvBlock::Empty (void) const { return m_tlvList.empty (); } Ptr<PbbTlv> PbbTlvBlock::Front (void) const { return m_tlvList.front (); } Ptr<PbbTlv> PbbTlvBlock::Back (void) const { return m_tlvList.back (); } void PbbTlvBlock::PushFront (Ptr<PbbTlv> tlv) { m_tlvList.push_front (tlv); } void PbbTlvBlock::PopFront (void) { m_tlvList.pop_front (); } void PbbTlvBlock::PushBack (Ptr<PbbTlv> tlv) { m_tlvList.push_back (tlv); } void PbbTlvBlock::PopBack (void) { m_tlvList.pop_back (); } PbbTlvBlock::Iterator PbbTlvBlock::Insert (PbbTlvBlock::Iterator position, const Ptr<PbbTlv> tlv) { return m_tlvList.insert (position, tlv); } PbbTlvBlock::Iterator PbbTlvBlock::Erase (PbbTlvBlock::Iterator position) { return m_tlvList.erase (position); } PbbTlvBlock::Iterator PbbTlvBlock::Erase (PbbTlvBlock::Iterator first, PbbTlvBlock::Iterator last) { return m_tlvList.erase (first, last); } void PbbTlvBlock::Clear (void) { for (Iterator iter = Begin (); iter != End (); iter++) { *iter = 0; } m_tlvList.clear (); } uint32_t PbbTlvBlock::GetSerializedSize (void) const { /* tlv size */ uint32_t size = 2; for (ConstIterator iter = Begin (); iter != End (); iter++) { size += (*iter)->GetSerializedSize (); } return size; } void PbbTlvBlock::Serialize (Buffer::Iterator &start) const { if (Empty ()) { start.WriteHtonU16 (0); return; } /* We need to write the size of the TLV block in front, so save its * position. */ Buffer::Iterator tlvsize = start; start.Next (2); for (ConstIterator iter = Begin (); iter != End (); iter++) { (*iter)->Serialize (start); } /* - 2 to not include the size field */ uint16_t size = start.GetDistanceFrom (tlvsize) - 2; tlvsize.WriteHtonU16 (size); } void PbbTlvBlock::Deserialize (Buffer::Iterator &start) { uint16_t size = start.ReadNtohU16 (); Buffer::Iterator tlvstart = start; if (size > 0) { while (start.GetDistanceFrom (tlvstart) < size) { Ptr<PbbTlv> newtlv = Create<PbbTlv> (); newtlv->Deserialize (start); PushBack (newtlv); } } } void PbbTlvBlock::Print (std::ostream &os) const { Print (os, 0); } void PbbTlvBlock::Print (std::ostream &os, int level) const { std::string prefix = ""; for (int i = 0; i < level; i++) { prefix.append ("\t"); } os << prefix << "TLV Block {" << std::endl; os << prefix << "\tsize = " << Size () << std::endl; os << prefix << "\tmembers [" << std::endl; for (ConstIterator iter = Begin (); iter != End (); iter++) { (*iter)->Print (os, level+2); } os << prefix << "\t]" << std::endl; os << prefix << "}" << std::endl; } bool PbbTlvBlock::operator== (const PbbTlvBlock &other) const { if (Size () != other.Size ()) { return false; } ConstIterator ti, oi; for (ti = Begin (), oi = other.Begin (); ti != End () && oi != other.End (); ti++, oi++) { if (**ti != **oi) { return false; } } return true; } bool PbbTlvBlock::operator!= (const PbbTlvBlock &other) const { return !(*this == other); } /* End PbbTlvBlock class */ PbbAddressTlvBlock::PbbAddressTlvBlock (void) { return; } PbbAddressTlvBlock::~PbbAddressTlvBlock (void) { Clear (); } PbbAddressTlvBlock::Iterator PbbAddressTlvBlock::Begin (void) { return m_tlvList.begin (); } PbbAddressTlvBlock::ConstIterator PbbAddressTlvBlock::Begin (void) const { return m_tlvList.begin (); } PbbAddressTlvBlock::Iterator PbbAddressTlvBlock::End (void) { return m_tlvList.end (); } PbbAddressTlvBlock::ConstIterator PbbAddressTlvBlock::End (void) const { return m_tlvList.end (); } int PbbAddressTlvBlock::Size (void) const { return m_tlvList.size (); } bool PbbAddressTlvBlock::Empty (void) const { return m_tlvList.empty (); } Ptr<PbbAddressTlv> PbbAddressTlvBlock::Front (void) const { return m_tlvList.front (); } Ptr<PbbAddressTlv> PbbAddressTlvBlock::Back (void) const { return m_tlvList.back (); } void PbbAddressTlvBlock::PushFront (Ptr<PbbAddressTlv> tlv) { m_tlvList.push_front (tlv); } void PbbAddressTlvBlock::PopFront (void) { m_tlvList.pop_front (); } void PbbAddressTlvBlock::PushBack (Ptr<PbbAddressTlv> tlv) { m_tlvList.push_back (tlv); } void PbbAddressTlvBlock::PopBack (void) { m_tlvList.pop_back (); } PbbAddressTlvBlock::Iterator PbbAddressTlvBlock::Insert (PbbAddressTlvBlock::Iterator position, const Ptr<PbbAddressTlv> tlv) { return m_tlvList.insert (position, tlv); } PbbAddressTlvBlock::Iterator PbbAddressTlvBlock::Erase (PbbAddressTlvBlock::Iterator position) { return m_tlvList.erase (position); } PbbAddressTlvBlock::Iterator PbbAddressTlvBlock::Erase (PbbAddressTlvBlock::Iterator first, PbbAddressTlvBlock::Iterator last) { return m_tlvList.erase (first, last); } void PbbAddressTlvBlock::Clear (void) { for (Iterator iter = Begin (); iter != End (); iter++) { *iter = 0; } m_tlvList.clear (); } uint32_t PbbAddressTlvBlock::GetSerializedSize (void) const { /* tlv size */ uint32_t size = 2; for (ConstIterator iter = Begin (); iter != End (); iter++) { size += (*iter)->GetSerializedSize (); } return size; } void PbbAddressTlvBlock::Serialize (Buffer::Iterator &start) const { if (Empty ()) { start.WriteHtonU16 (0); return; } /* We need to write the size of the TLV block in front, so save its * position. */ Buffer::Iterator tlvsize = start; start.Next (2); for (ConstIterator iter = Begin (); iter != End (); iter++) { (*iter)->Serialize (start); } /* - 2 to not include the size field */ uint16_t size = start.GetDistanceFrom (tlvsize) - 2; tlvsize.WriteHtonU16 (size); } void PbbAddressTlvBlock::Deserialize (Buffer::Iterator &start) { uint16_t size = start.ReadNtohU16 (); Buffer::Iterator tlvstart = start; if (size > 0) { while (start.GetDistanceFrom (tlvstart) < size) { Ptr<PbbAddressTlv> newtlv = Create<PbbAddressTlv> (); newtlv->Deserialize (start); PushBack (newtlv); } } } void PbbAddressTlvBlock::Print (std::ostream &os) const { Print (os, 0); } void PbbAddressTlvBlock::Print (std::ostream &os, int level) const { std::string prefix = ""; for (int i = 0; i < level; i++) { prefix.append ("\t"); } os << prefix << "TLV Block {" << std::endl; os << prefix << "\tsize = " << Size () << std::endl; os << prefix << "\tmembers [" << std::endl; for (ConstIterator iter = Begin (); iter != End (); iter++) { (*iter)->Print (os, level+2); } os << prefix << "\t]" << std::endl; os << prefix << "}" << std::endl; } bool PbbAddressTlvBlock::operator== (const PbbAddressTlvBlock &other) const { if (Size () != other.Size ()) { return false; } ConstIterator it, ot; for (it = Begin (), ot = other.Begin (); it != End () && ot != other.End (); it++, ot++) { if (**it != **ot) { return false; } } return true; } bool PbbAddressTlvBlock::operator!= (const PbbAddressTlvBlock &other) const { return !(*this == other); } /* End PbbAddressTlvBlock Class */ PbbPacket::PbbPacket (void) { m_version = VERSION; m_hasseqnum = false; } PbbPacket::~PbbPacket (void) { MessageClear (); } uint8_t PbbPacket::GetVersion (void) const { return m_version; } void PbbPacket::SetSequenceNumber (uint16_t number) { m_seqnum = number; m_hasseqnum = true; } uint16_t PbbPacket::GetSequenceNumber (void) const { NS_ASSERT (HasSequenceNumber ()); return m_seqnum; } bool PbbPacket::HasSequenceNumber (void) const { return m_hasseqnum; } /* Manipulating Packet TLVs */ PbbPacket::TlvIterator PbbPacket::TlvBegin (void) { return m_tlvList.Begin (); } PbbPacket::ConstTlvIterator PbbPacket::TlvBegin (void) const { return m_tlvList.Begin (); } PbbPacket::TlvIterator PbbPacket::TlvEnd (void) { return m_tlvList.End (); } PbbPacket::ConstTlvIterator PbbPacket::TlvEnd (void) const { return m_tlvList.End (); } int PbbPacket::TlvSize (void) const { return m_tlvList.Size (); } bool PbbPacket::TlvEmpty (void) const { return m_tlvList.Empty (); } Ptr<PbbTlv> PbbPacket::TlvFront (void) { return m_tlvList.Front (); } const Ptr<PbbTlv> PbbPacket::TlvFront (void) const { return m_tlvList.Front (); } Ptr<PbbTlv> PbbPacket::TlvBack (void) { return m_tlvList.Back (); } const Ptr<PbbTlv> PbbPacket::TlvBack (void) const { return m_tlvList.Back (); } void PbbPacket::TlvPushFront (Ptr<PbbTlv> tlv) { m_tlvList.PushFront (tlv); } void PbbPacket::TlvPopFront (void) { m_tlvList.PopFront (); } void PbbPacket::TlvPushBack (Ptr<PbbTlv> tlv) { m_tlvList.PushBack (tlv); } void PbbPacket::TlvPopBack (void) { m_tlvList.PopBack (); } PbbPacket::TlvIterator PbbPacket::Erase (PbbPacket::TlvIterator position) { return m_tlvList.Erase (position); } PbbPacket::TlvIterator PbbPacket::Erase (PbbPacket::TlvIterator first, PbbPacket::TlvIterator last) { return m_tlvList.Erase (first, last); } void PbbPacket::TlvClear (void) { m_tlvList.Clear (); } /* Manipulating Packet Messages */ PbbPacket::MessageIterator PbbPacket::MessageBegin (void) { return m_messageList.begin (); } PbbPacket::ConstMessageIterator PbbPacket::MessageBegin (void) const { return m_messageList.begin (); } PbbPacket::MessageIterator PbbPacket::MessageEnd (void) { return m_messageList.end (); } PbbPacket::ConstMessageIterator PbbPacket::MessageEnd (void) const { return m_messageList.end (); } int PbbPacket::MessageSize (void) const { return m_messageList.size (); } bool PbbPacket::MessageEmpty (void) const { return m_messageList.empty (); } Ptr<PbbMessage> PbbPacket::MessageFront (void) { return m_messageList.front (); } const Ptr<PbbMessage> PbbPacket::MessageFront (void) const { return m_messageList.front (); } Ptr<PbbMessage> PbbPacket::MessageBack (void) { return m_messageList.back (); } const Ptr<PbbMessage> PbbPacket::MessageBack (void) const { return m_messageList.back (); } void PbbPacket::MessagePushFront (Ptr<PbbMessage> tlv) { m_messageList.push_front (tlv); } void PbbPacket::MessagePopFront (void) { m_messageList.pop_front (); } void PbbPacket::MessagePushBack (Ptr<PbbMessage> tlv) { m_messageList.push_back (tlv); } void PbbPacket::MessagePopBack (void) { m_messageList.pop_back (); } PbbPacket::MessageIterator PbbPacket::Erase (PbbPacket::MessageIterator position) { return m_messageList.erase (position); } PbbPacket::MessageIterator PbbPacket::Erase (PbbPacket::MessageIterator first, PbbPacket::MessageIterator last) { return m_messageList.erase (first, last); } void PbbPacket::MessageClear (void) { for (MessageIterator iter = MessageBegin (); iter != MessageEnd (); iter++) { *iter = 0; } m_messageList.clear (); } TypeId PbbPacket::GetTypeId (void) { static TypeId tid = TypeId ("ns3::PbbPacket") .SetParent<Header> () .AddConstructor<PbbPacket> () ; return tid; } TypeId PbbPacket::GetInstanceTypeId (void) const { return GetTypeId (); } uint32_t PbbPacket::GetSerializedSize (void) const { /* Version number + flags */ uint32_t size = 1; if (HasSequenceNumber ()) { size += 2; } if (!TlvEmpty ()) { size += m_tlvList.GetSerializedSize (); } for (ConstMessageIterator iter = MessageBegin (); iter != MessageEnd (); iter++) { size += (*iter)->GetSerializedSize (); } return size; } void PbbPacket::Serialize (Buffer::Iterator start) const { /* We remember the start, so we can write the flags after we check for a * sequence number and TLV. */ Buffer::Iterator bufref = start; start.Next (); uint8_t flags = VERSION; /* Make room for 4 bit flags */ flags <<= 4; if (HasSequenceNumber ()) { flags |= PHAS_SEQ_NUM; start.WriteHtonU16 (GetSequenceNumber ()); } if (!TlvEmpty ()) { flags |= PHAS_TLV; m_tlvList.Serialize (start); } bufref.WriteU8 (flags); for (ConstMessageIterator iter = MessageBegin (); iter != MessageEnd (); iter++) { (*iter)->Serialize (start); } } uint32_t PbbPacket::Deserialize (Buffer::Iterator start) { Buffer::Iterator begin = start; uint8_t flags = start.ReadU8 (); if (flags & PHAS_SEQ_NUM) { SetSequenceNumber (start.ReadNtohU16 ()); } if (flags & PHAS_TLV) { m_tlvList.Deserialize (start); } while (!start.IsEnd ()) { Ptr<PbbMessage> newmsg = PbbMessage::DeserializeMessage (start); if (newmsg == 0) { return start.GetDistanceFrom (begin); } MessagePushBack (newmsg); } flags >>= 4; m_version = flags; return start.GetDistanceFrom (begin); } void PbbPacket::Print (std::ostream &os) const { os << "PbbPacket {" << std::endl; if (HasSequenceNumber ()) { os << "\tsequence number = " << GetSequenceNumber (); } os << std::endl; m_tlvList.Print (os, 1); for (ConstMessageIterator iter = MessageBegin (); iter != MessageEnd (); iter++) { (*iter)->Print (os, 1); } os << "}" << std::endl; } bool PbbPacket::operator== (const PbbPacket &other) const { if (GetVersion () != other.GetVersion ()) { return false; } if (HasSequenceNumber () != other.HasSequenceNumber ()) { return false; } if (HasSequenceNumber ()) { if (GetSequenceNumber () != other.GetSequenceNumber ()) return false; } if (m_tlvList != other.m_tlvList) { return false; } if (MessageSize () != other.MessageSize ()) { return false; } ConstMessageIterator tmi, omi; for (tmi = MessageBegin (), omi = other.MessageBegin (); tmi != MessageEnd () && omi != other.MessageEnd (); tmi++, omi++) { if (**tmi != **omi) { return false; } } return true; } bool PbbPacket::operator!= (const PbbPacket &other) const { return !(*this == other); } /* End PbbPacket class */ PbbMessage::PbbMessage () { /* Default to IPv4 */ m_addrSize = IPV4; m_hasOriginatorAddress = false; m_hasHopLimit = false; m_hasHopCount = false; m_hasSequenceNumber = false; } PbbMessage::~PbbMessage () { AddressBlockClear (); } void PbbMessage::SetType (uint8_t type) { m_type = type; } uint8_t PbbMessage::GetType (void) const { return m_type; } PbbAddressLength PbbMessage::GetAddressLength (void) const { return m_addrSize; } void PbbMessage::SetOriginatorAddress (Address address) { m_originatorAddress = address; m_hasOriginatorAddress = true; } Address PbbMessage::GetOriginatorAddress (void) const { NS_ASSERT (HasOriginatorAddress ()); return m_originatorAddress; } bool PbbMessage::HasOriginatorAddress (void) const { return m_hasOriginatorAddress; } void PbbMessage::SetHopLimit (uint8_t hopLimit) { m_hopLimit = hopLimit; m_hasHopLimit = true; } uint8_t PbbMessage::GetHopLimit (void) const { NS_ASSERT (HasHopLimit ()); return m_hopLimit; } bool PbbMessage::HasHopLimit (void) const { return m_hasHopLimit; } void PbbMessage::SetHopCount (uint8_t hopCount) { m_hopCount = hopCount; m_hasHopCount = true; } uint8_t PbbMessage::GetHopCount (void) const { NS_ASSERT (HasHopCount ()); return m_hopCount; } bool PbbMessage::HasHopCount (void) const { return m_hasHopCount; } void PbbMessage::SetSequenceNumber (uint16_t sequenceNumber) { m_sequenceNumber = sequenceNumber; m_hasSequenceNumber = true; } uint16_t PbbMessage::GetSequenceNumber (void) const { NS_ASSERT (HasSequenceNumber ()); return m_sequenceNumber; } bool PbbMessage::HasSequenceNumber (void) const { return m_hasSequenceNumber; } /* Manipulating PbbMessage TLVs */ PbbMessage::TlvIterator PbbMessage::TlvBegin (void) { return m_tlvList.Begin (); } PbbMessage::ConstTlvIterator PbbMessage::TlvBegin (void) const { return m_tlvList.Begin (); } PbbMessage::TlvIterator PbbMessage::TlvEnd (void) { return m_tlvList.End (); } PbbMessage::ConstTlvIterator PbbMessage::TlvEnd (void) const { return m_tlvList.End (); } int PbbMessage::TlvSize (void) const { return m_tlvList.Size (); } bool PbbMessage::TlvEmpty (void) const { return m_tlvList.Empty (); } Ptr<PbbTlv> PbbMessage::TlvFront (void) { return m_tlvList.Front (); } const Ptr<PbbTlv> PbbMessage::TlvFront (void) const { return m_tlvList.Front (); } Ptr<PbbTlv> PbbMessage::TlvBack (void) { return m_tlvList.Back (); } const Ptr<PbbTlv> PbbMessage::TlvBack (void) const { return m_tlvList.Back (); } void PbbMessage::TlvPushFront (Ptr<PbbTlv> tlv) { m_tlvList.PushFront (tlv); } void PbbMessage::TlvPopFront (void) { m_tlvList.PopFront (); } void PbbMessage::TlvPushBack (Ptr<PbbTlv> tlv) { m_tlvList.PushBack (tlv); } void PbbMessage::TlvPopBack (void) { m_tlvList.PopBack (); } PbbMessage::TlvIterator PbbMessage::TlvErase (PbbMessage::TlvIterator position) { return m_tlvList.Erase (position); } PbbMessage::TlvIterator PbbMessage::TlvErase (PbbMessage::TlvIterator first, PbbMessage::TlvIterator last) { return m_tlvList.Erase (first, last); } void PbbMessage::TlvClear (void) { m_tlvList.Clear (); } /* Manipulating Address Block and Address TLV pairs */ PbbMessage::AddressBlockIterator PbbMessage::AddressBlockBegin (void) { return m_addressBlockList.begin (); } PbbMessage::ConstAddressBlockIterator PbbMessage::AddressBlockBegin (void) const { return m_addressBlockList.begin (); } PbbMessage::AddressBlockIterator PbbMessage::AddressBlockEnd (void) { return m_addressBlockList.end (); } PbbMessage::ConstAddressBlockIterator PbbMessage::AddressBlockEnd (void) const { return m_addressBlockList.end (); } int PbbMessage::AddressBlockSize (void) const { return m_addressBlockList.size (); } bool PbbMessage::AddressBlockEmpty (void) const { return m_addressBlockList.empty (); } Ptr<PbbAddressBlock> PbbMessage::AddressBlockFront (void) { return m_addressBlockList.front (); } const Ptr<PbbAddressBlock> PbbMessage::AddressBlockFront (void) const { return m_addressBlockList.front (); } Ptr<PbbAddressBlock> PbbMessage::AddressBlockBack (void) { return m_addressBlockList.back (); } const Ptr<PbbAddressBlock> PbbMessage::AddressBlockBack (void) const { return m_addressBlockList.back (); } void PbbMessage::AddressBlockPushFront (Ptr<PbbAddressBlock> tlv) { m_addressBlockList.push_front (tlv); } void PbbMessage::AddressBlockPopFront (void) { m_addressBlockList.pop_front (); } void PbbMessage::AddressBlockPushBack (Ptr<PbbAddressBlock> tlv) { m_addressBlockList.push_back (tlv); } void PbbMessage::AddressBlockPopBack (void) { m_addressBlockList.pop_back (); } PbbMessage::AddressBlockIterator PbbMessage::AddressBlockErase (PbbMessage::AddressBlockIterator position) { return m_addressBlockList.erase (position); } PbbMessage::AddressBlockIterator PbbMessage::AddressBlockErase (PbbMessage::AddressBlockIterator first, PbbMessage::AddressBlockIterator last) { return m_addressBlockList.erase (first, last); } void PbbMessage::AddressBlockClear (void) { for (AddressBlockIterator iter = AddressBlockBegin (); iter != AddressBlockEnd (); iter++) { *iter = 0; } return m_addressBlockList.clear (); } uint32_t PbbMessage::GetSerializedSize (void) const { /* msg-type + (msg-flags + msg-addr-length) + 2msg-size */ uint32_t size = 4; if (HasOriginatorAddress ()) { size += GetAddressLength () + 1; } if (HasHopLimit ()) { size++; } if (HasHopCount ()) { size++; } if (HasSequenceNumber ()) { size += 2; } size += m_tlvList.GetSerializedSize (); for (ConstAddressBlockIterator iter = AddressBlockBegin (); iter != AddressBlockEnd (); iter++) { size += (*iter)->GetSerializedSize (); } return size; } void PbbMessage::Serialize (Buffer::Iterator &start) const { Buffer::Iterator front = start; start.WriteU8 (GetType ()); /* Save a reference to the spot where we will later write the flags */ Buffer::Iterator bufref = start; start.Next (1); uint8_t flags = 0; flags = GetAddressLength (); Buffer::Iterator sizeref = start; start.Next (2); if (HasOriginatorAddress ()) { flags |= MHAS_ORIG; SerializeOriginatorAddress (start); } if (HasHopLimit ()) { flags |= MHAS_HOP_LIMIT; start.WriteU8 (GetHopLimit ()); } if (HasHopCount ()) { flags |= MHAS_HOP_COUNT; start.WriteU8 (GetHopCount ()); } if (HasSequenceNumber ()) { flags |= MHAS_SEQ_NUM; start.WriteHtonU16 (GetSequenceNumber ()); } bufref.WriteU8 (flags); m_tlvList.Serialize (start); for (ConstAddressBlockIterator iter = AddressBlockBegin (); iter != AddressBlockEnd (); iter++) { (*iter)->Serialize (start); } sizeref.WriteHtonU16 (front.GetDistanceFrom (start)); } Ptr<PbbMessage> PbbMessage::DeserializeMessage (Buffer::Iterator &start) { /* We need to read the msg-addr-len field to determine what kind of object to * construct. */ start.Next (); uint8_t addrlen = start.ReadU8 (); start.Prev (2); /* Go back to the start */ /* The first four bytes of the flag is the address length. Set the last four * bytes to 0 to read it. */ addrlen = (addrlen & 0xf); Ptr<PbbMessage> newmsg; switch (addrlen) { case 0: case IPV4: newmsg = Create<PbbMessageIpv4> (); break; case IPV6: newmsg = Create<PbbMessageIpv6> (); break; default: return 0; break; } newmsg->Deserialize (start); return newmsg; } void PbbMessage::Deserialize (Buffer::Iterator &start) { Buffer::Iterator front = start; SetType (start.ReadU8 ()); uint8_t flags = start.ReadU8 (); uint16_t size = start.ReadNtohU16 (); if (flags & MHAS_ORIG) { SetOriginatorAddress (DeserializeOriginatorAddress (start)); } if (flags & MHAS_HOP_LIMIT) { SetHopLimit (start.ReadU8 ()); } if (flags & MHAS_HOP_COUNT) { SetHopCount (start.ReadU8 ()); } if (flags & MHAS_SEQ_NUM) { SetSequenceNumber (start.ReadNtohU16 ()); } m_tlvList.Deserialize (start); if (size > 0) { while (start.GetDistanceFrom (front) < size) { Ptr<PbbAddressBlock> newab = AddressBlockDeserialize (start); AddressBlockPushBack (newab); } } } void PbbMessage::Print (std::ostream &os) const { Print (os, 0); } void PbbMessage::Print (std::ostream &os, int level) const { std::string prefix = ""; for (int i = 0; i < level; i++) { prefix.append ("\t"); } os << prefix << "PbbMessage {" << std::endl; os << prefix << "\tmessage type = " << (int)GetType () << std::endl; os << prefix << "\taddress size = " << GetAddressLength () << std::endl; if (HasOriginatorAddress ()) { os << prefix << "\toriginator address = "; PrintOriginatorAddress (os); os << std::endl; } if (HasHopLimit ()) { os << prefix << "\thop limit = " << (int)GetHopLimit () << std::endl; } if (HasHopCount ()) { os << prefix << "\thop count = " << (int)GetHopCount () << std::endl; } if (HasSequenceNumber ()) { os << prefix << "\tseqnum = " << GetSequenceNumber () << std::endl; } m_tlvList.Print (os, level+1); for (ConstAddressBlockIterator iter = AddressBlockBegin (); iter != AddressBlockEnd (); iter++) { (*iter)->Print (os, level+1); } os << prefix << "}" << std::endl; } bool PbbMessage::operator== (const PbbMessage &other) const { if (GetAddressLength () != other.GetAddressLength ()) { return false; } if (GetType () != other.GetType ()) { return false; } if (HasOriginatorAddress () != other.HasOriginatorAddress ()) { return false; } if (HasOriginatorAddress ()) { if (GetOriginatorAddress () != other.GetOriginatorAddress ()) { return false; } } if (HasHopLimit () != other.HasHopLimit ()) { return false; } if (HasHopLimit ()) { if (GetHopLimit () != other.GetHopLimit ()) { return false; } } if (HasHopCount () != other.HasHopCount ()) { return false; } if (HasHopCount ()) { if (GetHopCount () != other.GetHopCount ()) { return false; } } if (HasSequenceNumber () != other.HasSequenceNumber ()) { return false; } if (HasSequenceNumber ()) { if (GetSequenceNumber () != other.GetSequenceNumber ()) { return false; } } if (m_tlvList != other.m_tlvList) { return false; } if (AddressBlockSize () != other.AddressBlockSize ()) { return false; } ConstAddressBlockIterator tai, oai; for (tai = AddressBlockBegin (), oai = other.AddressBlockBegin (); tai != AddressBlockEnd () && oai != other.AddressBlockEnd (); tai++, oai++) { if (**tai != **oai) { return false; } } return true; } bool PbbMessage::operator!= (const PbbMessage &other) const { return !(*this == other); } /* End PbbMessage Class */ PbbMessageIpv4::PbbMessageIpv4 () { } PbbMessageIpv4::~PbbMessageIpv4 () { } PbbAddressLength PbbMessageIpv4::GetAddressLength (void) const { return IPV4; } void PbbMessageIpv4::SerializeOriginatorAddress (Buffer::Iterator &start) const { uint8_t* buffer = new uint8_t[GetAddressLength () + 1]; Ipv4Address::ConvertFrom (GetOriginatorAddress ()).Serialize (buffer); start.Write (buffer, GetAddressLength () + 1); delete[] buffer; } Address PbbMessageIpv4::DeserializeOriginatorAddress (Buffer::Iterator &start) const { uint8_t* buffer = new uint8_t[GetAddressLength () + 1]; start.Read (buffer, GetAddressLength () + 1); Address result = Ipv4Address::Deserialize (buffer); delete[] buffer; return result; } void PbbMessageIpv4::PrintOriginatorAddress (std::ostream &os) const { Ipv4Address::ConvertFrom (GetOriginatorAddress ()).Print (os); } Ptr<PbbAddressBlock> PbbMessageIpv4::AddressBlockDeserialize (Buffer::Iterator &start) const { Ptr<PbbAddressBlock> newab = Create<PbbAddressBlockIpv4> (); newab->Deserialize (start); return newab; } /* End PbbMessageIpv4 Class */ PbbMessageIpv6::PbbMessageIpv6 () { } PbbMessageIpv6::~PbbMessageIpv6 () { } PbbAddressLength PbbMessageIpv6::GetAddressLength (void) const { return IPV6; } void PbbMessageIpv6::SerializeOriginatorAddress (Buffer::Iterator &start) const { uint8_t* buffer = new uint8_t[GetAddressLength () + 1]; Ipv6Address::ConvertFrom (GetOriginatorAddress ()).Serialize (buffer); start.Write (buffer, GetAddressLength () + 1); delete[] buffer; } Address PbbMessageIpv6::DeserializeOriginatorAddress (Buffer::Iterator &start) const { uint8_t* buffer = new uint8_t[GetAddressLength () + 1]; start.Read (buffer, GetAddressLength () + 1); Address res = Ipv6Address::Deserialize (buffer); delete[] buffer; return res; } void PbbMessageIpv6::PrintOriginatorAddress (std::ostream &os) const { Ipv6Address::ConvertFrom (GetOriginatorAddress ()).Print (os); } Ptr<PbbAddressBlock> PbbMessageIpv6::AddressBlockDeserialize (Buffer::Iterator &start) const { Ptr<PbbAddressBlock> newab = Create<PbbAddressBlockIpv6> (); newab->Deserialize (start); return newab; } /* End PbbMessageIpv6 Class */ PbbAddressBlock::PbbAddressBlock () { } PbbAddressBlock::~PbbAddressBlock () { } /* Manipulating the address block */ PbbAddressBlock::AddressIterator PbbAddressBlock::AddressBegin (void) { return m_addressList.begin (); } PbbAddressBlock::ConstAddressIterator PbbAddressBlock::AddressBegin (void) const { return m_addressList.begin (); } PbbAddressBlock::AddressIterator PbbAddressBlock::AddressEnd (void) { return m_addressList.end (); } PbbAddressBlock::ConstAddressIterator PbbAddressBlock::AddressEnd (void) const { return m_addressList.end (); } int PbbAddressBlock::AddressSize (void) const { return m_addressList.size (); } bool PbbAddressBlock::AddressEmpty (void) const { return m_addressList.empty (); } Address PbbAddressBlock::AddressFront (void) const { return m_addressList.front (); } Address PbbAddressBlock::AddressBack (void) const { return m_addressList.back (); } void PbbAddressBlock::AddressPushFront (Address tlv) { m_addressList.push_front (tlv); } void PbbAddressBlock::AddressPopFront (void) { m_addressList.pop_front (); } void PbbAddressBlock::AddressPushBack (Address tlv) { m_addressList.push_back (tlv); } void PbbAddressBlock::AddressPopBack (void) { m_addressList.pop_back (); } PbbAddressBlock::AddressIterator PbbAddressBlock::AddressErase (PbbAddressBlock::AddressIterator position) { return m_addressList.erase (position); } PbbAddressBlock::AddressIterator PbbAddressBlock::AddressErase (PbbAddressBlock::AddressIterator first, PbbAddressBlock::AddressIterator last) { return m_addressList.erase (first, last); } void PbbAddressBlock::AddressClear (void) { return m_addressList.clear (); } /* Manipulating the prefix list */ PbbAddressBlock::PrefixIterator PbbAddressBlock::PrefixBegin (void) { return m_prefixList.begin (); } PbbAddressBlock::ConstPrefixIterator PbbAddressBlock::PrefixBegin (void) const { return m_prefixList.begin (); } PbbAddressBlock::PrefixIterator PbbAddressBlock::PrefixEnd (void) { return m_prefixList.end (); } PbbAddressBlock::ConstPrefixIterator PbbAddressBlock::PrefixEnd (void) const { return m_prefixList.end (); } int PbbAddressBlock::PrefixSize (void) const { return m_prefixList.size (); } bool PbbAddressBlock::PrefixEmpty (void) const { return m_prefixList.empty (); } uint8_t PbbAddressBlock::PrefixFront (void) const { return m_prefixList.front (); } uint8_t PbbAddressBlock::PrefixBack (void) const { return m_prefixList.back (); } void PbbAddressBlock::PrefixPushFront (uint8_t prefix) { m_prefixList.push_front (prefix); } void PbbAddressBlock::PrefixPopFront (void) { m_prefixList.pop_front (); } void PbbAddressBlock::PrefixPushBack (uint8_t prefix) { m_prefixList.push_back (prefix); } void PbbAddressBlock::PrefixPopBack (void) { m_prefixList.pop_back (); } PbbAddressBlock::PrefixIterator PbbAddressBlock::PrefixInsert (PbbAddressBlock::PrefixIterator position, const uint8_t value) { return m_prefixList.insert (position, value); } PbbAddressBlock::PrefixIterator PbbAddressBlock::PrefixErase (PbbAddressBlock::PrefixIterator position) { return m_prefixList.erase (position); } PbbAddressBlock::PrefixIterator PbbAddressBlock::PrefixErase (PbbAddressBlock::PrefixIterator first, PbbAddressBlock::PrefixIterator last) { return m_prefixList.erase (first, last); } void PbbAddressBlock::PrefixClear (void) { m_prefixList.clear (); } /* Manipulating the TLV block */ PbbAddressBlock::TlvIterator PbbAddressBlock::TlvBegin (void) { return m_addressTlvList.Begin (); } PbbAddressBlock::ConstTlvIterator PbbAddressBlock::TlvBegin (void) const { return m_addressTlvList.Begin (); } PbbAddressBlock::TlvIterator PbbAddressBlock::TlvEnd (void) { return m_addressTlvList.End (); } PbbAddressBlock::ConstTlvIterator PbbAddressBlock::TlvEnd (void) const { return m_addressTlvList.End (); } int PbbAddressBlock::TlvSize (void) const { return m_addressTlvList.Size (); } bool PbbAddressBlock::TlvEmpty (void) const { return m_addressTlvList.Empty (); } Ptr<PbbAddressTlv> PbbAddressBlock::TlvFront (void) { return m_addressTlvList.Front (); } const Ptr<PbbAddressTlv> PbbAddressBlock::TlvFront (void) const { return m_addressTlvList.Front (); } Ptr<PbbAddressTlv> PbbAddressBlock::TlvBack (void) { return m_addressTlvList.Back (); } const Ptr<PbbAddressTlv> PbbAddressBlock::TlvBack (void) const { return m_addressTlvList.Back (); } void PbbAddressBlock::TlvPushFront (Ptr<PbbAddressTlv> tlv) { m_addressTlvList.PushFront (tlv); } void PbbAddressBlock::TlvPopFront (void) { m_addressTlvList.PopFront (); } void PbbAddressBlock::TlvPushBack (Ptr<PbbAddressTlv> tlv) { m_addressTlvList.PushBack (tlv); } void PbbAddressBlock::TlvPopBack (void) { m_addressTlvList.PopBack (); } PbbAddressBlock::TlvIterator PbbAddressBlock::TlvErase (PbbAddressBlock::TlvIterator position) { return m_addressTlvList.Erase (position); } PbbAddressBlock::TlvIterator PbbAddressBlock::TlvErase (PbbAddressBlock::TlvIterator first, PbbAddressBlock::TlvIterator last) { return m_addressTlvList.Erase (first, last); } void PbbAddressBlock::TlvClear (void) { m_addressTlvList.Clear (); } uint32_t PbbAddressBlock::GetSerializedSize (void) const { /* num-addr + flags */ uint32_t size = 2; if (AddressSize () == 1) { size += GetAddressLength () + PrefixSize (); } else if (AddressSize () > 0) { uint8_t* head = new uint8_t[GetAddressLength ()]; uint8_t headlen = 0; uint8_t* tail = new uint8_t[GetAddressLength ()]; uint8_t taillen = 0; GetHeadTail (head, headlen, tail, taillen); if (headlen > 0) { size += 1 + headlen; } if (taillen > 0) { size++; if (!HasZeroTail (tail, taillen)) { size += taillen; } } /* mid size */ size += (GetAddressLength () - headlen - taillen) * AddressSize (); size += PrefixSize (); delete[] head; delete[] tail; } size += m_addressTlvList.GetSerializedSize (); return size; } void PbbAddressBlock::Serialize (Buffer::Iterator &start) const { start.WriteU8 (AddressSize ()); Buffer::Iterator bufref = start; uint8_t flags = 0; start.Next (); if (AddressSize () == 1) { uint8_t* buf = new uint8_t[GetAddressLength ()]; SerializeAddress (buf, AddressBegin ()); start.Write (buf, GetAddressLength ()); if (PrefixSize () == 1) { start.WriteU8 (PrefixFront ()); flags |= AHAS_SINGLE_PRE_LEN; } bufref.WriteU8 (flags); delete[] buf; } else if (AddressSize () > 0) { uint8_t* head = new uint8_t[GetAddressLength ()]; uint8_t* tail = new uint8_t[GetAddressLength ()]; uint8_t headlen = 0; uint8_t taillen = 0; GetHeadTail (head, headlen, tail, taillen); if (headlen > 0) { flags |= AHAS_HEAD; start.WriteU8 (headlen); start.Write (head, headlen); } if (taillen > 0) { start.WriteU8 (taillen); if (HasZeroTail (tail, taillen)) { flags |= AHAS_ZERO_TAIL; } else { flags |= AHAS_FULL_TAIL; start.Write (tail, taillen); } } if (headlen + taillen < GetAddressLength ()) { uint8_t* mid = new uint8_t[GetAddressLength ()]; for (PbbAddressBlock::ConstAddressIterator iter = AddressBegin (); iter != AddressEnd (); iter++) { SerializeAddress (mid, iter); start.Write (mid + headlen, GetAddressLength () - headlen - taillen); } delete[] mid; } flags |= GetPrefixFlags (); bufref.WriteU8 (flags); for (ConstPrefixIterator iter = PrefixBegin (); iter != PrefixEnd (); iter++) { start.WriteU8 (*iter); } delete[] head; delete[] tail; } m_addressTlvList.Serialize (start); } void PbbAddressBlock::Deserialize (Buffer::Iterator &start) { uint8_t numaddr = start.ReadU8 (); uint8_t flags = start.ReadU8 (); if (numaddr > 0) { uint8_t headlen = 0; uint8_t taillen = 0; uint8_t* addrtmp = new uint8_t[GetAddressLength ()]; memset (addrtmp, 0, GetAddressLength ()); if (flags & AHAS_HEAD) { headlen = start.ReadU8 (); start.Read (addrtmp, headlen); } if ((flags & AHAS_FULL_TAIL) ^ (flags & AHAS_ZERO_TAIL)) { taillen = start.ReadU8 (); if (flags & AHAS_FULL_TAIL) { start.Read (addrtmp + GetAddressLength () - taillen, taillen); } } for (int i = 0; i < numaddr; i++) { start.Read (addrtmp + headlen, GetAddressLength () - headlen - taillen); AddressPushBack (DeserializeAddress (addrtmp)); } if (flags & AHAS_SINGLE_PRE_LEN) { PrefixPushBack (start.ReadU8 ()); } else if (flags & AHAS_MULTI_PRE_LEN) { for (int i = 0; i < numaddr; i++) { PrefixPushBack (start.ReadU8 ()); } } delete[] addrtmp; } m_addressTlvList.Deserialize (start); } void PbbAddressBlock::Print (std::ostream &os) const { Print (os, 0); } void PbbAddressBlock::Print (std::ostream &os, int level) const { std::string prefix = ""; for (int i = 0; i < level; i++) { prefix.append ("\t"); } os << prefix << "PbbAddressBlock {" << std::endl; os << prefix << "\taddresses = " << std::endl; for (ConstAddressIterator iter = AddressBegin (); iter != AddressEnd (); iter++) { os << prefix << "\t\t"; PrintAddress (os, iter); os << std::endl; } os << prefix << "\tprefixes = " << std::endl; for (ConstPrefixIterator iter = PrefixBegin (); iter != PrefixEnd (); iter++) { os << prefix << "\t\t" << (int)(*iter) << std::endl; } m_addressTlvList.Print (os, level+1); } bool PbbAddressBlock::operator== (const PbbAddressBlock &other) const { if (AddressSize () != other.AddressSize ()) { return false; } ConstAddressIterator tai, oai; for (tai = AddressBegin (), oai = other.AddressBegin (); tai != AddressEnd () && oai != other.AddressEnd (); tai++, oai++) { if (*tai != *oai) { return false; } } if (PrefixSize () != other.PrefixSize ()) { return false; } ConstPrefixIterator tpi, opi; for (tpi = PrefixBegin (), opi = other.PrefixBegin (); tpi != PrefixEnd () && opi != other.PrefixEnd (); tpi++, opi++) { if (*tpi != *opi) { return false; } } if (m_addressTlvList != other.m_addressTlvList) { return false; } return true; } bool PbbAddressBlock::operator!= (const PbbAddressBlock &other) const { return !(*this == other); } uint8_t PbbAddressBlock::GetPrefixFlags (void) const { switch (PrefixSize ()) { case 0: return 0; break; case 1: return AHAS_SINGLE_PRE_LEN; break; default: return AHAS_MULTI_PRE_LEN; break; } /* Quiet compiler */ return 0; } void PbbAddressBlock::GetHeadTail (uint8_t *head, uint8_t &headlen, uint8_t *tail, uint8_t &taillen) const { headlen = GetAddressLength (); taillen = headlen; /* Temporary automatic buffers to store serialized addresses */ uint8_t * buflast = new uint8_t[GetAddressLength ()]; uint8_t * bufcur = new uint8_t[GetAddressLength ()]; uint8_t * tmp; SerializeAddress (buflast, AddressBegin ()); /* Skip the first item */ for (PbbAddressBlock::ConstAddressIterator iter = AddressBegin ()++; iter != AddressEnd (); iter++) { SerializeAddress (bufcur, iter); int i; for (i = 0; i < headlen; i++) { if (buflast[i] != bufcur[i]) { headlen = i; break; } } /* If headlen == fulllen - 1, then tail is 0 */ if (headlen <= GetAddressLength () - 1) { for (i = GetAddressLength () - 1; GetAddressLength () - 1 - i <= taillen && i > headlen; i--) { if (buflast[i] != bufcur[i]) { break; } } taillen = GetAddressLength () - 1 - i; } else if (headlen == 0) { taillen = 0; break; } tmp = buflast; buflast = bufcur; bufcur = tmp; } memcpy (head, bufcur, headlen); memcpy (tail, bufcur + (GetAddressLength () - taillen), taillen); delete[] buflast; delete[] bufcur; } bool PbbAddressBlock::HasZeroTail (const uint8_t *tail, uint8_t taillen) const { int i; for (i = 0; i < taillen; i++) { if (tail[i] != 0) { break; } } return i == taillen; } /* End PbbAddressBlock Class */ PbbAddressBlockIpv4::PbbAddressBlockIpv4 () { } PbbAddressBlockIpv4::~PbbAddressBlockIpv4 () { } uint8_t PbbAddressBlockIpv4::GetAddressLength (void) const { return 4; } void PbbAddressBlockIpv4::SerializeAddress (uint8_t *buffer, ConstAddressIterator iter) const { Ipv4Address::ConvertFrom (*iter).Serialize (buffer); } Address PbbAddressBlockIpv4::DeserializeAddress (uint8_t *buffer) const { return Ipv4Address::Deserialize (buffer); } void PbbAddressBlockIpv4::PrintAddress (std::ostream &os, ConstAddressIterator iter) const { Ipv4Address::ConvertFrom (*iter).Print (os); } /* End PbbAddressBlockIpv4 Class */ PbbAddressBlockIpv6::PbbAddressBlockIpv6 () { } PbbAddressBlockIpv6::~PbbAddressBlockIpv6 () { } uint8_t PbbAddressBlockIpv6::GetAddressLength (void) const { return 16; } void PbbAddressBlockIpv6::SerializeAddress (uint8_t *buffer, ConstAddressIterator iter) const { Ipv6Address::ConvertFrom (*iter).Serialize (buffer); } Address PbbAddressBlockIpv6::DeserializeAddress (uint8_t *buffer) const { return Ipv6Address::Deserialize (buffer); } void PbbAddressBlockIpv6::PrintAddress (std::ostream &os, ConstAddressIterator iter) const { Ipv6Address::ConvertFrom (*iter).Print (os); } /* End PbbAddressBlockIpv6 Class */ PbbTlv::PbbTlv (void) { m_hasTypeExt = false; m_hasIndexStart = false; m_hasIndexStop = false; m_isMultivalue = false; m_hasValue = false; } PbbTlv::~PbbTlv (void) { m_value.RemoveAtEnd (m_value.GetSize ()); } void PbbTlv::SetType (uint8_t type) { m_type = type; } uint8_t PbbTlv::GetType (void) const { return m_type; } void PbbTlv::SetTypeExt (uint8_t typeExt) { m_typeExt = typeExt; m_hasTypeExt = true; } uint8_t PbbTlv::GetTypeExt (void) const { NS_ASSERT (HasTypeExt ()); return m_typeExt; } bool PbbTlv::HasTypeExt (void) const { return m_hasTypeExt; } void PbbTlv::SetIndexStart (uint8_t index) { m_indexStart = index; m_hasIndexStart = true; } uint8_t PbbTlv::GetIndexStart (void) const { NS_ASSERT (HasIndexStart ()); return m_indexStart; } bool PbbTlv::HasIndexStart (void) const { return m_hasIndexStart; } void PbbTlv::SetIndexStop (uint8_t index) { m_indexStop = index; m_hasIndexStop = true; } uint8_t PbbTlv::GetIndexStop (void) const { NS_ASSERT (HasIndexStop ()); return m_indexStop; } bool PbbTlv::HasIndexStop (void) const { return m_hasIndexStop; } void PbbTlv::SetMultivalue (bool isMultivalue) { m_isMultivalue = isMultivalue; } bool PbbTlv::IsMultivalue (void) const { return m_isMultivalue; } void PbbTlv::SetValue (Buffer start) { m_hasValue = true; m_value = start; } void PbbTlv::SetValue (const uint8_t * buffer, uint32_t size) { m_hasValue = true; m_value.AddAtStart (size); m_value.Begin ().Write (buffer, size); } Buffer PbbTlv::GetValue (void) const { NS_ASSERT (HasValue ()); return m_value; } bool PbbTlv::HasValue (void) const { return m_hasValue; } uint32_t PbbTlv::GetSerializedSize (void) const { /* type + flags */ uint32_t size = 2; if (HasTypeExt ()) { size++; } if (HasIndexStart ()) { size++; } if (HasIndexStop ()) { size++; } if (HasValue ()) { if (GetValue ().GetSize () > 255) { size += 2; } else { size++; } size += GetValue ().GetSize (); } return size; } void PbbTlv::Serialize (Buffer::Iterator &start) const { start.WriteU8 (GetType ()); Buffer::Iterator bufref = start; uint8_t flags = 0; start.Next (); if (HasTypeExt ()) { flags |= THAS_TYPE_EXT; start.WriteU8 (GetTypeExt ()); } if (HasIndexStart ()) { start.WriteU8 (GetIndexStart ()); if (HasIndexStop ()) { flags |= THAS_MULTI_INDEX; start.WriteU8 (GetIndexStop ()); } else { flags |= THAS_SINGLE_INDEX; } } if (HasValue ()) { flags |= THAS_VALUE; uint32_t size = GetValue ().GetSize (); if (size > 255) { flags |= THAS_EXT_LEN; start.WriteHtonU16 (size); } else { start.WriteU8 (size); } if (IsMultivalue ()) { flags |= TIS_MULTIVALUE; } start.Write (GetValue ().Begin (), GetValue ().End ()); } bufref.WriteU8 (flags); } void PbbTlv::Deserialize (Buffer::Iterator &start) { SetType (start.ReadU8 ()); uint8_t flags = start.ReadU8 (); if (flags & THAS_TYPE_EXT) { SetTypeExt (start.ReadU8 ()); } if (flags & THAS_MULTI_INDEX) { SetIndexStart (start.ReadU8 ()); SetIndexStop (start.ReadU8 ()); } else if (flags & THAS_SINGLE_INDEX) { SetIndexStart (start.ReadU8 ()); } if (flags & THAS_VALUE) { uint16_t len = 0; if (flags & THAS_EXT_LEN) { len = start.ReadNtohU16 (); } else { len = start.ReadU8 (); } m_value.AddAtStart (len); Buffer::Iterator valueStart = start; start.Next (len); m_value.Begin ().Write (valueStart, start); m_hasValue = true; } } void PbbTlv::Print (std::ostream &os) const { Print (os, 0); } void PbbTlv::Print (std::ostream &os, int level) const { std::string prefix = ""; for (int i = 0; i < level; i++) { prefix.append ("\t"); } os << prefix << "PbbTlv {" << std::endl; os << prefix << "\ttype = " << (int)GetType () << std::endl; if (HasTypeExt ()) { os << prefix << "\ttypeext = " << (int)GetTypeExt () << std::endl; } if (HasIndexStart ()) { os << prefix << "\tindexStart = " << (int)GetIndexStart () << std::endl; } if (HasIndexStop ()) { os << prefix << "\tindexStop = " << (int)GetIndexStop () << std::endl; } os << prefix << "\tisMultivalue = " << IsMultivalue () << std::endl; if (HasValue ()) { os << prefix << "\thas value; size = " << GetValue ().GetSize () << std::endl; } os << prefix << "}" << std::endl; } bool PbbTlv::operator== (const PbbTlv &other) const { if (GetType () != other.GetType ()) { return false; } if (HasTypeExt () != other.HasTypeExt ()) { return false; } if (HasTypeExt ()) { if (GetTypeExt () != other.GetTypeExt ()) { return false; } } if (HasValue () != other.HasValue ()) { return false; } if (HasValue ()) { Buffer tv = GetValue (); Buffer ov = other.GetValue (); if (tv.GetSize () != ov.GetSize ()) { return false; } /* The docs say I probably shouldn't use Buffer::PeekData, but I think it * is justified in this case. */ if (memcmp (tv.PeekData (), ov.PeekData (), tv.GetSize ()) != 0) { return false; } } return true; } bool PbbTlv::operator!= (const PbbTlv &other) const { return !(*this == other); } /* End PbbTlv Class */ void PbbAddressTlv::SetIndexStart (uint8_t index) { PbbTlv::SetIndexStart (index); } uint8_t PbbAddressTlv::GetIndexStart (void) const { return PbbTlv::GetIndexStart (); } bool PbbAddressTlv::HasIndexStart (void) const { return PbbTlv::HasIndexStart (); } void PbbAddressTlv::SetIndexStop (uint8_t index) { PbbTlv::SetIndexStop (index); } uint8_t PbbAddressTlv::GetIndexStop (void) const { return PbbTlv::GetIndexStop (); } bool PbbAddressTlv::HasIndexStop (void) const { return PbbTlv::HasIndexStop (); } void PbbAddressTlv::SetMultivalue (bool isMultivalue) { PbbTlv::SetMultivalue (isMultivalue); } bool PbbAddressTlv::IsMultivalue (void) const { return PbbTlv::IsMultivalue (); } } /* namespace ns3 */
zy901002-gpsr
src/network/utils/packetbb.cc
C++
gpl2
51,405
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2010 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "output-stream-wrapper.h" #include "ns3/log.h" #include "ns3/fatal-impl.h" #include "ns3/abort.h" #include <fstream> NS_LOG_COMPONENT_DEFINE ("OutputStreamWrapper"); namespace ns3 { OutputStreamWrapper::OutputStreamWrapper (std::string filename, std::ios::openmode filemode) : 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); NS_ABORT_MSG_UNLESS (m_ostream->good (), "Output stream is not vaild for writing."); } OutputStreamWrapper::~OutputStreamWrapper () { FatalImpl::UnregisterStream (m_ostream); if (m_destroyable) delete m_ostream; m_ostream = 0; } std::ostream * OutputStreamWrapper::GetStream (void) { return m_ostream; } } // namespace ns3
zy901002-gpsr
src/network/utils/output-stream-wrapper.cc
C++
gpl2
1,882
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2009 CTTC * * 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, Include., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Nicola Baldo <nbaldo@cttc.es> */ #ifndef RADIOTAP_HEADER_H #define RADIOTAP_HEADER_H #include <ns3/header.h> namespace ns3 { /** * @brief Radiotap header implementation * * Radiotap is a de facto standard for 802.11 frame injection and reception. * The radiotap header format is a mechanism to supply additional information * about frames, from the driver to userspace applications such as libpcap, and * from a userspace application to the driver for transmission. * * @warning the radiotap header specification says that the fields included in * the header should be aligned to their natural ize (e.g., 16-bit fields * aligned to 16-bit boundaries, 32-bit fields aligned to 32-bit boundaries, * and so on. This implementation does not enforce this. However, the radiotap * specification enforces an order in which fields have to appear (if they * appear), and this ordering is such that, provided you don't leave gaps, all * fields will end up aligned without the need of inserting padding space. By * the term "gap" I mean not using a field which would appear between two used * fields. Moral: don't leave gaps, or if you do be careful about how you * do it. */ class RadiotapHeader : public Header { public: RadiotapHeader(); static TypeId GetTypeId (void); virtual TypeId GetInstanceTypeId (void) const; /** * This method is used by Packet::AddHeader to store the header into the byte * buffer of a packet. This method returns the number of bytes which are * needed to store the header data during a Serialize. * * @returns The expected size of the header. */ virtual uint32_t GetSerializedSize (void) const; /** * This method is used by Packet::AddHeader to store the header into the byte * buffer of a packet. The data written is expected to match bit-for-bit the * representation of this header in a real network. * * @param start An iterator which points to where the header should * be written. */ virtual void Serialize (Buffer::Iterator start) const; /** * This method is used by Packet::RemoveHeader to re-create a header from the * byte buffer of a packet. The data read is expected to match bit-for-bit * the representation of this header in real networks. * * @param start An iterator which points to where the header should * written. * @returns The number of bytes read. */ virtual uint32_t Deserialize (Buffer::Iterator start); /** * This method is used by Packet::Print to print the content of the header as * ascii data to a C++ output stream. Although the header is free to format * its output as it wishes, it is recommended to follow a few rules to integrate * with the packet pretty printer: start with flags, small field * values located between a pair of parens. Values should be separated * by whitespace. Follow the parens with the important fields, * separated by whitespace. * * eg: (field1 val1 field2 val2 field3 val3) field4 val4 field5 val5 * * @param os The output stream */ virtual void Print (std::ostream &os) const; /** * @brief Set the Time Synchronization Function Timer (TSFT) value. Valid for * received frames only. * * @param tsft Value in microseconds of the MAC's 64-bit 802.11 Time * Synchronization Function timer when the first bit of the MPDU * arrived at the MAC. */ void SetTsft (uint64_t tsft); /** * @brief Get the Time Synchronization Function Timer (TSFT) value. Valid for * received frames only. * * @returns The value in microseconds of the MAC's 64-bit 802.11 Time * Synchronization Function timer when the first bit of the MPDU * arrived at the MAC. */ uint64_t GetTsft (void) const; enum { FRAME_FLAG_NONE = 0x00, /**< No flags set */ FRAME_FLAG_CFP = 0x01, /**< Frame sent/received during CFP */ FRAME_FLAG_SHORT_PREAMBLE = 0x02, /**< Frame sent/received with short preamble */ FRAME_FLAG_WEP = 0x04, /**< Frame sent/received with WEP encryption */ FRAME_FLAG_FRAGMENTED = 0x08, /**< Frame sent/received with fragmentation */ FRAME_FLAG_FCS_INCLUDED = 0x10, /**< Frame includes FCS */ FRAME_FLAG_DATA_PADDING = 0x20, /**< Frame has padding between 802.11 header and payload (to 32-bit boundary) */ FRAME_FLAG_BAD_FCS = 0x40, /**< Frame failed FCS check */ FRAME_FLAG_SHORT_GUARD = 0x80 /**< Frame used short guard interval (HT) */ }; /** * @brief Set the frame flags of the transmitted or received frame. * @param flags flags to set. */ void SetFrameFlags (uint8_t flags); /** * @brief Get the frame flags of the transmitted or received frame. * @returns The frame flags. * @see FrameFlags. */ uint8_t GetFrameFlags (void) const; /** * @brief Set the transmit/receive channel frequency in units of megahertz * @param rate the transmit/receive channel frequency in units of megahertz. */ void SetRate (uint8_t rate); /** * @brief Get the transmit/receive channel frequency in units of megahertz. * @returns The transmit/receive channel frequency in units of megahertz. */ uint8_t GetRate (void) const; enum { CHANNEL_FLAG_NONE = 0x0000, /**< No flags set */ CHANNEL_FLAG_TURBO = 0x0010, /**< Turbo Channel */ CHANNEL_FLAG_CCK = 0x0020, /**< CCK channel */ CHANNEL_FLAG_OFDM = 0x0040, /**< OFDM channel */ CHANNEL_FLAG_SPECTRUM_2GHZ = 0x0080, /**< 2 GHz spectrum channel */ CHANNEL_FLAG_SPECTRUM_5GHZ = 0x0100, /**< 5 GHz spectrum channel */ CHANNEL_FLAG_PASSIVE = 0x0200, /**< Only passive scan allowed */ CHANNEL_FLAG_DYNAMIC = 0x0400, /**< Dynamic CCK-OFDM channel */ CHANNEL_FLAG_GFSK = 0x0800 /**< GFSK channel (FHSS PHY) */ }; /** * @brief Set the transmit/receive channel frequency and flags * @param frequency The transmit/receive data rate in units of 500 kbps. * @param flags The flags to set. * @see ChannelFlags */ void SetChannelFrequencyAndFlags (uint16_t frequency, uint16_t flags); /** * @brief Get the transmit/receive data rate in units of 500 kbps. * @returns The transmit/receive data rate in units of 500 kbps. */ uint16_t GetChannelFrequency (void) const; /** * @brief Get the channel flags of the transmitted or received frame. * @returns The frame flags. * @see ChannelFlags. */ uint16_t GetChannelFlags (void) const; /** * @brief Set the RF signal power at the antenna as a decibel difference * from an arbitrary, fixed reference. * * @param signal The RF signal power at the antenna as a decibel difference * from an arbitrary, fixed reference; */ void SetAntennaSignalPower (double signal); /** * @brief Get the RF signal power at the antenna as a decibel difference * from an arbitrary, fixed reference. * * @returns The RF signal power at the antenna as a decibel difference * from an arbitrary, fixed reference. */ uint8_t GetAntennaSignalPower (void) const; /** * @brief Set the RF noise power at the antenna as a decibel difference * from an arbitrary, fixed reference. * * @param noise The RF noise power at the antenna as a decibel difference * from an arbitrary, fixed reference. */ void SetAntennaNoisePower (double noise); /** * @brief Get the RF noise power at the antenna as a decibel difference * from an arbitrary, fixed reference. * * @returns The RF noise power at the antenna as a decibel difference * from an arbitrary, fixed reference. */ uint8_t GetAntennaNoisePower (void) const; private: enum { RADIOTAP_TSFT = 0x00000001, RADIOTAP_FLAGS = 0x00000002, RADIOTAP_RATE = 0x00000004, RADIOTAP_CHANNEL = 0x00000008, RADIOTAP_FHSS = 0x00000010, RADIOTAP_DBM_ANTSIGNAL = 0x00000020, RADIOTAP_DBM_ANTNOISE = 0x00000040, RADIOTAP_LOCK_QUALITY = 0x00000080, RADIOTAP_TX_ATTENUATION = 0x00000100, RADIOTAP_DB_TX_ATTENUATION = 0x00000200, RADIOTAP_DBM_TX_POWER = 0x00000200, RADIOTAP_ANTENNA = 0x00000400, RADIOTAP_DB_ANTSIGNAL = 0x00000800, RADIOTAP_DB_ANTNOISE = 0x00001000, RADIOTAP_EXT = 0x10000000 }; void CheckAddChannelField (); uint16_t m_length; uint32_t m_present; uint64_t m_tsft; uint8_t m_flags; uint8_t m_rate; uint16_t m_channelFreq; uint16_t m_channelFlags; int8_t m_antennaSignal; int8_t m_antennaNoise; }; } // namespace ns3 #endif /* RADIOTAP_HEADER_H */
zy901002-gpsr
src/network/utils/radiotap-header.h
C++
gpl2
9,596
/* -*- 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 "flow-id-tag.h" namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (FlowIdTag); TypeId FlowIdTag::GetTypeId (void) { static TypeId tid = TypeId ("ns3::FlowIdTag") .SetParent<Tag> () .AddConstructor<FlowIdTag> () ; return tid; } TypeId FlowIdTag::GetInstanceTypeId (void) const { return GetTypeId (); } uint32_t FlowIdTag::GetSerializedSize (void) const { return 4; } void FlowIdTag::Serialize (TagBuffer buf) const { buf.WriteU32 (m_flowId); } void FlowIdTag::Deserialize (TagBuffer buf) { m_flowId = buf.ReadU32 (); } void FlowIdTag::Print (std::ostream &os) const { os << "FlowId=" << m_flowId; } FlowIdTag::FlowIdTag () : Tag () { } FlowIdTag::FlowIdTag (uint32_t id) : Tag (), m_flowId (id) { } void FlowIdTag::SetFlowId (uint32_t id) { m_flowId = id; } uint32_t FlowIdTag::GetFlowId (void) const { return m_flowId; } uint32_t FlowIdTag::AllocateFlowId (void) { static uint32_t nextFlowId = 1; uint32_t flowId = nextFlowId; nextFlowId++; return flowId; } } // namespace ns3
zy901002-gpsr
src/network/utils/flow-id-tag.cc
C++
gpl2
1,854
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007-2008 Louis Pasteur University * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr> */ #include <iomanip> #include "ns3/log.h" #include "ns3/assert.h" #include "mac48-address.h" #include "ipv6-address.h" NS_LOG_COMPONENT_DEFINE ("Ipv6Address"); namespace ns3 { #ifdef __cplusplus extern "C" { /* } */ #endif /** * \brief Get a hash key. * \param k the key * \param length the length of the key * \param level the previous hash, or an arbitrary value * \return hash * \note Adapted from Jens Jakobsen implementation (chillispot). */ static uint32_t lookuphash (unsigned char* k, uint32_t length, uint32_t level) { #define mix(a, b, c) \ ({ \ (a) -= (b); (a) -= (c); (a) ^= ((c) >> 13); \ (b) -= (c); (b) -= (a); (b) ^= ((a) << 8); \ (c) -= (a); (c) -= (b); (c) ^= ((b) >> 13); \ (a) -= (b); (a) -= (c); (a) ^= ((c) >> 12); \ (b) -= (c); (b) -= (a); (b) ^= ((a) << 16); \ (c) -= (a); (c) -= (b); (c) ^= ((b) >> 5); \ (a) -= (b); (a) -= (c); (a) ^= ((c) >> 3); \ (b) -= (c); (b) -= (a); (b) ^= ((a) << 10); \ (c) -= (a); (c) -= (b); (c) ^= ((b) >> 15); \ }) typedef uint32_t ub4; /* unsigned 4-byte quantities */ typedef unsigned char ub1; /* unsigned 1-byte quantities */ uint32_t a = 0; uint32_t b = 0; uint32_t c = 0; uint32_t len = 0; /* Set up the internal state */ len = length; a = b = 0x9e3779b9; /* the golden ratio; an arbitrary value */ c = level; /* the previous hash value */ /* handle most of the key */ while (len >= 12) { a += (k[0] + ((ub4)k[1] << 8) + ((ub4)k[2] << 16) + ((ub4)k[3] << 24)); b += (k[4] + ((ub4)k[5] << 8) + ((ub4)k[6] << 16) + ((ub4)k[7] << 24)); c += (k[8] + ((ub4)k[9] << 8) + ((ub4)k[10] << 16) + ((ub4)k[11] << 24)); mix (a, b, c); k += 12; len -= 12; } /* handle the last 11 bytes */ c += length; switch (len) /* all the case statements fall through */ { case 11: c += ((ub4)k[10] << 24); case 10: c += ((ub4)k[9] << 16); case 9: c += ((ub4)k[8] << 8); /* the first byte of c is reserved for the length */ case 8: b += ((ub4)k[7] << 24); case 7: b += ((ub4)k[6] << 16); case 6: b += ((ub4)k[5] << 8); case 5: b += k[4]; case 4: a += ((ub4)k[3] << 24); case 3: a += ((ub4)k[2] << 16); case 2: a += ((ub4)k[1] << 8); case 1: a += k[0]; /* case 0: nothing left to add */ } mix (a, b, c); #undef mix /* report the result */ return c; } #ifdef __cplusplus } #endif /** * \brief Convert an IPv6 C-string into a 128-bit representation. * \return true if success, false otherwise (bad format, ...) * \note This function is strongly inspired by inet_pton6() from Paul Vixie. * \todo Handle IPv6 address with decimal value for last four bytes. */ static bool AsciiToIpv6Host (const char *address, uint8_t addr[16]) { static const char xdigits_l[] = "0123456789abcdef"; static const char xdigits_u[] = "0123456789ABCDEF"; unsigned char tmp[16]; unsigned char* tp = tmp; unsigned char* endp = 0; unsigned char* colonp = 0; const char* xdigits = 0; #if 0 const char* curtok = 0; #endif int ch = 0; int seen_xdigits = 0; unsigned int val = 0; memset (tp, 0x00, 16); endp = tp + 16; /* Leading :: requires some special handling. */ if (*address == ':') { if (*++address != ':') { return (0); } } #if 0 curtok = address; #endif while ((ch = *address++) != '\0') { const char *pch = 0; if ((pch = strchr ((xdigits = xdigits_l), ch)) == 0) { pch = strchr ((xdigits = xdigits_u), ch); } if (pch != 0) { val <<= 4; val |= (pch - xdigits); if (++seen_xdigits > 4) { return (0); } continue; } if (ch == ':') { #if 0 curtok = address; #endif if (!seen_xdigits) { if (colonp) return (0); colonp = tp; continue; } if (tp + 2 > endp) { return (0); } *tp++ = (unsigned char)(val >> 8) & 0xff; *tp++ = (unsigned char) val & 0xff; seen_xdigits = 0; val = 0; continue; } /* TODO Handle IPv4 mapped address (2001::192.168.0.1) */ #if 0 if (ch == '.' && ((tp + 4 /*NS_INADDRSZ*/) <= endp) && inet_pton4 (curtok, tp) > 0) { tp += 4 /*NS_INADDRSZ*/; seen_xdigits = 0; break; /* '\0' was seen by inet_pton4(). */ } #endif return (0); } if (seen_xdigits) { if (tp + 2 > endp) { return (0); } *tp++ = (unsigned char)(val >> 8) & 0xff; *tp++ = (unsigned char) val & 0xff; } if (colonp != 0) { /* * Since some memmove ()'s erroneously fail to handle * overlapping regions, we'll do the shift by hand. */ const int n = tp - colonp; int i = 0; if (tp == endp) { return (0); } for (i = 1; i <= n; i++) { endp[-i] = colonp[n - i]; colonp[n - i] = 0; } tp = endp; } if (tp != endp) { return (0); } memcpy (addr, tmp, 16); return (1); } Ipv6Address::Ipv6Address () { memset (m_address, 0x00, 16); } Ipv6Address::Ipv6Address (Ipv6Address const& addr) { memcpy (m_address, addr.m_address, 16); } Ipv6Address::Ipv6Address (Ipv6Address const* addr) { memcpy (m_address, addr->m_address, 16); } Ipv6Address::Ipv6Address (char const* address) { AsciiToIpv6Host (address, m_address); } Ipv6Address::Ipv6Address (uint8_t address[16]) { /* 128 bit => 16 bytes */ memcpy (m_address, address, 16); } Ipv6Address::~Ipv6Address () { /* do nothing */ } void Ipv6Address::Set (char const* address) { AsciiToIpv6Host (address, m_address); } void Ipv6Address::Set (uint8_t address[16]) { /* 128 bit => 16 bytes */ memcpy (m_address, address, 16); } void Ipv6Address::Serialize (uint8_t buf[16]) const { memcpy (buf, m_address, 16); } Ipv6Address Ipv6Address::Deserialize (const uint8_t buf[16]) { Ipv6Address ipv6 ((uint8_t*)buf); return ipv6; } Ipv6Address Ipv6Address::MakeAutoconfiguredAddress (Mac48Address addr, Ipv6Address prefix) { Ipv6Address ret; uint8_t buf[16]; uint8_t buf2[16]; addr.CopyTo (buf); prefix.GetBytes (buf2); memcpy (buf2 + 8, buf, 3); buf2[11] = 0xff; buf2[12] = 0xfe; memcpy (buf2 + 13, buf + 3, 3); buf2[8] |= 0x02; ret.Set (buf2); return ret; } Ipv6Address Ipv6Address::MakeAutoconfiguredLinkLocalAddress (Mac48Address addr) { Ipv6Address ret; uint8_t buf[16]; uint8_t buf2[16]; addr.CopyTo (buf); memset (buf2, 0x00, sizeof (buf2)); buf2[0] = 0xfe; buf2[1] = 0x80; memcpy (buf2 + 8, buf, 3); buf2[11] = 0xff; buf2[12] = 0xfe; memcpy (buf2 + 13, buf + 3, 3); buf2[8] |= 0x02; ret.Set (buf2); return ret; } Ipv6Address Ipv6Address::MakeSolicitedAddress (Ipv6Address addr) { uint8_t buf[16]; uint8_t buf2[16]; Ipv6Address ret; addr.Serialize (buf2); memset (buf, 0x00, sizeof (buf)); buf[0] = 0xff; buf[1] = 0x02; buf[11] = 0x01; buf[12] = 0xff; buf[13] = buf2[13]; buf[14] = buf2[14]; buf[15] = buf2[15]; ret.Set (buf); return ret; } void Ipv6Address::Print (std::ostream& os) const { os << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_address[0] << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_address[1] << ":" << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_address[2] << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_address[3] << ":" << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_address[4] << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_address[5] << ":" << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_address[6] << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_address[7] << ":" << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_address[8] << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_address[9] << ":" << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_address[10] << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_address[11] << ":" << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_address[12] << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_address[13] << ":" << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_address[14] << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_address[15] << std::dec << std::setfill (' '); } bool Ipv6Address::IsLocalhost () const { static Ipv6Address localhost ("::1"); return (*this == localhost); } bool Ipv6Address::IsMulticast () const { if (m_address[0] == 0xff) { return true; } return false; } Ipv6Address Ipv6Address::CombinePrefix (Ipv6Prefix const& prefix) { Ipv6Address ipv6; uint8_t addr[16]; uint8_t pref[16]; unsigned int i = 0; memcpy (addr, m_address, 16); ((Ipv6Prefix)prefix).GetBytes (pref); /* a little bit ugly... */ for (i = 0; i < 16; i++) { addr[i] = addr[i] & pref[i]; } ipv6.Set (addr); return ipv6; } bool Ipv6Address::IsSolicitedMulticast () const { uint8_t buf[16]; Serialize (buf); if (buf[0] == 0xff && buf[1] == 0x02 && buf[11] == 0x01 && buf[12] == 0xff) { return true; } return false; } bool Ipv6Address::IsAllNodesMulticast () const { static Ipv6Address allnodes ("ff02::1"); return (*this == allnodes); } bool Ipv6Address::IsAllRoutersMulticast () const { static Ipv6Address allrouters ("ff02::2"); return (*this == allrouters); } bool Ipv6Address::IsAllHostsMulticast () const { static Ipv6Address allhosts ("ff02::3"); return (*this == allhosts); } bool Ipv6Address::IsAny () const { static Ipv6Address any ("::"); return (*this == any); } bool Ipv6Address::IsMatchingType (const Address& address) { return address.CheckCompatible (GetType (), 16); } Ipv6Address::operator Address () const { return ConvertTo (); } Address Ipv6Address::ConvertTo (void) const { uint8_t buf[16]; Serialize (buf); return Address (GetType (), buf, 16); } Ipv6Address Ipv6Address::ConvertFrom (const Address &address) { NS_ASSERT (address.CheckCompatible (GetType (), 16)); uint8_t buf[16]; address.CopyTo (buf); return Deserialize (buf); } uint8_t Ipv6Address::GetType (void) { static uint8_t type = Address::Register (); return type; } Ipv6Address Ipv6Address::GetAllNodesMulticast () { static Ipv6Address nmc ("ff02::1"); return nmc; } Ipv6Address Ipv6Address::GetAllRoutersMulticast () { static Ipv6Address rmc ("ff02::2"); return rmc; } Ipv6Address Ipv6Address::GetAllHostsMulticast () { static Ipv6Address hmc ("ff02::3"); return hmc; } Ipv6Address Ipv6Address::GetLoopback () { static Ipv6Address loopback ("::1"); return loopback; } Ipv6Address Ipv6Address::GetZero () { static Ipv6Address zero ("::"); return zero; } Ipv6Address Ipv6Address::GetAny () { static Ipv6Address any ("::"); return any; } Ipv6Address Ipv6Address::GetOnes () { static Ipv6Address ones ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"); return ones; } void Ipv6Address::GetBytes (uint8_t buf[16]) const { memcpy (buf, m_address, 16); } bool Ipv6Address::IsLinkLocal () const { Ipv6Address linkLocal ("fe80::0"); if (!IsMulticast () && ((Ipv6Address*)this)->CombinePrefix (Ipv6Prefix (64)) == linkLocal) { return true; } return false; } bool Ipv6Address::IsEqual (const Ipv6Address& other) const { if (!memcmp (m_address, other.m_address, 16)) { return true; } return false; } std::ostream& operator << (std::ostream& os, Ipv6Address const& address) { address.Print (os); return os; } std::istream& operator >> (std::istream& is, Ipv6Address& address) { std::string str; is >> str; address = Ipv6Address (str.c_str ()); return is; } Ipv6Prefix::Ipv6Prefix () { memset (m_prefix, 0x00, 16); } Ipv6Prefix::Ipv6Prefix (char const* prefix) { AsciiToIpv6Host (prefix, m_prefix); } Ipv6Prefix::Ipv6Prefix (uint8_t prefix[16]) { memcpy (m_prefix, prefix, 16); } Ipv6Prefix::Ipv6Prefix (uint8_t prefix) { unsigned int nb=0; unsigned int mod=0; unsigned int i=0; memset (m_prefix, 0x00, 16); NS_ASSERT (prefix <= 128); nb = prefix / 8; mod = prefix % 8; // protect memset with 'nb > 0' check to suppress // __warn_memset_zero_len compiler errors in some gcc>4.5.x if (nb > 0) { memset (m_prefix, 0xff, nb); } if (mod) { m_prefix[nb] = 0xff << (8-mod); } if (nb < 16) { nb++; for (i = nb; i < 16; i++) { m_prefix[i] = 0x00; } } } Ipv6Prefix::Ipv6Prefix (Ipv6Prefix const& prefix) { memcpy (m_prefix, prefix.m_prefix, 16); } Ipv6Prefix::Ipv6Prefix (Ipv6Prefix const* prefix) { memcpy (m_prefix, prefix->m_prefix, 16); } Ipv6Prefix::~Ipv6Prefix () { /* do nothing */ } bool Ipv6Prefix::IsMatch (Ipv6Address a, Ipv6Address b) const { uint8_t addrA[16]; uint8_t addrB[16]; unsigned int i = 0; a.GetBytes (addrA); b.GetBytes (addrB); /* a little bit ugly... */ for (i = 0; i < 16; i++) { if ((addrA[i] & m_prefix[i]) != (addrB[i] & m_prefix[i])) { return false; } } return true; } void Ipv6Prefix::Print (std::ostream &os) const { os << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_prefix[0] << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_prefix[1] << ":" << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_prefix[2] << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_prefix[3] << ":" << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_prefix[4] << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_prefix[5] << ":" << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_prefix[6] << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_prefix[7] << ":" << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_prefix[8] << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_prefix[9] << ":" << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_prefix[10] << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_prefix[11] << ":" << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_prefix[12] << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_prefix[13] << ":" << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_prefix[14] << std::hex << std::setw (2) << std::setfill ('0') << (unsigned int) m_prefix[15]; } Ipv6Prefix Ipv6Prefix::GetLoopback () { static Ipv6Prefix prefix ((uint8_t)128); return prefix; } Ipv6Prefix Ipv6Prefix::GetOnes () { static Ipv6Prefix ones ((uint8_t)128); return ones; } Ipv6Prefix Ipv6Prefix::GetZero () { static Ipv6Prefix prefix ((uint8_t)0); return prefix; } void Ipv6Prefix::GetBytes (uint8_t buf[16]) const { memcpy (buf, m_prefix, 16); } uint8_t Ipv6Prefix::GetPrefixLength () const { uint8_t i = 0; uint8_t prefixLength = 0; for(i = 0; i < 16; i++) { uint8_t mask = m_prefix[i]; while(mask != 0) { mask = mask << 1; prefixLength++; } } return prefixLength; } bool Ipv6Prefix::IsEqual (const Ipv6Prefix& other) const { if (!memcmp (m_prefix, other.m_prefix, 16)) { return true; } return false; } std::ostream& operator << (std::ostream& os, Ipv6Prefix const& prefix) { prefix.Print (os); return os; } std::istream& operator >> (std::istream& is, Ipv6Prefix& prefix) { std::string str; is >> str; prefix = Ipv6Prefix (str.c_str ()); return is; } bool operator == (Ipv6Prefix const &a, Ipv6Prefix const &b) { return a.IsEqual (b); } bool operator != (Ipv6Prefix const &a, Ipv6Prefix const &b) { return !a.IsEqual (b); } size_t Ipv6AddressHash::operator () (Ipv6Address const &x) const { uint8_t buf[16]; x.GetBytes (buf); return lookuphash (buf, sizeof (buf), 0); } ATTRIBUTE_HELPER_CPP (Ipv6Address); ATTRIBUTE_HELPER_CPP (Ipv6Prefix); } /* namespace ns3 */
zy901002-gpsr
src/network/utils/ipv6-address.cc
C++
gpl2
17,486
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2010 CTTC * * 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: Nicola Baldo <nbaldo@cttc.es> */ #ifndef GENERIC_PHY_H #define GENERIC_PHY_H #include <ns3/callback.h> namespace ns3 { /** * This method allows the MAC to instruct the PHY to start a * transmission of a given packet * * @param packet the Packet to be transmitted * @return this method returns false if the PHY will start TX, * true if the PHY refuses to start the TX. If false, the MAC layer * will expect that GenericPhyTxEndCallback is invoked at some point later. */ typedef Callback< bool, Ptr<Packet> > GenericPhyTxStartCallback; /** * this method is invoked by the PHY to notify the MAC that the * transmission of a given packet has been completed. * * @param packet the Packet whose TX has been completed. */ typedef Callback< void, Ptr<const Packet> > GenericPhyTxEndCallback; /** * This method is used by the PHY to notify the MAC that a RX * attempt is being started, i.e., a valid signal has been * recognized by the PHY. * */ typedef Callback< void > GenericPhyRxStartCallback; /** * This method is used by the PHY to notify the MAC that a * previously started RX attempt has terminated without success. */ typedef Callback< void > GenericPhyRxEndErrorCallback; /** * This method is used by the PHY to notify the MAC that a * previously started RX attempt has been successfully completed. * * @param packet the received Packet */ typedef Callback< void, Ptr<Packet> > GenericPhyRxEndOkCallback; } // namespace ns3 #endif /* GENERIC_PHY_H */
zy901002-gpsr
src/network/utils/generic-phy.h
C++
gpl2
2,254
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 INRIA * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> */ #include "mac64-address.h" #include "ns3/address.h" #include "ns3/assert.h" #include <iomanip> #include <iostream> #include <string.h> namespace ns3 { #define ASCII_a (0x41) #define ASCII_z (0x5a) #define ASCII_A (0x61) #define ASCII_Z (0x7a) #define ASCII_COLON (0x3a) #define ASCII_ZERO (0x30) static char AsciiToLowCase (char c) { if (c >= ASCII_a && c <= ASCII_z) { return c; } else if (c >= ASCII_A && c <= ASCII_Z) { return c + (ASCII_a - ASCII_A); } else { return c; } } Mac64Address::Mac64Address () { memset (m_address, 0, 8); } Mac64Address::Mac64Address (const char *str) { int i = 0; while (*str != 0 && i < 8) { uint8_t byte = 0; while (*str != ASCII_COLON && *str != 0) { byte <<= 4; char low = AsciiToLowCase (*str); if (low >= ASCII_a) { byte |= low - ASCII_a + 10; } else { byte |= low - ASCII_ZERO; } str++; } m_address[i] = byte; i++; if (*str == 0) { break; } str++; } NS_ASSERT (i == 6); } void Mac64Address::CopyFrom (const uint8_t buffer[8]) { memcpy (m_address, buffer, 8); } void Mac64Address::CopyTo (uint8_t buffer[8]) const { memcpy (buffer, m_address, 8); } bool Mac64Address::IsMatchingType (const Address &address) { return address.CheckCompatible (GetType (), 8); } Mac64Address::operator Address () const { return ConvertTo (); } Mac64Address Mac64Address::ConvertFrom (const Address &address) { NS_ASSERT (address.CheckCompatible (GetType (), 8)); Mac64Address retval; address.CopyTo (retval.m_address); return retval; } Address Mac64Address::ConvertTo (void) const { return Address (GetType (), m_address, 8); } Mac64Address Mac64Address::Allocate (void) { static uint64_t id = 0; id++; Mac64Address address; address.m_address[0] = (id >> 56) & 0xff; address.m_address[1] = (id >> 48) & 0xff; address.m_address[2] = (id >> 40) & 0xff; address.m_address[3] = (id >> 32) & 0xff; address.m_address[4] = (id >> 24) & 0xff; address.m_address[5] = (id >> 16) & 0xff; address.m_address[6] = (id >> 8) & 0xff; address.m_address[7] = (id >> 0) & 0xff; return address; } uint8_t Mac64Address::GetType (void) { static uint8_t type = Address::Register (); return type; } bool operator == (const Mac64Address &a, const Mac64Address &b) { uint8_t ada[8]; uint8_t adb[8]; a.CopyTo (ada); b.CopyTo (adb); return memcmp (ada, adb, 8) == 0; } bool operator != (const Mac64Address &a, const Mac64Address &b) { return !(a == b); } std::ostream& operator<< (std::ostream& os, const Mac64Address & address) { uint8_t ad[8]; address.CopyTo (ad); os.setf (std::ios::hex, std::ios::basefield); os.fill ('0'); for (uint8_t i=0; i < 7; i++) { os << std::setw (2) << (uint32_t)ad[i] << ":"; } // Final byte not suffixed by ":" os << std::setw (2) << (uint32_t)ad[7]; os.setf (std::ios::dec, std::ios::basefield); os.fill (' '); return os; } } // namespace ns3
zy901002-gpsr
src/network/utils/mac64-address.cc
C++
gpl2
3,947
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2010 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef OUTPUT_STREAM_WRAPPER_H #define OUTPUT_STREAM_WRAPPER_H #include <fstream> #include "ns3/object.h" #include "ns3/ptr.h" #include "ns3/simple-ref-count.h" namespace ns3 { /* * @brief A class encapsulating an STL output stream. * * This class wraps a pointer to a C++ std::ostream and provides * reference counting of the object. This class is recommended for users * who want to pass output streams in the ns-3 APIs, such as in callbacks * or tracing. * * This class is motivated by the fact that in C++, copy and assignment of * iostreams is forbidden by std::basic_ios<>, because it is not possible * to predict the semantics of the stream desired by a user. * * When writing traced information to a file, the tempting ns-3 idiom is to * create a bound callback with an ofstream as the bound object. Unfortunately, * this implies a copy construction in order to get the ofstream object into the * callback. This operation, as mentioned above, is forbidden by the STL. * Using this class in ns-3 APIs is generally preferable to passing global * pointers to ostream objects, or passing a pointer to a stack allocated * ostream (which creates object lifetime issues). * * One could imagine having this object inherit from stream to get the various * overloaded operator<< defined, but we're going to be using a * Ptr<OutputStreamWrapper> when passing this object around. In this case, the * Ptr<> wouldn't understand the operators and we would have to dereference it * to access the underlying object methods. Since we would have to dereference * the Ptr<>, we don't bother and just expect the user to Get a saved pointer * to an ostream and dereference it him or herself. As in: * * \verbatim * void * TraceSink (Ptr<OutputStreamWrapper> streamWrapper, Ptr<const Packet> packet) * { * std::ostream *stream = streamWrapper->GetStream (); * *stream << "got packet" << std::endl; * } * \endverbatim * * * This class uses a basic ns-3 reference counting base class but is not * an ns3::Object with attributes, TypeId, or aggregation. */ class OutputStreamWrapper : public SimpleRefCount<OutputStreamWrapper> { public: OutputStreamWrapper (std::string filename, std::ios::openmode filemode); OutputStreamWrapper (std::ostream* os); ~OutputStreamWrapper (); /** * Return a pointer to an ostream previously set in the wrapper. * * \see SetStream * * \returns a pointer to the encapsulated std::ostream */ std::ostream *GetStream (void); private: std::ostream *m_ostream; bool m_destroyable; }; } // namespace ns3 #endif /* OUTPUT_STREAM_WRAPPER_H */
zy901002-gpsr
src/network/utils/output-stream-wrapper.h
C++
gpl2
3,434
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2005 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: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca> */ #include <iomanip> #include <iostream> #include "ns3/assert.h" #include "ns3/log.h" #include "ns3/header.h" #include "ethernet-header.h" #include "address-utils.h" NS_LOG_COMPONENT_DEFINE ("EthernetHeader"); namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (EthernetHeader); EthernetHeader::EthernetHeader (bool hasPreamble) : m_enPreambleSfd (hasPreamble), m_lengthType (0) { } EthernetHeader::EthernetHeader () : m_enPreambleSfd (false), m_lengthType (0) { } void EthernetHeader::SetLengthType (uint16_t lengthType) { m_lengthType = lengthType; } uint16_t EthernetHeader::GetLengthType (void) const { return m_lengthType; } void EthernetHeader::SetPreambleSfd (uint64_t preambleSfd) { m_preambleSfd = preambleSfd; } uint64_t EthernetHeader::GetPreambleSfd (void) const { return m_preambleSfd; } void EthernetHeader::SetSource (Mac48Address source) { m_source = source; } Mac48Address EthernetHeader::GetSource (void) const { return m_source; } void EthernetHeader::SetDestination (Mac48Address dst) { m_destination = dst; } Mac48Address EthernetHeader::GetDestination (void) const { return m_destination; } ethernet_header_t EthernetHeader::GetPacketType (void) const { return LENGTH; } uint32_t EthernetHeader::GetHeaderSize (void) const { return GetSerializedSize (); } TypeId EthernetHeader::GetTypeId (void) { static TypeId tid = TypeId ("ns3::EthernetHeader") .SetParent<Header> () .AddConstructor<EthernetHeader> () ; return tid; } TypeId EthernetHeader::GetInstanceTypeId (void) const { return GetTypeId (); } void EthernetHeader::Print (std::ostream &os) const { // ethernet, right ? if (m_enPreambleSfd) { os << "preamble/sfd=" << m_preambleSfd << ","; } os << " length/type=0x" << std::hex << m_lengthType << std::dec << ", source=" << m_source << ", destination=" << m_destination; } uint32_t EthernetHeader::GetSerializedSize (void) const { if (m_enPreambleSfd) { return PREAMBLE_SIZE + LENGTH_SIZE + 2*MAC_ADDR_SIZE; } else { return LENGTH_SIZE + 2*MAC_ADDR_SIZE; } } void EthernetHeader::Serialize (Buffer::Iterator start) const { Buffer::Iterator i = start; if (m_enPreambleSfd) { i.WriteU64 (m_preambleSfd); } WriteTo (i, m_destination); WriteTo (i, m_source); i.WriteHtonU16 (m_lengthType); } uint32_t EthernetHeader::Deserialize (Buffer::Iterator start) { Buffer::Iterator i = start; if (m_enPreambleSfd) { m_enPreambleSfd = i.ReadU64 (); } ReadFrom (i, m_destination); ReadFrom (i, m_source); m_lengthType = i.ReadNtohU16 (); return GetSerializedSize (); } } // namespace ns3
zy901002-gpsr
src/network/utils/ethernet-header.cc
C++
gpl2
3,501
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2009 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef PCAP_FILE_WRAPPER_H #define PCAP_FILE_WRAPPER_H #include <string.h> #include <limits> #include <fstream> #include "ns3/ptr.h" #include "ns3/packet.h" #include "ns3/object.h" #include "ns3/nstime.h" #include "pcap-file.h" namespace ns3 { /* * A class that wraps a PcapFile as an ns3::Object and provides a higher-layer * ns-3 interface to the low-level public methods of PcapFile. Users are * encouraged to use this object instead of class ns3::PcapFile in ns-3 * public APIs. */ class PcapFileWrapper : public Object { public: static TypeId GetTypeId (void); PcapFileWrapper (); ~PcapFileWrapper (); /** * \return true if the 'fail' bit is set in the underlying iostream, false otherwise. */ bool Fail (void) const; /** * \return true if the 'eof' bit is set in the underlying iostream, false otherwise. */ bool Eof (void) const; /** * Clear all state bits of the underlying iostream. */ void Clear (void); /** * Create a new pcap file or open an existing pcap file. Semantics are * similar to the stdc++ io stream classes. * * Since a pcap file is always a binary file, the file type is automatically * selected as a binary file (fstream::binary is automatically ored with the mode * field). * * \param filename String containing the name of the file. * * \param mode String containing the access mode for the file. * */ void Open (std::string const &filename, std::ios::openmode mode); /** * Close the underlying pcap file. */ void Close (void); /** * Initialize the pcap file associated with this wrapper. This file must have * been previously opened with write permissions. * * \param dataLinkType A data link type as defined in the pcap library. If * you want to make resulting pcap files visible in existing tools, the * data link type must match existing definitions, such as PCAP_ETHERNET, * PCAP_PPP, PCAP_80211, etc. If you are storing different kinds of packet * data, such as naked TCP headers, you are at liberty to locally define your * own data link types. According to the pcap-linktype man page, "well-known" * pcap linktypes range from 0 to 177. If you use a large random number for * your type, chances are small for a collision. * * \param snapLen An optional maximum size for packets written to the file. * Defaults to 65535. If packets exceed this length they are truncated. * * \param tzCorrection An integer describing the offset of your local * time zone from UTC/GMT. For example, Pacific Standard Time in the US is * GMT-8, so one would enter -8 for that correction. Defaults to 0 (UTC). * * \warning Calling this method on an existing file will result in the loss * any existing data. */ void Init (uint32_t dataLinkType, uint32_t snapLen = std::numeric_limits<uint32_t>::max (), int32_t tzCorrection = PcapFile::ZONE_DEFAULT); /** * \brief Write the next packet to file * * \param t Packet timestamp as ns3::Time. * \param p Packet to write to the pcap file. * */ void Write (Time t, Ptr<const Packet> p); /** * \brief Write the provided header along with the packet to the pcap file. * * It is the case that adding a header to a packet prior to writing it to a * file must trigger a deep copy in the Packet. By providing the header * separately, we can avoid that copy. * * \param t Packet timestamp as ns3::Time. * \param header The Header to prepend to the packet. * \param p Packet to write to the pcap file. * */ void Write (Time t, Header &header, Ptr<const Packet> p); /** * \brief Write the provided data buffer to the pcap file. * * \param t Packet timestamp as ns3::Time. * \param buffer The buffer to write. * \param length The size of the buffer. * */ void Write (Time t, uint8_t const *buffer, uint32_t length); /* * \brief Returns the magic number of the pcap file as defined by the magic_number * field in the pcap global header. * * See http://wiki.wireshark.org/Development/LibpcapFileFormat */ uint32_t GetMagic (void); /* * \brief Returns the major version of the pcap file as defined by the version_major * field in the pcap global header. * * See http://wiki.wireshark.org/Development/LibpcapFileFormat */ uint16_t GetVersionMajor (void); /* * \brief Returns the minor version of the pcap file as defined by the version_minor * field in the pcap global header. * * See http://wiki.wireshark.org/Development/LibpcapFileFormat */ uint16_t GetVersionMinor (void); /* * \brief Returns the time zone offset of the pcap file as defined by the thiszone * field in the pcap global header. * * See http://wiki.wireshark.org/Development/LibpcapFileFormat */ int32_t GetTimeZoneOffset (void); /* * \brief Returns the accuracy of timestamps field of the pcap file as defined * by the sigfigs field in the pcap global header. * * See http://wiki.wireshark.org/Development/LibpcapFileFormat */ uint32_t GetSigFigs (void); /* * \brief Returns the max length of saved packets field of the pcap file as * defined by the snaplen field in the pcap global header. * * See http://wiki.wireshark.org/Development/LibpcapFileFormat */ uint32_t GetSnapLen (void); /* * \brief Returns the data link type field of the pcap file as defined by the * network field in the pcap global header. * * See http://wiki.wireshark.org/Development/LibpcapFileFormat */ uint32_t GetDataLinkType (void); private: PcapFile m_file; uint32_t m_snapLen; }; } // namespace ns3 #endif /* PCAP_FILE_WRAPPER_H */
zy901002-gpsr
src/network/utils/pcap-file-wrapper.h
C++
gpl2
6,552
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 INRIA * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> */ #ifndef PACKET_SOCKET_ADDRESS_H #define PACKET_SOCKET_ADDRESS_H #include "ns3/ptr.h" #include "ns3/address.h" #include "mac48-address.h" #include "mac64-address.h" #include "ns3/net-device.h" namespace ns3 { class NetDevice; /** * \ingroup address * * \brief an address for a packet socket */ class PacketSocketAddress { public: PacketSocketAddress (); void SetProtocol (uint16_t protocol); void SetAllDevices (void); void SetSingleDevice (uint32_t device); void SetPhysicalAddress (const Address address); uint16_t GetProtocol (void) const; uint32_t GetSingleDevice (void) const; bool IsSingleDevice (void) const; Address GetPhysicalAddress (void) const; /** * \returns a new Address instance * * Convert an instance of this class to a polymorphic Address instance. */ operator Address () const; /** * \param address a polymorphic address * * Convert a polymorphic address to an Mac48Address instance. * The conversion performs a type check. */ static PacketSocketAddress ConvertFrom (const Address &address); /** * \param address address to test * \returns true if the address matches, false otherwise. */ static bool IsMatchingType (const Address &address); private: static uint8_t GetType (void); Address ConvertTo (void) const; uint16_t m_protocol; bool m_isSingleDevice; uint32_t m_device; Address m_address; }; } // namespace ns3 #endif /* PACKET_SOCKET_ADDRESS_H */
zy901002-gpsr
src/network/utils/packet-socket-address.h
C++
gpl2
2,280
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007-2008 Louis Pasteur University * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr> */ #include "ns3/assert.h" #include "inet6-socket-address.h" namespace ns3 { Inet6SocketAddress::Inet6SocketAddress (Ipv6Address ipv6, uint16_t port) : m_ipv6 (ipv6), m_port (port) { } Inet6SocketAddress::Inet6SocketAddress (Ipv6Address ipv6) : m_ipv6 (ipv6), m_port (0) { } Inet6SocketAddress::Inet6SocketAddress (const char* ipv6, uint16_t port) : m_ipv6 (Ipv6Address (ipv6)), m_port (port) { } Inet6SocketAddress::Inet6SocketAddress (const char* ipv6) : m_ipv6 (Ipv6Address (ipv6)), m_port (0) { } Inet6SocketAddress::Inet6SocketAddress (uint16_t port) : m_ipv6 (Ipv6Address::GetAny ()), m_port (port) { } uint16_t Inet6SocketAddress::GetPort (void) const { return m_port; } void Inet6SocketAddress::SetPort (uint16_t port) { m_port=port; } Ipv6Address Inet6SocketAddress::GetIpv6 (void) const { return m_ipv6; } void Inet6SocketAddress::SetIpv6 (Ipv6Address ipv6) { m_ipv6=ipv6; } bool Inet6SocketAddress::IsMatchingType (const Address &addr) { return addr.CheckCompatible (GetType (), 18); /* 16 (address) + 2 (port) */ } Inet6SocketAddress::operator Address (void) const { return ConvertTo (); } Address Inet6SocketAddress::ConvertTo (void) const { uint8_t buf[18]; m_ipv6.Serialize (buf); buf[16]=m_port & 0xff; buf[17]=(m_port >> 8) &0xff; return Address (GetType (), buf, 18); } Inet6SocketAddress Inet6SocketAddress::ConvertFrom (const Address &addr) { NS_ASSERT (addr.CheckCompatible (GetType (), 18)); uint8_t buf[18]; addr.CopyTo (buf); Ipv6Address ipv6=Ipv6Address::Deserialize (buf); uint16_t port= buf[16] | (buf[17] << 8); return Inet6SocketAddress (ipv6, port); } uint8_t Inet6SocketAddress::GetType (void) { static uint8_t type=Address::Register (); return type; } } /* namespace ns3 */
zy901002-gpsr
src/network/utils/inet6-socket-address.cc
C++
gpl2
2,631
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 Emmanuelle Laprise * * 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: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca> */ #ifndef PACKET_SOCKET_FACTORY_H #define PACKET_SOCKET_FACTORY_H #include "ns3/socket-factory.h" namespace ns3 { class Socket; /** * \ingroup socket * * This can be used as an interface in a node in order for the node to * generate PacketSockets that can connect to net devices. */ class PacketSocketFactory : public SocketFactory { public: static TypeId GetTypeId (void); PacketSocketFactory (); /** * Creates a PacketSocket and returns a pointer to it. * * \return a pointer to the created socket */ virtual Ptr<Socket> CreateSocket (void); }; } // namespace ns3 #endif /* PACKET_SOCKET_FACTORY_H */
zy901002-gpsr
src/network/utils/packet-socket-factory.h
C++
gpl2
1,468
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "ns3/log.h" #include "ns3/enum.h" #include "ns3/uinteger.h" #include "drop-tail-queue.h" NS_LOG_COMPONENT_DEFINE ("DropTailQueue"); namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (DropTailQueue); TypeId DropTailQueue::GetTypeId (void) { static TypeId tid = TypeId ("ns3::DropTailQueue") .SetParent<Queue> () .AddConstructor<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<uint32_t> ()) .AddAttribute ("MaxBytes", "The maximum number of bytes accepted by this DropTailQueue.", UintegerValue (100 * 65535), MakeUintegerAccessor (&DropTailQueue::m_maxBytes), MakeUintegerChecker<uint32_t> ()) ; return tid; } DropTailQueue::DropTailQueue () : Queue (), m_packets (), m_bytesInQueue (0) { NS_LOG_FUNCTION_NOARGS (); } 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<Packet> p) { NS_LOG_FUNCTION (this << p); if (m_mode == PACKETS && (m_packets.size () >= m_maxPackets)) { 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; } Ptr<Packet> DropTailQueue::DoDequeue (void) { NS_LOG_FUNCTION (this); if (m_packets.empty ()) { NS_LOG_LOGIC ("Queue empty"); return 0; } Ptr<Packet> 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; } Ptr<const Packet> DropTailQueue::DoPeek (void) const { NS_LOG_FUNCTION (this); if (m_packets.empty ()) { NS_LOG_LOGIC ("Queue empty"); return 0; } Ptr<Packet> p = m_packets.front (); NS_LOG_LOGIC ("Number packets " << m_packets.size ()); NS_LOG_LOGIC ("Number bytes " << m_bytesInQueue); return p; } } // namespace ns3
zy901002-gpsr
src/network/utils/drop-tail-queue.cc
C++
gpl2
3,892
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2005 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: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca> */ #include "ns3/assert.h" #include "ns3/log.h" #include "ns3/trailer.h" #include "ethernet-trailer.h" NS_LOG_COMPONENT_DEFINE ("EthernetTrailer"); namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (EthernetTrailer); EthernetTrailer::EthernetTrailer () : m_calcFcs (false), m_fcs (0) { } void EthernetTrailer::EnableFcs (bool enable) { m_calcFcs = enable; } bool EthernetTrailer::CheckFcs (Ptr<const Packet> p) const { int len = p->GetSize (); uint8_t *buffer; uint32_t crc; if (!m_calcFcs) { return true; } buffer = new uint8_t[len]; p->CopyData (buffer, len); crc = DoCalcFcs (buffer, len); delete[] buffer; return (m_fcs == crc); } void EthernetTrailer::CalcFcs (Ptr<const Packet> p) { int len = p->GetSize (); uint8_t *buffer; if (!m_calcFcs) { return; } buffer = new uint8_t[len]; p->CopyData (buffer, len); m_fcs = DoCalcFcs (buffer, len); delete[] buffer; } void EthernetTrailer::SetFcs (uint32_t fcs) { m_fcs = fcs; } uint32_t EthernetTrailer::GetFcs (void) { return m_fcs; } uint32_t EthernetTrailer::GetTrailerSize (void) const { return GetSerializedSize (); } TypeId EthernetTrailer::GetTypeId (void) { static TypeId tid = TypeId ("ns3::EthernetTrailer") .SetParent<Trailer> () .AddConstructor<EthernetTrailer> () ; return tid; } TypeId EthernetTrailer::GetInstanceTypeId (void) const { return GetTypeId (); } void EthernetTrailer::Print (std::ostream &os) const { os << "fcs=" << m_fcs; } uint32_t EthernetTrailer::GetSerializedSize (void) const { return 4; } void EthernetTrailer::Serialize (Buffer::Iterator end) const { Buffer::Iterator i = end; i.Prev (GetSerializedSize ()); i.WriteU32 (m_fcs); } uint32_t EthernetTrailer::Deserialize (Buffer::Iterator end) { Buffer::Iterator i = end; uint32_t size = GetSerializedSize (); i.Prev (size); m_fcs = i.ReadU32 (); return size; } // This code is copied from /lib/crc32.c in the linux kernel. // It assumes little endian ordering. uint32_t EthernetTrailer::DoCalcFcs (uint8_t const *buffer, size_t len) const { uint32_t crc = 0xffffffff; int i; while (len--) { crc ^= *buffer++; for (i = 0; i < 8; i++) { crc = (crc >> 1) ^ ((crc & 1) ? 0xedb88320 : 0); } } return ~crc; } } // namespace ns3
zy901002-gpsr
src/network/utils/ethernet-trailer.cc
C++
gpl2
3,155
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2005 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 "llc-snap-header.h" #include "ns3/assert.h" #include <string> namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (LlcSnapHeader); LlcSnapHeader::LlcSnapHeader () { } void LlcSnapHeader::SetType (uint16_t type) { m_etherType = type; } uint16_t LlcSnapHeader::GetType (void) { return m_etherType; } uint32_t LlcSnapHeader::GetSerializedSize (void) const { return LLC_SNAP_HEADER_LENGTH; } TypeId LlcSnapHeader::GetTypeId (void) { static TypeId tid = TypeId ("ns3::LlcSnapHeader") .SetParent<Header> () .AddConstructor<LlcSnapHeader> () ; return tid; } TypeId LlcSnapHeader::GetInstanceTypeId (void) const { return GetTypeId (); } void LlcSnapHeader::Print (std::ostream &os) const { os << "type 0x"; os.setf (std::ios::hex, std::ios::basefield); os << m_etherType; os.setf (std::ios::dec, std::ios::basefield); } void LlcSnapHeader::Serialize (Buffer::Iterator start) const { Buffer::Iterator i = start; uint8_t buf[] = { 0xaa, 0xaa, 0x03, 0, 0, 0}; i.Write (buf, 6); i.WriteHtonU16 (m_etherType); } uint32_t LlcSnapHeader::Deserialize (Buffer::Iterator start) { Buffer::Iterator i = start; i.Next (5+1); m_etherType = i.ReadNtohU16 (); return GetSerializedSize (); } } // namespace ns3
zy901002-gpsr
src/network/utils/llc-snap-header.cc
C++
gpl2
2,061
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 INRIA * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> */ #include "mac48-address.h" #include "ns3/address.h" #include "ns3/assert.h" #include <iomanip> #include <iostream> #include <string.h> namespace ns3 { ATTRIBUTE_HELPER_CPP (Mac48Address); #define ASCII_a (0x41) #define ASCII_z (0x5a) #define ASCII_A (0x61) #define ASCII_Z (0x7a) #define ASCII_COLON (0x3a) #define ASCII_ZERO (0x30) static char AsciiToLowCase (char c) { if (c >= ASCII_a && c <= ASCII_z) { return c; } else if (c >= ASCII_A && c <= ASCII_Z) { return c + (ASCII_a - ASCII_A); } else { return c; } } Mac48Address::Mac48Address () { memset (m_address, 0, 6); } Mac48Address::Mac48Address (const char *str) { int i = 0; while (*str != 0 && i < 6) { uint8_t byte = 0; while (*str != ASCII_COLON && *str != 0) { byte <<= 4; char low = AsciiToLowCase (*str); if (low >= ASCII_a) { byte |= low - ASCII_a + 10; } else { byte |= low - ASCII_ZERO; } str++; } m_address[i] = byte; i++; if (*str == 0) { break; } str++; } NS_ASSERT (i == 6); } void Mac48Address::CopyFrom (const uint8_t buffer[6]) { memcpy (m_address, buffer, 6); } void Mac48Address::CopyTo (uint8_t buffer[6]) const { memcpy (buffer, m_address, 6); } bool Mac48Address::IsMatchingType (const Address &address) { return address.CheckCompatible (GetType (), 6); } Mac48Address::operator Address () const { return ConvertTo (); } Address Mac48Address::ConvertTo (void) const { return Address (GetType (), m_address, 6); } Mac48Address Mac48Address::ConvertFrom (const Address &address) { NS_ASSERT (address.CheckCompatible (GetType (), 6)); Mac48Address retval; address.CopyTo (retval.m_address); return retval; } Mac48Address Mac48Address::Allocate (void) { static uint64_t id = 0; id++; Mac48Address address; address.m_address[0] = (id >> 40) & 0xff; address.m_address[1] = (id >> 32) & 0xff; address.m_address[2] = (id >> 24) & 0xff; address.m_address[3] = (id >> 16) & 0xff; address.m_address[4] = (id >> 8) & 0xff; address.m_address[5] = (id >> 0) & 0xff; return address; } uint8_t Mac48Address::GetType (void) { static uint8_t type = Address::Register (); return type; } bool Mac48Address::IsBroadcast (void) const { return *this == GetBroadcast (); } bool Mac48Address::IsGroup (void) const { return (m_address[0] & 0x01) == 0x01; } Mac48Address Mac48Address::GetBroadcast (void) { static Mac48Address broadcast = Mac48Address ("ff:ff:ff:ff:ff:ff"); return broadcast; } Mac48Address Mac48Address::GetMulticastPrefix (void) { static Mac48Address multicast = Mac48Address ("01:00:5e:00:00:00"); return multicast; } Mac48Address Mac48Address::GetMulticast6Prefix (void) { static Mac48Address multicast = Mac48Address ("33:33:00:00:00:00"); return multicast; } Mac48Address Mac48Address::GetMulticast (Ipv4Address multicastGroup) { Mac48Address etherAddr = Mac48Address::GetMulticastPrefix (); // // We now have the multicast address in an abstract 48-bit container. We // need to pull it out so we can play with it. When we're done, we have the // high order bits in etherBuffer[0], etc. // uint8_t etherBuffer[6]; etherAddr.CopyTo (etherBuffer); // // Now we need to pull the raw bits out of the Ipv4 destination address. // uint8_t ipBuffer[4]; multicastGroup.Serialize (ipBuffer); // // RFC 1112 says that an Ipv4 host group address is mapped to an EUI-48 // multicast address by placing the low-order 23-bits of the IP address into // the low-order 23 bits of the Ethernet multicast address // 01-00-5E-00-00-00 (hex). // etherBuffer[3] |= ipBuffer[1] & 0x7f; etherBuffer[4] = ipBuffer[2]; etherBuffer[5] = ipBuffer[3]; // // Now, etherBuffer has the desired ethernet multicast address. We have to // suck these bits back into the Mac48Address, // Mac48Address result; result.CopyFrom (etherBuffer); return result; } Mac48Address Mac48Address::GetMulticast (Ipv6Address addr) { Mac48Address etherAddr = Mac48Address::GetMulticast6Prefix (); uint8_t etherBuffer[6]; uint8_t ipBuffer[16]; /* a MAC multicast IPv6 address is like 33:33 and the four low bytes */ /* for 2001:db8::2fff:fe11:ac10 => 33:33:FE:11:AC:10 */ etherAddr.CopyTo (etherBuffer); addr.Serialize (ipBuffer); etherBuffer[2] = ipBuffer[12]; etherBuffer[3] = ipBuffer[13]; etherBuffer[4] = ipBuffer[14]; etherBuffer[5] = ipBuffer[15]; etherAddr.CopyFrom (etherBuffer); return etherAddr; } std::ostream& operator<< (std::ostream& os, const Mac48Address & address) { uint8_t ad[6]; address.CopyTo (ad); os.setf (std::ios::hex, std::ios::basefield); os.fill ('0'); for (uint8_t i=0; i < 5; i++) { os << std::setw (2) << (uint32_t)ad[i] << ":"; } // Final byte not suffixed by ":" os << std::setw (2) << (uint32_t)ad[5]; os.setf (std::ios::dec, std::ios::basefield); os.fill (' '); return os; } static uint8_t AsInt (std::string v) { std::istringstream iss; iss.str (v); uint32_t retval; iss >> std::hex >> retval >> std::dec; return retval; } std::istream& operator>> (std::istream& is, Mac48Address & address) { std::string v; is >> v; std::string::size_type col = 0; for (uint8_t i = 0; i < 6; ++i) { std::string tmp; std::string::size_type next; next = v.find (":", col); if (next == std::string::npos) { tmp = v.substr (col, v.size ()-col); address.m_address[i] = AsInt (tmp); break; } else { tmp = v.substr (col, next-col); address.m_address[i] = AsInt (tmp); col = next + 1; } } return is; } } // namespace ns3
zy901002-gpsr
src/network/utils/mac48-address.cc
C++
gpl2
6,691
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007,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: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr> */ #ifndef PACKET_BURST_H #define PACKET_BURST_H #include <stdint.h> #include <list> #include "ns3/object.h" namespace ns3 { class Packet; class PacketBurst : public Object { /** * \brief this class implement a burst as a list of packets */ public: static TypeId GetTypeId (void); PacketBurst (void); virtual ~PacketBurst (void); /** * \return a copy the packetBurst */ Ptr<PacketBurst> Copy (void) const; /** * \brief add a packet to the list of packet * \param packet the packet to add */ void AddPacket (Ptr<Packet> packet); /** * \return the list of packet of this burst */ std::list<Ptr<Packet> > GetPackets (void) const; /** * \return the number of packet in the burst */ uint32_t GetNPackets (void) const; /** * \return the size of the burst in byte (the size of all packets) */ uint32_t GetSize (void) const; std::list<Ptr<Packet> >::const_iterator Begin (void) const; std::list<Ptr<Packet> >::const_iterator End (void) const; private: void DoDispose (void); std::list<Ptr<Packet> > m_packets; }; } // namespace ns3 #endif /* PACKET_BURST */
zy901002-gpsr
src/network/utils/packet-burst.h
C++
gpl2
1,950
/* -*- 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 "simple-channel.h" #include "simple-net-device.h" #include "ns3/simulator.h" #include "ns3/packet.h" #include "ns3/node.h" #include "ns3/log.h" NS_LOG_COMPONENT_DEFINE ("SimpleChannel"); namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (SimpleChannel); TypeId SimpleChannel::GetTypeId (void) { static TypeId tid = TypeId ("ns3::SimpleChannel") .SetParent<Channel> () .AddConstructor<SimpleChannel> () ; return tid; } SimpleChannel::SimpleChannel () { } void SimpleChannel::Send (Ptr<Packet> p, uint16_t protocol, Mac48Address to, Mac48Address from, Ptr<SimpleNetDevice> sender) { NS_LOG_FUNCTION (p << protocol << to << from << sender); for (std::vector<Ptr<SimpleNetDevice> >::const_iterator i = m_devices.begin (); i != m_devices.end (); ++i) { Ptr<SimpleNetDevice> tmp = *i; if (tmp == sender) { continue; } Simulator::ScheduleWithContext (tmp->GetNode ()->GetId (), Seconds (0), &SimpleNetDevice::Receive, tmp, p->Copy (), protocol, to, from); } } void SimpleChannel::Add (Ptr<SimpleNetDevice> device) { m_devices.push_back (device); } uint32_t SimpleChannel::GetNDevices (void) const { return m_devices.size (); } Ptr<NetDevice> SimpleChannel::GetDevice (uint32_t i) const { return m_devices[i]; } } // namespace ns3
zy901002-gpsr
src/network/utils/simple-channel.cc
C++
gpl2
2,206
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 Emmanuelle Laprise * * 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: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca> */ #ifndef ETHERNET_HEADER_H #define ETHERNET_HEADER_H #include "ns3/header.h" #include <string> #include "ns3/mac48-address.h" namespace ns3 { /** * Types of ethernet packets. Indicates the type of the current * header. */ enum ethernet_header_t { LENGTH, /**< Basic ethernet packet, no tags, type/length field indicates packet length or IP/ARP packet */ VLAN, /**< Single tagged packet. Header includes VLAN tag */ QINQ /**< Double tagged packet. Header includes two VLAN tags */ }; /** * \ingroup network * * \brief Packet header for Ethernet * * This class can be used to add a header to an ethernet packet that * will specify the source and destination addresses and the length of * the packet. Eventually the class will be improved to also support * VLAN tags in packet headers. */ class EthernetHeader : public Header { public: /** * \brief Construct a null ethernet header * \param hasPreamble if true, insert and remove an ethernet preamble from the * packet, if false, does not insert and remove it. */ EthernetHeader (bool hasPreamble); /** * \brief Construct a null ethernet header * By default, does not add or remove an ethernet preamble */ EthernetHeader (); /** * \param size The size of the payload in bytes */ void SetLengthType (uint16_t size); /** * \param source The source address of this packet */ void SetSource (Mac48Address source); /** * \param destination The destination address of this packet. */ void SetDestination (Mac48Address destination); /** * \param preambleSfd The value that the preambleSfd field should take */ void SetPreambleSfd (uint64_t preambleSfd); /** * \return The size of the payload in bytes */ uint16_t GetLengthType (void) const; /** * \return The type of packet (only basic Ethernet is currently supported) */ ethernet_header_t GetPacketType (void) const; /** * \return The source address of this packet */ Mac48Address GetSource (void) const; /** * \return The destination address of this packet */ Mac48Address GetDestination (void) const; /** * \return The value of the PreambleSfd field */ uint64_t GetPreambleSfd () const; /** * \return The size of the header */ uint32_t GetHeaderSize () const; static TypeId GetTypeId (void); virtual TypeId GetInstanceTypeId (void) const; virtual void Print (std::ostream &os) const; virtual uint32_t GetSerializedSize (void) const; virtual void Serialize (Buffer::Iterator start) const; virtual uint32_t Deserialize (Buffer::Iterator start); private: static const int PREAMBLE_SIZE = 8; /// size of the preamble_sfd header field static const int LENGTH_SIZE = 2; /// size of the length_type header field static const int MAC_ADDR_SIZE = 6; /// size of src/dest addr header fields /** * If false, the preamble/sfd are not serialised/deserialised. */ bool m_enPreambleSfd; uint64_t m_preambleSfd; /// Value of the Preamble/SFD fields uint16_t m_lengthType; /// Length or type of the packet Mac48Address m_source; /// Source address Mac48Address m_destination; /// Destination address }; } // namespace ns3 #endif /* ETHERNET_HEADER_H */
zy901002-gpsr
src/network/utils/ethernet-header.h
C++
gpl2
4,114
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef DROPTAIL_H #define DROPTAIL_H #include <queue> #include "ns3/packet.h" #include "ns3/queue.h" namespace ns3 { class TraceContainer; /** * \ingroup queue * * \brief A FIFO packet queue that drops tail-end packets on overflow */ class DropTailQueue : public Queue { public: static TypeId GetTypeId (void); /** * \brief DropTailQueue Constructor * * Creates a droptail queue with a maximum size of 100 packets by default */ DropTailQueue (); 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<Packet> p); virtual Ptr<Packet> DoDequeue (void); virtual Ptr<const Packet> DoPeek (void) const; std::queue<Ptr<Packet> > m_packets; uint32_t m_maxPackets; uint32_t m_maxBytes; uint32_t m_bytesInQueue; Mode m_mode; }; } // namespace ns3 #endif /* DROPTAIL_H */
zy901002-gpsr
src/network/utils/drop-tail-queue.h
C++
gpl2
2,183
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2009 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Craig Dowell (craigdo@ee.washington.edu) */ #ifndef PCAP_FILE_H #define PCAP_FILE_H #include <string> #include <fstream> #include <stdint.h> #include "ns3/ptr.h" namespace ns3 { class Packet; class Header; /* * A class representing a pcap file. This allows easy creation, writing and * reading of files composed of stored packets; which may be viewed using * standard tools. */ class PcapFile { public: static const int32_t ZONE_DEFAULT = 0; /**< Time zone offset for current location */ static const uint32_t SNAPLEN_DEFAULT = 65535; /**< Default value for maximum octets to save per packet */ public: PcapFile (); ~PcapFile (); /** * \return true if the 'fail' bit is set in the underlying iostream, false otherwise. */ bool Fail (void) const; /** * \return true if the 'eof' bit is set in the underlying iostream, false otherwise. */ bool Eof (void) const; /** * Clear all state bits of the underlying iostream. */ void Clear (void); /** * Create a new pcap file or open an existing pcap file. Semantics are * similar to the stdc++ io stream classes, but differ in that * positions in the file are based on packets not characters. For example * if the file is opened for reading, the file position indicator (seek * position) points to the beginning of the first packet in the file, not * zero (which would point to the start of the pcap header). * * Since a pcap file is always a binary file, the file type is automatically * selected as a binary file (fstream::binary is automatically ored with the mode * field). * * \param filename String containing the name of the file. * * \param mode the access mode for the file. */ void Open (std::string const &filename, std::ios::openmode mode); /** * Close the underlying file. */ void Close (void); /** * Initialize the pcap file associated with this object. This file must have * been previously opened with write permissions. * * \param dataLinkType A data link type as defined in the pcap library. If * you want to make resulting pcap files visible in existing tools, the * data link type must match existing definitions, such as PCAP_ETHERNET, * PCAP_PPP, PCAP_80211, etc. If you are storing different kinds of packet * data, such as naked TCP headers, you are at liberty to locally define your * own data link types. According to the pcap-linktype man page, "well-known" * pcap linktypes range from 0 to 177. If you use a large random number for * your type, chances are small for a collision. * * \param snapLen An optional maximum size for packets written to the file. * Defaults to 65535. If packets exceed this length they are truncated. * * \param timeZoneCorrection An integer describing the offset of your local * time zone from UTC/GMT. For example, Pacific Standard Time in the US is * GMT-8, so one would enter -8 for that correction. Defaults to 0 (UTC). * * \param swapMode Flag indicating a difference in endianness of the * writing system. Defaults to false. * * \return false if the open succeeds, true otherwise. * * \warning Calling this method on an existing file will result in the loss * any existing data. */ void Init (uint32_t dataLinkType, uint32_t snapLen = SNAPLEN_DEFAULT, int32_t timeZoneCorrection = ZONE_DEFAULT, bool swapMode = false); /** * \brief Write next packet to file * * \param tsSec Packet timestamp, seconds * \param tsUsec Packet timestamp, microseconds * \param data Data buffer * \param totalLen Total packet length * */ void Write (uint32_t tsSec, uint32_t tsUsec, uint8_t const * const data, uint32_t totalLen); /** * \brief Write next packet to file * * \param tsSec Packet timestamp, seconds * \param tsUsec Packet timestamp, microseconds * \param p Packet to write * */ void Write (uint32_t tsSec, uint32_t tsUsec, Ptr<const Packet> p); /** * \brief Write next packet to file * * \param tsSec Packet timestamp, seconds * \param tsUsec Packet timestamp, microseconds * \param header Header to write, in front of packet * \param p Packet to write * */ void Write (uint32_t tsSec, uint32_t tsUsec, Header &header, Ptr<const Packet> p); /** * \brief Read next packet from file * * \param data [out] Data buffer * \param maxBytes Allocated data buffer size * \param tsSec [out] Packet timestamp, seconds * \param tsUsec [out] Packet timestamp, microseconds * \param inclLen [out] Included length * \param origLen [out] Original length * \param readLen [out] Number of bytes read * */ void Read (uint8_t * const data, uint32_t maxBytes, uint32_t &tsSec, uint32_t &tsUsec, uint32_t &inclLen, uint32_t &origLen, uint32_t &readLen); /** * \brief Get the swap mode of the file. * * Pcap files use a magic number that is overloaded to identify both the * format of the file itself and the byte ordering of the file. The magic * number (and all data) is written into the file according to the native * byte ordering of the writing system. If a reading application reads * the magic number identically (for example 0xa1b2c3d4) then no byte * swapping is required to correctly interpret the file data. If the reading * application sees the magic number is byte swapped (for example 0xd4c3b2a1) * then it knows that it needs to byteswap appropriate fields in the format. * * GetSWapMode returns a value indicating whether or not the fields are being * byteswapped. Used primarily for testing the class itself, but may be * useful as a flag indicating a difference in endianness of the writing * system. */ bool GetSwapMode (void); /* * \brief Returns the magic number of the pcap file as defined by the magic_number * field in the pcap global header. * * See http://wiki.wireshark.org/Development/LibpcapFileFormat */ uint32_t GetMagic (void); /* * \brief Returns the major version of the pcap file as defined by the version_major * field in the pcap global header. * * See http://wiki.wireshark.org/Development/LibpcapFileFormat */ uint16_t GetVersionMajor (void); /* * \brief Returns the minor version of the pcap file as defined by the version_minor * field in the pcap global header. * * See http://wiki.wireshark.org/Development/LibpcapFileFormat */ uint16_t GetVersionMinor (void); /* * \brief Returns the time zone offset of the pcap file as defined by the thiszone * field in the pcap global header. * * See http://wiki.wireshark.org/Development/LibpcapFileFormat */ int32_t GetTimeZoneOffset (void); /* * \brief Returns the accuracy of timestamps field of the pcap file as defined * by the sigfigs field in the pcap global header. * * See http://wiki.wireshark.org/Development/LibpcapFileFormat */ uint32_t GetSigFigs (void); /* * \brief Returns the max length of saved packets field of the pcap file as * defined by the snaplen field in the pcap global header. * * See http://wiki.wireshark.org/Development/LibpcapFileFormat */ uint32_t GetSnapLen (void); /* * \brief Returns the data link type field of the pcap file as defined by the * network field in the pcap global header. * * See http://wiki.wireshark.org/Development/LibpcapFileFormat */ uint32_t GetDataLinkType (void); /** * \brief Compare two PCAP files packet-by-packet * * \return true if files are different, false otherwise * * \param f1 First PCAP file name * \param f2 Second PCAP file name * \param sec [out] Time stamp of first different packet, seconds. Undefined if files doesn't differ. * \param usec [out] Time stamp of first different packet, microseconds. Undefined if files doesn't differ. * \param snapLen Snap length (if used) */ static bool Diff (std::string const & f1, std::string const & f2, uint32_t & sec, uint32_t & usec, uint32_t snapLen = SNAPLEN_DEFAULT); private: typedef struct { uint32_t m_magicNumber; /**< Magic number identifying this as a pcap file */ uint16_t m_versionMajor; /**< Major version identifying the version of pcap used in this file */ uint16_t m_versionMinor; /**< Minor version identifying the version of pcap used in this file */ int32_t m_zone; /**< Time zone correction to be applied to timestamps of packets */ uint32_t m_sigFigs; /**< Unused by pretty much everybody */ uint32_t m_snapLen; /**< Maximum length of packet data stored in records */ uint32_t m_type; /**< Data link type of packet data */ } PcapFileHeader; typedef struct { uint32_t m_tsSec; /**< seconds part of timestamp */ uint32_t m_tsUsec; /**< microseconds part of timestamp (nsecs for PCAP_NSEC_MAGIC) */ uint32_t m_inclLen; /**< number of octets of packet saved in file */ uint32_t m_origLen; /**< actual length of original packet */ } PcapRecordHeader; uint8_t Swap (uint8_t val); uint16_t Swap (uint16_t val); uint32_t Swap (uint32_t val); void Swap (PcapFileHeader *from, PcapFileHeader *to); void Swap (PcapRecordHeader *from, PcapRecordHeader *to); void WriteFileHeader (void); uint32_t WritePacketHeader (uint32_t tsSec, uint32_t tsUsec, uint32_t totalLen); void ReadAndVerifyFileHeader (void); std::string m_filename; std::fstream m_file; PcapFileHeader m_fileHeader; bool m_swapMode; }; } // namespace ns3 #endif /* PCAP_FILE_H */
zy901002-gpsr
src/network/utils/pcap-file.h
C++
gpl2
10,773
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2009 CTTC * * 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, Include., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Nicola Baldo <nbaldo@cttc.es> */ #include <iomanip> #include <math.h> #include "ns3/log.h" #include "radiotap-header.h" NS_LOG_COMPONENT_DEFINE ("RadiotapHeader"); namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (RadiotapHeader); RadiotapHeader::RadiotapHeader() : m_length (8), m_present (0), m_tsft (0), m_flags (FRAME_FLAG_NONE), m_rate (0), m_channelFreq (0), m_channelFlags (CHANNEL_FLAG_NONE), m_antennaSignal (0), m_antennaNoise (0) { NS_LOG_FUNCTION (this); } TypeId RadiotapHeader::GetTypeId (void) { static TypeId tid = TypeId ("ns3::RadiotapHeader") .SetParent<Header> () .AddConstructor<RadiotapHeader> () ; return tid; } TypeId RadiotapHeader::GetInstanceTypeId (void) const { NS_LOG_FUNCTION (this); return GetTypeId (); } uint32_t RadiotapHeader::GetSerializedSize (void) const { NS_LOG_FUNCTION (this); return m_length; } void RadiotapHeader::Serialize (Buffer::Iterator start) const { NS_LOG_FUNCTION (this); start.WriteU8 (0); // major version of radiotap header start.WriteU8 (0); // pad field start.WriteU16 (m_length); // entire length of radiotap data + header start.WriteU32 (m_present); // bits describing which fields follow header // // Time Synchronization Function Timer (when the first bit of the MPDU // arrived at the MAC) // if (m_present & RADIOTAP_TSFT) // bit 0 { start.WriteU64 (m_tsft); } // // Properties of transmitted and received frames. // if (m_present & RADIOTAP_FLAGS) // bit 1 { start.WriteU8 (m_flags); } // // TX/RX data rate in units of 500 kbps // if (m_present & RADIOTAP_RATE) // bit 2 { start.WriteU8 (m_rate); } // // Tx/Rx frequency in MHz, followed by flags. // if (m_present & RADIOTAP_CHANNEL) // bit 3 { start.WriteU16 (m_channelFreq); start.WriteU16 (m_channelFlags); } // // RF signal power at the antenna, decibel difference from an arbitrary, fixed // reference. // if (m_present & RADIOTAP_DBM_ANTSIGNAL) // bit 5 { start.WriteU8 (m_antennaSignal); } // // RF noise power at the antenna, decibel difference from an arbitrary, fixed // reference. // if (m_present & RADIOTAP_DBM_ANTNOISE) // bit 6 { start.WriteU8 (m_antennaNoise); } } uint32_t RadiotapHeader::Deserialize (Buffer::Iterator start) { NS_LOG_FUNCTION (this); uint8_t __attribute__ ((unused)) tmp = start.ReadU8 (); // major version of radiotap header NS_ASSERT_MSG (tmp == 0x00, "RadiotapHeader::Deserialize(): Unexpected major version"); start.ReadU8 (); // pad field m_length = start.ReadU16 (); // entire length of radiotap data + header m_present = start.ReadU32 (); // bits describing which fields follow header uint32_t bytesRead = 8; // // Time Synchronization Function Timer (when the first bit of the MPDU arrived at the MAC) // if (m_present & RADIOTAP_TSFT) // bit 0 { m_tsft = start.ReadU64 (); bytesRead += 8; } // // Properties of transmitted and received frames. // if (m_present & RADIOTAP_FLAGS) // bit 1 { m_flags = start.ReadU8 (); ++bytesRead; } // // TX/RX data rate in units of 500 kbps // if (m_present & RADIOTAP_RATE) // bit 2 { m_rate = start.ReadU8 (); ++bytesRead; } // // Tx/Rx frequency in MHz, followed by flags. // if (m_present & RADIOTAP_CHANNEL) // bit 3 { m_channelFreq = start.ReadU16 (); m_channelFlags = start.ReadU16 (); bytesRead += 4; } // // The hop set and pattern for frequency-hopping radios. We don't need it but // still need to account for it. // if (m_present & RADIOTAP_FHSS) // bit 4 { start.ReadU8 (); ++bytesRead; } // // RF signal power at the antenna, decibel difference from an arbitrary, fixed // reference. // if (m_present & RADIOTAP_DBM_ANTSIGNAL) // bit 5 { m_antennaSignal = start.ReadU8 (); ++bytesRead; } // // RF noise power at the antenna, decibel difference from an arbitrary, fixed // reference. // if (m_present & RADIOTAP_DBM_ANTNOISE) // bit 6 { m_antennaNoise = start.ReadU8 (); ++bytesRead; } NS_ASSERT_MSG (m_length == bytesRead, "RadiotapHeader::Deserialize(): expected and actual lengths inconsistent"); return bytesRead; } void RadiotapHeader::Print (std::ostream &os) const { NS_LOG_FUNCTION (this); os << " tsft=" << m_tsft << " flags=" << std::hex << m_flags << std::dec << " rate=" << (uint16_t) m_rate << " freq=" << m_channelFreq << " chflags=" << std::hex << (uint32_t)m_channelFlags << std::dec << " signal=" << (int16_t) m_antennaSignal << " noise=" << (int16_t) m_antennaNoise; } void RadiotapHeader::SetTsft (uint64_t value) { NS_LOG_FUNCTION (this << value); m_tsft = value; if (!(m_present & RADIOTAP_TSFT)) { m_present |= RADIOTAP_TSFT; m_length += 8; } NS_LOG_LOGIC (this << " m_length=" << m_length << " m_present=0x" << std::hex << m_present << std::dec); } uint64_t RadiotapHeader::GetTsft () const { NS_LOG_FUNCTION (this); return m_tsft; } void RadiotapHeader::SetFrameFlags (uint8_t flags) { NS_LOG_FUNCTION (this << flags); m_flags = flags; if (!(m_present & RADIOTAP_FLAGS)) { m_present |= RADIOTAP_FLAGS; m_length += 1; } NS_LOG_LOGIC (this << " m_length=" << m_length << " m_present=0x" << std::hex << m_present << std::dec); } uint8_t RadiotapHeader::GetFrameFlags (void) const { NS_LOG_FUNCTION (this); return m_flags; } void RadiotapHeader::SetRate (uint8_t rate) { NS_LOG_FUNCTION (this << rate); m_rate = rate; if (!(m_present & RADIOTAP_RATE)) { m_present |= RADIOTAP_RATE; m_length += 1; } NS_LOG_LOGIC (this << " m_length=" << m_length << " m_present=0x" << std::hex << m_present << std::dec); } uint8_t RadiotapHeader::GetRate (void) const { NS_LOG_FUNCTION (this); return m_rate; } void RadiotapHeader::SetChannelFrequencyAndFlags (uint16_t frequency, uint16_t flags) { NS_LOG_FUNCTION (this << frequency << flags); m_channelFreq = frequency; m_channelFlags = flags; if (!(m_present & RADIOTAP_CHANNEL)) { m_present |= RADIOTAP_CHANNEL; m_length += 4; } NS_LOG_LOGIC (this << " m_length=" << m_length << " m_present=0x" << std::hex << m_present << std::dec); } uint16_t RadiotapHeader::GetChannelFrequency (void) const { NS_LOG_FUNCTION (this); return m_channelFreq; } uint16_t RadiotapHeader::GetChannelFlags (void) const { NS_LOG_FUNCTION (this); return m_channelFlags; } void RadiotapHeader::SetAntennaSignalPower (double signal) { NS_LOG_FUNCTION (this << signal); if (!(m_present & RADIOTAP_DBM_ANTSIGNAL)) { m_present |= RADIOTAP_DBM_ANTSIGNAL; m_length += 1; } if (signal > 127) { m_antennaSignal = 127; } else if (signal < -128) { m_antennaSignal = -128; } else { m_antennaSignal = static_cast<int8_t> (floor (signal + 0.5)); } NS_LOG_LOGIC (this << " m_length=" << m_length << " m_present=0x" << std::hex << m_present << std::dec); } uint8_t RadiotapHeader::GetAntennaSignalPower (void) const { NS_LOG_FUNCTION (this); return m_antennaSignal; } void RadiotapHeader::SetAntennaNoisePower (double noise) { NS_LOG_FUNCTION (this << noise); if (!(m_present & RADIOTAP_DBM_ANTNOISE)) { m_present |= RADIOTAP_DBM_ANTNOISE; m_length += 1; } if (noise > 127.0) { m_antennaNoise = 127; } else if (noise < -128.0) { m_antennaNoise = -128; } else { m_antennaNoise = static_cast<int8_t> (floor (noise + 0.5)); } NS_LOG_LOGIC (this << " m_length=" << m_length << " m_present=0x" << std::hex << m_present << std::dec); } uint8_t RadiotapHeader::GetAntennaNoisePower (void) const { NS_LOG_FUNCTION (this); return m_antennaNoise; } } // namespace ns3
zy901002-gpsr
src/network/utils/radiotap-header.cc
C++
gpl2
8,779
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 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 ADDRESS_UTILS_H #define ADDRESS_UTILS_H #include "ns3/buffer.h" #include "ipv4-address.h" #include "ipv6-address.h" #include "ns3/address.h" #include "mac48-address.h" namespace ns3 { void WriteTo (Buffer::Iterator &i, Ipv4Address ad); void WriteTo (Buffer::Iterator &i, Ipv6Address ad); void WriteTo (Buffer::Iterator &i, const Address &ad); void WriteTo (Buffer::Iterator &i, Mac48Address ad); void ReadFrom (Buffer::Iterator &i, Ipv4Address &ad); void ReadFrom (Buffer::Iterator &i, Ipv6Address &ad); void ReadFrom (Buffer::Iterator &i, Address &ad, uint32_t len); void ReadFrom (Buffer::Iterator &i, Mac48Address &ad); namespace addressUtils { /** * \brief Address family-independent test for a multicast address */ bool IsMulticast (const Address &ad); }; }; #endif /* ADDRESS_UTILS_H */
zy901002-gpsr
src/network/utils/address-utils.h
C++
gpl2
1,625
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 Emmanuelle Laprise * * 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: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca> */ #include "packet-socket-factory.h" #include "ns3/node.h" #include "packet-socket.h" namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (PacketSocketFactory); TypeId PacketSocketFactory::GetTypeId (void) { static TypeId tid = TypeId ("ns3::PacketSocketFactory") .SetParent<SocketFactory> (); return tid; } PacketSocketFactory::PacketSocketFactory () { } Ptr<Socket> PacketSocketFactory::CreateSocket (void) { Ptr<Node> node = GetObject<Node> (); Ptr<PacketSocket> socket = CreateObject<PacketSocket> (); socket->SetNode (node); return socket; } } // namespace ns3
zy901002-gpsr
src/network/utils/packet-socket-factory.cc
C++
gpl2
1,411
#ifndef PCAP_TEST_H #define PCAP_TEST_H #include <sstream> #include <string> #include <stdint.h> #include "pcap-file.h" #include "ns3/test.h" /** * \brief Test that a pair of reference/new pcap files are equal * * The filename is interpreted as a stream. * * \param filename The name of the file to read in the reference/temporary * directories */ #define NS_PCAP_TEST_EXPECT_EQ(filename) \ do { \ std::ostringstream oss; \ oss << filename; \ std::string expected = CreateDataDirFilename (oss.str()); \ std::string got = CreateTempDirFilename (oss.str()); \ uint32_t sec(0), usec(0); \ /* TODO support default PcapWriter snap length here */ \ bool diff = PcapFile::Diff (got, expected, sec, usec); \ NS_TEST_EXPECT_MSG_EQ (diff, false, \ "PCAP traces " << got << " and " << expected \ << " differ starting from " << sec << " s " \ << usec << " us"); \ } while (false) #endif /* PCAP_TEST_H */
zy901002-gpsr
src/network/utils/pcap-test.h
C++
gpl2
1,371
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* vim: set ts=2 sw=2 sta expandtab ai si cin: */ /* * Copyright (c) 2009 Drexel University * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Tom Wambold <tom5760@gmail.com> */ /* These classes implement RFC 5444 - The Generalized Mobile Ad Hoc Network * (MANET) Packet/PbbMessage Format * See: http://tools.ietf.org/html/rfc5444 for details */ #ifndef PACKETBB_H #define PACKETBB_H #include <list> #include "ns3/ptr.h" #include "ns3/address.h" #include "ns3/header.h" #include "ns3/buffer.h" #include "ns3/simple-ref-count.h" namespace ns3 { /* Forward declare objects */ class PbbMessage; class PbbAddressBlock; class PbbTlv; class PbbAddressTlv; /** Used in Messages to determine whether it contains IPv4 or IPv6 addresses */ enum PbbAddressLength { IPV4 = 3, IPV6 = 15, }; /** * \brief A block of packet or message TLVs (PbbTlv). * * Acts similar to a C++ STL container. Should not be used for Address TLVs. */ class PbbTlvBlock { public: typedef std::list< Ptr<PbbTlv> >::iterator Iterator; typedef std::list< Ptr<PbbTlv> >::const_iterator ConstIterator; PbbTlvBlock (void); ~PbbTlvBlock (void); /** * \return an iterator to the first TLV in this block. */ Iterator Begin (void); /** * \return a const iterator to the first TLV in this block. */ ConstIterator Begin (void) const; /** * \return an iterator to the past-the-end element in this block. */ Iterator End (void); /** * \return a const iterator to the past-the-end element in this block. */ ConstIterator End (void) const; /** * \return the number of TLVs in this block. */ int Size (void) const; /** * \return true if there are no TLVs in this block, false otherwise. */ bool Empty (void) const; /** * \return a smart pointer to the first TLV in this block. */ Ptr<PbbTlv> Front (void) const; /** * \return a smart pointer to the last TLV in this block. */ Ptr<PbbTlv> Back (void) const; /** * \brief Prepends a TLV to the front of this block. * \param tlv a smart pointer to the TLV to prepend. */ void PushFront (Ptr<PbbTlv> tlv); /** * \brief Removes a TLV from the front of this block. */ void PopFront (void); /** * \brief Appends a TLV to the back of this block. * \param tlv a smart pointer to the TLV to append. */ void PushBack (Ptr<PbbTlv> tlv); /** * \brief Removes a TLV from the back of this block. */ void PopBack (void); /** * \brief Inserts a TLV at the specified position in this block. * \param position an Iterator pointing to the position in this block to * insert the TLV. * \param tlv a smart pointer to the TLV to insert. * \return An iterator pointing to the newly inserted TLV. */ Iterator Insert (Iterator position, const Ptr<PbbTlv> tlv); /** * \brief Removes the TLV at the specified position. * \param position an Iterator pointing to the TLV to erase. * \return an iterator pointing to the next TLV in the block. */ Iterator Erase (Iterator position); /** * \brief Removes all TLVs from [first, last) (includes first, not includes * last). * \param first an Iterator pointing to the first TLV to erase (inclusive). * \param last an Iterator pointing to the element past the last TLV to erase. * \return an iterator pointing to the next TLV in the block. */ Iterator Erase (Iterator first, Iterator last); /** * \brief Removes all TLVs from this block. */ void Clear (void); /** * \return The size (in bytes) needed to serialize this block. */ uint32_t GetSerializedSize (void) const; /** * \brief Serializes this block into the specified buffer. * \param start a reference to the point in a buffer to begin serializing. * * Users should not need to call this. Blocks will be serialized by their * containing packet. */ void Serialize (Buffer::Iterator &start) const; /** * \brief Deserializes a block from the specified buffer. * \param start a reference to the point in a buffer to begin deserializing. * * Users should not need to call this. Blocks will be deserialized by their * containing packet. */ void Deserialize (Buffer::Iterator &start); /** * \brief Pretty-prints the contents of this block. * \param os a stream object to print to. */ void Print (std::ostream &os) const; /** * \brief Pretty-prints the contents of this block, with specified indentation. * \param os a stream object to print to. * \param level level of indentation. * * This probably never needs to be called by users. This is used when * recursively printing sub-objects. */ void Print (std::ostream &os, int level) const; bool operator== (const PbbTlvBlock &other) const; bool operator!= (const PbbTlvBlock &other) const; private: std::list< Ptr<PbbTlv> > m_tlvList; }; /** * \brief A block of Address TLVs (PbbAddressTlv). * * Acts similar to a C++ STL container. */ class PbbAddressTlvBlock { public: typedef std::list< Ptr<PbbAddressTlv> >::iterator Iterator; typedef std::list< Ptr<PbbAddressTlv> >::const_iterator ConstIterator; PbbAddressTlvBlock (void); ~PbbAddressTlvBlock (void); /** * \return an iterator to the first Address TLV in this block. */ Iterator Begin (void); /** * \return a const iterator to the first Address TLV in this block. */ ConstIterator Begin (void) const; /** * \return an iterator to the past-the-end element in this block. */ Iterator End (void); /** * \return a const iterator to the past-the-end element in this block. */ ConstIterator End (void) const; /** * \return the number of Address TLVs in this block. */ int Size (void) const; /** * \return true if there are no Address TLVs in this block, false otherwise. */ bool Empty (void) const; /** * \return the first Address TLV in this block. */ Ptr<PbbAddressTlv> Front (void) const; /** * \return the last AddressTLV in this block. */ Ptr<PbbAddressTlv> Back (void) const; /** * \brief Prepends an Address TLV to the front of this block. * \param tlv a smart pointer to the Address TLV to prepend. */ void PushFront (Ptr<PbbAddressTlv> tlv); /** * \brief Removes an AddressTLV from the front of this block. */ void PopFront (void); /** * \brief Appends an Address TLV to the back of this block. * \param tlv a smart pointer to the Address TLV to append. */ void PushBack (Ptr<PbbAddressTlv> tlv); /** * \brief Removes an Address TLV from the back of this block. */ void PopBack (void); /** * \brief Inserts an Address TLV at the specified position in this block. * \param position an Iterator pointing to the position in this block to * insert the Address TLV. * \param tlv a smart pointer to the Address TLV to insert. * \return An iterator pointing to the newly inserted Address TLV. */ Iterator Insert (Iterator position, const Ptr<PbbAddressTlv> tlv); /** * \brief Removes the Address TLV at the specified position. * \param position an Iterator pointing to the Address TLV to erase. * \return an iterator pointing to the next Address TLV in the block. */ Iterator Erase (Iterator position); /** * \brief Removes all Address TLVs from [first, last) (includes first, not * includes last). * \param first an Iterator pointing to the first Address TLV to erase * (inclusive). * \param last an Iterator pointing to the element past the last Address TLV * to erase. * \return an iterator pointing to the next Address TLV in the block. */ Iterator Erase (Iterator first, Iterator last); /** * \brief Removes all Address TLVs from this block. */ void Clear (void); /** * \return The size (in bytes) needed to serialize this block. */ uint32_t GetSerializedSize (void) const; /** * \brief Serializes this block into the specified buffer. * \param start a reference to the point in a buffer to begin serializing. * * Users should not need to call this. Blocks will be serialized by their * containing packet. */ void Serialize (Buffer::Iterator &start) const; /** * \brief Deserializes a block from the specified buffer. * \param start a reference to the point in a buffer to begin deserializing. * * Users should not need to call this. Blocks will be deserialized by their * containing packet. */ void Deserialize (Buffer::Iterator &start); /** * \brief Pretty-prints the contents of this block. * \param os a stream object to print to. */ void Print (std::ostream &os) const; /** * \brief Pretty-prints the contents of this block, with specified indentation. * \param os a stream object to print to. * \param level level of indentation. * * This probably never needs to be called by users. This is used when * recursively printing sub-objects. */ void Print (std::ostream &os, int level) const; bool operator== (const PbbAddressTlvBlock &other) const; bool operator!= (const PbbAddressTlvBlock &other) const; private: std::list< Ptr<PbbAddressTlv> > m_tlvList; }; /** * \brief Main PacketBB Packet object. * * A PacketBB packet is made up of zero or more packet TLVs (PbbTlv), and zero * or more messages (PbbMessage). * * See: http://tools.ietf.org/html/rfc5444 for details. */ class PbbPacket : public SimpleRefCount<PbbPacket,Header> { public: typedef std::list< Ptr<PbbTlv> >::iterator TlvIterator; typedef std::list< Ptr<PbbTlv> >::const_iterator ConstTlvIterator; typedef std::list< Ptr<PbbMessage> >::iterator MessageIterator; typedef std::list< Ptr<PbbMessage> >::const_iterator ConstMessageIterator; PbbPacket (void); ~PbbPacket (void); /** * \return the version of PacketBB that constructed this packet. * * This will always return 0 for packets constructed using this API. */ uint8_t GetVersion (void) const; /** * \brief Sets the sequence number of this packet. * \param number the sequence number. */ void SetSequenceNumber (uint16_t number); /** * \return the sequence number of this packet. * * Calling this while HasSequenceNumber is False is undefined. Make sure you * check it first. This will be checked by an assert in debug builds. */ uint16_t GetSequenceNumber (void) const; /** * \brief Tests whether or not this packet has a sequence number. * \return true if this packet has a sequence number, false otherwise. * * This should be called before calling GetSequenceNumber to make sure there * actually is one. */ bool HasSequenceNumber (void) const; /* Manipulating Packet TLVs */ /** * \return an iterator to the first Packet TLV in this packet. */ TlvIterator TlvBegin (void); /** * \return a const iterator to the first Packet TLV in this packet. */ ConstTlvIterator TlvBegin (void) const; /** * \return an iterator to the past-the-end element in this packet TLV block. */ TlvIterator TlvEnd (void); /** * \return a const iterator to the past-the-end element in this packet TLV * block. */ ConstTlvIterator TlvEnd (void) const; /** * \return the number of packet TLVs in this packet. */ int TlvSize (void) const; /** * \return true if there are no packet TLVs in this packet, false otherwise. */ bool TlvEmpty (void) const; /** * \return a smart pointer to the first packet TLV in this packet. */ Ptr<PbbTlv> TlvFront (void); /** * \return a const smart pointer to the first packet TLV in this packet. */ const Ptr<PbbTlv> TlvFront (void) const; /** * \return a smart pointer to the last packet TLV in this packet. */ Ptr<PbbTlv> TlvBack (void); /** * \return a const smart pointer to the last packet TLV in this packet. */ const Ptr<PbbTlv> TlvBack (void) const; /** * \brief Prepends a packet TLV to the front of this packet. * \param tlv a smart pointer to the packet TLV to prepend. */ void TlvPushFront (Ptr<PbbTlv> tlv); /** * \brief Removes a packet TLV from the front of this packet. */ void TlvPopFront (void); /** * \brief Appends a packet TLV to the back of this packet. * \param tlv a smart pointer to the packet TLV to append. */ void TlvPushBack (Ptr<PbbTlv> tlv); /** * \brief Removes a packet TLV from the back of this block. */ void TlvPopBack (void); /** * \brief Removes the packet TLV at the specified position. * \param position an Iterator pointing to the packet TLV to erase. * \return an iterator pointing to the next packet TLV in the block. */ TlvIterator Erase (TlvIterator position); /** * \brief Removes all packet TLVs from [first, last) (includes first, not * includes last). * \param first an Iterator pointing to the first packet TLV to erase * (inclusive). * \param last an Iterator pointing to the element past the last packet TLV * to erase. * \return an iterator pointing to the next packet TLV in the block. */ TlvIterator Erase (TlvIterator first, TlvIterator last); /** * \brief Removes all packet TLVs from this packet. */ void TlvClear (void); /* Manipulating Packet Messages */ /** * \return an iterator to the first message in this packet. */ MessageIterator MessageBegin (void); /** * \return a const iterator to the first message in this packet. */ ConstMessageIterator MessageBegin (void) const; /** * \return an iterator to the past-the-end element in this message block. */ MessageIterator MessageEnd (void); /** * \return a const iterator to the past-the-end element in this message * block. */ ConstMessageIterator MessageEnd (void) const; /** * \return the number of messages in this packet. */ int MessageSize (void) const; /** * \return true if there are no messages in this packet, false otherwise. */ bool MessageEmpty (void) const; /** * \return a smart pointer to the first message in this packet. */ Ptr<PbbMessage> MessageFront (void); /** * \return a const smart pointer to the first message in this packet. */ const Ptr<PbbMessage> MessageFront (void) const; /** * \return a smart pointer to the last message in this packet. */ Ptr<PbbMessage> MessageBack (void); /** * \return a const smart pointer to the last message in this packet. */ const Ptr<PbbMessage> MessageBack (void) const; /** * \brief Prepends a message to the front of this packet. * \param message a smart pointer to the message to prepend. */ void MessagePushFront (Ptr<PbbMessage> message); /** * \brief Removes a message from the front of this packet. */ void MessagePopFront (void); /** * \brief Appends a message to the back of this packet. * \param message a smart pointer to the message to append. */ void MessagePushBack (Ptr<PbbMessage> message); /** * \brief Removes a message from the back of this packet. */ void MessagePopBack (void); /** * \brief Removes the message at the specified position. * \param position an Iterator pointing to the message to erase. * \return an iterator pointing to the next message in the packet. */ MessageIterator Erase (MessageIterator position); /** * \brief Removes all messages from [first, last) (includes first, not * includes last). * \param first an Iterator pointing to the first message to erase (inclusive). * \param last an Iterator pointing to the element past the last message to erase. * \return an iterator pointing to the next message in the block. */ MessageIterator Erase (MessageIterator first, MessageIterator last); /** * \brief Removes all messages from this packet. */ void MessageClear (void); /* Methods implemented by all headers */ static TypeId GetTypeId (void); virtual TypeId GetInstanceTypeId (void) const; /** * \return The size (in bytes) needed to serialize this packet. */ virtual uint32_t GetSerializedSize (void) const; /** * \brief Serializes this packet into the specified buffer. * \param start a reference to the point in a buffer to begin serializing. */ virtual void Serialize (Buffer::Iterator start) const; /** * \brief Deserializes a packet from the specified buffer. * \param start start offset * \return the number of bytes deserialized * * If this returns a number smaller than the total number of bytes in the * buffer, there was an error. */ virtual uint32_t Deserialize (Buffer::Iterator start); /** * \brief Pretty-prints the contents of this block. * \param os a stream object to print to. */ virtual void Print (std::ostream &os) const; bool operator== (const PbbPacket &other) const; bool operator!= (const PbbPacket &other) const; protected: private: PbbTlvBlock m_tlvList; std::list< Ptr<PbbMessage> > m_messageList; uint8_t m_version; bool m_hasseqnum; uint16_t m_seqnum; }; /** * \brief A message within a PbbPacket packet. * * There may be any number of messages in one packet packet. This is a pure * virtual base class, when creating a message, you should instantiate either * PbbMessageIpv4 or PbbMessageIpv6. */ class PbbMessage : public SimpleRefCount<PbbMessage> { public: typedef std::list< Ptr<PbbTlv> >::iterator TlvIterator; typedef std::list< Ptr<PbbTlv> >::const_iterator ConstTlvIterator; typedef std::list< Ptr<PbbAddressBlock> >::iterator AddressBlockIterator; typedef std::list< Ptr<PbbAddressBlock> >::const_iterator ConstAddressBlockIterator; PbbMessage (); virtual ~PbbMessage (); /** * \brief Sets the type for this message. * \param type the type to set. */ void SetType (uint8_t type); /** * \return the type assigned to this packet */ uint8_t GetType (void) const; /** * \brief Sets the address for the node that created this packet. * \param address the originator address. */ void SetOriginatorAddress (Address address); /** * \return the address of the node that created this packet. * * Calling this while HasOriginatorAddress is False is undefined. Make sure * you check it first. This will be checked by an assert in debug builds. */ Address GetOriginatorAddress (void) const; /** * \brief Tests whether or not this message has an originator address. * \return true if this message has an originator address, false otherwise. */ bool HasOriginatorAddress (void) const; /** * \brief Sets the maximum number of hops this message should travel * \param hoplimit the limit to set */ void SetHopLimit (uint8_t hoplimit); /** * \return the maximum number of hops this message should travel. * * Calling this while HasHopLimit is False is undefined. Make sure you check * it first. This will be checked by an assert in debug builds. */ uint8_t GetHopLimit (void) const; /** * \brief Tests whether or not this message has a hop limit. * \return true if this message has a hop limit, false otherwise. * * If this is set, messages should not hop further than this limit. */ bool HasHopLimit (void) const; /** * \brief Sets the current number of hops this message has traveled. * \param hopcount the current number of hops */ void SetHopCount (uint8_t hopcount); /** * \return the current number of hops this message has traveled. * * Calling this while HasHopCount is False is undefined. Make sure you check * it first. This will be checked by an assert in debug builds. */ uint8_t GetHopCount (void) const; /** * \brief Tests whether or not this message has a hop count. * \return true if this message has a hop limit, false otherwise. */ bool HasHopCount (void) const; /** * \brief Sets the sequence number of this message. * \param seqnum the sequence number to set. */ void SetSequenceNumber (uint16_t seqnum); /** * \return the sequence number of this message. * * Calling this while HasSequenceNumber is False is undefined. Make sure you * check it first. This will be checked by an assert in debug builds. */ uint16_t GetSequenceNumber (void) const; /** * \brief Tests whether or not this message has a sequence number. * \return true if this message has a sequence number, false otherwise. */ bool HasSequenceNumber (void) const; /* Manipulating PbbMessage TLVs */ /** * \return an iterator to the first message TLV in this message. */ TlvIterator TlvBegin (); /** * \return a const iterator to the first message TLV in this message. */ ConstTlvIterator TlvBegin () const; /** * \return an iterator to the past-the-end message TLV element in this * message. */ TlvIterator TlvEnd (); /** * \return a const iterator to the past-the-end message TLV element in this * message. */ ConstTlvIterator TlvEnd () const; /** * \return the number of message TLVs in this message. */ int TlvSize (void) const; /** * \return true if there are no message TLVs in this message, false otherwise. */ bool TlvEmpty (void) const; /** * \return a smart pointer to the first message TLV in this message. */ Ptr<PbbTlv> TlvFront (void); /** * \return a const smart pointer to the first message TLV in this message. */ const Ptr<PbbTlv> TlvFront (void) const; /** * \return a smart pointer to the last message TLV in this message. */ Ptr<PbbTlv> TlvBack (void); /** * \return a const smart pointer to the last message TLV in this message. */ const Ptr<PbbTlv> TlvBack (void) const; /** * \brief Prepends a message TLV to the front of this message. * \param tlv a smart pointer to the message TLV to prepend. */ void TlvPushFront (Ptr<PbbTlv> tlv); /** * \brief Removes a message TLV from the front of this message. */ void TlvPopFront (void); /** * \brief Appends a message TLV to the back of this message. * \param tlv a smart pointer to the message TLV to append. */ void TlvPushBack (Ptr<PbbTlv> tlv); /** * \brief Removes a message TLV from the back of this message. */ void TlvPopBack (void); /** * \brief Removes the message TLV at the specified position. * \param position an Iterator pointing to the message TLV to erase. * \return an iterator pointing to the next TLV in the block. */ TlvIterator TlvErase (TlvIterator position); /** * \brief Removes all message TLVs from [first, last) (includes first, not * includes last). * \param first an Iterator pointing to the first message TLV to erase * (inclusive). * \param last an Iterator pointing to the element past the last message TLV * to erase. * \return an iterator pointing to the next message TLV in the message. */ TlvIterator TlvErase (TlvIterator first, TlvIterator last); /** * \brief Removes all message TLVs from this block. */ void TlvClear (void); /* Manipulating Address Block and Address TLV pairs */ /** * \return an iterator to the first address block in this message. */ AddressBlockIterator AddressBlockBegin (); /** * \return a const iterator to the first address block in this message. */ ConstAddressBlockIterator AddressBlockBegin () const; /** * \return an iterator to the past-the-end address block element in this * message. */ AddressBlockIterator AddressBlockEnd (); /** * \return a const iterator to the past-the-end address block element in this * message. */ ConstAddressBlockIterator AddressBlockEnd () const; /** * \return the number of address blocks in this message. */ int AddressBlockSize (void) const; /** * \return true if there are no address blocks in this message, false * otherwise. */ bool AddressBlockEmpty (void) const; /** * \return a smart pointer to the first address block in this message. */ Ptr<PbbAddressBlock> AddressBlockFront (void); /** * \return a const smart pointer to the first address block in this message. */ const Ptr<PbbAddressBlock> AddressBlockFront (void) const; /** * \return a smart pointer to the last address block in this message. */ Ptr<PbbAddressBlock> AddressBlockBack (void); /** * \return a const smart pointer to the last address block in this message. */ const Ptr<PbbAddressBlock> AddressBlockBack (void) const; /** * \brief Prepends an address block to the front of this message. * \param block a smart pointer to the address block to prepend. */ void AddressBlockPushFront (Ptr<PbbAddressBlock> block); /** * \brief Removes an address block from the front of this message. */ void AddressBlockPopFront (void); /** * \brief Appends an address block to the front of this message. * \param block a smart pointer to the address block to append. */ void AddressBlockPushBack (Ptr<PbbAddressBlock> block); /** * \brief Removes an address block from the back of this message. */ void AddressBlockPopBack (void); /** * \brief Removes the address block at the specified position. * \param position an Iterator pointing to the address block to erase. * \return an iterator pointing to the next address block in the message. */ AddressBlockIterator AddressBlockErase (AddressBlockIterator position); /** * \brief Removes all address blocks from [first, last) (includes first, not * includes last). * \param first an Iterator pointing to the first address block to erase * (inclusive). * \param last an Iterator pointing to the element past the last address * block to erase. * \return an iterator pointing to the next address block in the message. */ AddressBlockIterator AddressBlockErase (AddressBlockIterator first, AddressBlockIterator last); /** * \brief Removes all address blocks from this message. */ void AddressBlockClear (void); /** * \brief Deserializes a message, returning the correct object depending on * whether it is an IPv4 message or an IPv6 message. * \param start a reference to the point in a buffer to begin deserializing. * \return A pointer to the deserialized message, or 0 on error. * * Users should not need to call this. Blocks will be deserialized by their * containing packet. */ static Ptr<PbbMessage> DeserializeMessage (Buffer::Iterator &start); /** * \return The size (in bytes) needed to serialize this message. */ uint32_t GetSerializedSize (void) const; /** * \brief Serializes this message into the specified buffer. * \param start a reference to the point in a buffer to begin serializing. * * Users should not need to call this. Blocks will be deserialized by their * containing packet. */ void Serialize (Buffer::Iterator &start) const; /** * \brief Deserializes a message from the specified buffer. * \param start a reference to the point in a buffer to begin deserializing. * * Users should not need to call this. Blocks will be deserialized by their * containing packet. */ void Deserialize (Buffer::Iterator &start); /** * \brief Pretty-prints the contents of this message. * \param os a stream object to print to. */ void Print (std::ostream &os) const; /** * \brief Pretty-prints the contents of this message, with specified * indentation. * \param os a stream object to print to. * \param level level of indentation. * * This probably never needs to be called by users. This is used when * recursively printing sub-objects. */ void Print (std::ostream &os, int level) const; bool operator== (const PbbMessage &other) const; bool operator!= (const PbbMessage &other) const; protected: /* PbbMessage size in bytes - 1. * * IPv4 = 4 - 1 = 3, IPv6 = 16 - 1 = 15 */ virtual PbbAddressLength GetAddressLength (void) const = 0; virtual void SerializeOriginatorAddress (Buffer::Iterator &start) const = 0; virtual Address DeserializeOriginatorAddress (Buffer::Iterator &start) const = 0; virtual void PrintOriginatorAddress (std::ostream &os) const = 0; virtual Ptr<PbbAddressBlock> AddressBlockDeserialize (Buffer::Iterator &start) const = 0; private: PbbTlvBlock m_tlvList; std::list< Ptr<PbbAddressBlock> > m_addressBlockList; uint8_t m_type; PbbAddressLength m_addrSize; bool m_hasOriginatorAddress; Address m_originatorAddress; bool m_hasHopLimit; uint8_t m_hopLimit; bool m_hasHopCount; uint8_t m_hopCount; bool m_hasSequenceNumber; uint16_t m_sequenceNumber; }; /** * \brief Concrete IPv4 specific PbbMessage. * * This message will only contain IPv4 addresses. */ class PbbMessageIpv4 : public PbbMessage { public: PbbMessageIpv4 (); virtual ~PbbMessageIpv4 (); protected: virtual PbbAddressLength GetAddressLength (void) const; virtual void SerializeOriginatorAddress (Buffer::Iterator &start) const; virtual Address DeserializeOriginatorAddress (Buffer::Iterator &start) const; virtual void PrintOriginatorAddress (std::ostream &os) const; virtual Ptr<PbbAddressBlock> AddressBlockDeserialize (Buffer::Iterator &start) const; }; /** * \brief Concrete IPv6 specific PbbMessage class. * * This message will only contain IPv6 addresses. */ class PbbMessageIpv6 : public PbbMessage { public: PbbMessageIpv6 (); virtual ~PbbMessageIpv6 (); protected: virtual PbbAddressLength GetAddressLength (void) const; virtual void SerializeOriginatorAddress (Buffer::Iterator &start) const; virtual Address DeserializeOriginatorAddress (Buffer::Iterator &start) const; virtual void PrintOriginatorAddress (std::ostream &os) const; virtual Ptr<PbbAddressBlock> AddressBlockDeserialize (Buffer::Iterator &start) const; }; /** * \brief An Address Block and its associated Address TLV Blocks. * * This is a pure virtual base class, when creating address blocks, you should * instantiate either PbbAddressBlockIpv4 or PbbAddressBlockIpv6. */ class PbbAddressBlock : public SimpleRefCount<PbbAddressBlock> { public: typedef std::list< Address >::iterator AddressIterator; typedef std::list< Address >::const_iterator ConstAddressIterator; typedef std::list<uint8_t>::iterator PrefixIterator; typedef std::list<uint8_t>::const_iterator ConstPrefixIterator; typedef PbbAddressTlvBlock::Iterator TlvIterator; typedef PbbAddressTlvBlock::ConstIterator ConstTlvIterator; PbbAddressBlock (); virtual ~PbbAddressBlock (); /* Manipulating the address block */ /** * \return an iterator to the first address in this block. */ AddressIterator AddressBegin (void); /** * \return a const iterator to the first address in this block. */ ConstAddressIterator AddressBegin (void) const; /** * \return an iterator to the last address in this block. */ AddressIterator AddressEnd (void); /** * \return a const iterator to the last address in this block. */ ConstAddressIterator AddressEnd (void) const; /** * \return the number of addresses in this block. */ int AddressSize (void) const; /** * \return true if there are no addresses in this block, false otherwise. */ bool AddressEmpty (void) const; /** * \return the first address in this block. */ Address AddressFront (void) const; /** * \return the last address in this block. */ Address AddressBack (void) const; /** * \brief Prepends an address to the front of this block. * \param address the address to prepend. */ void AddressPushFront (Address address); /** * \brief Removes an address from the front of this block. */ void AddressPopFront (void); /** * \brief Appends an address to the back of this block. * \param address the address to append. */ void AddressPushBack (Address address); /** * \brief Removes an address from the back of this block. */ void AddressPopBack (void); /** * \brief Inserts an address at the specified position in this block. * \param position an Iterator pointing to the position in this block to * insert the address. * \param value the address to insert. * \return An iterator pointing to the newly inserted address. */ AddressIterator AddressInsert (AddressIterator position, const Address value); /** * \brief Removes the address at the specified position. * \param position an Iterator pointing to the address to erase. * \return an iterator pointing to the next address in the block. */ AddressIterator AddressErase (AddressIterator position); /** * \brief Removes all addresses from [first, last) (includes first, not * includes last). * \param first an Iterator pointing to the first address to erase * (inclusive). * \param last an Iterator pointing to the element past the last address to * erase. * \return an iterator pointing to the next address in the block. */ AddressIterator AddressErase (AddressIterator first, AddressIterator last); /** * \brief Removes all addresses from this block. */ void AddressClear (void); /* Prefix methods */ /** * \return an iterator to the first prefix in this block. */ PrefixIterator PrefixBegin (void); /** * \return a const iterator to the first prefix in this block. */ ConstPrefixIterator PrefixBegin (void) const; /** * \return an iterator to the last prefix in this block. */ PrefixIterator PrefixEnd (void); /** * \return a const iterator to the last prefix in this block. */ ConstPrefixIterator PrefixEnd (void) const; /** * \return the number of prefixes in this block. */ int PrefixSize (void) const; /** * \return true if there are no prefixes in this block, false otherwise. */ bool PrefixEmpty (void) const; /** * \return the first prefix in this block. */ uint8_t PrefixFront (void) const; /** * \return the last prefix in this block. */ uint8_t PrefixBack (void) const; /** * \brief Prepends a prefix to the front of this block. * \param prefix the prefix to prepend. */ void PrefixPushFront (uint8_t prefix); /** * \brief Removes a prefix from the front of this block. */ void PrefixPopFront (void); /** * \brief Appends a prefix to the back of this block. * \param prefix the prefix to append. */ void PrefixPushBack (uint8_t prefix); /** * \brief Removes a prefix from the back of this block. */ void PrefixPopBack (void); /** * \brief Inserts a prefix at the specified position in this block. * \param position an Iterator pointing to the position in this block to * insert the prefix. * \param value the prefix to insert. * \return An iterator pointing to the newly inserted prefix. */ PrefixIterator PrefixInsert (PrefixIterator position, const uint8_t value); /** * \brief Removes the prefix at the specified position. * \param position an Iterator pointing to the prefix to erase. * \return an iterator pointing to the next prefix in the block. */ PrefixIterator PrefixErase (PrefixIterator position); /** * \brief Removes all prefixes from [first, last) (includes first, not * includes last). * \param first an Iterator pointing to the first prefix to erase * (inclusive). * \param last an Iterator pointing to the element past the last prefix to * erase. * \return an iterator pointing to the next prefix in the block. */ PrefixIterator PrefixErase (PrefixIterator first, PrefixIterator last); /** * \brief Removes all prefixes from this block. */ void PrefixClear (void); /* Manipulating the TLV block */ /** * \return an iterator to the first address TLV in this block. */ TlvIterator TlvBegin (void); /** * \return a const iterator to the first address TLV in this block. */ ConstTlvIterator TlvBegin (void) const; /** * \return an iterator to the last address TLV in this block. */ TlvIterator TlvEnd (void); /** * \return a const iterator to the last address TLV in this block. */ ConstTlvIterator TlvEnd (void) const; /** * \return the number of address TLVs in this block. */ int TlvSize (void) const; /** * \return true if there are no address TLVs in this block, false otherwise. */ bool TlvEmpty (void) const; /** * \return a smart pointer to the first address TLV in this block. */ Ptr<PbbAddressTlv> TlvFront (void); /** * \return a const smart pointer to the first address TLV in this message. */ const Ptr<PbbAddressTlv> TlvFront (void) const; /** * \return a smart pointer to the last address TLV in this message. */ Ptr<PbbAddressTlv> TlvBack (void); /** * \return a const smart pointer to the last address TLV in this message. */ const Ptr<PbbAddressTlv> TlvBack (void) const; /** * \brief Prepends an address TLV to the front of this message. * \param address a smart pointer to the address TLV to prepend. */ void TlvPushFront (Ptr<PbbAddressTlv> address); /** * \brief Removes an address TLV from the front of this message. */ void TlvPopFront (void); /** * \brief Appends an address TLV to the back of this message. * \param address a smart pointer to the address TLV to append. */ void TlvPushBack (Ptr<PbbAddressTlv> address); /** * \brief Removes an address TLV from the back of this message. */ void TlvPopBack (void); /** * \brief Inserts an address TLV at the specified position in this block. * \param position an Iterator pointing to the position in this block to * insert the address TLV. * \param value the prefix to insert. * \return An iterator pointing to the newly inserted address TLV. */ TlvIterator TlvInsert (TlvIterator position, const Ptr<PbbTlv> value); /** * \brief Removes the address TLV at the specified position. * \param position an Iterator pointing to the address TLV to erase. * \return an iterator pointing to the next address TLV in the block. */ TlvIterator TlvErase (TlvIterator position); /** * \brief Removes all address TLVs from [first, last) (includes first, not * includes last). * \param first an Iterator pointing to the first address TLV to erase * (inclusive). * \param last an Iterator pointing to the element past the last address TLV * to erase. * \return an iterator pointing to the next address TLV in the message. */ TlvIterator TlvErase (TlvIterator first, TlvIterator last); /** * \brief Removes all address TLVs from this block. */ void TlvClear (void); /** * \return The size (in bytes) needed to serialize this address block. */ uint32_t GetSerializedSize (void) const; /** * \brief Serializes this address block into the specified buffer. * \param start a reference to the point in a buffer to begin serializing. * * Users should not need to call this. Blocks will be deserialized by their * containing packet. */ void Serialize (Buffer::Iterator &start) const; /** * \brief Deserializes an address block from the specified buffer. * \param start a reference to the point in a buffer to begin deserializing. * * Users should not need to call this. Blocks will be deserialized by their * containing packet. */ void Deserialize (Buffer::Iterator &start); /** * \brief Pretty-prints the contents of this address block. * \param os a stream object to print to. */ void Print (std::ostream &os) const; /** * \brief Pretty-prints the contents of this address block, with specified * indentation. * \param os a stream object to print to. * \param level level of indentation. * * This probably never needs to be called by users. This is used when * recursively printing sub-objects. */ void Print (std::ostream &os, int level) const; bool operator== (const PbbAddressBlock &other) const; bool operator!= (const PbbAddressBlock &other) const; protected: virtual uint8_t GetAddressLength (void) const = 0; virtual void SerializeAddress (uint8_t *buffer, ConstAddressIterator iter) const = 0; virtual Address DeserializeAddress (uint8_t *buffer) const = 0; virtual void PrintAddress (std::ostream &os, ConstAddressIterator iter) const = 0; private: uint8_t GetPrefixFlags (void) const; void GetHeadTail (uint8_t *head, uint8_t &headlen, uint8_t *tail, uint8_t &taillen) const; bool HasZeroTail (const uint8_t *tail, uint8_t taillen) const; std::list<Address> m_addressList; std::list<uint8_t> m_prefixList; PbbAddressTlvBlock m_addressTlvList; }; /** * \brief Concrete IPv4 specific PbbAddressBlock. * * This address block will only contain IPv4 addresses. */ class PbbAddressBlockIpv4 : public PbbAddressBlock { public: PbbAddressBlockIpv4 (); virtual ~PbbAddressBlockIpv4 (); protected: virtual uint8_t GetAddressLength (void) const; virtual void SerializeAddress (uint8_t *buffer, ConstAddressIterator iter) const; virtual Address DeserializeAddress (uint8_t *buffer) const; virtual void PrintAddress (std::ostream &os, ConstAddressIterator iter) const; }; /** * \brief Concrete IPv6 specific PbbAddressBlock. * * This address block will only contain IPv6 addresses. */ class PbbAddressBlockIpv6 : public PbbAddressBlock { public: PbbAddressBlockIpv6 (); virtual ~PbbAddressBlockIpv6 (); protected: virtual uint8_t GetAddressLength (void) const; virtual void SerializeAddress (uint8_t *buffer, ConstAddressIterator iter) const; virtual Address DeserializeAddress (uint8_t *buffer) const; virtual void PrintAddress (std::ostream &os, ConstAddressIterator iter) const; }; /** * \brief A packet or message TLV */ class PbbTlv : public SimpleRefCount<PbbTlv> { public: PbbTlv (void); virtual ~PbbTlv (void); /** * \brief Sets the type of this TLV. * \param type the type value to set. */ void SetType (uint8_t type); /** * \return the type of this TLV. */ uint8_t GetType (void) const; /** * \brief Sets the type extension of this TLV. * \param type the type extension value to set. * * The type extension is like a sub-type used to further distinguish between * TLVs of the same type. */ void SetTypeExt (uint8_t type); /** * \return the type extension for this TLV. * * Calling this while HasTypeExt is False is undefined. Make sure you check * it first. This will be checked by an assert in debug builds. */ uint8_t GetTypeExt (void) const; /** * \brief Tests whether or not this TLV has a type extension. * \return true if this TLV has a type extension, false otherwise. * * This should be called before calling GetTypeExt to make sure there * actually is one. */ bool HasTypeExt (void) const; /** * \brief Sets the value of this message to the specified buffer. * \param start a buffer instance. * * The buffer is _not_ copied until this TLV is serialized. You should not * change the contents of the buffer you pass in to this function. */ void SetValue (Buffer start); /** * \brief Sets the value of this message to a buffer with the specified data. * \param buffer a pointer to data to put in the TLVs buffer. * \param size the size of the buffer. * * The buffer *is copied* into a *new buffer instance*. You can free the * data in the buffer provided anytime you wish. */ void SetValue (const uint8_t * buffer, uint32_t size); /** * \return a Buffer pointing to the value of this TLV. * * Calling this while HasValue is False is undefined. Make sure you check it * first. This will be checked by an assert in debug builds. */ Buffer GetValue (void) const; /** * \brief Tests whether or not this TLV has a value. * \return true if this tlv has a TLV, false otherwise. * * This should be called before calling GetTypeExt to make sure there * actually is one. */ bool HasValue (void) const; /** * \return The size (in bytes) needed to serialize this TLV. */ uint32_t GetSerializedSize (void) const; /** * \brief Serializes this TLV into the specified buffer. * \param start a reference to the point in a buffer to begin serializing. * * Users should not need to call this. TLVs will be serialized by their * containing blocks. */ void Serialize (Buffer::Iterator &start) const; /** * \brief Deserializes a TLV from the specified buffer. * \param start a reference to the point in a buffer to begin deserializing. * * Users should not need to call this. TLVs will be deserialized by their * containing blocks. */ void Deserialize (Buffer::Iterator &start); /** * \brief Pretty-prints the contents of this TLV. * \param os a stream object to print to. */ void Print (std::ostream &os) const; /** * \brief Pretty-prints the contents of this TLV, with specified indentation. * \param os a stream object to print to. * \param level level of indentation. * * This probably never needs to be called by users. This is used when * recursively printing sub-objects. */ void Print (std::ostream &os, int level) const; bool operator== (const PbbTlv &other) const; bool operator!= (const PbbTlv &other) const; protected: void SetIndexStart (uint8_t index); uint8_t GetIndexStart (void) const; bool HasIndexStart (void) const; void SetIndexStop (uint8_t index); uint8_t GetIndexStop (void) const; bool HasIndexStop (void) const; void SetMultivalue (bool isMultivalue); bool IsMultivalue (void) const; private: uint8_t m_type; bool m_hasTypeExt; uint8_t m_typeExt; bool m_hasIndexStart; uint8_t m_indexStart; bool m_hasIndexStop; uint8_t m_indexStop; bool m_isMultivalue; bool m_hasValue; Buffer m_value; }; /** * \brief An Address TLV */ class PbbAddressTlv : public PbbTlv { public: /** * \brief Sets the index of the first address in the associated address block * that this address TLV applies to. * \param index the index of the first address. */ void SetIndexStart (uint8_t index); /** * \return the first (inclusive) index of the address in the corresponding * address block that this TLV applies to. * * Calling this while HasIndexStart is False is undefined. Make sure you * check it first. This will be checked by an assert in debug builds. */ uint8_t GetIndexStart (void) const; /** * \brief Tests whether or not this address TLV has a start index. * \return true if this address TLV has a start index, false otherwise. * * This should be called before calling GetIndexStart to make sure there * actually is one. */ bool HasIndexStart (void) const; /** * \brief Sets the index of the last address in the associated address block * that this address TLV applies to. * \param index the index of the last address. */ void SetIndexStop (uint8_t index); /** * \return the last (inclusive) index of the address in the corresponding * PbbAddressBlock that this TLV applies to. * * Calling this while HasIndexStop is False is undefined. Make sure you * check it first. This will be checked by an assert in debug builds. */ uint8_t GetIndexStop (void) const; /** * \brief Tests whether or not this address TLV has a stop index. * \return true if this address TLV has a stop index, false otherwise. * * This should be called before calling GetIndexStop to make sure there * actually is one. */ bool HasIndexStop (void) const; /** * \brief Sets whether or not this address TLV is "multivalue" * \param isMultivalue whether or not this address TLV should be multivalue. * * If true, this means the value associated with this TLV should be divided * evenly into (GetIndexStop() - GetIndexStart() + 1) values. Otherwise, the * value is one single value that applies to each address in the range. */ void SetMultivalue (bool isMultivalue); /** * \brief Tests whether or not this address TLV is "multivalue" * \return whether this address TLV is multivalue or not. */ bool IsMultivalue (void) const; }; } /* namespace ns3 */ #endif /* PACKETBB_H */
zy901002-gpsr
src/network/utils/packetbb.h
C++
gpl2
49,552
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 Emmanuelle Laprise * * 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: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca> */ #ifndef ETHERNET_TRAILER_H #define ETHERNET_TRAILER_H #include "ns3/trailer.h" #include "ns3/packet.h" #include <string> namespace ns3 { /** * \ingroup network * * \brief Packet trailer for Ethernet * * This class can be used to add and verify the FCS at the end of an * Ethernet packet. */ class EthernetTrailer : public Trailer { public: /** * \brief Construct a null ethernet trailer */ EthernetTrailer (); /** * \brief Enable or disable FCS checking and calculations * \param enable If true, enables FCS calculations. */ void EnableFcs (bool enable); /** * \brief Updates the Fcs Field to the correct FCS * \param p Reference to a packet on which the FCS should be * calculated. The packet should not currently contain an * EthernetTrailer. */ void CalcFcs (Ptr<const Packet> p); /** * \brief Sets the FCS to a new value * \param fcs New FCS value */ void SetFcs (uint32_t fcs); /** * \return the FCS contained in this trailer */ uint32_t GetFcs (); /** * Calculate an FCS on the provided packet and check this value against * the FCS found when the trailer was deserialized (the one in the transmitted * packet). * * If FCS checking is disabled, this method will always * return true. * * \param p Reference to the packet on which the FCS should be * calculated. The packet should not contain an EthernetTrailer. * * \return Returns true if the Packet FCS matches the FCS in the trailer, * false otherwise. */ bool CheckFcs (Ptr<const Packet> p) const; /** *\return Returns the size of the trailer */ uint32_t GetTrailerSize () const; static TypeId GetTypeId (void); virtual TypeId GetInstanceTypeId (void) const; virtual void Print (std::ostream &os) const; virtual uint32_t GetSerializedSize (void) const; virtual void Serialize (Buffer::Iterator end) const; virtual uint32_t Deserialize (Buffer::Iterator end); private: /** * Enabled FCS calculations. If false, m_fcs is set to 0 and CheckFcs * returns true. */ bool m_calcFcs; uint32_t m_fcs; /// Value of the fcs contained in the trailer uint32_t DoCalcFcs (uint8_t const *buffer, size_t len) const; }; } // namespace ns3 #endif /* ETHERNET_TRAILER_H */
zy901002-gpsr
src/network/utils/ethernet-trailer.h
C++
gpl2
3,120
/* -*- 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 SIMPLE_NET_DEVICE_H #define SIMPLE_NET_DEVICE_H #include "ns3/net-device.h" #include "mac48-address.h" #include <stdint.h> #include <string> #include "ns3/traced-callback.h" namespace ns3 { class SimpleChannel; class Node; class ErrorModel; /** * \ingroup netdevice * * This device does not have a helper and assumes 48-bit mac addressing; * the default address assigned to each device is zero, so you must * assign a real address to use it. There is also the possibility to * add an ErrorModel if you want to force losses on the device. * * \brief simple net device for simple things and testing */ class SimpleNetDevice : public NetDevice { public: static TypeId GetTypeId (void); SimpleNetDevice (); void Receive (Ptr<Packet> packet, uint16_t protocol, Mac48Address to, Mac48Address from); void SetChannel (Ptr<SimpleChannel> channel); /** * Attach a receive ErrorModel to the SimpleNetDevice. * * The SimpleNetDevice may optionally include an ErrorModel in * the packet receive chain. * * \see ErrorModel * \param em Ptr to the ErrorModel. */ void SetReceiveErrorModel (Ptr<ErrorModel> em); // inherited from NetDevice base class. virtual void SetIfIndex (const uint32_t index); virtual uint32_t GetIfIndex (void) const; virtual Ptr<Channel> GetChannel (void) const; virtual void SetAddress (Address address); virtual Address GetAddress (void) const; virtual bool SetMtu (const uint16_t mtu); virtual uint16_t GetMtu (void) const; virtual bool IsLinkUp (void) const; virtual void AddLinkChangeCallback (Callback<void> callback); virtual bool IsBroadcast (void) const; virtual Address GetBroadcast (void) const; virtual bool IsMulticast (void) const; virtual Address GetMulticast (Ipv4Address multicastGroup) const; virtual bool IsPointToPoint (void) const; virtual bool IsBridge (void) const; virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber); virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber); virtual Ptr<Node> GetNode (void) const; virtual void SetNode (Ptr<Node> node); virtual bool NeedsArp (void) const; virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb); virtual Address GetMulticast (Ipv6Address addr) const; virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb); virtual bool SupportsSendFrom (void) const; protected: virtual void DoDispose (void); private: Ptr<SimpleChannel> m_channel; NetDevice::ReceiveCallback m_rxCallback; NetDevice::PromiscReceiveCallback m_promiscCallback; Ptr<Node> m_node; uint16_t m_mtu; uint32_t m_ifIndex; Mac48Address m_address; Ptr<ErrorModel> m_receiveErrorModel; /** * The trace source fired when the phy layer drops a packet it has received * due to the error model being active. Although SimpleNetDevice doesn't * really have a Phy model, we choose this trace source name for alignment * with other trace sources. * * \see class CallBackTraceSource */ TracedCallback<Ptr<const Packet> > m_phyRxDropTrace; }; } // namespace ns3 #endif /* SIMPLE_NET_DEVICE_H */
zy901002-gpsr
src/network/utils/simple-net-device.h
C++
gpl2
4,009
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Tom Henderson <tomhend@u.washington.edu> * This code has been ported from ns-2 (queue/errmodel.{cc,h} */ #include <math.h> #include "error-model.h" #include "ns3/packet.h" #include "ns3/assert.h" #include "ns3/log.h" #include "ns3/random-variable.h" #include "ns3/boolean.h" #include "ns3/enum.h" #include "ns3/double.h" NS_LOG_COMPONENT_DEFINE ("ErrorModel"); namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (ErrorModel); TypeId ErrorModel::GetTypeId (void) { static TypeId tid = TypeId ("ns3::ErrorModel") .SetParent<Object> () .AddAttribute ("IsEnabled", "Whether this ErrorModel is enabled or not.", BooleanValue (true), MakeBooleanAccessor (&ErrorModel::m_enable), MakeBooleanChecker ()) ; return tid; } ErrorModel::ErrorModel () : m_enable (true) { NS_LOG_FUNCTION_NOARGS (); } ErrorModel::~ErrorModel () { NS_LOG_FUNCTION_NOARGS (); } bool ErrorModel::IsCorrupt (Ptr<Packet> p) { NS_LOG_FUNCTION_NOARGS (); bool result; // Insert any pre-conditions here result = DoCorrupt (p); // Insert any post-conditions here return result; } void ErrorModel::Reset (void) { NS_LOG_FUNCTION_NOARGS (); DoReset (); } void ErrorModel::Enable (void) { NS_LOG_FUNCTION_NOARGS (); m_enable = true; } void ErrorModel::Disable (void) { NS_LOG_FUNCTION_NOARGS (); m_enable = false; } bool ErrorModel::IsEnabled (void) const { NS_LOG_FUNCTION_NOARGS (); return m_enable; } // // RateErrorModel // NS_OBJECT_ENSURE_REGISTERED (RateErrorModel); TypeId RateErrorModel::GetTypeId (void) { static TypeId tid = TypeId ("ns3::RateErrorModel") .SetParent<ErrorModel> () .AddConstructor<RateErrorModel> () .AddAttribute ("ErrorUnit", "The error unit", EnumValue (EU_BYTE), MakeEnumAccessor (&RateErrorModel::m_unit), MakeEnumChecker (EU_BYTE, "EU_BYTE", EU_PKT, "EU_PKT", EU_BIT, "EU_BIT")) .AddAttribute ("ErrorRate", "The error rate.", DoubleValue (0.0), MakeDoubleAccessor (&RateErrorModel::m_rate), MakeDoubleChecker<double> ()) .AddAttribute ("RanVar", "The decision variable attached to this error model.", RandomVariableValue (UniformVariable (0.0, 1.0)), MakeRandomVariableAccessor (&RateErrorModel::m_ranvar), MakeRandomVariableChecker ()) ; return tid; } RateErrorModel::RateErrorModel () { NS_LOG_FUNCTION_NOARGS (); } RateErrorModel::~RateErrorModel () { NS_LOG_FUNCTION_NOARGS (); } enum ErrorUnit RateErrorModel::GetUnit (void) const { NS_LOG_FUNCTION_NOARGS (); return m_unit; } void RateErrorModel::SetUnit (enum ErrorUnit error_unit) { NS_LOG_FUNCTION_NOARGS (); m_unit = error_unit; } double RateErrorModel::GetRate (void) const { NS_LOG_FUNCTION_NOARGS (); return m_rate; } void RateErrorModel::SetRate (double rate) { NS_LOG_FUNCTION_NOARGS (); m_rate = rate; } void RateErrorModel::SetRandomVariable (const RandomVariable &ranvar) { NS_LOG_FUNCTION_NOARGS (); m_ranvar = ranvar; } bool RateErrorModel::DoCorrupt (Ptr<Packet> p) { NS_LOG_FUNCTION_NOARGS (); if (!IsEnabled ()) { return false; } switch (m_unit) { case EU_PKT: return DoCorruptPkt (p); case EU_BYTE: return DoCorruptByte (p); case EU_BIT: return DoCorruptBit (p); default: NS_ASSERT_MSG (false, "m_unit not supported yet"); break; } return false; } bool RateErrorModel::DoCorruptPkt (Ptr<Packet> p) { NS_LOG_FUNCTION_NOARGS (); return (m_ranvar.GetValue () < m_rate); } bool RateErrorModel::DoCorruptByte (Ptr<Packet> p) { NS_LOG_FUNCTION_NOARGS (); // compute pkt error rate, assume uniformly distributed byte error double per = 1 - pow (1.0 - m_rate, p->GetSize ()); return (m_ranvar.GetValue () < per); } bool RateErrorModel::DoCorruptBit (Ptr<Packet> p) { NS_LOG_FUNCTION_NOARGS (); // compute pkt error rate, assume uniformly distributed bit error double per = 1 - pow (1.0 - m_rate, (8 * p->GetSize ()) ); return (m_ranvar.GetValue () < per); } void RateErrorModel::DoReset (void) { NS_LOG_FUNCTION_NOARGS (); /* re-initialize any state; no-op for now */ } // // ListErrorModel // NS_OBJECT_ENSURE_REGISTERED (ListErrorModel); TypeId ListErrorModel::GetTypeId (void) { static TypeId tid = TypeId ("ns3::ListErrorModel") .SetParent<ErrorModel> () .AddConstructor<ListErrorModel> () ; return tid; } ListErrorModel::ListErrorModel () { NS_LOG_FUNCTION_NOARGS (); } ListErrorModel::~ListErrorModel () { NS_LOG_FUNCTION_NOARGS (); } std::list<uint32_t> ListErrorModel::GetList (void) const { NS_LOG_FUNCTION_NOARGS (); return m_packetList; } void ListErrorModel::SetList (const std::list<uint32_t> &packetlist) { NS_LOG_FUNCTION_NOARGS (); m_packetList = packetlist; } // When performance becomes a concern, the list provided could be // converted to a dynamically-sized array of uint32_t to avoid // list iteration below. bool ListErrorModel::DoCorrupt (Ptr<Packet> p) { NS_LOG_FUNCTION_NOARGS (); if (!IsEnabled ()) { return false; } uint32_t uid = p->GetUid (); for (PacketListCI i = m_packetList.begin (); i != m_packetList.end (); i++) { if (uid == *i) { return true; } } return false; } void ListErrorModel::DoReset (void) { NS_LOG_FUNCTION_NOARGS (); m_packetList.clear (); } // // ReceiveListErrorModel // NS_OBJECT_ENSURE_REGISTERED (ReceiveListErrorModel); TypeId ReceiveListErrorModel::GetTypeId (void) { static TypeId tid = TypeId ("ns3::ReceiveListErrorModel") .SetParent<ErrorModel> () .AddConstructor<ReceiveListErrorModel> () ; return tid; } ReceiveListErrorModel::ReceiveListErrorModel () : m_timesInvoked (0) { NS_LOG_FUNCTION_NOARGS (); } ReceiveListErrorModel::~ReceiveListErrorModel () { NS_LOG_FUNCTION_NOARGS (); } std::list<uint32_t> ReceiveListErrorModel::GetList (void) const { NS_LOG_FUNCTION_NOARGS (); return m_packetList; } void ReceiveListErrorModel::SetList (const std::list<uint32_t> &packetlist) { NS_LOG_FUNCTION_NOARGS (); m_packetList = packetlist; } bool ReceiveListErrorModel::DoCorrupt (Ptr<Packet> p) { NS_LOG_FUNCTION_NOARGS (); if (!IsEnabled ()) { return false; } m_timesInvoked += 1; for (PacketListCI i = m_packetList.begin (); i != m_packetList.end (); i++) { if (m_timesInvoked - 1 == *i) { return true; } } return false; } void ReceiveListErrorModel::DoReset (void) { NS_LOG_FUNCTION_NOARGS (); m_packetList.clear (); } } // namespace ns3
zy901002-gpsr
src/network/utils/error-model.cc
C++
gpl2
7,640
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2009 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "ns3/log.h" #include "ns3/uinteger.h" #include "ns3/buffer.h" #include "ns3/header.h" #include "pcap-file-wrapper.h" NS_LOG_COMPONENT_DEFINE ("PcapFileWrapper"); namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (PcapFileWrapper); TypeId PcapFileWrapper::GetTypeId (void) { static TypeId tid = TypeId ("ns3::PcapFileWrapper") .SetParent<Object> () .AddConstructor<PcapFileWrapper> () .AddAttribute ("CaptureSize", "Maximum length of captured packets (cf. pcap snaplen)", UintegerValue (PcapFile::SNAPLEN_DEFAULT), MakeUintegerAccessor (&PcapFileWrapper::m_snapLen), MakeUintegerChecker<uint32_t> (0, PcapFile::SNAPLEN_DEFAULT)) ; return tid; } PcapFileWrapper::PcapFileWrapper () { } PcapFileWrapper::~PcapFileWrapper () { Close (); } bool PcapFileWrapper::Fail (void) const { return m_file.Fail (); } bool PcapFileWrapper::Eof (void) const { return m_file.Eof (); } void PcapFileWrapper::Clear (void) { m_file.Clear (); } void PcapFileWrapper::Close (void) { m_file.Close (); } void PcapFileWrapper::Open (std::string const &filename, std::ios::openmode mode) { m_file.Open (filename, mode); } void PcapFileWrapper::Init (uint32_t dataLinkType, uint32_t snapLen, int32_t tzCorrection) { // // If the user doesn't provide a snaplen, the default value will come in. If // this happens, we use the "CaptureSize" Attribute. If the user does provide // a snaplen, we use the one provided. // if (snapLen != std::numeric_limits<uint32_t>::max ()) { m_file.Init (dataLinkType, snapLen, tzCorrection); } else { m_file.Init (dataLinkType, m_snapLen, tzCorrection); } } void PcapFileWrapper::Write (Time t, Ptr<const Packet> p) { uint64_t current = t.GetMicroSeconds (); uint64_t s = current / 1000000; uint64_t us = current % 1000000; m_file.Write (s, us, p); } void PcapFileWrapper::Write (Time t, Header &header, Ptr<const Packet> p) { uint64_t current = t.GetMicroSeconds (); uint64_t s = current / 1000000; uint64_t us = current % 1000000; m_file.Write (s, us, header, p); } void PcapFileWrapper::Write (Time t, uint8_t const *buffer, uint32_t length) { uint64_t current = t.GetMicroSeconds (); uint64_t s = current / 1000000; uint64_t us = current % 1000000; m_file.Write (s, us, buffer, length); } uint32_t PcapFileWrapper::GetMagic (void) { return m_file.GetMagic (); } uint16_t PcapFileWrapper::GetVersionMajor (void) { return m_file.GetVersionMajor (); } uint16_t PcapFileWrapper::GetVersionMinor (void) { return m_file.GetVersionMinor (); } int32_t PcapFileWrapper::GetTimeZoneOffset (void) { return m_file.GetTimeZoneOffset (); } uint32_t PcapFileWrapper::GetSigFigs (void) { return m_file.GetSigFigs (); } uint32_t PcapFileWrapper::GetSnapLen (void) { return m_file.GetSnapLen (); } uint32_t PcapFileWrapper::GetDataLinkType (void) { return m_file.GetDataLinkType (); } } // namespace ns3
zy901002-gpsr
src/network/utils/pcap-file-wrapper.cc
C++
gpl2
3,788
/* -*- 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 "simple-net-device.h" #include "simple-channel.h" #include "ns3/node.h" #include "ns3/packet.h" #include "ns3/log.h" #include "ns3/pointer.h" #include "ns3/error-model.h" #include "ns3/trace-source-accessor.h" NS_LOG_COMPONENT_DEFINE ("SimpleNetDevice"); namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (SimpleNetDevice); TypeId SimpleNetDevice::GetTypeId (void) { static TypeId tid = TypeId ("ns3::SimpleNetDevice") .SetParent<NetDevice> () .AddConstructor<SimpleNetDevice> () .AddAttribute ("ReceiveErrorModel", "The receiver error model used to simulate packet loss", PointerValue (), MakePointerAccessor (&SimpleNetDevice::m_receiveErrorModel), MakePointerChecker<ErrorModel> ()) .AddTraceSource ("PhyRxDrop", "Trace source indicating a packet has been dropped by the device during reception", MakeTraceSourceAccessor (&SimpleNetDevice::m_phyRxDropTrace)) ; return tid; } SimpleNetDevice::SimpleNetDevice () : m_channel (0), m_node (0), m_mtu (0xffff), m_ifIndex (0) { } void SimpleNetDevice::Receive (Ptr<Packet> packet, uint16_t protocol, Mac48Address to, Mac48Address from) { NS_LOG_FUNCTION (packet << protocol << to << from); NetDevice::PacketType packetType; if (m_receiveErrorModel && m_receiveErrorModel->IsCorrupt (packet) ) { m_phyRxDropTrace (packet); return; } if (to == m_address) { packetType = NetDevice::PACKET_HOST; } else if (to.IsBroadcast ()) { packetType = NetDevice::PACKET_HOST; } else if (to.IsGroup ()) { packetType = NetDevice::PACKET_MULTICAST; } else { packetType = NetDevice::PACKET_OTHERHOST; } m_rxCallback (this, packet, protocol, from); if (!m_promiscCallback.IsNull ()) { m_promiscCallback (this, packet, protocol, from, to, packetType); } } void SimpleNetDevice::SetChannel (Ptr<SimpleChannel> channel) { m_channel = channel; m_channel->Add (this); } void SimpleNetDevice::SetReceiveErrorModel (Ptr<ErrorModel> em) { m_receiveErrorModel = em; } void SimpleNetDevice::SetIfIndex (const uint32_t index) { m_ifIndex = index; } uint32_t SimpleNetDevice::GetIfIndex (void) const { return m_ifIndex; } Ptr<Channel> SimpleNetDevice::GetChannel (void) const { return m_channel; } void SimpleNetDevice::SetAddress (Address address) { m_address = Mac48Address::ConvertFrom (address); } Address SimpleNetDevice::GetAddress (void) const { // // Implicit conversion from Mac48Address to Address // return m_address; } bool SimpleNetDevice::SetMtu (const uint16_t mtu) { m_mtu = mtu; return true; } uint16_t SimpleNetDevice::GetMtu (void) const { return m_mtu; } bool SimpleNetDevice::IsLinkUp (void) const { return true; } void SimpleNetDevice::AddLinkChangeCallback (Callback<void> callback) {} bool SimpleNetDevice::IsBroadcast (void) const { return true; } Address SimpleNetDevice::GetBroadcast (void) const { return Mac48Address ("ff:ff:ff:ff:ff:ff"); } bool SimpleNetDevice::IsMulticast (void) const { return false; } Address SimpleNetDevice::GetMulticast (Ipv4Address multicastGroup) const { return Mac48Address::GetMulticast (multicastGroup); } Address SimpleNetDevice::GetMulticast (Ipv6Address addr) const { return Mac48Address::GetMulticast (addr); } bool SimpleNetDevice::IsPointToPoint (void) const { return false; } bool SimpleNetDevice::IsBridge (void) const { return false; } bool SimpleNetDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber) { NS_LOG_FUNCTION (packet << dest << protocolNumber); Mac48Address to = Mac48Address::ConvertFrom (dest); m_channel->Send (packet, protocolNumber, to, m_address, this); return true; } bool SimpleNetDevice::SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber) { Mac48Address to = Mac48Address::ConvertFrom (dest); Mac48Address from = Mac48Address::ConvertFrom (source); m_channel->Send (packet, protocolNumber, to, from, this); return true; } Ptr<Node> SimpleNetDevice::GetNode (void) const { return m_node; } void SimpleNetDevice::SetNode (Ptr<Node> node) { m_node = node; } bool SimpleNetDevice::NeedsArp (void) const { return false; } void SimpleNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb) { m_rxCallback = cb; } void SimpleNetDevice::DoDispose (void) { m_channel = 0; m_node = 0; m_receiveErrorModel = 0; NetDevice::DoDispose (); } void SimpleNetDevice::SetPromiscReceiveCallback (PromiscReceiveCallback cb) { m_promiscCallback = cb; } bool SimpleNetDevice::SupportsSendFrom (void) const { return true; } } // namespace ns3
zy901002-gpsr
src/network/utils/simple-net-device.cc
C++
gpl2
5,632
/* -*- 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 SIMPLE_CHANNEL_H #define SIMPLE_CHANNEL_H #include "ns3/channel.h" #include "mac48-address.h" #include <vector> namespace ns3 { class SimpleNetDevice; class Packet; /** * \ingroup channel * \brief A simple channel, for simple things and testing */ class SimpleChannel : public Channel { public: static TypeId GetTypeId (void); SimpleChannel (); void Send (Ptr<Packet> p, uint16_t protocol, Mac48Address to, Mac48Address from, Ptr<SimpleNetDevice> sender); void Add (Ptr<SimpleNetDevice> device); // inherited from ns3::Channel virtual uint32_t GetNDevices (void) const; virtual Ptr<NetDevice> GetDevice (uint32_t i) const; private: std::vector<Ptr<SimpleNetDevice> > m_devices; }; } // namespace ns3 #endif /* SIMPLE_CHANNEL_H */
zy901002-gpsr
src/network/utils/simple-channel.h
C++
gpl2
1,594
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 INRIA * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> */ #ifndef MAC48_ADDRESS_H #define MAC48_ADDRESS_H #include <stdint.h> #include <ostream> #include "ns3/attribute.h" #include "ns3/attribute-helper.h" #include "ipv4-address.h" #include "ipv6-address.h" namespace ns3 { class Address; /** * \ingroup address * * \brief an EUI-48 address * * This class can contain 48 bit IEEE addresses. */ class Mac48Address { public: Mac48Address (); /** * \param str a string representing the new Mac48Address * * The format of the string is "xx:xx:xx:xx:xx:xx" */ Mac48Address (const char *str); /** * \param buffer address in network order * * Copy the input address to our internal buffer. */ void CopyFrom (const uint8_t buffer[6]); /** * \param buffer address in network order * * Copy the internal address to the input buffer. */ void CopyTo (uint8_t buffer[6]) const; /** * \returns a new Address instance * * Convert an instance of this class to a polymorphic Address instance. */ operator Address () const; /** * \param address a polymorphic address * \returns a new Mac48Address from the polymorphic address * * This function performs a type check and asserts if the * type of the input address is not compatible with an * Mac48Address. */ static Mac48Address ConvertFrom (const Address &address); /** * \param address address to test * \returns true if the address matches, false otherwise. */ static bool IsMatchingType (const Address &address); /** * Allocate a new Mac48Address. */ static Mac48Address Allocate (void); /** * \returns true if this is a broadcast address, false otherwise. */ bool IsBroadcast (void) const; /** * \returns true if the group bit is set, false otherwise. */ bool IsGroup (void) const; /** * \returns the broadcast address */ static Mac48Address GetBroadcast (void); /** * \param address base IPv4 address * \returns a multicast address */ static Mac48Address GetMulticast (Ipv4Address address); /** * \brief Get multicast address from IPv6 address. * \param address base IPv6 address * \returns a multicast address */ static Mac48Address GetMulticast (Ipv6Address address); /** * \returns the multicast prefix (01:00:5e:00:00:00). */ static Mac48Address GetMulticastPrefix (void); /** * \brief Get the multicast prefix for IPv6 (33:33:00:00:00:00). * \returns a multicast address. */ static Mac48Address GetMulticast6Prefix (void); private: /** * \returns a new Address instance * * Convert an instance of this class to a polymorphic Address instance. */ Address ConvertTo (void) const; static uint8_t GetType (void); friend bool operator < (const Mac48Address &a, const Mac48Address &b); friend bool operator == (const Mac48Address &a, const Mac48Address &b); friend bool operator != (const Mac48Address &a, const Mac48Address &b); friend std::istream& operator>> (std::istream& is, Mac48Address & address); uint8_t m_address[6]; }; /** * \class ns3::Mac48AddressValue * \brief hold objects of type ns3::Mac48Address */ ATTRIBUTE_HELPER_HEADER (Mac48Address); inline bool operator == (const Mac48Address &a, const Mac48Address &b) { return memcmp (a.m_address, b.m_address, 6) == 0; } inline bool operator != (const Mac48Address &a, const Mac48Address &b) { return memcmp (a.m_address, b.m_address, 6) != 0; } inline bool operator < (const Mac48Address &a, const Mac48Address &b) { return memcmp (a.m_address, b.m_address, 6) < 0; } std::ostream& operator<< (std::ostream& os, const Mac48Address & address); std::istream& operator>> (std::istream& is, Mac48Address & address); } // namespace ns3 #endif /* MAC48_ADDRESS_H */
zy901002-gpsr
src/network/utils/mac48-address.h
C++
gpl2
4,576
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 Emmanuelle Laprise, INRIA * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Authors: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>, * Mathieu Lacage <mathieu.lacage@sophia.inria.fr> */ #ifndef PACKET_SOCKET_H #define PACKET_SOCKET_H #include <stdint.h> #include <queue> #include "ns3/callback.h" #include "ns3/traced-callback.h" #include "ns3/ptr.h" #include "ns3/socket.h" #include "ns3/net-device.h" namespace ns3 { class Node; class Packet; class NetDevice; class PacketSocketAddress; /** * \ingroup socket * * \brief A PacketSocket is a link between an application and a net device. * * A PacketSocket can be used to connect an application to a net * device. The application provides the buffers of data, the socket * conserts them to a raw packet and the net device then adds the * protocol specific headers and trailers. This socket type * is very similar to the linux and BSD "packet" sockets. * * Here is a summary of the semantics of this class: * - Bind: Bind uses only the protocol and device fields of the * PacketSocketAddress. If none are provided, Bind uses * zero for both, which means that the socket is bound * to all protocols on all devices on the node. * * - Connect: uses only the protocol, device and "physical address" * field of the PacketSocketAddress. It is used to set the default * destination address for outgoing packets. * * - Send: send the input packet to the underlying NetDevices * with the default destination address. The socket must * be bound and connected. * * - SendTo: uses the protocol, device, and "physical address" * fields of the PacketSocketAddress. The device value is * used to specialize the packet transmission to a single * device, the protocol value specifies the protocol of this * packet only and the "physical address" field is used to override the * default destination address. The socket must be bound. * * - Recv: The address represents the address of the packer originator. * The fields "physical address", device, and protocol are filled. * * - Accept: not allowed * * - Listen: returns -1 (OPNOTSUPP) */ class PacketSocket : public Socket { public: static TypeId GetTypeId (void); PacketSocket (); virtual ~PacketSocket (); 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); 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 bool SetAllowBroadcast (bool allowBroadcast); virtual bool GetAllowBroadcast () const; private: void ForwardUp (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType); int DoBind (const PacketSocketAddress &address); uint32_t GetMinMtu (PacketSocketAddress ad) const; virtual void DoDispose (void); enum State { STATE_OPEN, STATE_BOUND, // open and bound STATE_CONNECTED, // open, bound and connected STATE_CLOSED }; Ptr<Node> m_node; enum SocketErrno m_errno; bool m_shutdownSend; bool m_shutdownRecv; enum State m_state; uint16_t m_protocol; bool m_isSingleDevice; uint32_t m_device; Address m_destAddr; /// Default destination address std::queue<Ptr<Packet> > m_deliveryQueue; uint32_t m_rxAvailable; TracedCallback<Ptr<const Packet> > m_dropTrace; // Socket options (attributes) uint32_t m_rcvBufSize; }; } // namespace ns3 #endif /* PACKET_SOCKET_H */
zy901002-gpsr
src/network/utils/packet-socket.h
C++
gpl2
4,996
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // The queue base class does not have any limit based on the number // of packets or number of bytes. It is, conceptually, infinite // by default. Only subclasses define limitations. // The base class implements tracing and basic statistics calculations. #ifndef QUEUE_H #define QUEUE_H #include <string> #include <list> #include "ns3/packet.h" #include "ns3/object.h" #include "ns3/traced-callback.h" namespace ns3 { /** * \ingroup network * \defgroup queue Queue */ /** * \ingroup queue * \brief Abstract base class for packet Queues * * This class defines the base APIs for packet queues in the ns-3 system */ class Queue : public Object { public: static TypeId GetTypeId (void); Queue (); virtual ~Queue (); /** * \return true if the queue is empty; false otherwise */ bool IsEmpty (void) const; /** * Place a packet into the rear of the Queue * \param p packet to enqueue * \return True if the operation was successful; false otherwise */ bool Enqueue (Ptr<Packet> p); /** * Remove a packet from the front of the Queue * \return 0 if the operation was not successful; the packet otherwise. */ Ptr<Packet> Dequeue (void); /** * Get a copy of the item at the front of the queue without removing it * \return 0 if the operation was not successful; the packet otherwise. */ Ptr<const Packet> Peek (void) const; /** * Flush the queue. */ void DequeueAll (void); /** * \return The number of packets currently stored in the Queue */ uint32_t GetNPackets (void) const; /** * \return The number of bytes currently occupied by the packets in the Queue */ uint32_t GetNBytes (void) const; /** * \return The total number of bytes received by this Queue since the * simulation began, or since ResetStatistics was called, according to * whichever happened more recently * */ uint32_t GetTotalReceivedBytes (void) const; /** * \return The total number of packets received by this Queue since the * simulation began, or since ResetStatistics was called, according to * whichever happened more recently */ uint32_t GetTotalReceivedPackets (void) const; /** * \return The total number of bytes dropped by this Queue since the * simulation began, or since ResetStatistics was called, according to * whichever happened more recently */ uint32_t GetTotalDroppedBytes (void) const; /** * \return The total number of bytes dropped by this Queue since the * simulation began, or since ResetStatistics was called, according to * whichever happened more recently */ uint32_t GetTotalDroppedPackets (void) const; /** * Resets the counts for dropped packets, dropped bytes, received packets, and * received bytes. */ void ResetStatistics (void); #if 0 // average calculation requires keeping around // a buffer with the date of arrival of past received packets // which are within the average window // so, it is quite costly to do it all the time. // Hence, it is disabled by default and must be explicitely // enabled with this method which specifies the size // of the average window in time units. void EnableRunningAverage (Time averageWindow); void DisableRunningAverage (void); // average double GetQueueSizeAverage (void); double GetReceivedBytesPerSecondAverage (void); double GetReceivedPacketsPerSecondAverage (void); double GetDroppedBytesPerSecondAverage (void); double GetDroppedPacketsPerSecondAverage (void); // variance double GetQueueSizeVariance (void); double GetReceivedBytesPerSecondVariance (void); double GetReceivedPacketsPerSecondVariance (void); double GetDroppedBytesPerSecondVariance (void); double GetDroppedPacketsPerSecondVariance (void); #endif private: virtual bool DoEnqueue (Ptr<Packet> p) = 0; virtual Ptr<Packet> DoDequeue (void) = 0; virtual Ptr<const Packet> DoPeek (void) const = 0; protected: // called by subclasses to notify parent of packet drops. void Drop (Ptr<Packet> packet); private: TracedCallback<Ptr<const Packet> > m_traceEnqueue; TracedCallback<Ptr<const Packet> > m_traceDequeue; TracedCallback<Ptr<const Packet> > m_traceDrop; uint32_t m_nBytes; uint32_t m_nTotalReceivedBytes; uint32_t m_nPackets; uint32_t m_nTotalReceivedPackets; uint32_t m_nTotalDroppedBytes; uint32_t m_nTotalDroppedPackets; }; } // namespace ns3 #endif /* QUEUE_H */
zy901002-gpsr
src/network/utils/queue.h
C++
gpl2
5,215
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2005 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 INET_SOCKET_ADDRESS_H #define INET_SOCKET_ADDRESS_H #include "ns3/address.h" #include "ipv4-address.h" #include <stdint.h> namespace ns3 { /** * \ingroup address * * \brief an Inet address class * * This class is similar to inet_sockaddr in the BSD socket * API. i.e., this class holds an Ipv4Address and a port number * to form an ipv4 transport endpoint. */ class InetSocketAddress { public: /** * \param ipv4 the ipv4 address * \param port the port number */ InetSocketAddress (Ipv4Address ipv4, uint16_t port); /** * \param ipv4 the ipv4 address * * The port number is set to zero by default. */ InetSocketAddress (Ipv4Address ipv4); /** * \param port the port number * * The ipv4 address is set to the "Any" address by default. */ InetSocketAddress (uint16_t port); /** * \param ipv4 string which represents an ipv4 address * \param port the port number */ InetSocketAddress (const char *ipv4, uint16_t port); /** * \param ipv4 string which represents an ipv4 address * * The port number is set to zero. */ InetSocketAddress (const char *ipv4); /** * \returns the port number */ uint16_t GetPort (void) const; /** * \returns the ipv4 address */ Ipv4Address GetIpv4 (void) const; /** * \param port the new port number. */ void SetPort (uint16_t port); /** * \param address the new ipv4 address */ void SetIpv4 (Ipv4Address address); /** * \param address address to test * \returns true if the address matches, false otherwise. */ static bool IsMatchingType (const Address &address); /** * \returns an Address instance which represents this * InetSocketAddress instance. */ operator Address () const; /** * \param address the Address instance to convert from. * * Returns an InetSocketAddress which corresponds to the input * Address */ static InetSocketAddress ConvertFrom (const Address &address); private: Address ConvertTo (void) const; static uint8_t GetType (void); Ipv4Address m_ipv4; uint16_t m_port; }; } // namespace ns3 #endif /* INET_SOCKET_ADDRESS_H */
zy901002-gpsr
src/network/utils/inet-socket-address.h
C++
gpl2
2,979
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2005 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 IPV4_ADDRESS_H #define IPV4_ADDRESS_H #include <stdint.h> #include <ostream> #include "ns3/address.h" #include "ns3/attribute-helper.h" namespace ns3 { class Ipv4Mask; /** * \ingroup address * * \brief Ipv4 addresses are stored in host order in this class. */ class Ipv4Address { public: Ipv4Address (); /** * input address is in host order. * \param address The host order 32-bit address */ explicit Ipv4Address (uint32_t address); /** * \brief Constructs an Ipv4Address by parsing a the input C-string * * Input address is in format: * hhh.xxx.xxx.lll * where h is the high byte and l the * low byte * \param address C-string containing the address as described above */ Ipv4Address (char const *address); /** * Get the host-order 32-bit IP address * \return the host-order 32-bit IP address */ uint32_t Get (void) const; /** * input address is in host order. * \param address The host order 32-bit address */ void Set (uint32_t address); /** * \brief Sets an Ipv4Address by parsing a the input C-string * * Input address is in format: * hhh.xxx.xxx.lll * where h is the high byte and l the * low byte * \param address C-string containing the address as described above */ void Set (char const *address); /** * \brief Comparison operation between two Ipv4Addresses * \param other address to which to compare this address * \return True if the addresses are equal. False otherwise. */ bool IsEqual (const Ipv4Address &other) const { return m_address == other.m_address; } /** * Serialize this address to a 4-byte buffer * * \param buf output buffer to which this address gets overwritten with this * Ipv4Address */ void Serialize (uint8_t buf[4]) const; /** * \param buf buffer to read address from * \return an Ipv4Address * * The input address is expected to be in network byte order format. */ static Ipv4Address Deserialize (const uint8_t buf[4]); /** * \brief Print this address to the given output stream * * The print format is in the typical "192.168.1.1" * \param os The output stream to which this Ipv4Address is printed */ void Print (std::ostream &os) const; /** * \return true if address is 255.255.255.255; false otherwise */ bool IsBroadcast (void) const; /** * \return true only if address is in the range 224.0.0.0 - 239.255.255.255 */ bool IsMulticast (void) const; /** * \return true only if address is in local multicast address scope, 224.0.0.0/24 */ bool IsLocalMulticast (void) const; /** * \brief Combine this address with a network mask * * This method returns an IPv4 address that is this address combined * (bitwise and) with a network mask, yielding an IPv4 network * address. * * \param mask a network mask */ Ipv4Address CombineMask (Ipv4Mask const &mask) const; /** * \brief Generate subnet-directed broadcast address corresponding to mask * * The subnet-directed broadcast address has the host bits set to all * ones. If this method is called with a mask of 255.255.255.255, * (i.e., the address is a /32 address), the program will assert, since * there is no subnet associated with a /32 address. * * \param mask a network mask */ Ipv4Address GetSubnetDirectedBroadcast (Ipv4Mask const &mask) const; /** * \brief Generate subnet-directed broadcast address corresponding to mask * * The subnet-directed broadcast address has the host bits set to all * ones. If this method is called with a mask of 255.255.255.255, * (i.e., the address is a /32 address), the program will assert, since * there is no subnet associated with a /32 address. * * \param mask a network mask * \return true if the address, when combined with the input mask, has all * of its host bits set to one */ bool IsSubnetDirectedBroadcast (Ipv4Mask const &mask) const; /** * \param address an address to compare type with * * \return true if the type of the address stored internally * is compatible with the type of the input address, false otherwise. */ static bool IsMatchingType (const Address &address); /** * Convert an instance of this class to a polymorphic Address instance. * * \return a new Address instance */ operator Address () const; /** * \param address a polymorphic address * \return a new Ipv4Address from the polymorphic address * * This function performs a type check and asserts if the * type of the input address is not compatible with an * Ipv4Address. */ static Ipv4Address ConvertFrom (const Address &address); /** * \return the 0.0.0.0 address */ static Ipv4Address GetZero (void); /** * \return the 0.0.0.0 address */ static Ipv4Address GetAny (void); /** * \return the 255.255.255.255 address */ static Ipv4Address GetBroadcast (void); /** * \return the 127.0.0.1 address */ static Ipv4Address GetLoopback (void); private: Address ConvertTo (void) const; static uint8_t GetType (void); uint32_t m_address; friend bool operator == (Ipv4Address const &a, Ipv4Address const &b); friend bool operator != (Ipv4Address const &a, Ipv4Address const &b); friend bool operator < (Ipv4Address const &addrA, Ipv4Address const &addrB); }; /** * \ingroup address * * \brief a class to represent an Ipv4 address mask * * The constructor takes arguments according to a few formats. * Ipv4Mask ("255.255.255.255"), Ipv4Mask ("/32"), and Ipv4Mask (0xffffffff) * are all equivalent. */ class Ipv4Mask { public: /** * Will initialize to a garbage value (0x66666666) */ Ipv4Mask (); /** * \param mask bitwise integer representation of the mask * * For example, the integer input 0xffffff00 yields a 24-bit mask */ Ipv4Mask (uint32_t mask); /** * \param mask String constant either in "255.255.255.0" or "/24" format */ Ipv4Mask (char const *mask); /** * \param a first address to compare * \param b second address to compare * \return true if both addresses are equal in their masked bits, * corresponding to this mask */ bool IsMatch (Ipv4Address a, Ipv4Address b) const; /** * \param other a mask to compare * \return true if the mask equals the mask passed as input parameter */ bool IsEqual (Ipv4Mask other) const; /** * Get the host-order 32-bit IP mask * \return the host-order 32-bit IP mask */ uint32_t Get (void) const; /** * input mask is in host order. * \param mask The host order 32-bit mask */ void Set (uint32_t mask); /** * \brief Return the inverse mask in host order. */ uint32_t GetInverse (void) const; /** * \brief Print this mask to the given output stream * * The print format is in the typical "255.255.255.0" * \param os The output stream to which this Ipv4Address is printed */ void Print (std::ostream &os) const; /** * \return the prefix length of mask (the yy in x.x.x.x/yy notation) */ uint16_t GetPrefixLength (void) const; /** * \return the 255.0.0.0 mask corresponding to a typical loopback address */ static Ipv4Mask GetLoopback (void); /** * \return the 0.0.0.0 mask */ static Ipv4Mask GetZero (void); /** * \return the 255.255.255.255 mask */ static Ipv4Mask GetOnes (void); private: uint32_t m_mask; }; /** * \class ns3::Ipv4AddressValue * \brief hold objects of type ns3::Ipv4Address */ /** * \class ns3::Ipv4MaskValue * \brief hold objects of type ns3::Ipv4Mask */ ATTRIBUTE_HELPER_HEADER (Ipv4Address); ATTRIBUTE_HELPER_HEADER (Ipv4Mask); std::ostream& operator<< (std::ostream& os, Ipv4Address const& address); std::ostream& operator<< (std::ostream& os, Ipv4Mask const& mask); std::istream & operator >> (std::istream &is, Ipv4Address &address); std::istream & operator >> (std::istream &is, Ipv4Mask &mask); inline bool operator == (const Ipv4Address &a, const Ipv4Address &b) { return (a.m_address == b.m_address); } inline bool operator != (const Ipv4Address &a, const Ipv4Address &b) { return (a.m_address != b.m_address); } inline bool operator < (const Ipv4Address &a, const Ipv4Address &b) { return (a.m_address < b.m_address); } class Ipv4AddressHash : public std::unary_function<Ipv4Address, size_t> { public: size_t operator() (Ipv4Address const &x) const; }; bool operator == (Ipv4Mask const &a, Ipv4Mask const &b); bool operator != (Ipv4Mask const &a, Ipv4Mask const &b); } // namespace ns3 #endif /* IPV4_ADDRESS_H */
zy901002-gpsr
src/network/utils/ipv4-address.h
C++
gpl2
9,469
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ // // Copyright (c) 2008-2010 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 J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com> // #ifndef NS3_SEQ_NUM_H #define NS3_SEQ_NUM_H #include <limits> #include <iostream> #include <stdint.h> namespace ns3 { /** * \brief Generic "sequence number" class * * This class can be used to handle sequence numbers. In networking * protocols, sequence numbers are fixed precision integer numbers * that are used to order events relative to each other. A sequence * number is expected to increase over time but, since it has a * limited number of bits, the number will "wrap around" from the * maximum value that can represented with the given number of bits * back to zero. For this reason, comparison of two sequence numbers, * and subtraction, is non-trivial. The SequenceNumber class behaves * like a number, with the usual arythmetic operators implemented, but * knows how to correctly compare and subtract sequence numbers. * * This is a templated class. To use it you need to supply two * fundamental types as template parameters: NUMERIC_TYPE and * SIGNED_TYPE. For instance, SequenceNumber<uint32_t, int32_t> gives * you a 32-bit sequence number, while SequenceNumber<uint16_t, * int16_t> is a 16-bit one. For your convenience, these are * typedef'ed as SequenceNumber32 and SequenceNumber16, respectively. */ template<typename NUMERIC_TYPE, typename SIGNED_TYPE> class SequenceNumber { public: SequenceNumber () : m_value (0) {} /** * \brief Constructs a SequenceNumber with the given value * \param value the sequence number value */ explicit SequenceNumber (NUMERIC_TYPE value) : m_value (value) {} // copy contructor SequenceNumber (SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> const &value) : m_value (value.m_value) {} // assignment from a plain number SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& operator= (NUMERIC_TYPE value) { m_value = value; return *this; } // assignment from a sequence number SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& operator= (SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> const &value) { m_value = value.m_value; return *this; } #if 0 // a SequenceNumber implicitly converts to a plain number, but not the other way around operator NUMERIC_TYPE () const { return m_value; } #endif /** * \brief Extracts the numeric value of the sequence number * \returns the sequence number value */ NUMERIC_TYPE GetValue () const { return m_value; } // prefix ++ SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator++ () { m_value++; return *this; } // postfix ++ SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator++ (int) { SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> retval (m_value); m_value++; return retval; } // prefix -- SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator-- () { m_value--; return *this; } // postfix -- SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator-- (int) { SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> retval (m_value); m_value--; return retval; } SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& operator+= (SIGNED_TYPE value) { m_value += value; return *this; } SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& operator-= (SIGNED_TYPE value) { m_value -= value; return *this; } SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator + (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> &other) const { return SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> (m_value + other.m_value); } SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator + (SIGNED_TYPE delta) const { return SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> (m_value + delta); } SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator - (SIGNED_TYPE delta) const { return SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> (m_value - delta); } SIGNED_TYPE operator - (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> &other) const { static const NUMERIC_TYPE maxValue = std::numeric_limits<NUMERIC_TYPE>::max (); static const NUMERIC_TYPE halfMaxValue = std::numeric_limits<NUMERIC_TYPE>::max () / 2; if (m_value > other.m_value) { NUMERIC_TYPE diff = m_value - other.m_value; if (diff < halfMaxValue) { return static_cast<SIGNED_TYPE> (diff); } else { // |------------|------------| // ==== === // ^ ^ // other.m_value m_value return -(static_cast<SIGNED_TYPE> (maxValue - m_value + 1 + other.m_value)); } } else { NUMERIC_TYPE diff = other.m_value - m_value; if (diff < halfMaxValue) { // |------------|------------| // ======== // ^ ^ // m_value other.m_value return -(static_cast<SIGNED_TYPE> (diff)); } else { // |------------|------------| // ==== === // ^ ^ // m_value other.m_value return static_cast<SIGNED_TYPE> (maxValue - other.m_value + 1 + m_value); } } } // Here is the critical part, how the comparison is made taking into // account wrap-around. From RFC 3626: // // The sequence number S1 is said to be "greater than" the sequence // number S2 if: // // S1 > S2 AND S1 - S2 <= MAXVALUE/2 OR // // S2 > S1 AND S2 - S1 > MAXVALUE/2 bool operator > (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> &other) const { static const NUMERIC_TYPE halfMaxValue = std::numeric_limits<NUMERIC_TYPE>::max () / 2; return (((m_value > other.m_value) && (m_value - other.m_value) <= halfMaxValue) || ((other.m_value > m_value) && (other.m_value - m_value) > halfMaxValue)); } bool operator == (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> &other) const { return (m_value == other.m_value); } bool operator != (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> &other) const { return (m_value != other.m_value); } bool operator <= (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> &other) const { return (!this->operator> (other)); } bool operator >= (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> &other) const { return (this->operator> (other) || this->operator== (other)); } bool operator < (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> &other) const { return !this->operator> (other) && m_value != other.m_value; } template<typename NUMERIC_TYPE2, typename SIGNED_TYPE2> friend std::ostream & operator<< (std::ostream& os, const SequenceNumber<NUMERIC_TYPE2, SIGNED_TYPE2> &val); template<typename NUMERIC_TYPE2, typename SIGNED_TYPE2> friend std::istream & operator >> (std::istream &is, const SequenceNumber<NUMERIC_TYPE2, SIGNED_TYPE2> &val); private: // unimplemented operators SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& operator+= (SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> const &value); SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& operator-= (SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> const &value); SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator* (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const; SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator/ (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const; SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator% (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const; bool operator ! () const; bool operator && (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const; bool operator || (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const; SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator~ () const; SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator& (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const; SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator| (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const; SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator^ (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const; SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator<< (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const; SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator>> (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const; int operator* (); //SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>* operator& (); private: NUMERIC_TYPE m_value; }; template<typename NUMERIC_TYPE, typename SIGNED_TYPE> std::ostream & operator<< (std::ostream& os, const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> &val) { os << val.m_value; return os; } template<typename NUMERIC_TYPE, typename SIGNED_TYPE> std::istream & operator >> (std::istream &is, const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> &val) { is >> val.m_value; return is; } typedef SequenceNumber<uint32_t, int32_t> SequenceNumber32; typedef SequenceNumber<uint16_t, int16_t> SequenceNumber16; } // namespace ns3 #endif /* NS3_SEQ_NUM_H */
zy901002-gpsr
src/network/utils/sequence-number.h
C++
gpl2
9,922
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "ns3/log.h" #include "ns3/trace-source-accessor.h" #include "queue.h" NS_LOG_COMPONENT_DEFINE ("Queue"); namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (Queue); TypeId Queue::GetTypeId (void) { static TypeId tid = TypeId ("ns3::Queue") .SetParent<Object> () .AddTraceSource ("Enqueue", "Enqueue a packet in the queue.", MakeTraceSourceAccessor (&Queue::m_traceEnqueue)) .AddTraceSource ("Dequeue", "Dequeue a packet from the queue.", MakeTraceSourceAccessor (&Queue::m_traceDequeue)) .AddTraceSource ("Drop", "Drop a packet stored in the queue.", MakeTraceSourceAccessor (&Queue::m_traceDrop)) ; return tid; } Queue::Queue() : m_nBytes (0), m_nTotalReceivedBytes (0), m_nPackets (0), m_nTotalReceivedPackets (0), m_nTotalDroppedBytes (0), m_nTotalDroppedPackets (0) { NS_LOG_FUNCTION_NOARGS (); } Queue::~Queue() { NS_LOG_FUNCTION_NOARGS (); } bool Queue::Enqueue (Ptr<Packet> p) { NS_LOG_FUNCTION (this << p); // // If DoEnqueue fails, Queue::Drop is called by the subclass // bool retval = DoEnqueue (p); if (retval) { NS_LOG_LOGIC ("m_traceEnqueue (p)"); m_traceEnqueue (p); uint32_t size = p->GetSize (); m_nBytes += size; m_nTotalReceivedBytes += size; m_nPackets++; m_nTotalReceivedPackets++; } return retval; } Ptr<Packet> Queue::Dequeue (void) { NS_LOG_FUNCTION (this); Ptr<Packet> packet = DoDequeue (); if (packet != 0) { NS_ASSERT (m_nBytes >= packet->GetSize ()); NS_ASSERT (m_nPackets > 0); m_nBytes -= packet->GetSize (); m_nPackets--; NS_LOG_LOGIC ("m_traceDequeue (packet)"); m_traceDequeue (packet); } return packet; } void Queue::DequeueAll (void) { NS_LOG_FUNCTION (this); while (!IsEmpty ()) { Dequeue (); } } Ptr<const Packet> Queue::Peek (void) const { NS_LOG_FUNCTION (this); return DoPeek (); } uint32_t Queue::GetNPackets (void) const { NS_LOG_FUNCTION_NOARGS (); NS_LOG_LOGIC ("returns " << m_nPackets); return m_nPackets; } uint32_t Queue::GetNBytes (void) const { NS_LOG_FUNCTION_NOARGS (); NS_LOG_LOGIC (" returns " << m_nBytes); return m_nBytes; } bool Queue::IsEmpty (void) const { NS_LOG_FUNCTION_NOARGS (); NS_LOG_LOGIC ("returns " << (m_nPackets == 0)); return m_nPackets == 0; } uint32_t Queue::GetTotalReceivedBytes (void) const { NS_LOG_FUNCTION_NOARGS (); NS_LOG_LOGIC ("returns " << m_nTotalReceivedBytes); return m_nTotalReceivedBytes; } uint32_t Queue::GetTotalReceivedPackets (void) const { NS_LOG_FUNCTION_NOARGS (); NS_LOG_LOGIC ("returns " << m_nTotalReceivedPackets); return m_nTotalReceivedPackets; } uint32_t Queue:: GetTotalDroppedBytes (void) const { NS_LOG_FUNCTION_NOARGS (); NS_LOG_LOGIC ("returns " << m_nTotalDroppedBytes); return m_nTotalDroppedBytes; } uint32_t Queue::GetTotalDroppedPackets (void) const { NS_LOG_FUNCTION_NOARGS (); NS_LOG_LOGIC ("returns " << m_nTotalDroppedPackets); return m_nTotalDroppedPackets; } void Queue::ResetStatistics (void) { NS_LOG_FUNCTION_NOARGS (); m_nTotalReceivedBytes = 0; m_nTotalReceivedPackets = 0; m_nTotalDroppedBytes = 0; m_nTotalDroppedPackets = 0; } void Queue::Drop (Ptr<Packet> p) { NS_LOG_FUNCTION (this << p); m_nTotalDroppedPackets++; m_nTotalDroppedBytes += p->GetSize (); NS_LOG_LOGIC ("m_traceDrop (p)"); m_traceDrop (p); } } // namespace ns3
zy901002-gpsr
src/network/utils/queue.cc
C++
gpl2
4,269
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Tom Henderson <tomhend@u.washington.edu> * This code has been ported from ns-2 (queue/errmodel.{cc,h} */ #ifndef ERROR_MODEL_H #define ERROR_MODEL_H #include <list> #include "ns3/object.h" #include "ns3/random-variable.h" namespace ns3 { class Packet; /** * \ingroup network * \defgroup errormodel Error Model */ /** * \ingroup errormodel * \brief General error model that can be used to corrupt packets * * This object is used to flag packets as being lost/errored or not. * It is part of the Object framework and can be aggregated to * other ns3 objects and handled by the Ptr class. * * The main method is IsCorrupt(Ptr<Packet> p) which returns true if * the packet is to be corrupted according to the underlying model. * Depending on the error model, the packet itself may have its packet * data buffer errored or not, or side information may be returned to * the client in the form of a packet tag. (Note: No such error models * that actually error the bits in a packet presently exist). * The object can have state (resettable by Reset()). * The object can also be enabled and disabled via two public member functions. * * Typical code (simplified) to use an ErrorModel may look something like * this: * \code * Ptr<ErrorModel> rem = CreateObject<RateErrorModel> (); * rem->SetRandomVariable (UniformVariable ()); * rem->SetRate (0.001); * ... * Ptr<Packet> p; * if (rem->IsCorrupt (p)) * { * dropTrace(p); * } else { * Forward (p); * } * \endcode * * Two practical error models, a ListErrorModel and a RateErrorModel, * are currently implemented. */ class ErrorModel : public Object { public: static TypeId GetTypeId (void); ErrorModel (); virtual ~ErrorModel (); /** * Note: Depending on the error model, this function may or may not * alter the contents of the packet upon returning true. * * \returns true if the Packet is to be considered as errored/corrupted * \param pkt Packet to apply error model to */ bool IsCorrupt (Ptr<Packet> pkt); /** * Reset any state associated with the error model */ void Reset (void); /** * Enable the error model */ void Enable (void); /** * Disable the error model */ void Disable (void); /** * \return true if error model is enabled; false otherwise */ bool IsEnabled (void) const; private: /* * These methods must be implemented by subclasses */ virtual bool DoCorrupt (Ptr<Packet>) = 0; virtual void DoReset (void) = 0; bool m_enable; }; enum ErrorUnit { EU_BIT, EU_BYTE, EU_PKT }; /** * \brief Determine which packets are errored corresponding to an underlying * distribution, rate, and unit. * * This object is used to flag packets as being lost/errored or not. * The two parameters that govern the behavior are the rate (or * equivalently, the mean duration/spacing between errors), and the * unit (which may be per-bit, per-byte, and per-packet). * Users can optionally provide a RandomVariable object; the default * is to use a Uniform(0,1) distribution. * Reset() on this model will do nothing * * IsCorrupt() will not modify the packet data buffer */ class RateErrorModel : public ErrorModel { public: static TypeId GetTypeId (void); RateErrorModel (); virtual ~RateErrorModel (); /** * \returns the ErrorUnit being used by the underlying model */ enum ErrorUnit GetUnit (void) const; /** * \param error_unit the ErrorUnit to be used by the underlying model */ void SetUnit (enum ErrorUnit error_unit); /** * \returns the error rate being applied by the model */ double GetRate (void) const; /** * \param rate the error rate to be used by the model */ void SetRate (double rate); /** * \param ranvar A random variable distribution to generate random variates */ void SetRandomVariable (const RandomVariable &ranvar); private: virtual bool DoCorrupt (Ptr<Packet> p); virtual bool DoCorruptPkt (Ptr<Packet> p); virtual bool DoCorruptByte (Ptr<Packet> p); virtual bool DoCorruptBit (Ptr<Packet> p); virtual void DoReset (void); enum ErrorUnit m_unit; double m_rate; RandomVariable m_ranvar; }; /** * \brief Provide a list of Packet uids to corrupt * * This object is used to flag packets as being lost/errored or not. * A note on performance: the list is assumed to be unordered, and * in general, Packet uids received may be unordered. Therefore, * each call to IsCorrupt() will result in a walk of the list with * the present underlying implementation. * * Note also that if one wants to target multiple packets from looking * at an (unerrored) trace file, the act of erroring a given packet may * cause subsequent packet uids to change. For instance, suppose one wants * to error packets 11 and 17 on a given device. It may be that erroring * packet 11 will cause the subsequent uid stream to change and 17 may no * longer correspond to the second packet that one wants to lose. Therefore, * be advised that it might take some trial and error to select the * right uids when multiple are provided. * * Reset() on this model will clear the list * * IsCorrupt() will not modify the packet data buffer */ class ListErrorModel : public ErrorModel { public: static TypeId GetTypeId (void); ListErrorModel (); virtual ~ListErrorModel (); /** * \return a copy of the underlying list */ std::list<uint32_t> GetList (void) const; /** * \param packetlist The list of packet uids to error. * * This method overwrites any previously provided list. */ void SetList (const std::list<uint32_t> &packetlist); private: virtual bool DoCorrupt (Ptr<Packet> p); virtual void DoReset (void); typedef std::list<uint32_t> PacketList; typedef std::list<uint32_t>::const_iterator PacketListCI; PacketList m_packetList; }; /** * \brief Provide a list of Packets to corrupt * * This model also processes a user-generated list of packets to * corrupt, except that the list corresponds to the sequence of * received packets as observed by this error model, and not the * Packet UID. * * Reset() on this model will clear the list * * IsCorrupt() will not modify the packet data buffer */ class ReceiveListErrorModel : public ErrorModel { public: static TypeId GetTypeId (void); ReceiveListErrorModel (); virtual ~ReceiveListErrorModel (); /** * \return a copy of the underlying list */ std::list<uint32_t> GetList (void) const; /** * \param packetlist The list of packets to error. * * This method overwrites any previously provided list. */ void SetList (const std::list<uint32_t> &packetlist); private: virtual bool DoCorrupt (Ptr<Packet> p); virtual void DoReset (void); typedef std::list<uint32_t> PacketList; typedef std::list<uint32_t>::const_iterator PacketListCI; PacketList m_packetList; uint32_t m_timesInvoked; }; } // namespace ns3 #endif
zy901002-gpsr
src/network/utils/error-model.h
C++
gpl2
7,757
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- def build(bld): network = bld.create_ns3_module('network', ['core']) network.source = [ 'model/address.cc', 'model/application.cc', 'model/buffer.cc', 'model/byte-tag-list.cc', 'model/channel.cc', 'model/channel-list.cc', 'model/chunk.cc', 'model/header.cc', 'model/nix-vector.cc', 'model/node.cc', 'model/node-list.cc', 'model/net-device.cc', 'model/packet.cc', 'model/packet-metadata.cc', 'model/packet-tag-list.cc', 'model/socket.cc', 'model/socket-factory.cc', 'model/tag.cc', 'model/tag-buffer.cc', 'model/trailer.cc', 'utils/address-utils.cc', 'utils/data-rate.cc', 'utils/drop-tail-queue.cc', 'utils/error-model.cc', 'utils/ethernet-header.cc', 'utils/ethernet-trailer.cc', 'utils/flow-id-tag.cc', 'utils/inet-socket-address.cc', 'utils/inet6-socket-address.cc', 'utils/ipv4-address.cc', 'utils/ipv6-address.cc', 'utils/mac48-address.cc', 'utils/mac64-address.cc', 'utils/llc-snap-header.cc', 'utils/output-stream-wrapper.cc', 'utils/packetbb.cc', 'utils/packet-burst.cc', 'utils/packet-socket.cc', 'utils/packet-socket-address.cc', 'utils/packet-socket-factory.cc', 'utils/pcap-file.cc', 'utils/pcap-file-wrapper.cc', 'utils/queue.cc', 'utils/radiotap-header.cc', 'utils/simple-channel.cc', 'utils/simple-net-device.cc', 'helper/application-container.cc', 'helper/net-device-container.cc', 'helper/node-container.cc', 'helper/packet-socket-helper.cc', 'helper/trace-helper.cc', ] network_test = bld.create_ns3_module_test_library('network') network_test.source = [ 'test/buffer-test.cc', 'test/drop-tail-queue-test-suite.cc', 'test/packetbb-test-suite.cc', 'test/packet-test-suite.cc', 'test/packet-metadata-test.cc', 'test/pcap-file-test-suite.cc', 'test/sequence-number-test-suite.cc', ] headers = bld.new_task_gen(features=['ns3header']) headers.module = 'network' headers.source = [ 'model/address.h', 'model/application.h', 'model/buffer.h', 'model/byte-tag-list.h', 'model/channel.h', 'model/channel-list.h', 'model/chunk.h', 'model/header.h', 'model/net-device.h', 'model/nix-vector.h', 'model/node.h', 'model/node-list.h', 'model/packet.h', 'model/packet-metadata.h', 'model/packet-tag-list.h', 'model/socket.h', 'model/socket-factory.h', 'model/tag.h', 'model/tag-buffer.h', 'model/trailer.h', 'utils/address-utils.h', 'utils/data-rate.h', 'utils/drop-tail-queue.h', 'utils/error-model.h', 'utils/ethernet-header.h', 'utils/ethernet-trailer.h', 'utils/flow-id-tag.h', 'utils/inet-socket-address.h', 'utils/inet6-socket-address.h', 'utils/ipv4-address.h', 'utils/ipv6-address.h', 'utils/llc-snap-header.h', 'utils/mac48-address.h', 'utils/mac64-address.h', 'utils/output-stream-wrapper.h', 'utils/packetbb.h', 'utils/packet-burst.h', 'utils/packet-socket.h', 'utils/packet-socket-address.h', 'utils/packet-socket-factory.h', 'utils/pcap-file.h', 'utils/pcap-file-wrapper.h', 'utils/generic-phy.h', 'utils/queue.h', 'utils/radiotap-header.h', 'utils/sequence-number.h', 'utils/sgi-hashmap.h', 'utils/simple-channel.h', 'utils/simple-net-device.h', 'utils/pcap-test.h', 'helper/application-container.h', 'helper/net-device-container.h', 'helper/node-container.h', 'helper/packet-socket-helper.h', 'helper/trace-helper.h', ] if (bld.env['ENABLE_EXAMPLES']): bld.add_subdirs('examples') bld.ns3_python_bindings()
zy901002-gpsr
src/network/wscript
Python
gpl2
4,278
#! /usr/bin/env python import sys from optparse import OptionParser import os WSCRIPT_TEMPLATE = '''# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- # def options(opt): # pass # def configure(conf): # conf.check_nonfatal(header_name='stdint.h', define_name='HAVE_STDINT_H') def build(bld): module = bld.create_ns3_module(%(MODULE)r, ['core']) module.source = [ 'model/%(MODULE)s.cc', 'helper/%(MODULE)s-helper.cc', ] headers = bld.new_task_gen(features=['ns3header']) headers.module = %(MODULE)r headers.source = [ 'model/%(MODULE)s.h', 'helper/%(MODULE)s-helper.h', ] if bld.env.ENABLE_EXAMPLES: bld.add_subdirs('examples') # bld.ns3_python_bindings() ''' MODEL_CC_TEMPLATE = '''/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ #include "%(MODULE)s.h" namespace ns3 { /* ... */ } ''' MODEL_H_TEMPLATE = '''/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ #ifndef %(INCLUDE_GUARD)s #define %(INCLUDE_GUARD)s namespace ns3 { /* ... */ } #endif /* %(INCLUDE_GUARD)s */ ''' HELPER_CC_TEMPLATE = '''/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ #include "%(MODULE)s-helper.h" namespace ns3 { /* ... */ } ''' HELPER_H_TEMPLATE = '''/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ #ifndef %(INCLUDE_GUARD)s #define %(INCLUDE_GUARD)s #include "ns3/%(MODULE)s.h" namespace ns3 { /* ... */ } #endif /* %(INCLUDE_GUARD)s */ ''' EXAMPLES_WSCRIPT_TEMPLATE = '''# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- def build(bld): obj = bld.create_ns3_program('%(MODULE)s-example', [%(MODULE)r]) obj.source = '%(MODULE)s-example.cc' ''' EXAMPLE_CC_TEMPLATE = '''/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ #include "ns3/core-module.h" #include "ns3/%(MODULE)s-helper.h" using namespace ns3; int main (int argc, char *argv[]) { bool verbose = true; CommandLine cmd; cmd.AddValue ("verbose", "Tell application to log if true", verbose); cmd.Parse (argc,argv); /* ... */ Simulator::Run (); Simulator::Destroy (); return 0; } ''' def main(argv): parser = OptionParser(usage=("Usage: %prog [options] modulename\n" "Utility script to create a basic template for a new ns-3 module")) (options, args) = parser.parse_args() if len(args) != 1: parser.print_help() return 1 modname = args[0] assert os.path.sep not in modname moduledir = os.path.join(os.path.dirname(__file__), modname) if os.path.exists(moduledir): print >> sys.stderr, "Module %r already exists" % (modname,) return 2 os.mkdir(moduledir) wscript = file(os.path.join(moduledir, "wscript"), "wt") wscript.write(WSCRIPT_TEMPLATE % dict(MODULE=modname)) wscript.close() # # model # modeldir = os.path.join(moduledir, "model") os.mkdir(modeldir) model_cc = file(os.path.join(moduledir, "model", "%s.cc" % modname), "wt") model_cc.write(MODEL_CC_TEMPLATE % dict(MODULE=modname)) model_cc.close() model_h = file(os.path.join(moduledir, "model", "%s.h" % modname), "wt") model_h.write(MODEL_H_TEMPLATE % dict(MODULE=modname, INCLUDE_GUARD="__%s_H__" % (modname.upper()),)) model_h.close() # # helper # helperdir = os.path.join(moduledir, "helper") os.mkdir(helperdir) helper_cc = file(os.path.join(moduledir, "helper", "%s-helper.cc" % modname), "wt") helper_cc.write(HELPER_CC_TEMPLATE % dict(MODULE=modname)) helper_cc.close() helper_h = file(os.path.join(moduledir, "helper", "%s-helper.h" % modname), "wt") helper_h.write(HELPER_H_TEMPLATE % dict(MODULE=modname, INCLUDE_GUARD="__%s_HELPER_H__" % (modname.upper()),)) helper_h.close() examplesdir = os.path.join(moduledir, "examples") os.mkdir(examplesdir) examples_wscript = file(os.path.join(examplesdir, "wscript"), "wt") examples_wscript.write(EXAMPLES_WSCRIPT_TEMPLATE % dict(MODULE=modname)) examples_wscript.close() example_cc = file(os.path.join(moduledir, "examples", "%s-example.cc" % modname), "wt") example_cc.write(EXAMPLE_CC_TEMPLATE % dict(MODULE=modname)) example_cc.close() return 0 if __name__ == '__main__': sys.exit(main(sys.argv))
zy901002-gpsr
src/create-module.py
Python
gpl2
4,438
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2009 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef TAP_BRIDGE_H #define TAP_BRIDGE_H #include <string.h> #include "ns3/address.h" #include "ns3/net-device.h" #include "ns3/node.h" #include "ns3/callback.h" #include "ns3/packet.h" #include "ns3/traced-callback.h" #include "ns3/event-id.h" #include "ns3/nstime.h" #include "ns3/data-rate.h" #include "ns3/ptr.h" #include "ns3/mac48-address.h" #include "ns3/unix-fd-reader.h" #include "ns3/realtime-simulator-impl.h" namespace ns3 { class TapBridgeFdReader : public FdReader { private: FdReader::Data DoRead (void); }; class Node; /** * \ingroup tap-bridge * * \brief A bridge to make it appear that a real host process is connected to * an ns-3 net device. * * The Tap Bridge lives in a kind of a gray world somewhere between a * Linux host and an ns-3 bridge device. From the Linux perspective, * this code appears as the user mode handler for a Tap net device. That * is, when the Linux host writes to a /dev/tap device (that is either * manually or automatically created depending on basic operating mode * -- more on this later), the write is redirected into the TapBridge that * lives in the ns-3 world; and from this perspective, becomes a read. * In other words, a Linux process writes a packet to a tap device and * this packet is redirected to an ns-3 process where it is received by * the TapBridge as a result of a read operation there. The TapBridge * then sends the packet to the ns-3 net device to which it is bridged. * In the other direction, a packet received by an ns-3 net device is * bridged to the TapBridge (it appears via a callback from that net * device. The TapBridge then takes that packet and writes it back to * the host using the Linux TAP mechanism. This write to the device will * then appear to the Linux host as if a packet has arrived on its * device. * * The upshot is that the Tap Bridge appears to bridge a tap device on a * Linux host in the "real world" to an ns-3 net device in the simulation * and make is appear that a ns-3 net device is actually installed in the * Linux host. In order to do this on the ns-3 side, we need a "ghost * node" in the simulation to hold the bridged ns-3 net device and the * TapBridge. This node should not actually do anything else in the * simulation since its job is simply to make the net device appear in * Linux. This is not just arbitrary policy, it is because: * * - Bits sent to the Tap Bridge from higher layers in the ghost node (using * the TapBridge Send() method) are completely ignored. The Tap Bridge is * not, itself, connected to any network, neither in Linux nor in ns-3; * - The bridged ns-3 net device is has had its receive callback disconnected * from the ns-3 node and reconnected to the Tap Bridge. All data received * by a bridged device will be sent to the Linux host and will not be * received by the node. From the perspective of the ghost node, you can * send over this device but you cannot ever receive. * * Of course, if you understand all of the issues you can take control of * your own destiny and do whatever you want -- we do not actively * prevent you from using the ghost node for anything you decide. You * will be able to perform typical ns-3 operations on the ghost node if * you so desire. The internet stack, for example, must be there and * functional on that node in order to participate in IP address * assignment and global routing. However, as mentioned above, * interfaces talking any Tap Bridge or associated bridged net devices * will not work completely. If you understand exactly what you are * doing, you can set up other interfaces and devices on the ghost node * and use them; or take advantage of the operational send side of the * bridged devices to create traffic generators. We generally recommend * that you treat this node as a ghost of the Linux host and leave it to * itself, though. */ class TapBridge : public NetDevice { public: static TypeId GetTypeId (void); /** * Enumeration of the operating modes supported in the class. * */ enum Mode { ILLEGAL, /**< mode not set */ CONFIGURE_LOCAL, /**< ns-3 creates and configures tap device */ USE_LOCAL, /**< ns-3 uses a pre-created tap, without configuring it */ USE_BRIDGE, /**< ns-3 uses a pre-created tap, and bridges to a bridging net device */ }; TapBridge (); virtual ~TapBridge (); /** * \brief Get the bridged net device. * * The bridged net device is the ns-3 device to which this bridge is connected, * * \returns the bridged net device. */ Ptr<NetDevice> GetBridgedNetDevice (void); /** * \brief Set the ns-3 net device to bridge. * * This method tells the bridge which ns-3 net device it should use to connect * the simulation side of the bridge. * * \param bridgedDevice device to set * * \attention The ns-3 net device that is being set as the device must have an * an IP address assigned to it before the simulation is run. This address * will be used to set the hardware address of the host Linux device. */ void SetBridgedNetDevice (Ptr<NetDevice> bridgedDevice); /** * \brief Set a start time for the device. * * The tap bridge consumes a non-trivial amount of time to start. It starts * up in the context of a scheduled event to ensure that all configuration * has been completed before extracting the configuration (IP addresses, etc.) * In order to allow a more reasonable start-up sequence than a thundering * herd of devices, the time at which each device starts is also configurable * bot via the Attribute system and via this call. * * \param tStart the start time */ void Start (Time tStart); /** * Set a stop time for the device. * * @param tStop the stop time * * \see TapBridge::Start */ void Stop (Time tStop); /** * Set the operating mode of this device. * * \param mode The operating mode of this device. */ void SetMode (TapBridge::Mode mode); /** * Get the operating mode of this device. * * \returns The operating mode of this device. */ TapBridge::Mode GetMode (void); // // The following methods are inherited from NetDevice base class and are // documented there. // virtual void SetIfIndex (const uint32_t index); virtual uint32_t GetIfIndex (void) const; virtual Ptr<Channel> GetChannel (void) const; virtual void SetAddress (Address address); virtual Address GetAddress (void) const; virtual bool SetMtu (const uint16_t mtu); virtual uint16_t GetMtu (void) const; virtual bool IsLinkUp (void) const; virtual void AddLinkChangeCallback (Callback<void> callback); virtual bool IsBroadcast (void) const; virtual Address GetBroadcast (void) const; virtual bool IsMulticast (void) const; virtual Address GetMulticast (Ipv4Address multicastGroup) const; virtual bool IsPointToPoint (void) const; virtual bool IsBridge (void) const; virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber); virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber); virtual Ptr<Node> GetNode (void) const; virtual void SetNode (Ptr<Node> node); virtual bool NeedsArp (void) const; virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb); virtual void SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb); virtual bool SupportsSendFrom () const; virtual Address GetMulticast (Ipv6Address addr) const; protected: /** * \internal * * Call out to a separate process running as suid root in order to get our * tap device created. We do this to avoid having the entire simulation * running as root. If this method returns, we'll have a socket waiting * for us in m_sock that we can use to talk to the tap device. */ virtual void DoDispose (void); bool ReceiveFromBridgedDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol, Address const &src, Address const &dst, PacketType packetType); bool DiscardFromBridgedDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol, Address const &src); private: /** * \internal * * Call out to a separate process running as suid root in order to get our * tap device created. We do this to avoid having the entire simulation * running as root. If this method returns, we'll have a socket waiting * for us in m_sock that we can use to talk to the tap device. */ void CreateTap (void); /** * \internal * * Spin up the device */ void StartTapDevice (void); /** * \internal * * Tear down the device */ void StopTapDevice (void); /** * \internal * * Callback to process packets that are read */ void ReadCallback (uint8_t *buf, ssize_t len); /* * \internal * * Forward a packet received from the tap device to the bridged ns-3 * device * * \param buf A character buffer containing the actual packet bits that were * received from the host. * \param buf The length of the buffer. */ void ForwardToBridgedDevice (uint8_t *buf, ssize_t len); /** * \internal * * The host we are bridged to is in the evil real world. Do some sanity * checking on a received packet to make sure it isn't too evil for our * poor naive virginal simulator to handle. * * \param packet The packet we received from the host, and which we need * to check. * \param src A pointer to the data structure that will get the source * MAC address of the packet (extracted from the packet Ethernet * header). * \param dst A pointer to the data structure that will get the destination * MAC address of the packet (extracted from the packet Ethernet * header). * \param type A pointer to the variable that will get the packet type from * either the Ethernet header in the case of type interpretation * (DIX framing) or from the 802.2 LLC header in the case of * length interpretation (802.3 framing). */ Ptr<Packet> Filter (Ptr<Packet> packet, Address *src, Address *dst, uint16_t *type); /** * \internal * * Callback used to hook the standard packet receive callback of the TapBridge * ns-3 net device. This is never called, and therefore no packets will ever * be received forwarded up the IP stack on the ghost node through this device. */ NetDevice::ReceiveCallback m_rxCallback; /** * \internal * * Callback used to hook the promiscuous packet receive callback of the TapBridge * ns-3 net device. This is never called, and therefore no packets will ever * be received forwarded up the IP stack on the ghost node through this device. * * Note that we intercept the similar callback in the bridged device in order to * do the actual bridging between the bridged ns-3 net device and the Tap device * on the host. */ NetDevice::PromiscReceiveCallback m_promiscRxCallback; /** * \internal * * Pointer to the (ghost) Node to which we are connected. */ Ptr<Node> m_node; /** * \internal * * The ns-3 interface index of this TapBridge net device. */ uint32_t m_ifIndex; /** * \internal * * The common mtu to use for the net devices */ uint16_t m_mtu; /** * \internal * * The socket (actually interpreted as fd) to use to talk to the Tap device on * the real internet host. */ int m_sock; /** * \internal * * The ID of the ns-3 event used to schedule the start up of the underlying * host Tap device and ns-3 read thread. */ EventId m_startEvent; /** * \internal * * The ID of the ns-3 event used to schedule the tear down of the underlying * host Tap device and ns-3 read thread. */ EventId m_stopEvent; /** * \internal * * Includes the ns-3 read thread used to do blocking reads on the fd * corresponding to the host device. */ Ptr<TapBridgeFdReader> m_fdReader; /** * \internal * * The operating mode of the bridge. Tells basically who creates and * configures the underlying network tap. */ Mode m_mode; /** * \internal * * The (unused) MAC address of the TapBridge net device. Since the TapBridge * is implemented as a ns-3 net device, it is required to implement certain * functionality. In this case, the TapBridge is automatically assigned a * MAC address, but it is not used. */ Mac48Address m_address; /** * \internal * * Time to start spinning up the device */ Time m_tStart; /** * \internal * * Time to start tearing down the device */ Time m_tStop; /** * \internal * * The name of the device to create on the host. If the device name is the * empty string, we allow the host kernel to choose a name. */ std::string m_tapDeviceName; /** * \internal * * The IP address to use as the device default gateway on the host. */ Ipv4Address m_tapGateway; /** * \internal * * The IP address to use as the device IP on the host. */ Ipv4Address m_tapIp; /** * \internal * * The MAC address to use as the hardware address on the host; only used * in UseLocal mode. This value comes from the MAC * address assigned to the bridged ns-3 net device and matches the MAC * address of the underlying network TAP which we configured to have the * same value. */ Mac48Address m_tapMac; /** * \internal * * The network mask to assign to the device created on the host. */ Ipv4Mask m_tapNetmask; /** * \internal * * The ns-3 net device to which we are bridging. */ Ptr<NetDevice> m_bridgedDevice; /** * \internal * * Whether the MAC address of the underlying ns-3 device has already been * rewritten is stored in this variable (for UseLocal mode only). */ bool m_ns3AddressRewritten; /** * A 64K buffer to hold packet data while it is being sent. */ uint8_t *m_packetBuffer; /** * A copy of a raw pointer to the required real-time simulator implementation. * Never free this pointer! */ RealtimeSimulatorImpl *m_rtImpl; /* * a copy of the node id so the read thread doesn't have to GetNode() in * in order to find the node ID. Thread unsafe reference counting in * multithreaded apps is not a good thing. */ uint32_t m_nodeId; }; } // namespace ns3 #endif /* TAP_BRIDGE_H */
zy901002-gpsr
src/tap-bridge/model/tap-bridge.h
C++
gpl2
15,485
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2009 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "tap-bridge.h" #include "tap-encode-decode.h" #include "ns3/node.h" #include "ns3/channel.h" #include "ns3/packet.h" #include "ns3/ethernet-header.h" #include "ns3/llc-snap-header.h" #include "ns3/log.h" #include "ns3/abort.h" #include "ns3/boolean.h" #include "ns3/string.h" #include "ns3/enum.h" #include "ns3/ipv4.h" #include "ns3/simulator.h" #include "ns3/realtime-simulator-impl.h" #include "ns3/unix-fd-reader.h" #include "ns3/uinteger.h" #include <sys/wait.h> #include <sys/stat.h> #include <sys/socket.h> #include <sys/un.h> #include <errno.h> #include <limits> #include <stdlib.h> // // Sometimes having a tap-creator is actually more trouble than solution. In // these cases you can uncomment the define of TAP_CREATOR below and the // simulation will just use a device you have preconfigured. This is useful // if you are running in an environment where you have got to run as root, // such as ORBIT or CORE. // // #define NO_CREATOR #ifdef NO_CREATOR #include <fcntl.h> #include <net/if.h> #include <linux/if_tun.h> #include <sys/ioctl.h> #endif NS_LOG_COMPONENT_DEFINE ("TapBridge"); namespace ns3 { FdReader::Data TapBridgeFdReader::DoRead (void) { NS_LOG_FUNCTION_NOARGS (); uint32_t bufferSize = 65536; uint8_t *buf = (uint8_t *)malloc (bufferSize); NS_ABORT_MSG_IF (buf == 0, "malloc() failed"); NS_LOG_LOGIC ("Calling read on tap device fd " << m_fd); ssize_t len = read (m_fd, buf, bufferSize); if (len <= 0) { NS_LOG_INFO ("TapBridgeFdReader::DoRead(): done"); free (buf); buf = 0; len = 0; } return FdReader::Data (buf, len); } #define TAP_MAGIC 95549 NS_OBJECT_ENSURE_REGISTERED (TapBridge); TypeId TapBridge::GetTypeId (void) { static TypeId tid = TypeId ("ns3::TapBridge") .SetParent<NetDevice> () .AddConstructor<TapBridge> () .AddAttribute ("Mtu", "The MAC-level Maximum Transmission Unit", UintegerValue (0), MakeUintegerAccessor (&TapBridge::SetMtu, &TapBridge::GetMtu), MakeUintegerChecker<uint16_t> ()) .AddAttribute ("DeviceName", "The name of the tap device to create.", StringValue (""), MakeStringAccessor (&TapBridge::m_tapDeviceName), MakeStringChecker ()) .AddAttribute ("Gateway", "The IP address of the default gateway to assign to the host machine, when in ConfigureLocal mode.", Ipv4AddressValue ("255.255.255.255"), MakeIpv4AddressAccessor (&TapBridge::m_tapGateway), MakeIpv4AddressChecker ()) .AddAttribute ("IpAddress", "The IP address to assign to the tap device, when in ConfigureLocal mode. " "This address will override the discovered IP address of the simulated device.", Ipv4AddressValue ("255.255.255.255"), MakeIpv4AddressAccessor (&TapBridge::m_tapIp), MakeIpv4AddressChecker ()) .AddAttribute ("MacAddress", "The MAC address to assign to the tap device, when in ConfigureLocal mode. " "This address will override the discovered MAC address of the simulated device.", Mac48AddressValue (Mac48Address ("ff:ff:ff:ff:ff:ff")), MakeMac48AddressAccessor (&TapBridge::m_tapMac), MakeMac48AddressChecker ()) .AddAttribute ("Netmask", "The network mask to assign to the tap device, when in ConfigureLocal mode. " "This address will override the discovered MAC address of the simulated device.", Ipv4MaskValue ("255.255.255.255"), MakeIpv4MaskAccessor (&TapBridge::m_tapNetmask), MakeIpv4MaskChecker ()) .AddAttribute ("Start", "The simulation time at which to spin up the tap device read thread.", TimeValue (Seconds (0.)), MakeTimeAccessor (&TapBridge::m_tStart), MakeTimeChecker ()) .AddAttribute ("Stop", "The simulation time at which to tear down the tap device read thread.", TimeValue (Seconds (0.)), MakeTimeAccessor (&TapBridge::m_tStop), MakeTimeChecker ()) .AddAttribute ("Mode", "The operating and configuration mode to use.", EnumValue (USE_LOCAL), MakeEnumAccessor (&TapBridge::SetMode), MakeEnumChecker (CONFIGURE_LOCAL, "ConfigureLocal", USE_LOCAL, "UseLocal", USE_BRIDGE, "UseBridge")) ; return tid; } TapBridge::TapBridge () : m_node (0), m_ifIndex (0), m_sock (-1), m_startEvent (), m_stopEvent (), m_fdReader (0), m_ns3AddressRewritten (false) { NS_LOG_FUNCTION_NOARGS (); m_packetBuffer = new uint8_t[65536]; Start (m_tStart); } TapBridge::~TapBridge() { NS_LOG_FUNCTION_NOARGS (); StopTapDevice (); delete [] m_packetBuffer; m_packetBuffer = 0; m_bridgedDevice = 0; } void TapBridge::DoDispose () { NS_LOG_FUNCTION_NOARGS (); NetDevice::DoDispose (); } void TapBridge::Start (Time tStart) { NS_LOG_FUNCTION (tStart); // // Cancel any pending start event and schedule a new one at some relative time in the future. // Simulator::Cancel (m_startEvent); m_startEvent = Simulator::Schedule (tStart, &TapBridge::StartTapDevice, this); } void TapBridge::Stop (Time tStop) { NS_LOG_FUNCTION (tStop); // // Cancel any pending stop event and schedule a new one at some relative time in the future. // Simulator::Cancel (m_stopEvent); m_startEvent = Simulator::Schedule (tStop, &TapBridge::StopTapDevice, this); } void TapBridge::StartTapDevice (void) { NS_LOG_FUNCTION_NOARGS (); NS_ABORT_MSG_IF (m_sock != -1, "TapBridge::StartTapDevice(): Tap is already started"); // // We're going to need a pointer to the realtime simulator implementation. // It's important to remember that access to that implementation may happen // in a completely different thread than the simulator is running in (we're // going to spin up that thread below). We are talking about multiple threads // here, so it is very, very dangerous to do any kind of reference couning on // a shared object that is unaware of what is happening. What we are going to // do to address that is to get a reference to the realtime simulator here // where we are running in the context of a running simulator scheduler -- // recall we did a Simulator::Schedule of this method above. We get the // simulator implementation pointer in a single-threaded way and save the // underlying raw pointer for use by the (other) read thread. We must not // free this pointer or we may delete the simulator out from under us an // everyone else. We assume that the simulator implementation cannot be // replaced while the tap bridge is running and so will remain valid through // the time during which the read thread is running. // Ptr<RealtimeSimulatorImpl> impl = DynamicCast<RealtimeSimulatorImpl> (Simulator::GetImplementation ()); m_rtImpl = GetPointer (impl); // // A similar story exists for the node ID. We can't just naively do a // GetNode ()->GetId () since GetNode is going to give us a Ptr<Node> which // is reference counted. We need to stash away the node ID for use in the // read thread. // m_nodeId = GetNode ()->GetId (); // // Spin up the tap bridge and start receiving packets. // NS_LOG_LOGIC ("Creating tap device"); // // Call out to a separate process running as suid root in order to get the // tap device allocated and set up. We do this to avoid having the entire // simulation running as root. If this method returns, we'll have a socket // waiting for us in m_sock that we can use to talk to the newly created // tap device. // CreateTap (); // // Now spin up a read thread to read packets from the tap device. // NS_ABORT_MSG_IF (m_fdReader != 0,"TapBridge::StartTapDevice(): Receive thread is already running"); NS_LOG_LOGIC ("Spinning up read thread"); m_fdReader = Create<TapBridgeFdReader> (); m_fdReader->Start (m_sock, MakeCallback (&TapBridge::ReadCallback, this)); } void TapBridge::StopTapDevice (void) { NS_LOG_FUNCTION_NOARGS (); if (m_fdReader != 0) { m_fdReader->Stop (); m_fdReader = 0; } if (m_sock != -1) { close (m_sock); m_sock = -1; } } void TapBridge::CreateTap (void) { NS_LOG_FUNCTION_NOARGS (); // // The TapBridge has three distinct operating modes. At this point, the // differences revolve around who is responsible for creating and configuring // the underlying network tap that we use. In ConfigureLocal mode, the // TapBridge has the responsibility for creating and configuring the TAP. // // In UseBridge or UseLocal modes, the user will provide us a configuration // and we have to adapt to it. For example, in UseLocal mode, the user will // be configuring a tap device outside the scope of the ns-3 simulation and // will be expecting us to work with it. The user will do something like: // // sudo tunctl -t tap0 // sudo ifconfig tap0 hw ether 00:00:00:00:00:01 // sudo ifconfig tap0 10.1.1.1 netmask 255.255.255.0 up // // The user will then set the "Mode" Attribute of the TapBridge to "UseLocal" // and the "DeviceName" Attribute to "tap0" in this case. // // In ConfigureLocal mode, the user is asking the TapBridge to do the // configuration and create a TAP with the provided "DeviceName" with which // the user can later do what she wants. We need to extract values for the // MAC address, IP address, net mask, etc, from the simualtion itself and // use them to initialize corresponding values on the created tap device. // // In UseBridge mode, the user is asking us to use an existing tap device // has been included in an OS bridge. She is asking us to take the simulated // net device and logically add it to the existing bridge. We expect that // the user has done something like: // // sudo brctl addbr mybridge // sudo tunctl -t mytap // sudo ifconfig mytap hw ether 00:00:00:00:00:01 // sudo ifconfig mytap 0.0.0.0 up // sudo brctl addif mybridge mytap // sudo brctl addif mybridge ... // sudo ifconfig mybridge 10.1.1.1 netmask 255.255.255.0 up // // The bottom line at this point is that we want to either create or use a // tap device on the host based on the verb part "Use" or "Configure" of the // operating mode. Unfortunately for us you have to have root privileges to // do either. Instead of running the entire simulation as root, we decided // to make a small program who's whole reason for being is to run as suid // root and do what it takes to create the tap. We're just going to pass // off the configuration information to that program and let it deal with // the situation. // // We're going to fork and exec that program soon, but first we need to have // a socket to talk to it with. So we create a local interprocess (Unix) // socket for that purpose. // int sock = socket (PF_UNIX, SOCK_DGRAM, 0); NS_ABORT_MSG_IF (sock == -1, "TapBridge::CreateTap(): Unix socket creation error, errno = " << strerror (errno)); // // Bind to that socket and let the kernel allocate an endpoint // struct sockaddr_un un; memset (&un, 0, sizeof (un)); un.sun_family = AF_UNIX; int status = bind (sock, (struct sockaddr*)&un, sizeof (sa_family_t)); NS_ABORT_MSG_IF (status == -1, "TapBridge::CreateTap(): Could not bind(): errno = " << strerror (errno)); NS_LOG_INFO ("Created Unix socket"); NS_LOG_INFO ("sun_family = " << un.sun_family); NS_LOG_INFO ("sun_path = " << un.sun_path); // // We have a socket here, but we want to get it there -- to the program we're // going to exec. What we'll do is to do a getsockname and then encode the // resulting address information as a string, and then send the string to the // program as an argument. So we need to get the sock name. // socklen_t len = sizeof (un); status = getsockname (sock, (struct sockaddr*)&un, &len); NS_ABORT_MSG_IF (status == -1, "TapBridge::CreateTap(): Could not getsockname(): errno = " << strerror (errno)); // // Now encode that socket name (family and path) as a string of hex digits // std::string path = TapBufferToString ((uint8_t *)&un, len); NS_LOG_INFO ("Encoded Unix socket as \"" << path << "\""); // // Tom Goff reports the possiblility of a deadlock when trying to acquire the // python GIL here. He says that this might be due to trying to access Python // objects after fork() without calling PyOS_AfterFork() to properly reset // Python state (including the GIL). Originally these next three lines were // done after the fork, but were moved here to work around the deadlock. // Ptr<NetDevice> nd = GetBridgedNetDevice (); Ptr<Node> n = nd->GetNode (); Ptr<Ipv4> ipv4 = n->GetObject<Ipv4> (); // // Fork and exec the process to create our socket. If we're us (the parent) // we wait for the child (the creator) to complete and read the socket it // created and passed back using the ancillary data mechanism. // pid_t pid = ::fork (); if (pid == 0) { NS_LOG_DEBUG ("Child process"); // // build a command line argument from the encoded endpoint string that // the socket creation process will use to figure out how to respond to // the (now) parent process. We're going to have to give this program // quite a bit of information. // // -d<device-name> The name of the tap device we want to create; // -g<gateway-address> The IP address to use as the default gateway; // -i<IP-address> The IP address to assign to the new tap device; // -m<MAC-address> The MAC-48 address to assign to the new tap device; // -n<network-mask> The network mask to assign to the new tap device; // -o<operating mode> The operating mode of the bridge (1=ConfigureLocal, 2=UseLocal, 3=UseBridge) // -p<path> the path to the unix socket described above. // // Example tap-creator -dnewdev -g1.2.3.2 -i1.2.3.1 -m08:00:2e:00:01:23 -n255.255.255.0 -o1 -pblah // // We want to get as much of this stuff automagically as possible. // // For CONFIGURE_LOCAL mode only: // <IP-address> is the IP address we are going to set in the newly // created Tap device on the Linux host. At the point in the simulation // where devices are coming up, we should have all of our IP addresses // assigned. That means that we can find the IP address to assign to // the new Tap device from the IP address associated with the bridged // net device. // bool wantIp = (m_mode == CONFIGURE_LOCAL); if (wantIp && (ipv4 == 0) && m_tapIp.IsBroadcast () && m_tapNetmask.IsEqual (Ipv4Mask::GetOnes ())) { NS_FATAL_ERROR ("TapBridge::CreateTap(): Tap device IP configuration requested but neither IP address nor IP netmask is provided"); } // Some stub values to make tap-creator happy Ipv4Address ipv4Address ("255.255.255.255"); Ipv4Mask ipv4Mask ("255.255.255.255"); if (ipv4 != 0) { uint32_t index = ipv4->GetInterfaceForDevice (nd); if (ipv4->GetNAddresses (index) > 1) { NS_LOG_WARN ("Underlying bridged NetDevice has multiple IP addresses; using first one."); } ipv4Address = ipv4->GetAddress (index, 0).GetLocal (); // // The net mask is sitting right there next to the ipv4 address. // ipv4Mask = ipv4->GetAddress (index, 0).GetMask (); } // // The MAC address should also already be assigned and waiting for us in // the bridged net device. // Address address = nd->GetAddress (); Mac48Address mac48Address = Mac48Address::ConvertFrom (address); // // The device-name is something we may want the system to make up in // every case. We also rely on it being configured via an Attribute // through the helper. By default, it is set to the empty string // which tells the system to make up a device name such as "tap123". // std::ostringstream ossDeviceName; ossDeviceName << "-d" << m_tapDeviceName; // // The gateway-address is something we can't derive, so we rely on it // being configured via an Attribute through the helper. // std::ostringstream ossGateway; ossGateway << "-g" << m_tapGateway; // // For flexibility, we do allow a client to override any of the values // above via attributes, so only use our found values if the Attribute // is not equal to its default value (empty string or broadcast address). // std::ostringstream ossIp; if (m_tapIp.IsBroadcast ()) { ossIp << "-i" << ipv4Address; } else { ossIp << "-i" << m_tapIp; } std::ostringstream ossMac; if (m_tapMac.IsBroadcast ()) { ossMac << "-m" << mac48Address; } else { ossMac << "-m" << m_tapMac; } std::ostringstream ossNetmask; if (m_tapNetmask.IsEqual (Ipv4Mask::GetOnes ())) { ossNetmask << "-n" << ipv4Mask; } else { ossNetmask << "-n" << m_tapNetmask; } std::ostringstream ossMode; ossMode << "-o"; if (m_mode == CONFIGURE_LOCAL) { ossMode << "1"; } else if (m_mode == USE_LOCAL) { ossMode << "2"; } else { ossMode << "3"; } std::ostringstream ossPath; ossPath << "-p" << path; // // Execute the socket creation process image. // status = ::execlp ("tap-creator", "tap-creator", // argv[0] (filename) ossDeviceName.str ().c_str (), // argv[1] (-d<device name>) ossGateway.str ().c_str (), // argv[2] (-g<gateway>) ossIp.str ().c_str (), // argv[3] (-i<IP address>) ossMac.str ().c_str (), // argv[4] (-m<MAC address>) ossNetmask.str ().c_str (), // argv[5] (-n<net mask>) ossMode.str ().c_str (), // argv[6] (-o<operating mode>) ossPath.str ().c_str (), // argv[7] (-p<path>) (char *)NULL); // // If the execlp successfully completes, it never returns. If it returns it failed or the OS is // broken. In either case, we bail. // NS_FATAL_ERROR ("TapBridge::CreateTap(): Back from execlp(), errno = " << ::strerror (errno)); } else { NS_LOG_DEBUG ("Parent process"); // // We're the process running the emu net device. We need to wait for the // socket creator process to finish its job. // int st; pid_t waited = waitpid (pid, &st, 0); NS_ABORT_MSG_IF (waited == -1, "TapBridge::CreateTap(): waitpid() fails, errno = " << strerror (errno)); NS_ASSERT_MSG (pid == waited, "TapBridge::CreateTap(): pid mismatch"); // // Check to see if the socket creator exited normally and then take a // look at the exit code. If it bailed, so should we. If it didn't // even exit normally, we bail too. // if (WIFEXITED (st)) { int exitStatus = WEXITSTATUS (st); NS_ABORT_MSG_IF (exitStatus != 0, "TapBridge::CreateTap(): socket creator exited normally with status " << exitStatus); } else { NS_FATAL_ERROR ("TapBridge::CreateTap(): socket creator exited abnormally"); } // // At this point, the socket creator has run successfully and should // have created our tap device, initialized it with the information we // passed and sent it back to the socket address we provided. A socket // (fd) we can use to talk to this tap device should be waiting on the // Unix socket we set up to receive information back from the creator // program. We've got to do a bunch of grunt work to get at it, though. // // The struct iovec below is part of a scatter-gather list. It describes a // buffer. In this case, it describes a buffer (an integer) that will // get the data that comes back from the socket creator process. It will // be a magic number that we use as a consistency/sanity check. // struct iovec iov; uint32_t magic; iov.iov_base = &magic; iov.iov_len = sizeof(magic); // // The CMSG macros you'll see below are used to create and access control // messages (which is another name for ancillary data). The ancillary // data is made up of pairs of struct cmsghdr structures and associated // data arrays. // // First, we're going to allocate a buffer on the stack to receive our // data array (that contains the socket). Sometimes you'll see this called // an "ancillary element" but the msghdr uses the control message termimology // so we call it "control." // size_t msg_size = sizeof(int); char control[CMSG_SPACE (msg_size)]; // // There is a msghdr that is used to minimize the number of parameters // passed to recvmsg (which we will use to receive our ancillary data). // This structure uses terminology corresponding to control messages, so // you'll see msg_control, which is the pointer to the ancillary data and // controllen which is the size of the ancillary data array. // // So, initialize the message header that describes the ancillary/control // data we expect to receive and point it to buffer. // struct msghdr msg; msg.msg_name = 0; msg.msg_namelen = 0; msg.msg_iov = &iov; msg.msg_iovlen = 1; msg.msg_control = control; msg.msg_controllen = sizeof (control); msg.msg_flags = 0; // // Now we can actually receive the interesting bits from the tap // creator process. Lots of pain to get four bytes. // ssize_t bytesRead = recvmsg (sock, &msg, 0); NS_ABORT_MSG_IF (bytesRead != sizeof(int), "TapBridge::CreateTap(): Wrong byte count from socket creator"); // // There may be a number of message headers/ancillary data arrays coming in. // Let's look for the one with a type SCM_RIGHTS which indicates it's the // one we're interested in. // struct cmsghdr *cmsg; for (cmsg = CMSG_FIRSTHDR (&msg); cmsg != NULL; cmsg = CMSG_NXTHDR (&msg, cmsg)) { if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) { // // This is the type of message we want. Check to see if the magic // number is correct and then pull out the socket we care about if // it matches // if (magic == TAP_MAGIC) { NS_LOG_INFO ("Got SCM_RIGHTS with correct magic " << magic); int *rawSocket = (int*)CMSG_DATA (cmsg); NS_LOG_INFO ("Got the socket from the socket creator = " << *rawSocket); m_sock = *rawSocket; return; } else { NS_LOG_INFO ("Got SCM_RIGHTS, but with bad magic " << magic); } } } NS_FATAL_ERROR ("Did not get the raw socket from the socket creator"); } } void TapBridge::ReadCallback (uint8_t *buf, ssize_t len) { NS_LOG_FUNCTION_NOARGS (); NS_ASSERT_MSG (buf != 0, "invalid buf argument"); NS_ASSERT_MSG (len > 0, "invalid len argument"); // // It's important to remember that we're in a completely different thread // than the simulator is running in. We need to synchronize with that // other thread to get the packet up into ns-3. What we will need to do // is to schedule a method to deal with the packet using the multithreaded // simulator we are most certainly running. However, I just said it -- we // are talking about two threads here, so it is very, very dangerous to do // any kind of reference counting on a shared object. Just don't do it. // So what we're going to do is pass the buffer allocated on the heap // into the ns-3 context thread where it will create the packet. // NS_LOG_INFO ("TapBridge::ReadCallback(): Received packet on node " << m_nodeId); NS_LOG_INFO ("TapBridge::ReadCallback(): Scheduling handler"); NS_ASSERT_MSG (m_rtImpl, "TapBridge::ReadCallback(): Realtime simulator implementation pointer not set"); m_rtImpl->ScheduleRealtimeNowWithContext (m_nodeId, MakeEvent (&TapBridge::ForwardToBridgedDevice, this, buf, len)); } void TapBridge::ForwardToBridgedDevice (uint8_t *buf, ssize_t len) { NS_LOG_FUNCTION (buf << len); // // There are three operating modes for the TapBridge // // CONFIGURE_LOCAL means that ns-3 will create and configure a tap device // and we are expected to use it. The tap device and the ns-3 net device // will have the same MAC address by definition. Thus Send and SendFrom // are equivalent in this case. We use Send to allow all ns-3 devices to // participate in this mode. // // USE_LOCAL mode tells us that we have got to USE a pre-created tap device // that will have a different MAC address from the ns-3 net device. We // also enforce the requirement that there will only be one MAC address // bridged on the Linux side so we can use Send (instead of SendFrom) in // the linux to ns-3 direction. Again, all ns-3 devices can participate // in this mode. // // USE_BRIDGE mode tells us that we are logically extending a Linux bridge // on which lies our tap device. In this case there may be many linux // net devices on the other side of the bridge and so we must use SendFrom // to preserve the possibly many source addresses. Thus, ns-3 devices // must support SendFrom in order to be considered for USE_BRIDGE mode. // // // First, create a packet out of the byte buffer we received and free that // buffer. // Ptr<Packet> packet = Create<Packet> (reinterpret_cast<const uint8_t *> (buf), len); free (buf); buf = 0; // // Make sure the packet we received is reasonable enough for the rest of the // system to handle and get it ready to be injected directly into an ns-3 // device. What should come back is a packet with the Ethernet header // (and possibly an LLC header as well) stripped off. // Address src, dst; uint16_t type; NS_LOG_LOGIC ("Received packet from tap device"); Ptr<Packet> p = Filter (packet, &src, &dst, &type); if (p == 0) { NS_LOG_LOGIC ("TapBridge::ForwardToBridgedDevice: Discarding packet as unfit for ns-3 consumption"); return; } NS_LOG_LOGIC ("Pkt source is " << src); NS_LOG_LOGIC ("Pkt destination is " << dst); NS_LOG_LOGIC ("Pkt LengthType is " << type); if (m_mode == USE_LOCAL) { // // Packets we are going to forward should not be from a broadcast src // NS_ASSERT_MSG (Mac48Address::ConvertFrom (src) != Mac48Address ("ff:ff:ff:ff:ff:ff"), "TapBridge::ForwardToBridgedDevice: Source addr is broadcast"); if (m_ns3AddressRewritten == false) { // // Set the ns-3 device's mac address to the overlying container's // mac address // Mac48Address learnedMac = Mac48Address::ConvertFrom (src); NS_LOG_LOGIC ("Learned MacAddr is " << learnedMac << ": setting ns-3 device to use this address"); m_bridgedDevice->SetAddress (Mac48Address::ConvertFrom (learnedMac)); m_ns3AddressRewritten = true; } // // If we are operating in USE_LOCAL mode, we may be attached to an ns-3 // device that does not support bridging (SupportsSendFrom returns false). // But, since the mac addresses are now aligned, we can call Send() // NS_LOG_LOGIC ("Forwarding packet to ns-3 device via Send()"); m_bridgedDevice->Send (packet, dst, type); return; } // // If we are operating in USE_BRIDGE mode, we have the // situation described below: // // Other Device <-bridge-> Tap Device <-bridge-> ns3 device // Mac Addr A Mac Addr B Mac Addr C // // In Linux, "Other Device" and "Tap Device" are bridged together. By this // we mean that a user has sone something in Linux like: // // brctl addbr mybridge // brctl addif other-device // brctl addif tap-device // // In USE_BRIDGE mode, we want to logically extend this Linux behavior to the // simulated ns3 device and make it appear as if it is connected to the Linux // subnet. As you may expect, this means that we need to act like a real // Linux bridge and take all packets that come from "Tap Device" and ask // "ns3 Device" to send them down its directly connected network. Just like // in a normal everyday bridge we need to call SendFrom in order to preserve //the original packet's from address. // // If we are operating in CONFIGURE_LOCAL mode, we simply simply take all packets // that come from "Tap Device" and ask "ns3 Device" to send them down its // directly connected network. A normal bridge would need to call SendFrom // in order to preserve the original from address, but in CONFIGURE_LOCAL mode // the tap device and the ns-3 device have the same MAC address by definition so // we can call Send. // NS_LOG_LOGIC ("Forwarding packet"); if (m_mode == USE_BRIDGE) { m_bridgedDevice->SendFrom (packet, src, dst, type); } else { NS_ASSERT_MSG (m_mode == CONFIGURE_LOCAL, "TapBridge::ForwardToBridgedDevice(): Internal error"); m_bridgedDevice->Send (packet, dst, type); } } Ptr<Packet> TapBridge::Filter (Ptr<Packet> p, Address *src, Address *dst, uint16_t *type) { NS_LOG_FUNCTION (p); uint32_t pktSize; // // We have a candidate packet for injection into ns-3. We expect that since // it came over a socket that provides Ethernet packets, it should be big // enough to hold an EthernetHeader. If it can't, we signify the packet // should be filtered out by returning 0. // pktSize = p->GetSize (); EthernetHeader header (false); if (pktSize < header.GetSerializedSize ()) { return 0; } p->RemoveHeader (header); NS_LOG_LOGIC ("Pkt source is " << header.GetSource ()); NS_LOG_LOGIC ("Pkt destination is " << header.GetDestination ()); NS_LOG_LOGIC ("Pkt LengthType is " << header.GetLengthType ()); // // If the length/type is less than 1500, it corresponds to a length // interpretation packet. In this case, it is an 802.3 packet and // will also have an 802.2 LLC header. If greater than 1500, we // find the protocol number (Ethernet type) directly. // if (header.GetLengthType () <= 1500) { *src = header.GetSource (); *dst = header.GetDestination (); pktSize = p->GetSize (); LlcSnapHeader llc; if (pktSize < llc.GetSerializedSize ()) { return 0; } p->RemoveHeader (llc); *type = llc.GetType (); } else { *src = header.GetSource (); *dst = header.GetDestination (); *type = header.GetLengthType (); } // // What we give back is a packet without the Ethernet header (nor the // possible llc/snap header) on it. We think it is ready to send on // out the bridged net device. // return p; } Ptr<NetDevice> TapBridge::GetBridgedNetDevice (void) { NS_LOG_FUNCTION_NOARGS (); return m_bridgedDevice; } void TapBridge::SetBridgedNetDevice (Ptr<NetDevice> bridgedDevice) { NS_LOG_FUNCTION (bridgedDevice); NS_ASSERT_MSG (m_node != 0, "TapBridge::SetBridgedDevice: Bridge not installed in a node"); NS_ASSERT_MSG (bridgedDevice != this, "TapBridge::SetBridgedDevice: Cannot bridge to self"); NS_ASSERT_MSG (m_bridgedDevice == 0, "TapBridge::SetBridgedDevice: Already bridged"); if (!Mac48Address::IsMatchingType (bridgedDevice->GetAddress ())) { NS_FATAL_ERROR ("TapBridge::SetBridgedDevice: Device does not support eui 48 addresses: cannot be added to bridge."); } if (m_mode == USE_BRIDGE && !bridgedDevice->SupportsSendFrom ()) { NS_FATAL_ERROR ("TapBridge::SetBridgedDevice: Device does not support SendFrom: cannot be added to bridge."); } // // We need to disconnect the bridged device from the internet stack on our // node to ensure that only one stack responds to packets inbound over the // bridged device. That one stack lives outside ns-3 so we just blatantly // steal the device callbacks. // // N.B This can be undone if someone does a RegisterProtocolHandler later // on this node. // bridgedDevice->SetReceiveCallback (MakeCallback (&TapBridge::DiscardFromBridgedDevice, this)); bridgedDevice->SetPromiscReceiveCallback (MakeCallback (&TapBridge::ReceiveFromBridgedDevice, this)); m_bridgedDevice = bridgedDevice; } bool TapBridge::DiscardFromBridgedDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol, const Address &src) { NS_LOG_FUNCTION (device << packet << protocol << src); NS_LOG_LOGIC ("Discarding packet stolen from bridged device " << device); return true; } bool TapBridge::ReceiveFromBridgedDevice ( Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol, const Address &src, const Address &dst, PacketType packetType) { NS_LOG_FUNCTION (device << packet << protocol << src << dst << packetType); NS_ASSERT_MSG (device == m_bridgedDevice, "TapBridge::SetBridgedDevice: Received packet from unexpected device"); NS_LOG_DEBUG ("Packet UID is " << packet->GetUid ()); // // There are three operating modes for the TapBridge // // CONFIGURE_LOCAL means that ns-3 will create and configure a tap device // and we are expected to use it. The tap device and the ns-3 net device // will have the same MAC address by definition. // // USE_LOCAL mode tells us that we have got to USE a pre-created tap device // that will have a different MAC address from the ns-3 net device. In this // case we will be spoofing the MAC address of a received packet to match // the single allowed address on the Linux side. // // USE_BRIDGE mode tells us that we are logically extending a Linux bridge // on which lies our tap device. // if (m_mode == CONFIGURE_LOCAL && packetType == PACKET_OTHERHOST) { // // We hooked the promiscuous mode protocol handler so we could get the // destination address of the actual packet. This means we will be // getting PACKET_OTHERHOST packets (not broadcast, not multicast, not // unicast to the ns-3 net device, but to some other address). In // CONFIGURE_LOCAL mode we are not interested in these packets since they // don't refer to the single MAC address shared by the ns-3 device and // the TAP device. If, however, we are in USE_LOCAL or USE_BRIDGE mode, // we want to act like a bridge and forward these PACKET_OTHERHOST // packets. // return true; } Mac48Address from = Mac48Address::ConvertFrom (src); Mac48Address to = Mac48Address::ConvertFrom (dst); Ptr<Packet> p = packet->Copy (); EthernetHeader header = EthernetHeader (false); header.SetSource (from); header.SetDestination (to); header.SetLengthType (protocol); p->AddHeader (header); NS_LOG_LOGIC ("Writing packet to Linux host"); NS_LOG_LOGIC ("Pkt source is " << header.GetSource ()); NS_LOG_LOGIC ("Pkt destination is " << header.GetDestination ()); NS_LOG_LOGIC ("Pkt LengthType is " << header.GetLengthType ()); NS_LOG_LOGIC ("Pkt size is " << p->GetSize ()); NS_ASSERT_MSG (p->GetSize () <= 65536, "TapBridge::ReceiveFromBridgedDevice: Packet too big " << p->GetSize ()); p->CopyData (m_packetBuffer, p->GetSize ()); uint32_t bytesWritten = write (m_sock, m_packetBuffer, p->GetSize ()); NS_ABORT_MSG_IF (bytesWritten != p->GetSize (), "TapBridge::ReceiveFromBridgedDevice(): Write error."); NS_LOG_LOGIC ("End of receive packet handling on node " << m_node->GetId ()); return true; } void TapBridge::SetIfIndex (const uint32_t index) { NS_LOG_FUNCTION_NOARGS (); m_ifIndex = index; } uint32_t TapBridge::GetIfIndex (void) const { NS_LOG_FUNCTION_NOARGS (); return m_ifIndex; } Ptr<Channel> TapBridge::GetChannel (void) const { NS_LOG_FUNCTION_NOARGS (); return 0; } void TapBridge::SetAddress (Address address) { NS_LOG_FUNCTION (address); m_address = Mac48Address::ConvertFrom (address); } Address TapBridge::GetAddress (void) const { NS_LOG_FUNCTION_NOARGS (); return m_address; } void TapBridge::SetMode (enum Mode mode) { NS_LOG_FUNCTION (mode); m_mode = mode; } TapBridge::Mode TapBridge::GetMode (void) { NS_LOG_FUNCTION_NOARGS (); return m_mode; } bool TapBridge::SetMtu (const uint16_t mtu) { NS_LOG_FUNCTION_NOARGS (); m_mtu = mtu; return true; } uint16_t TapBridge::GetMtu (void) const { NS_LOG_FUNCTION_NOARGS (); return m_mtu; } bool TapBridge::IsLinkUp (void) const { NS_LOG_FUNCTION_NOARGS (); return true; } void TapBridge::AddLinkChangeCallback (Callback<void> callback) { NS_LOG_FUNCTION_NOARGS (); } bool TapBridge::IsBroadcast (void) const { NS_LOG_FUNCTION_NOARGS (); return true; } Address TapBridge::GetBroadcast (void) const { NS_LOG_FUNCTION_NOARGS (); return Mac48Address ("ff:ff:ff:ff:ff:ff"); } bool TapBridge::IsMulticast (void) const { NS_LOG_FUNCTION_NOARGS (); return true; } Address TapBridge::GetMulticast (Ipv4Address multicastGroup) const { NS_LOG_FUNCTION (this << multicastGroup); Mac48Address multicast = Mac48Address::GetMulticast (multicastGroup); return multicast; } bool TapBridge::IsPointToPoint (void) const { NS_LOG_FUNCTION_NOARGS (); return false; } bool TapBridge::IsBridge (void) const { NS_LOG_FUNCTION_NOARGS (); // // Returning false from IsBridge in a device called TapBridge may seem odd // at first glance, but this test is for a device that bridges ns-3 devices // together. The Tap bridge doesn't do that -- it bridges an ns-3 device to // a Linux device. This is a completely different story. // return false; } bool TapBridge::Send (Ptr<Packet> packet, const Address& dst, uint16_t protocol) { NS_LOG_FUNCTION (packet << dst << protocol); NS_FATAL_ERROR ("TapBridge::Send: You may not call Send on a TapBridge directly"); return false; } bool TapBridge::SendFrom (Ptr<Packet> packet, const Address& src, const Address& dst, uint16_t protocol) { NS_LOG_FUNCTION (packet << src << dst << protocol); NS_FATAL_ERROR ("TapBridge::Send: You may not call SendFrom on a TapBridge directly"); return false; } Ptr<Node> TapBridge::GetNode (void) const { NS_LOG_FUNCTION_NOARGS (); return m_node; } void TapBridge::SetNode (Ptr<Node> node) { NS_LOG_FUNCTION_NOARGS (); m_node = node; } bool TapBridge::NeedsArp (void) const { NS_LOG_FUNCTION_NOARGS (); return true; } void TapBridge::SetReceiveCallback (NetDevice::ReceiveCallback cb) { NS_LOG_FUNCTION_NOARGS (); m_rxCallback = cb; } void TapBridge::SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb) { NS_LOG_FUNCTION_NOARGS (); m_promiscRxCallback = cb; } bool TapBridge::SupportsSendFrom () const { NS_LOG_FUNCTION_NOARGS (); return true; } Address TapBridge::GetMulticast (Ipv6Address addr) const { NS_LOG_FUNCTION (this << addr); return Mac48Address::GetMulticast (addr); } } // namespace ns3
zy901002-gpsr
src/tap-bridge/model/tap-bridge.cc
C++
gpl2
41,341
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2009 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef TAP_ENCODE_DECODE_H #define TAP_ENCODE_DECODE_H #include <string> namespace ns3 { std::string TapBufferToString (uint8_t *buffer, uint32_t len); bool TapStringToBuffer (std::string s, uint8_t *buffer, uint32_t *len); } // namespace ns3 #endif /* TAP_ENCODE_DECODE_H */
zy901002-gpsr
src/tap-bridge/model/tap-encode-decode.h
C++
gpl2
1,056
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2009 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <unistd.h> #include <stdint.h> #include <string> #include <string.h> // for strerror #include <iostream> #include <iomanip> #include <sstream> #include <stdlib.h> #include <errno.h> #include <fcntl.h> #include <sys/ioctl.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/un.h> #include <net/if.h> #include <linux/if_tun.h> #include <net/route.h> #include <netinet/in.h> #include "tap-encode-decode.h" #define TAP_MAGIC 95549 static int gVerbose = 0; // Set to true to turn on logging messages. #define LOG(msg) \ if (gVerbose) \ { \ std::cout << __FUNCTION__ << "(): " << msg << std::endl; \ } #define ABORT(msg, printErrno) \ std::cout << __FILE__ << ": fatal error at line " << __LINE__ << ": " << __FUNCTION__ << "(): " << msg << std::endl; \ if (printErrno) \ { \ std::cout << " errno = " << errno << " (" << strerror (errno) << ")" << std::endl; \ } \ exit (-1); #define ABORT_IF(cond, msg, printErrno) \ if (cond) \ { \ ABORT (msg, printErrno); \ } // // Lots of the following helper code taken from corresponding functions in src/node. // #define ASCII_DOT (0x2e) #define ASCII_ZERO (0x30) #define ASCII_a (0x41) #define ASCII_z (0x5a) #define ASCII_A (0x61) #define ASCII_Z (0x7a) #define ASCII_COLON (0x3a) #define ASCII_ZERO (0x30) static char AsciiToLowCase (char c) { if (c >= ASCII_a && c <= ASCII_z) { return c; } else if (c >= ASCII_A && c <= ASCII_Z) { return c + (ASCII_a - ASCII_A); } else { return c; } } static uint32_t AsciiToIpv4 (const char *address) { uint32_t host = 0; while (true) { uint8_t byte = 0; while (*address != ASCII_DOT && *address != 0) { byte *= 10; byte += *address - ASCII_ZERO; address++; } host <<= 8; host |= byte; if (*address == 0) { break; } address++; } return host; } static void AsciiToMac48 (const char *str, uint8_t addr[6]) { int i = 0; while (*str != 0 && i < 6) { uint8_t byte = 0; while (*str != ASCII_COLON && *str != 0) { byte <<= 4; char low = AsciiToLowCase (*str); if (low >= ASCII_a) { byte |= low - ASCII_a + 10; } else { byte |= low - ASCII_ZERO; } str++; } addr[i] = byte; i++; if (*str == 0) { break; } str++; } } static sockaddr CreateInetAddress (uint32_t networkOrder) { union { struct sockaddr any_socket; struct sockaddr_in si; } s; s.si.sin_family = AF_INET; s.si.sin_port = 0; // unused s.si.sin_addr.s_addr = htonl (networkOrder); return s.any_socket; } static void SendSocket (const char *path, int fd) { // // Open a Unix (local interprocess) socket to call back to the tap bridge // LOG ("Create Unix socket"); int sock = socket (PF_UNIX, SOCK_DGRAM, 0); ABORT_IF (sock == -1, "Unable to open socket", 1); // // We have this string called path, which is really a hex representation // of the endpoint that the tap bridge created. It used a forward encoding // method (TapBufferToString) to take the sockaddr_un it made and passed // the resulting string to us. So we need to take the inverse method // (TapStringToBuffer) and build the same sockaddr_un over here. // socklen_t clientAddrLen; struct sockaddr_un clientAddr; LOG ("Decode address " << path); bool rc = ns3::TapStringToBuffer (path, (uint8_t *)&clientAddr, &clientAddrLen); ABORT_IF (rc == false, "Unable to decode path", 0); LOG ("Connect"); int status = connect (sock, (struct sockaddr*)&clientAddr, clientAddrLen); ABORT_IF (status == -1, "Unable to connect to tap bridge", 1); LOG ("Connected"); // // This is arcane enough that a few words are worthwhile to explain what's // going on here. // // The interesting information (the socket FD) is going to go back to the // tap bridge as an integer of ancillary data. Ancillary data is bits // that are not a part a socket payload (out-of-band data). We're also // going to send one integer back. It's just initialized to a magic number // we use to make sure that the tap bridge is talking to the tap socket // creator and not some other creator process (emu, specifically) // // The struct iovec below is part of a scatter-gather list. It describes a // buffer. In this case, it describes a buffer (an integer) containing the // data that we're going to send back to the tap bridge (that magic number). // struct iovec iov; uint32_t magic = TAP_MAGIC; iov.iov_base = &magic; iov.iov_len = sizeof(magic); // // The CMSG macros you'll see below are used to create and access control // messages (which is another name for ancillary data). The ancillary // data is made up of pairs of struct cmsghdr structures and associated // data arrays. // // First, we're going to allocate a buffer on the stack to contain our // data array (that contains the socket). Sometimes you'll see this called // an "ancillary element" but the msghdr uses the control message termimology // so we call it "control." // size_t msg_size = sizeof(int); char control[CMSG_SPACE (msg_size)]; // // There is a msghdr that is used to minimize the number of parameters // passed to sendmsg (which we will use to send our ancillary data). This // structure uses terminology corresponding to control messages, so you'll // see msg_control, which is the pointer to the ancillary data and controllen // which is the size of the ancillary data array. // // So, initialize the message header that describes our ancillary/control data // and point it to the control message/ancillary data we just allocated space // for. // struct msghdr msg; msg.msg_name = 0; msg.msg_namelen = 0; msg.msg_iov = &iov; msg.msg_iovlen = 1; msg.msg_control = control; msg.msg_controllen = sizeof (control); msg.msg_flags = 0; // // A cmsghdr contains a length field that is the length of the header and // the data. It has a cmsg_level field corresponding to the originating // protocol. This takes values which are legal levels for getsockopt and // setsockopt (here SOL_SOCKET). We're going to use the SCM_RIGHTS type of // cmsg, that indicates that the ancillary data array contains access rights // that we are sending back to the tap bridge. // // We have to put together the first (and only) cmsghdr that will describe // the whole package we're sending. // struct cmsghdr *cmsg; cmsg = CMSG_FIRSTHDR (&msg); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; cmsg->cmsg_len = CMSG_LEN (msg_size); // // We also have to update the controllen in case other stuff is actually // in there we may not be aware of (due to macros). // msg.msg_controllen = cmsg->cmsg_len; // // Finally, we get a pointer to the start of the ancillary data array and // put our file descriptor in. // int *fdptr = (int*)(CMSG_DATA (cmsg)); *fdptr = fd; // // // Actually send the file descriptor back to the tap bridge. // ssize_t len = sendmsg (sock, &msg, 0); ABORT_IF (len == -1, "Could not send socket back to tap bridge", 1); LOG ("sendmsg complete"); } static int CreateTap (const char *dev, const char *gw, const char *ip, const char *mac, const char *mode, const char *netmask) { // // Creation and management of Tap devices is done via the tun device // int tap = open ("/dev/net/tun", O_RDWR); ABORT_IF (tap == -1, "Could not open /dev/net/tun", true); // // Allocate a tap device, making sure that it will not send the tun_pi header. // If we provide a null name to the ifr.ifr_name, we tell the kernel to pick // a name for us (i.e., tapn where n = 0..255. // // If the device does not already exist, the system will create one. // struct ifreq ifr; ifr.ifr_flags = IFF_TAP | IFF_NO_PI; strcpy (ifr.ifr_name, dev); int status = ioctl (tap, TUNSETIFF, (void *) &ifr); ABORT_IF (status == -1, "Could not allocate tap device", true); std::string tapDeviceName = (char *)ifr.ifr_name; LOG ("Allocated TAP device " << tapDeviceName); // // Operating mode "2" corresponds to USE_LOCAL and "3" to USE_BRIDGE mode. // This means that we expect that the user will have named, created and // configured a network tap that we are just going to use. So don't mess // up his hard work by changing anything, just return the tap fd. // if (strcmp (mode, "2") == 0 || strcmp (mode, "3") == 0) { LOG ("Returning precreated tap "); return tap; } // // Set the hardware (MAC) address of the new device // ifr.ifr_hwaddr.sa_family = 1; // this is ARPHRD_ETHER from if_arp.h AsciiToMac48 (mac, (uint8_t*)ifr.ifr_hwaddr.sa_data); status = ioctl (tap, SIOCSIFHWADDR, &ifr); ABORT_IF (status == -1, "Could not set MAC address", true); LOG ("Set device MAC address to " << mac); int fd = socket (AF_INET, SOCK_DGRAM, 0); // // Bring the interface up. // status = ioctl (fd, SIOCGIFFLAGS, &ifr); ABORT_IF (status == -1, "Could not get flags for interface", true); ifr.ifr_flags |= IFF_UP | IFF_RUNNING; status = ioctl (fd, SIOCSIFFLAGS, &ifr); ABORT_IF (status == -1, "Could not bring interface up", true); LOG ("Device is up"); // // Set the IP address of the new interface/device. // ifr.ifr_addr = CreateInetAddress (AsciiToIpv4 (ip)); status = ioctl (fd, SIOCSIFADDR, &ifr); ABORT_IF (status == -1, "Could not set IP address", true); LOG ("Set device IP address to " << ip); // // Set the net mask of the new interface/device // ifr.ifr_netmask = CreateInetAddress (AsciiToIpv4 (netmask)); status = ioctl (fd, SIOCSIFNETMASK, &ifr); ABORT_IF (status == -1, "Could not set net mask", true); LOG ("Set device Net Mask to " << netmask); return tap; } int main (int argc, char *argv[]) { int c; char *dev = (char *)""; char *gw = NULL; char *ip = NULL; char *mac = NULL; char *netmask = NULL; char *operatingMode = NULL; char *path = NULL; opterr = 0; while ((c = getopt (argc, argv, "vd:g:i:m:n:o:p:")) != -1) { switch (c) { case 'd': dev = optarg; // name of the new tap device break; case 'g': gw = optarg; // gateway address for the new device break; case 'i': ip = optarg; // ip address of the new device break; case 'm': mac = optarg; // mac address of the new device break; case 'n': netmask = optarg; // net mask for the new device break; case 'o': operatingMode = optarg; // operating mode of tap bridge break; case 'p': path = optarg; // path back to the tap bridge break; case 'v': gVerbose = true; break; } } // // We have got to be able to coordinate the name of the tap device we are // going to create and or open with the device that an external Linux host // will use. If this name is provided we use it. If not we let the system // create the device for us. This name is given in dev // LOG ("Provided Device Name is \"" << dev << "\""); // // We have got to be able to provide a gateway to the external Linux host // so it can talk to the ns-3 network. This ip address is provided in // gw. // ABORT_IF (gw == NULL, "Gateway Address is a required argument", 0); LOG ("Provided Gateway Address is \"" << gw << "\""); // // We have got to be able to assign an IP address to the tap device we are // allocating. This address is allocated in the simulation and assigned to // the tap bridge. This address is given in ip. // ABORT_IF (ip == NULL, "IP Address is a required argument", 0); LOG ("Provided IP Address is \"" << ip << "\""); // // We have got to be able to assign a Mac address to the tap device we are // allocating. This address is allocated in the simulation and assigned to // the bridged device. This allows packets addressed to the bridged device // to appear in the Linux host as if they were received there. // ABORT_IF (mac == NULL, "MAC Address is a required argument", 0); LOG ("Provided MAC Address is \"" << mac << "\""); // // We have got to be able to assign a net mask to the tap device we are // allocating. This mask is allocated in the simulation and given to // the bridged device. // ABORT_IF (netmask == NULL, "Net Mask is a required argument", 0); LOG ("Provided Net Mask is \"" << netmask << "\""); // // We have got to know whether or not to create the TAP. // ABORT_IF (operatingMode == NULL, "Operating Mode is a required argument", 0); LOG ("Provided Operating Mode is \"" << operatingMode << "\""); // // This program is spawned by a tap bridge running in a simulation. It // wants to create a socket as described below. We are going to do the // work here since we're running suid root. Once we create the socket, // we have to send it back to the tap bridge. We do that over a Unix // (local interprocess) socket. The tap bridge created a socket to // listen for our response on, and it is expected to have encoded the address // information as a string and to have passed that string as an argument to // us. We see it here as the "path" string. We can't do anything useful // unless we have that string. // ABORT_IF (path == NULL, "path is a required argument", 0); LOG ("Provided path is \"" << path << "\""); // // The whole reason for all of the hoops we went through to call out to this // program will pay off here. We created this program to run as suid root // in order to keep the main simulation program from having to be run with // root privileges. We need root privileges to be able to futz with the // Tap device underlying all of this. So all of these hoops are to allow // us to exeucte the following code: // LOG ("Creating Tap"); int sock = CreateTap (dev, gw, ip, mac, operatingMode, netmask); ABORT_IF (sock == -1, "main(): Unable to create tap socket", 1); // // Send the socket back to the tap net device so it can go about its business // SendSocket (path, sock); return 0; }
zy901002-gpsr
src/tap-bridge/model/tap-creator.cc
C++
gpl2
15,336
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2009 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <string> #include <iostream> #include <iomanip> #include <sstream> #include <stdint.h> namespace ns3 { /** * \brief Convert a byte buffer to a string containing a hex representation * of the buffer. Make the string pretty by adding a colon (':') between * the hex. * * \param buffer The input buffer to be converted. * \param len The length of the input buffer. * \returns A string containing a hex representation of the data in buffer. */ std::string TapBufferToString (uint8_t *buffer, uint32_t len) { std::ostringstream oss; // // Tell the stream to make hex characters, zero-filled // oss.setf (std::ios::hex, std::ios::basefield); oss.fill ('0'); // // Loop through the buffer, separating the two-digit-wide hex bytes // with a colon. // for (uint8_t i = 0; i < len; i++) { oss << ":" << std::setw (2) << (uint32_t)buffer[i]; } return oss.str (); } /** * \brief Convert string encoded by the inverse function (TapBufferToString) * back into a byte buffer. * * \param s The input string. * \param buffer The buffer to initialize with the converted bits. * \param len The length of the data that is valid in the buffer. * \returns True indicates a successful conversion. */ bool TapStringToBuffer (std::string s, uint8_t *buffer, uint32_t *len) { // // If the string was made by our inverse function, the string length must // be a multiple of three characters in length. Use this fact to do a // quick reasonableness test. // if ((s.length () % 3) != 0) { return false; } std::istringstream iss; iss.str (s); uint8_t n = 0; while (iss.good ()) { // // The first character in the "triplet" we're working on is always the // the ':' separator. Read that into a char and make sure we're skipping // what we think we're skipping. // char c; iss.read (&c, 1); if (c != ':') { return false; } // // And then read in the real bits and convert them. // uint32_t tmp; iss >> std::hex >> tmp; buffer[n] = tmp; n++; } *len = n; return true; } } // namespace ns3
zy901002-gpsr
src/tap-bridge/model/tap-encode-decode.cc
C++
gpl2
2,965
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers import pybindgen.settings import warnings class ErrorHandler(pybindgen.settings.ErrorHandler): def handle_error(self, wrapper, exception, traceback_): warnings.warn("exception %r in wrapper %s" % (exception, wrapper)) return True pybindgen.settings.error_handler = ErrorHandler() import sys def module_init(): root_module = Module('ns.tap_bridge', cpp_namespace='::ns3') return root_module def register_types(module): root_module = module.get_root() ## log.h (module 'core'): ns3::LogLevel [enumeration] module.add_enum('LogLevel', ['LOG_NONE', 'LOG_ERROR', 'LOG_LEVEL_ERROR', 'LOG_WARN', 'LOG_LEVEL_WARN', 'LOG_DEBUG', 'LOG_LEVEL_DEBUG', 'LOG_INFO', 'LOG_LEVEL_INFO', 'LOG_FUNCTION', 'LOG_LEVEL_FUNCTION', 'LOG_LOGIC', 'LOG_LEVEL_LOGIC', 'LOG_ALL', 'LOG_LEVEL_ALL', 'LOG_PREFIX_FUNC', 'LOG_PREFIX_TIME', 'LOG_PREFIX_NODE'], import_from_module='ns.core') ## address.h (module 'network'): ns3::Address [class] module.add_class('Address', import_from_module='ns.network') ## address.h (module 'network'): ns3::Address::MaxSize_e [enumeration] module.add_enum('MaxSize_e', ['MAX_SIZE'], outer_class=root_module['ns3::Address'], import_from_module='ns.network') ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList [class] module.add_class('AttributeConstructionList', import_from_module='ns.core') ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item [struct] module.add_class('Item', import_from_module='ns.core', outer_class=root_module['ns3::AttributeConstructionList']) ## buffer.h (module 'network'): ns3::Buffer [class] module.add_class('Buffer', import_from_module='ns.network') ## buffer.h (module 'network'): ns3::Buffer::Iterator [class] module.add_class('Iterator', import_from_module='ns.network', outer_class=root_module['ns3::Buffer']) ## packet.h (module 'network'): ns3::ByteTagIterator [class] module.add_class('ByteTagIterator', import_from_module='ns.network') ## packet.h (module 'network'): ns3::ByteTagIterator::Item [class] module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagIterator']) ## byte-tag-list.h (module 'network'): ns3::ByteTagList [class] module.add_class('ByteTagList', import_from_module='ns.network') ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator [class] module.add_class('Iterator', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagList']) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item [struct] module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagList::Iterator']) ## callback.h (module 'core'): ns3::CallbackBase [class] module.add_class('CallbackBase', import_from_module='ns.core') ## system-mutex.h (module 'core'): ns3::CriticalSection [class] module.add_class('CriticalSection', import_from_module='ns.core') ## data-rate.h (module 'network'): ns3::DataRate [class] module.add_class('DataRate', import_from_module='ns.network') ## event-id.h (module 'core'): ns3::EventId [class] module.add_class('EventId', import_from_module='ns.core') ## ipv4-address.h (module 'network'): ns3::Ipv4Address [class] module.add_class('Ipv4Address', import_from_module='ns.network') ## ipv4-address.h (module 'network'): ns3::Ipv4Address [class] root_module['ns3::Ipv4Address'].implicitly_converts_to(root_module['ns3::Address']) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask [class] module.add_class('Ipv4Mask', import_from_module='ns.network') ## ipv6-address.h (module 'network'): ns3::Ipv6Address [class] module.add_class('Ipv6Address', import_from_module='ns.network') ## ipv6-address.h (module 'network'): ns3::Ipv6Address [class] root_module['ns3::Ipv6Address'].implicitly_converts_to(root_module['ns3::Address']) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix [class] module.add_class('Ipv6Prefix', import_from_module='ns.network') ## log.h (module 'core'): ns3::LogComponent [class] module.add_class('LogComponent', import_from_module='ns.core') ## mac48-address.h (module 'network'): ns3::Mac48Address [class] module.add_class('Mac48Address', import_from_module='ns.network') ## mac48-address.h (module 'network'): ns3::Mac48Address [class] root_module['ns3::Mac48Address'].implicitly_converts_to(root_module['ns3::Address']) ## net-device-container.h (module 'network'): ns3::NetDeviceContainer [class] module.add_class('NetDeviceContainer', import_from_module='ns.network') ## object-base.h (module 'core'): ns3::ObjectBase [class] module.add_class('ObjectBase', allow_subclassing=True, import_from_module='ns.core') ## object.h (module 'core'): ns3::ObjectDeleter [struct] module.add_class('ObjectDeleter', import_from_module='ns.core') ## object-factory.h (module 'core'): ns3::ObjectFactory [class] module.add_class('ObjectFactory', import_from_module='ns.core') ## packet-metadata.h (module 'network'): ns3::PacketMetadata [class] module.add_class('PacketMetadata', import_from_module='ns.network') ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [struct] module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::PacketMetadata']) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [enumeration] module.add_enum('', ['PAYLOAD', 'HEADER', 'TRAILER'], outer_class=root_module['ns3::PacketMetadata::Item'], import_from_module='ns.network') ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator [class] module.add_class('ItemIterator', import_from_module='ns.network', outer_class=root_module['ns3::PacketMetadata']) ## packet.h (module 'network'): ns3::PacketTagIterator [class] module.add_class('PacketTagIterator', import_from_module='ns.network') ## packet.h (module 'network'): ns3::PacketTagIterator::Item [class] module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagIterator']) ## packet-tag-list.h (module 'network'): ns3::PacketTagList [class] module.add_class('PacketTagList', import_from_module='ns.network') ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData [struct] module.add_class('TagData', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagList']) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Object', 'ns3::ObjectBase', 'ns3::ObjectDeleter'], parent=root_module['ns3::ObjectBase'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## system-mutex.h (module 'core'): ns3::SystemMutex [class] module.add_class('SystemMutex', import_from_module='ns.core') ## tag.h (module 'network'): ns3::Tag [class] module.add_class('Tag', import_from_module='ns.network', parent=root_module['ns3::ObjectBase']) ## tag-buffer.h (module 'network'): ns3::TagBuffer [class] module.add_class('TagBuffer', import_from_module='ns.network') ## tap-bridge-helper.h (module 'tap-bridge'): ns3::TapBridgeHelper [class] module.add_class('TapBridgeHelper') ## type-id.h (module 'core'): ns3::TypeId [class] module.add_class('TypeId', import_from_module='ns.core') ## type-id.h (module 'core'): ns3::TypeId::AttributeFlag [enumeration] module.add_enum('AttributeFlag', ['ATTR_GET', 'ATTR_SET', 'ATTR_CONSTRUCT', 'ATTR_SGC'], outer_class=root_module['ns3::TypeId'], import_from_module='ns.core') ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation [struct] module.add_class('AttributeInformation', import_from_module='ns.core', outer_class=root_module['ns3::TypeId']) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation [struct] module.add_class('TraceSourceInformation', import_from_module='ns.core', outer_class=root_module['ns3::TypeId']) ## empty.h (module 'core'): ns3::empty [class] module.add_class('empty', import_from_module='ns.core') ## int64x64-double.h (module 'core'): ns3::int64x64_t [class] module.add_class('int64x64_t', import_from_module='ns.core') ## chunk.h (module 'network'): ns3::Chunk [class] module.add_class('Chunk', import_from_module='ns.network', parent=root_module['ns3::ObjectBase']) ## header.h (module 'network'): ns3::Header [class] module.add_class('Header', import_from_module='ns.network', parent=root_module['ns3::Chunk']) ## object.h (module 'core'): ns3::Object [class] module.add_class('Object', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >']) ## object.h (module 'core'): ns3::Object::AggregateIterator [class] module.add_class('AggregateIterator', import_from_module='ns.core', outer_class=root_module['ns3::Object']) ## scheduler.h (module 'core'): ns3::Scheduler [class] module.add_class('Scheduler', import_from_module='ns.core', parent=root_module['ns3::Object']) ## scheduler.h (module 'core'): ns3::Scheduler::Event [struct] module.add_class('Event', import_from_module='ns.core', outer_class=root_module['ns3::Scheduler']) ## scheduler.h (module 'core'): ns3::Scheduler::EventKey [struct] module.add_class('EventKey', import_from_module='ns.core', outer_class=root_module['ns3::Scheduler']) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeChecker', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeChecker>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeValue', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeValue>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::CallbackImplBase', 'ns3::empty', 'ns3::DefaultDeleter<ns3::CallbackImplBase>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::EventImpl', 'ns3::empty', 'ns3::DefaultDeleter<ns3::EventImpl>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::FdReader', 'ns3::empty', 'ns3::DefaultDeleter<ns3::FdReader>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::NixVector', 'ns3::empty', 'ns3::DefaultDeleter<ns3::NixVector>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Packet', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Packet>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::SystemThread', 'ns3::empty', 'ns3::DefaultDeleter<ns3::SystemThread>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simulator-impl.h (module 'core'): ns3::SimulatorImpl [class] module.add_class('SimulatorImpl', import_from_module='ns.core', parent=root_module['ns3::Object']) ## synchronizer.h (module 'core'): ns3::Synchronizer [class] module.add_class('Synchronizer', import_from_module='ns.core', parent=root_module['ns3::Object']) ## system-thread.h (module 'core'): ns3::SystemThread [class] module.add_class('SystemThread', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >']) ## nstime.h (module 'core'): ns3::Time [class] module.add_class('Time', import_from_module='ns.core') ## nstime.h (module 'core'): ns3::Time::Unit [enumeration] module.add_enum('Unit', ['S', 'MS', 'US', 'NS', 'PS', 'FS', 'LAST'], outer_class=root_module['ns3::Time'], import_from_module='ns.core') ## nstime.h (module 'core'): ns3::Time [class] root_module['ns3::Time'].implicitly_converts_to(root_module['ns3::int64x64_t']) ## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor [class] module.add_class('TraceSourceAccessor', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >']) ## trailer.h (module 'network'): ns3::Trailer [class] module.add_class('Trailer', import_from_module='ns.network', parent=root_module['ns3::Chunk']) ## attribute.h (module 'core'): ns3::AttributeAccessor [class] module.add_class('AttributeAccessor', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >']) ## attribute.h (module 'core'): ns3::AttributeChecker [class] module.add_class('AttributeChecker', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >']) ## attribute.h (module 'core'): ns3::AttributeValue [class] module.add_class('AttributeValue', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >']) ## callback.h (module 'core'): ns3::CallbackChecker [class] module.add_class('CallbackChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) ## callback.h (module 'core'): ns3::CallbackImplBase [class] module.add_class('CallbackImplBase', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >']) ## callback.h (module 'core'): ns3::CallbackValue [class] module.add_class('CallbackValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## data-rate.h (module 'network'): ns3::DataRateChecker [class] module.add_class('DataRateChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) ## data-rate.h (module 'network'): ns3::DataRateValue [class] module.add_class('DataRateValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) ## attribute.h (module 'core'): ns3::EmptyAttributeValue [class] module.add_class('EmptyAttributeValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## event-impl.h (module 'core'): ns3::EventImpl [class] module.add_class('EventImpl', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >']) ## unix-fd-reader.h (module 'core'): ns3::FdReader [class] module.add_class('FdReader', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >']) ## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker [class] module.add_class('Ipv4AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) ## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue [class] module.add_class('Ipv4AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) ## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker [class] module.add_class('Ipv4MaskChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) ## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue [class] module.add_class('Ipv4MaskValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) ## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker [class] module.add_class('Ipv6AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) ## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue [class] module.add_class('Ipv6AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker [class] module.add_class('Ipv6PrefixChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue [class] module.add_class('Ipv6PrefixValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) ## mac48-address.h (module 'network'): ns3::Mac48AddressChecker [class] module.add_class('Mac48AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) ## mac48-address.h (module 'network'): ns3::Mac48AddressValue [class] module.add_class('Mac48AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) ## net-device.h (module 'network'): ns3::NetDevice [class] module.add_class('NetDevice', import_from_module='ns.network', parent=root_module['ns3::Object']) ## net-device.h (module 'network'): ns3::NetDevice::PacketType [enumeration] module.add_enum('PacketType', ['PACKET_HOST', 'NS3_PACKET_HOST', 'PACKET_BROADCAST', 'NS3_PACKET_BROADCAST', 'PACKET_MULTICAST', 'NS3_PACKET_MULTICAST', 'PACKET_OTHERHOST', 'NS3_PACKET_OTHERHOST'], outer_class=root_module['ns3::NetDevice'], import_from_module='ns.network') ## nix-vector.h (module 'network'): ns3::NixVector [class] module.add_class('NixVector', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >']) ## node.h (module 'network'): ns3::Node [class] module.add_class('Node', import_from_module='ns.network', parent=root_module['ns3::Object']) ## object-factory.h (module 'core'): ns3::ObjectFactoryChecker [class] module.add_class('ObjectFactoryChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) ## object-factory.h (module 'core'): ns3::ObjectFactoryValue [class] module.add_class('ObjectFactoryValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## packet.h (module 'network'): ns3::Packet [class] module.add_class('Packet', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >']) ## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl [class] module.add_class('RealtimeSimulatorImpl', import_from_module='ns.core', parent=root_module['ns3::SimulatorImpl']) ## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::SynchronizationMode [enumeration] module.add_enum('SynchronizationMode', ['SYNC_BEST_EFFORT', 'SYNC_HARD_LIMIT'], outer_class=root_module['ns3::RealtimeSimulatorImpl'], import_from_module='ns.core') ## tap-bridge.h (module 'tap-bridge'): ns3::TapBridge [class] module.add_class('TapBridge', parent=root_module['ns3::NetDevice']) ## tap-bridge.h (module 'tap-bridge'): ns3::TapBridge::Mode [enumeration] module.add_enum('Mode', ['ILLEGAL', 'CONFIGURE_LOCAL', 'USE_LOCAL', 'USE_BRIDGE'], outer_class=root_module['ns3::TapBridge']) ## tap-bridge.h (module 'tap-bridge'): ns3::TapBridgeFdReader [class] module.add_class('TapBridgeFdReader', parent=root_module['ns3::FdReader']) ## nstime.h (module 'core'): ns3::TimeChecker [class] module.add_class('TimeChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) ## nstime.h (module 'core'): ns3::TimeValue [class] module.add_class('TimeValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## type-id.h (module 'core'): ns3::TypeIdChecker [class] module.add_class('TypeIdChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) ## type-id.h (module 'core'): ns3::TypeIdValue [class] module.add_class('TypeIdValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## address.h (module 'network'): ns3::AddressChecker [class] module.add_class('AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) ## address.h (module 'network'): ns3::AddressValue [class] module.add_class('AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *', 'ns3::LogTimePrinter') typehandlers.add_type_alias('void ( * ) ( std::ostream & ) **', 'ns3::LogTimePrinter*') typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *&', 'ns3::LogTimePrinter&') typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *', 'ns3::LogNodePrinter') typehandlers.add_type_alias('void ( * ) ( std::ostream & ) **', 'ns3::LogNodePrinter*') typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *&', 'ns3::LogNodePrinter&') ## Register a nested module for the namespace FatalImpl nested_module = module.add_cpp_namespace('FatalImpl') register_types_ns3_FatalImpl(nested_module) def register_types_ns3_FatalImpl(module): root_module = module.get_root() def register_methods(root_module): register_Ns3Address_methods(root_module, root_module['ns3::Address']) register_Ns3AttributeConstructionList_methods(root_module, root_module['ns3::AttributeConstructionList']) register_Ns3AttributeConstructionListItem_methods(root_module, root_module['ns3::AttributeConstructionList::Item']) register_Ns3Buffer_methods(root_module, root_module['ns3::Buffer']) register_Ns3BufferIterator_methods(root_module, root_module['ns3::Buffer::Iterator']) register_Ns3ByteTagIterator_methods(root_module, root_module['ns3::ByteTagIterator']) register_Ns3ByteTagIteratorItem_methods(root_module, root_module['ns3::ByteTagIterator::Item']) register_Ns3ByteTagList_methods(root_module, root_module['ns3::ByteTagList']) register_Ns3ByteTagListIterator_methods(root_module, root_module['ns3::ByteTagList::Iterator']) register_Ns3ByteTagListIteratorItem_methods(root_module, root_module['ns3::ByteTagList::Iterator::Item']) register_Ns3CallbackBase_methods(root_module, root_module['ns3::CallbackBase']) register_Ns3CriticalSection_methods(root_module, root_module['ns3::CriticalSection']) register_Ns3DataRate_methods(root_module, root_module['ns3::DataRate']) register_Ns3EventId_methods(root_module, root_module['ns3::EventId']) register_Ns3Ipv4Address_methods(root_module, root_module['ns3::Ipv4Address']) register_Ns3Ipv4Mask_methods(root_module, root_module['ns3::Ipv4Mask']) register_Ns3Ipv6Address_methods(root_module, root_module['ns3::Ipv6Address']) register_Ns3Ipv6Prefix_methods(root_module, root_module['ns3::Ipv6Prefix']) register_Ns3LogComponent_methods(root_module, root_module['ns3::LogComponent']) register_Ns3Mac48Address_methods(root_module, root_module['ns3::Mac48Address']) register_Ns3NetDeviceContainer_methods(root_module, root_module['ns3::NetDeviceContainer']) register_Ns3ObjectBase_methods(root_module, root_module['ns3::ObjectBase']) register_Ns3ObjectDeleter_methods(root_module, root_module['ns3::ObjectDeleter']) register_Ns3ObjectFactory_methods(root_module, root_module['ns3::ObjectFactory']) register_Ns3PacketMetadata_methods(root_module, root_module['ns3::PacketMetadata']) register_Ns3PacketMetadataItem_methods(root_module, root_module['ns3::PacketMetadata::Item']) register_Ns3PacketMetadataItemIterator_methods(root_module, root_module['ns3::PacketMetadata::ItemIterator']) register_Ns3PacketTagIterator_methods(root_module, root_module['ns3::PacketTagIterator']) register_Ns3PacketTagIteratorItem_methods(root_module, root_module['ns3::PacketTagIterator::Item']) register_Ns3PacketTagList_methods(root_module, root_module['ns3::PacketTagList']) register_Ns3PacketTagListTagData_methods(root_module, root_module['ns3::PacketTagList::TagData']) register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >']) register_Ns3SystemMutex_methods(root_module, root_module['ns3::SystemMutex']) register_Ns3Tag_methods(root_module, root_module['ns3::Tag']) register_Ns3TagBuffer_methods(root_module, root_module['ns3::TagBuffer']) register_Ns3TapBridgeHelper_methods(root_module, root_module['ns3::TapBridgeHelper']) register_Ns3TypeId_methods(root_module, root_module['ns3::TypeId']) register_Ns3TypeIdAttributeInformation_methods(root_module, root_module['ns3::TypeId::AttributeInformation']) register_Ns3TypeIdTraceSourceInformation_methods(root_module, root_module['ns3::TypeId::TraceSourceInformation']) register_Ns3Empty_methods(root_module, root_module['ns3::empty']) register_Ns3Int64x64_t_methods(root_module, root_module['ns3::int64x64_t']) register_Ns3Chunk_methods(root_module, root_module['ns3::Chunk']) register_Ns3Header_methods(root_module, root_module['ns3::Header']) register_Ns3Object_methods(root_module, root_module['ns3::Object']) register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator']) register_Ns3Scheduler_methods(root_module, root_module['ns3::Scheduler']) register_Ns3SchedulerEvent_methods(root_module, root_module['ns3::Scheduler::Event']) register_Ns3SchedulerEventKey_methods(root_module, root_module['ns3::Scheduler::EventKey']) register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >']) register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >']) register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >']) register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >']) register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >']) register_Ns3SimpleRefCount__Ns3FdReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3FdReader__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >']) register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >']) register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >']) register_Ns3SimpleRefCount__Ns3SystemThread_Ns3Empty_Ns3DefaultDeleter__lt__ns3SystemThread__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >']) register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >']) register_Ns3SimulatorImpl_methods(root_module, root_module['ns3::SimulatorImpl']) register_Ns3Synchronizer_methods(root_module, root_module['ns3::Synchronizer']) register_Ns3SystemThread_methods(root_module, root_module['ns3::SystemThread']) register_Ns3Time_methods(root_module, root_module['ns3::Time']) register_Ns3TraceSourceAccessor_methods(root_module, root_module['ns3::TraceSourceAccessor']) register_Ns3Trailer_methods(root_module, root_module['ns3::Trailer']) register_Ns3AttributeAccessor_methods(root_module, root_module['ns3::AttributeAccessor']) register_Ns3AttributeChecker_methods(root_module, root_module['ns3::AttributeChecker']) register_Ns3AttributeValue_methods(root_module, root_module['ns3::AttributeValue']) register_Ns3CallbackChecker_methods(root_module, root_module['ns3::CallbackChecker']) register_Ns3CallbackImplBase_methods(root_module, root_module['ns3::CallbackImplBase']) register_Ns3CallbackValue_methods(root_module, root_module['ns3::CallbackValue']) register_Ns3DataRateChecker_methods(root_module, root_module['ns3::DataRateChecker']) register_Ns3DataRateValue_methods(root_module, root_module['ns3::DataRateValue']) register_Ns3EmptyAttributeValue_methods(root_module, root_module['ns3::EmptyAttributeValue']) register_Ns3EventImpl_methods(root_module, root_module['ns3::EventImpl']) register_Ns3FdReader_methods(root_module, root_module['ns3::FdReader']) register_Ns3Ipv4AddressChecker_methods(root_module, root_module['ns3::Ipv4AddressChecker']) register_Ns3Ipv4AddressValue_methods(root_module, root_module['ns3::Ipv4AddressValue']) register_Ns3Ipv4MaskChecker_methods(root_module, root_module['ns3::Ipv4MaskChecker']) register_Ns3Ipv4MaskValue_methods(root_module, root_module['ns3::Ipv4MaskValue']) register_Ns3Ipv6AddressChecker_methods(root_module, root_module['ns3::Ipv6AddressChecker']) register_Ns3Ipv6AddressValue_methods(root_module, root_module['ns3::Ipv6AddressValue']) register_Ns3Ipv6PrefixChecker_methods(root_module, root_module['ns3::Ipv6PrefixChecker']) register_Ns3Ipv6PrefixValue_methods(root_module, root_module['ns3::Ipv6PrefixValue']) register_Ns3Mac48AddressChecker_methods(root_module, root_module['ns3::Mac48AddressChecker']) register_Ns3Mac48AddressValue_methods(root_module, root_module['ns3::Mac48AddressValue']) register_Ns3NetDevice_methods(root_module, root_module['ns3::NetDevice']) register_Ns3NixVector_methods(root_module, root_module['ns3::NixVector']) register_Ns3Node_methods(root_module, root_module['ns3::Node']) register_Ns3ObjectFactoryChecker_methods(root_module, root_module['ns3::ObjectFactoryChecker']) register_Ns3ObjectFactoryValue_methods(root_module, root_module['ns3::ObjectFactoryValue']) register_Ns3Packet_methods(root_module, root_module['ns3::Packet']) register_Ns3RealtimeSimulatorImpl_methods(root_module, root_module['ns3::RealtimeSimulatorImpl']) register_Ns3TapBridge_methods(root_module, root_module['ns3::TapBridge']) register_Ns3TapBridgeFdReader_methods(root_module, root_module['ns3::TapBridgeFdReader']) register_Ns3TimeChecker_methods(root_module, root_module['ns3::TimeChecker']) register_Ns3TimeValue_methods(root_module, root_module['ns3::TimeValue']) register_Ns3TypeIdChecker_methods(root_module, root_module['ns3::TypeIdChecker']) register_Ns3TypeIdValue_methods(root_module, root_module['ns3::TypeIdValue']) register_Ns3AddressChecker_methods(root_module, root_module['ns3::AddressChecker']) register_Ns3AddressValue_methods(root_module, root_module['ns3::AddressValue']) return def register_Ns3Address_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## address.h (module 'network'): ns3::Address::Address() [constructor] cls.add_constructor([]) ## address.h (module 'network'): ns3::Address::Address(uint8_t type, uint8_t const * buffer, uint8_t len) [constructor] cls.add_constructor([param('uint8_t', 'type'), param('uint8_t const *', 'buffer'), param('uint8_t', 'len')]) ## address.h (module 'network'): ns3::Address::Address(ns3::Address const & address) [copy constructor] cls.add_constructor([param('ns3::Address const &', 'address')]) ## address.h (module 'network'): bool ns3::Address::CheckCompatible(uint8_t type, uint8_t len) const [member function] cls.add_method('CheckCompatible', 'bool', [param('uint8_t', 'type'), param('uint8_t', 'len')], is_const=True) ## address.h (module 'network'): uint32_t ns3::Address::CopyAllFrom(uint8_t const * buffer, uint8_t len) [member function] cls.add_method('CopyAllFrom', 'uint32_t', [param('uint8_t const *', 'buffer'), param('uint8_t', 'len')]) ## address.h (module 'network'): uint32_t ns3::Address::CopyAllTo(uint8_t * buffer, uint8_t len) const [member function] cls.add_method('CopyAllTo', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint8_t', 'len')], is_const=True) ## address.h (module 'network'): uint32_t ns3::Address::CopyFrom(uint8_t const * buffer, uint8_t len) [member function] cls.add_method('CopyFrom', 'uint32_t', [param('uint8_t const *', 'buffer'), param('uint8_t', 'len')]) ## address.h (module 'network'): uint32_t ns3::Address::CopyTo(uint8_t * buffer) const [member function] cls.add_method('CopyTo', 'uint32_t', [param('uint8_t *', 'buffer')], is_const=True) ## address.h (module 'network'): void ns3::Address::Deserialize(ns3::TagBuffer buffer) [member function] cls.add_method('Deserialize', 'void', [param('ns3::TagBuffer', 'buffer')]) ## address.h (module 'network'): uint8_t ns3::Address::GetLength() const [member function] cls.add_method('GetLength', 'uint8_t', [], is_const=True) ## address.h (module 'network'): uint32_t ns3::Address::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## address.h (module 'network'): bool ns3::Address::IsInvalid() const [member function] cls.add_method('IsInvalid', 'bool', [], is_const=True) ## address.h (module 'network'): bool ns3::Address::IsMatchingType(uint8_t type) const [member function] cls.add_method('IsMatchingType', 'bool', [param('uint8_t', 'type')], is_const=True) ## address.h (module 'network'): static uint8_t ns3::Address::Register() [member function] cls.add_method('Register', 'uint8_t', [], is_static=True) ## address.h (module 'network'): void ns3::Address::Serialize(ns3::TagBuffer buffer) const [member function] cls.add_method('Serialize', 'void', [param('ns3::TagBuffer', 'buffer')], is_const=True) return def register_Ns3AttributeConstructionList_methods(root_module, cls): ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList(ns3::AttributeConstructionList const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeConstructionList const &', 'arg0')]) ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList() [constructor] cls.add_constructor([]) ## attribute-construction-list.h (module 'core'): void ns3::AttributeConstructionList::Add(std::string name, ns3::Ptr<ns3::AttributeChecker const> checker, ns3::Ptr<ns3::AttributeValue> value) [member function] cls.add_method('Add', 'void', [param('std::string', 'name'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker'), param('ns3::Ptr< ns3::AttributeValue >', 'value')]) ## attribute-construction-list.h (module 'core'): std::_List_const_iterator<ns3::AttributeConstructionList::Item> ns3::AttributeConstructionList::Begin() const [member function] cls.add_method('Begin', 'std::_List_const_iterator< ns3::AttributeConstructionList::Item >', [], is_const=True) ## attribute-construction-list.h (module 'core'): std::_List_const_iterator<ns3::AttributeConstructionList::Item> ns3::AttributeConstructionList::End() const [member function] cls.add_method('End', 'std::_List_const_iterator< ns3::AttributeConstructionList::Item >', [], is_const=True) ## attribute-construction-list.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeConstructionList::Find(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('Find', 'ns3::Ptr< ns3::AttributeValue >', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True) return def register_Ns3AttributeConstructionListItem_methods(root_module, cls): ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item() [constructor] cls.add_constructor([]) ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item(ns3::AttributeConstructionList::Item const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeConstructionList::Item const &', 'arg0')]) ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::checker [variable] cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False) ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::name [variable] cls.add_instance_attribute('name', 'std::string', is_const=False) ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::value [variable] cls.add_instance_attribute('value', 'ns3::Ptr< ns3::AttributeValue >', is_const=False) return def register_Ns3Buffer_methods(root_module, cls): ## buffer.h (module 'network'): ns3::Buffer::Buffer() [constructor] cls.add_constructor([]) ## buffer.h (module 'network'): ns3::Buffer::Buffer(uint32_t dataSize) [constructor] cls.add_constructor([param('uint32_t', 'dataSize')]) ## buffer.h (module 'network'): ns3::Buffer::Buffer(uint32_t dataSize, bool initialize) [constructor] cls.add_constructor([param('uint32_t', 'dataSize'), param('bool', 'initialize')]) ## buffer.h (module 'network'): ns3::Buffer::Buffer(ns3::Buffer const & o) [copy constructor] cls.add_constructor([param('ns3::Buffer const &', 'o')]) ## buffer.h (module 'network'): bool ns3::Buffer::AddAtEnd(uint32_t end) [member function] cls.add_method('AddAtEnd', 'bool', [param('uint32_t', 'end')]) ## buffer.h (module 'network'): void ns3::Buffer::AddAtEnd(ns3::Buffer const & o) [member function] cls.add_method('AddAtEnd', 'void', [param('ns3::Buffer const &', 'o')]) ## buffer.h (module 'network'): bool ns3::Buffer::AddAtStart(uint32_t start) [member function] cls.add_method('AddAtStart', 'bool', [param('uint32_t', 'start')]) ## buffer.h (module 'network'): ns3::Buffer::Iterator ns3::Buffer::Begin() const [member function] cls.add_method('Begin', 'ns3::Buffer::Iterator', [], is_const=True) ## buffer.h (module 'network'): void ns3::Buffer::CopyData(std::ostream * os, uint32_t size) const [member function] cls.add_method('CopyData', 'void', [param('std::ostream *', 'os'), param('uint32_t', 'size')], is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::CopyData(uint8_t * buffer, uint32_t size) const [member function] cls.add_method('CopyData', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint32_t', 'size')], is_const=True) ## buffer.h (module 'network'): ns3::Buffer ns3::Buffer::CreateFragment(uint32_t start, uint32_t length) const [member function] cls.add_method('CreateFragment', 'ns3::Buffer', [param('uint32_t', 'start'), param('uint32_t', 'length')], is_const=True) ## buffer.h (module 'network'): ns3::Buffer ns3::Buffer::CreateFullCopy() const [member function] cls.add_method('CreateFullCopy', 'ns3::Buffer', [], is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Deserialize(uint8_t const * buffer, uint32_t size) [member function] cls.add_method('Deserialize', 'uint32_t', [param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## buffer.h (module 'network'): ns3::Buffer::Iterator ns3::Buffer::End() const [member function] cls.add_method('End', 'ns3::Buffer::Iterator', [], is_const=True) ## buffer.h (module 'network'): int32_t ns3::Buffer::GetCurrentEndOffset() const [member function] cls.add_method('GetCurrentEndOffset', 'int32_t', [], is_const=True) ## buffer.h (module 'network'): int32_t ns3::Buffer::GetCurrentStartOffset() const [member function] cls.add_method('GetCurrentStartOffset', 'int32_t', [], is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::GetSize() const [member function] cls.add_method('GetSize', 'uint32_t', [], is_const=True) ## buffer.h (module 'network'): uint8_t const * ns3::Buffer::PeekData() const [member function] cls.add_method('PeekData', 'uint8_t const *', [], is_const=True) ## buffer.h (module 'network'): void ns3::Buffer::RemoveAtEnd(uint32_t end) [member function] cls.add_method('RemoveAtEnd', 'void', [param('uint32_t', 'end')]) ## buffer.h (module 'network'): void ns3::Buffer::RemoveAtStart(uint32_t start) [member function] cls.add_method('RemoveAtStart', 'void', [param('uint32_t', 'start')]) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function] cls.add_method('Serialize', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')], is_const=True) return def register_Ns3BufferIterator_methods(root_module, cls): ## buffer.h (module 'network'): ns3::Buffer::Iterator::Iterator(ns3::Buffer::Iterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::Buffer::Iterator const &', 'arg0')]) ## buffer.h (module 'network'): ns3::Buffer::Iterator::Iterator() [constructor] cls.add_constructor([]) ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::CalculateIpChecksum(uint16_t size) [member function] cls.add_method('CalculateIpChecksum', 'uint16_t', [param('uint16_t', 'size')]) ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::CalculateIpChecksum(uint16_t size, uint32_t initialChecksum) [member function] cls.add_method('CalculateIpChecksum', 'uint16_t', [param('uint16_t', 'size'), param('uint32_t', 'initialChecksum')]) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetDistanceFrom(ns3::Buffer::Iterator const & o) const [member function] cls.add_method('GetDistanceFrom', 'uint32_t', [param('ns3::Buffer::Iterator const &', 'o')], is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetSize() const [member function] cls.add_method('GetSize', 'uint32_t', [], is_const=True) ## buffer.h (module 'network'): bool ns3::Buffer::Iterator::IsEnd() const [member function] cls.add_method('IsEnd', 'bool', [], is_const=True) ## buffer.h (module 'network'): bool ns3::Buffer::Iterator::IsStart() const [member function] cls.add_method('IsStart', 'bool', [], is_const=True) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Next() [member function] cls.add_method('Next', 'void', []) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Next(uint32_t delta) [member function] cls.add_method('Next', 'void', [param('uint32_t', 'delta')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev() [member function] cls.add_method('Prev', 'void', []) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev(uint32_t delta) [member function] cls.add_method('Prev', 'void', [param('uint32_t', 'delta')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(uint8_t * buffer, uint32_t size) [member function] cls.add_method('Read', 'void', [param('uint8_t *', 'buffer'), param('uint32_t', 'size')]) ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadLsbtohU16() [member function] cls.add_method('ReadLsbtohU16', 'uint16_t', []) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadLsbtohU32() [member function] cls.add_method('ReadLsbtohU32', 'uint32_t', []) ## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadLsbtohU64() [member function] cls.add_method('ReadLsbtohU64', 'uint64_t', []) ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadNtohU16() [member function] cls.add_method('ReadNtohU16', 'uint16_t', []) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadNtohU32() [member function] cls.add_method('ReadNtohU32', 'uint32_t', []) ## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadNtohU64() [member function] cls.add_method('ReadNtohU64', 'uint64_t', []) ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadU16() [member function] cls.add_method('ReadU16', 'uint16_t', []) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadU32() [member function] cls.add_method('ReadU32', 'uint32_t', []) ## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadU64() [member function] cls.add_method('ReadU64', 'uint64_t', []) ## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::ReadU8() [member function] cls.add_method('ReadU8', 'uint8_t', []) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Write(uint8_t const * buffer, uint32_t size) [member function] cls.add_method('Write', 'void', [param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Write(ns3::Buffer::Iterator start, ns3::Buffer::Iterator end) [member function] cls.add_method('Write', 'void', [param('ns3::Buffer::Iterator', 'start'), param('ns3::Buffer::Iterator', 'end')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU16(uint16_t data) [member function] cls.add_method('WriteHtolsbU16', 'void', [param('uint16_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU32(uint32_t data) [member function] cls.add_method('WriteHtolsbU32', 'void', [param('uint32_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU64(uint64_t data) [member function] cls.add_method('WriteHtolsbU64', 'void', [param('uint64_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU16(uint16_t data) [member function] cls.add_method('WriteHtonU16', 'void', [param('uint16_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU32(uint32_t data) [member function] cls.add_method('WriteHtonU32', 'void', [param('uint32_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU64(uint64_t data) [member function] cls.add_method('WriteHtonU64', 'void', [param('uint64_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU16(uint16_t data) [member function] cls.add_method('WriteU16', 'void', [param('uint16_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU32(uint32_t data) [member function] cls.add_method('WriteU32', 'void', [param('uint32_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU64(uint64_t data) [member function] cls.add_method('WriteU64', 'void', [param('uint64_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU8(uint8_t data) [member function] cls.add_method('WriteU8', 'void', [param('uint8_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU8(uint8_t data, uint32_t len) [member function] cls.add_method('WriteU8', 'void', [param('uint8_t', 'data'), param('uint32_t', 'len')]) return def register_Ns3ByteTagIterator_methods(root_module, cls): ## packet.h (module 'network'): ns3::ByteTagIterator::ByteTagIterator(ns3::ByteTagIterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::ByteTagIterator const &', 'arg0')]) ## packet.h (module 'network'): bool ns3::ByteTagIterator::HasNext() const [member function] cls.add_method('HasNext', 'bool', [], is_const=True) ## packet.h (module 'network'): ns3::ByteTagIterator::Item ns3::ByteTagIterator::Next() [member function] cls.add_method('Next', 'ns3::ByteTagIterator::Item', []) return def register_Ns3ByteTagIteratorItem_methods(root_module, cls): ## packet.h (module 'network'): ns3::ByteTagIterator::Item::Item(ns3::ByteTagIterator::Item const & arg0) [copy constructor] cls.add_constructor([param('ns3::ByteTagIterator::Item const &', 'arg0')]) ## packet.h (module 'network'): uint32_t ns3::ByteTagIterator::Item::GetEnd() const [member function] cls.add_method('GetEnd', 'uint32_t', [], is_const=True) ## packet.h (module 'network'): uint32_t ns3::ByteTagIterator::Item::GetStart() const [member function] cls.add_method('GetStart', 'uint32_t', [], is_const=True) ## packet.h (module 'network'): void ns3::ByteTagIterator::Item::GetTag(ns3::Tag & tag) const [member function] cls.add_method('GetTag', 'void', [param('ns3::Tag &', 'tag')], is_const=True) ## packet.h (module 'network'): ns3::TypeId ns3::ByteTagIterator::Item::GetTypeId() const [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_const=True) return def register_Ns3ByteTagList_methods(root_module, cls): ## byte-tag-list.h (module 'network'): ns3::ByteTagList::ByteTagList() [constructor] cls.add_constructor([]) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::ByteTagList(ns3::ByteTagList const & o) [copy constructor] cls.add_constructor([param('ns3::ByteTagList const &', 'o')]) ## byte-tag-list.h (module 'network'): ns3::TagBuffer ns3::ByteTagList::Add(ns3::TypeId tid, uint32_t bufferSize, int32_t start, int32_t end) [member function] cls.add_method('Add', 'ns3::TagBuffer', [param('ns3::TypeId', 'tid'), param('uint32_t', 'bufferSize'), param('int32_t', 'start'), param('int32_t', 'end')]) ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::Add(ns3::ByteTagList const & o) [member function] cls.add_method('Add', 'void', [param('ns3::ByteTagList const &', 'o')]) ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::AddAtEnd(int32_t adjustment, int32_t appendOffset) [member function] cls.add_method('AddAtEnd', 'void', [param('int32_t', 'adjustment'), param('int32_t', 'appendOffset')]) ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::AddAtStart(int32_t adjustment, int32_t prependOffset) [member function] cls.add_method('AddAtStart', 'void', [param('int32_t', 'adjustment'), param('int32_t', 'prependOffset')]) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator ns3::ByteTagList::Begin(int32_t offsetStart, int32_t offsetEnd) const [member function] cls.add_method('Begin', 'ns3::ByteTagList::Iterator', [param('int32_t', 'offsetStart'), param('int32_t', 'offsetEnd')], is_const=True) ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::RemoveAll() [member function] cls.add_method('RemoveAll', 'void', []) return def register_Ns3ByteTagListIterator_methods(root_module, cls): ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Iterator(ns3::ByteTagList::Iterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::ByteTagList::Iterator const &', 'arg0')]) ## byte-tag-list.h (module 'network'): uint32_t ns3::ByteTagList::Iterator::GetOffsetStart() const [member function] cls.add_method('GetOffsetStart', 'uint32_t', [], is_const=True) ## byte-tag-list.h (module 'network'): bool ns3::ByteTagList::Iterator::HasNext() const [member function] cls.add_method('HasNext', 'bool', [], is_const=True) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item ns3::ByteTagList::Iterator::Next() [member function] cls.add_method('Next', 'ns3::ByteTagList::Iterator::Item', []) return def register_Ns3ByteTagListIteratorItem_methods(root_module, cls): ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::Item(ns3::ByteTagList::Iterator::Item const & arg0) [copy constructor] cls.add_constructor([param('ns3::ByteTagList::Iterator::Item const &', 'arg0')]) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::Item(ns3::TagBuffer buf) [constructor] cls.add_constructor([param('ns3::TagBuffer', 'buf')]) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::buf [variable] cls.add_instance_attribute('buf', 'ns3::TagBuffer', is_const=False) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::end [variable] cls.add_instance_attribute('end', 'int32_t', is_const=False) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::size [variable] cls.add_instance_attribute('size', 'uint32_t', is_const=False) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::start [variable] cls.add_instance_attribute('start', 'int32_t', is_const=False) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::tid [variable] cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False) return def register_Ns3CallbackBase_methods(root_module, cls): ## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::CallbackBase const & arg0) [copy constructor] cls.add_constructor([param('ns3::CallbackBase const &', 'arg0')]) ## callback.h (module 'core'): ns3::CallbackBase::CallbackBase() [constructor] cls.add_constructor([]) ## callback.h (module 'core'): ns3::Ptr<ns3::CallbackImplBase> ns3::CallbackBase::GetImpl() const [member function] cls.add_method('GetImpl', 'ns3::Ptr< ns3::CallbackImplBase >', [], is_const=True) ## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::Ptr<ns3::CallbackImplBase> impl) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::CallbackImplBase >', 'impl')], visibility='protected') ## callback.h (module 'core'): static std::string ns3::CallbackBase::Demangle(std::string const & mangled) [member function] cls.add_method('Demangle', 'std::string', [param('std::string const &', 'mangled')], is_static=True, visibility='protected') return def register_Ns3CriticalSection_methods(root_module, cls): ## system-mutex.h (module 'core'): ns3::CriticalSection::CriticalSection(ns3::CriticalSection const & arg0) [copy constructor] cls.add_constructor([param('ns3::CriticalSection const &', 'arg0')]) ## system-mutex.h (module 'core'): ns3::CriticalSection::CriticalSection(ns3::SystemMutex & mutex) [constructor] cls.add_constructor([param('ns3::SystemMutex &', 'mutex')]) return def register_Ns3DataRate_methods(root_module, cls): cls.add_output_stream_operator() cls.add_binary_comparison_operator('!=') cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('<=') cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('>') cls.add_binary_comparison_operator('>=') ## data-rate.h (module 'network'): ns3::DataRate::DataRate(ns3::DataRate const & arg0) [copy constructor] cls.add_constructor([param('ns3::DataRate const &', 'arg0')]) ## data-rate.h (module 'network'): ns3::DataRate::DataRate() [constructor] cls.add_constructor([]) ## data-rate.h (module 'network'): ns3::DataRate::DataRate(uint64_t bps) [constructor] cls.add_constructor([param('uint64_t', 'bps')]) ## data-rate.h (module 'network'): ns3::DataRate::DataRate(std::string rate) [constructor] cls.add_constructor([param('std::string', 'rate')]) ## data-rate.h (module 'network'): double ns3::DataRate::CalculateTxTime(uint32_t bytes) const [member function] cls.add_method('CalculateTxTime', 'double', [param('uint32_t', 'bytes')], is_const=True) ## data-rate.h (module 'network'): uint64_t ns3::DataRate::GetBitRate() const [member function] cls.add_method('GetBitRate', 'uint64_t', [], is_const=True) return def register_Ns3EventId_methods(root_module, cls): cls.add_binary_comparison_operator('!=') cls.add_binary_comparison_operator('==') ## event-id.h (module 'core'): ns3::EventId::EventId(ns3::EventId const & arg0) [copy constructor] cls.add_constructor([param('ns3::EventId const &', 'arg0')]) ## event-id.h (module 'core'): ns3::EventId::EventId() [constructor] cls.add_constructor([]) ## event-id.h (module 'core'): ns3::EventId::EventId(ns3::Ptr<ns3::EventImpl> const & impl, uint64_t ts, uint32_t context, uint32_t uid) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::EventImpl > const &', 'impl'), param('uint64_t', 'ts'), param('uint32_t', 'context'), param('uint32_t', 'uid')]) ## event-id.h (module 'core'): void ns3::EventId::Cancel() [member function] cls.add_method('Cancel', 'void', []) ## event-id.h (module 'core'): uint32_t ns3::EventId::GetContext() const [member function] cls.add_method('GetContext', 'uint32_t', [], is_const=True) ## event-id.h (module 'core'): uint64_t ns3::EventId::GetTs() const [member function] cls.add_method('GetTs', 'uint64_t', [], is_const=True) ## event-id.h (module 'core'): uint32_t ns3::EventId::GetUid() const [member function] cls.add_method('GetUid', 'uint32_t', [], is_const=True) ## event-id.h (module 'core'): bool ns3::EventId::IsExpired() const [member function] cls.add_method('IsExpired', 'bool', [], is_const=True) ## event-id.h (module 'core'): bool ns3::EventId::IsRunning() const [member function] cls.add_method('IsRunning', 'bool', [], is_const=True) ## event-id.h (module 'core'): ns3::EventImpl * ns3::EventId::PeekEventImpl() const [member function] cls.add_method('PeekEventImpl', 'ns3::EventImpl *', [], is_const=True) return def register_Ns3Ipv4Address_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(ns3::Ipv4Address const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4Address const &', 'arg0')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(uint32_t address) [constructor] cls.add_constructor([param('uint32_t', 'address')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(char const * address) [constructor] cls.add_constructor([param('char const *', 'address')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4Address::CombineMask(ns3::Ipv4Mask const & mask) const [member function] cls.add_method('CombineMask', 'ns3::Ipv4Address', [param('ns3::Ipv4Mask const &', 'mask')], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::ConvertFrom(ns3::Address const & address) [member function] cls.add_method('ConvertFrom', 'ns3::Ipv4Address', [param('ns3::Address const &', 'address')], is_static=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::Deserialize(uint8_t const * buf) [member function] cls.add_method('Deserialize', 'ns3::Ipv4Address', [param('uint8_t const *', 'buf')], is_static=True) ## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Address::Get() const [member function] cls.add_method('Get', 'uint32_t', [], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetAny() [member function] cls.add_method('GetAny', 'ns3::Ipv4Address', [], is_static=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetBroadcast() [member function] cls.add_method('GetBroadcast', 'ns3::Ipv4Address', [], is_static=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetLoopback() [member function] cls.add_method('GetLoopback', 'ns3::Ipv4Address', [], is_static=True) ## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4Address::GetSubnetDirectedBroadcast(ns3::Ipv4Mask const & mask) const [member function] cls.add_method('GetSubnetDirectedBroadcast', 'ns3::Ipv4Address', [param('ns3::Ipv4Mask const &', 'mask')], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetZero() [member function] cls.add_method('GetZero', 'ns3::Ipv4Address', [], is_static=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsBroadcast() const [member function] cls.add_method('IsBroadcast', 'bool', [], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsEqual(ns3::Ipv4Address const & other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ipv4Address const &', 'other')], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsLocalMulticast() const [member function] cls.add_method('IsLocalMulticast', 'bool', [], is_const=True) ## ipv4-address.h (module 'network'): static bool ns3::Ipv4Address::IsMatchingType(ns3::Address const & address) [member function] cls.add_method('IsMatchingType', 'bool', [param('ns3::Address const &', 'address')], is_static=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsMulticast() const [member function] cls.add_method('IsMulticast', 'bool', [], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsSubnetDirectedBroadcast(ns3::Ipv4Mask const & mask) const [member function] cls.add_method('IsSubnetDirectedBroadcast', 'bool', [param('ns3::Ipv4Mask const &', 'mask')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Serialize(uint8_t * buf) const [member function] cls.add_method('Serialize', 'void', [param('uint8_t *', 'buf')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Set(uint32_t address) [member function] cls.add_method('Set', 'void', [param('uint32_t', 'address')]) ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Set(char const * address) [member function] cls.add_method('Set', 'void', [param('char const *', 'address')]) return def register_Ns3Ipv4Mask_methods(root_module, cls): cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(ns3::Ipv4Mask const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4Mask const &', 'arg0')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(uint32_t mask) [constructor] cls.add_constructor([param('uint32_t', 'mask')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(char const * mask) [constructor] cls.add_constructor([param('char const *', 'mask')]) ## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Mask::Get() const [member function] cls.add_method('Get', 'uint32_t', [], is_const=True) ## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Mask::GetInverse() const [member function] cls.add_method('GetInverse', 'uint32_t', [], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetLoopback() [member function] cls.add_method('GetLoopback', 'ns3::Ipv4Mask', [], is_static=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetOnes() [member function] cls.add_method('GetOnes', 'ns3::Ipv4Mask', [], is_static=True) ## ipv4-address.h (module 'network'): uint16_t ns3::Ipv4Mask::GetPrefixLength() const [member function] cls.add_method('GetPrefixLength', 'uint16_t', [], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetZero() [member function] cls.add_method('GetZero', 'ns3::Ipv4Mask', [], is_static=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Mask::IsEqual(ns3::Ipv4Mask other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ipv4Mask', 'other')], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Mask::IsMatch(ns3::Ipv4Address a, ns3::Ipv4Address b) const [member function] cls.add_method('IsMatch', 'bool', [param('ns3::Ipv4Address', 'a'), param('ns3::Ipv4Address', 'b')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Mask::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Mask::Set(uint32_t mask) [member function] cls.add_method('Set', 'void', [param('uint32_t', 'mask')]) return def register_Ns3Ipv6Address_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(char const * address) [constructor] cls.add_constructor([param('char const *', 'address')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(uint8_t * address) [constructor] cls.add_constructor([param('uint8_t *', 'address')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(ns3::Ipv6Address const & addr) [copy constructor] cls.add_constructor([param('ns3::Ipv6Address const &', 'addr')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(ns3::Ipv6Address const * addr) [constructor] cls.add_constructor([param('ns3::Ipv6Address const *', 'addr')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address ns3::Ipv6Address::CombinePrefix(ns3::Ipv6Prefix const & prefix) [member function] cls.add_method('CombinePrefix', 'ns3::Ipv6Address', [param('ns3::Ipv6Prefix const &', 'prefix')]) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::ConvertFrom(ns3::Address const & address) [member function] cls.add_method('ConvertFrom', 'ns3::Ipv6Address', [param('ns3::Address const &', 'address')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::Deserialize(uint8_t const * buf) [member function] cls.add_method('Deserialize', 'ns3::Ipv6Address', [param('uint8_t const *', 'buf')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllHostsMulticast() [member function] cls.add_method('GetAllHostsMulticast', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllNodesMulticast() [member function] cls.add_method('GetAllNodesMulticast', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllRoutersMulticast() [member function] cls.add_method('GetAllRoutersMulticast', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAny() [member function] cls.add_method('GetAny', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::GetBytes(uint8_t * buf) const [member function] cls.add_method('GetBytes', 'void', [param('uint8_t *', 'buf')], is_const=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetLoopback() [member function] cls.add_method('GetLoopback', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetOnes() [member function] cls.add_method('GetOnes', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetZero() [member function] cls.add_method('GetZero', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllHostsMulticast() const [member function] cls.add_method('IsAllHostsMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllNodesMulticast() const [member function] cls.add_method('IsAllNodesMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllRoutersMulticast() const [member function] cls.add_method('IsAllRoutersMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAny() const [member function] cls.add_method('IsAny', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsEqual(ns3::Ipv6Address const & other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ipv6Address const &', 'other')], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLinkLocal() const [member function] cls.add_method('IsLinkLocal', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLocalhost() const [member function] cls.add_method('IsLocalhost', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): static bool ns3::Ipv6Address::IsMatchingType(ns3::Address const & address) [member function] cls.add_method('IsMatchingType', 'bool', [param('ns3::Address const &', 'address')], is_static=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsMulticast() const [member function] cls.add_method('IsMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsSolicitedMulticast() const [member function] cls.add_method('IsSolicitedMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress(ns3::Mac48Address addr, ns3::Ipv6Address prefix) [member function] cls.add_method('MakeAutoconfiguredAddress', 'ns3::Ipv6Address', [param('ns3::Mac48Address', 'addr'), param('ns3::Ipv6Address', 'prefix')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(ns3::Mac48Address mac) [member function] cls.add_method('MakeAutoconfiguredLinkLocalAddress', 'ns3::Ipv6Address', [param('ns3::Mac48Address', 'mac')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeSolicitedAddress(ns3::Ipv6Address addr) [member function] cls.add_method('MakeSolicitedAddress', 'ns3::Ipv6Address', [param('ns3::Ipv6Address', 'addr')], is_static=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Serialize(uint8_t * buf) const [member function] cls.add_method('Serialize', 'void', [param('uint8_t *', 'buf')], is_const=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Set(char const * address) [member function] cls.add_method('Set', 'void', [param('char const *', 'address')]) ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Set(uint8_t * address) [member function] cls.add_method('Set', 'void', [param('uint8_t *', 'address')]) return def register_Ns3Ipv6Prefix_methods(root_module, cls): cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(uint8_t * prefix) [constructor] cls.add_constructor([param('uint8_t *', 'prefix')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(char const * prefix) [constructor] cls.add_constructor([param('char const *', 'prefix')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(uint8_t prefix) [constructor] cls.add_constructor([param('uint8_t', 'prefix')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(ns3::Ipv6Prefix const & prefix) [copy constructor] cls.add_constructor([param('ns3::Ipv6Prefix const &', 'prefix')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(ns3::Ipv6Prefix const * prefix) [constructor] cls.add_constructor([param('ns3::Ipv6Prefix const *', 'prefix')]) ## ipv6-address.h (module 'network'): void ns3::Ipv6Prefix::GetBytes(uint8_t * buf) const [member function] cls.add_method('GetBytes', 'void', [param('uint8_t *', 'buf')], is_const=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetLoopback() [member function] cls.add_method('GetLoopback', 'ns3::Ipv6Prefix', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetOnes() [member function] cls.add_method('GetOnes', 'ns3::Ipv6Prefix', [], is_static=True) ## ipv6-address.h (module 'network'): uint8_t ns3::Ipv6Prefix::GetPrefixLength() const [member function] cls.add_method('GetPrefixLength', 'uint8_t', [], is_const=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetZero() [member function] cls.add_method('GetZero', 'ns3::Ipv6Prefix', [], is_static=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Prefix::IsEqual(ns3::Ipv6Prefix const & other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ipv6Prefix const &', 'other')], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Prefix::IsMatch(ns3::Ipv6Address a, ns3::Ipv6Address b) const [member function] cls.add_method('IsMatch', 'bool', [param('ns3::Ipv6Address', 'a'), param('ns3::Ipv6Address', 'b')], is_const=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Prefix::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) return def register_Ns3LogComponent_methods(root_module, cls): ## log.h (module 'core'): ns3::LogComponent::LogComponent(ns3::LogComponent const & arg0) [copy constructor] cls.add_constructor([param('ns3::LogComponent const &', 'arg0')]) ## log.h (module 'core'): ns3::LogComponent::LogComponent(char const * name) [constructor] cls.add_constructor([param('char const *', 'name')]) ## log.h (module 'core'): void ns3::LogComponent::Disable(ns3::LogLevel level) [member function] cls.add_method('Disable', 'void', [param('ns3::LogLevel', 'level')]) ## log.h (module 'core'): void ns3::LogComponent::Enable(ns3::LogLevel level) [member function] cls.add_method('Enable', 'void', [param('ns3::LogLevel', 'level')]) ## log.h (module 'core'): void ns3::LogComponent::EnvVarCheck(char const * name) [member function] cls.add_method('EnvVarCheck', 'void', [param('char const *', 'name')]) ## log.h (module 'core'): bool ns3::LogComponent::IsEnabled(ns3::LogLevel level) const [member function] cls.add_method('IsEnabled', 'bool', [param('ns3::LogLevel', 'level')], is_const=True) ## log.h (module 'core'): bool ns3::LogComponent::IsNoneEnabled() const [member function] cls.add_method('IsNoneEnabled', 'bool', [], is_const=True) ## log.h (module 'core'): char const * ns3::LogComponent::Name() const [member function] cls.add_method('Name', 'char const *', [], is_const=True) return def register_Ns3Mac48Address_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address(ns3::Mac48Address const & arg0) [copy constructor] cls.add_constructor([param('ns3::Mac48Address const &', 'arg0')]) ## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address() [constructor] cls.add_constructor([]) ## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address(char const * str) [constructor] cls.add_constructor([param('char const *', 'str')]) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::Allocate() [member function] cls.add_method('Allocate', 'ns3::Mac48Address', [], is_static=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::ConvertFrom(ns3::Address const & address) [member function] cls.add_method('ConvertFrom', 'ns3::Mac48Address', [param('ns3::Address const &', 'address')], is_static=True) ## mac48-address.h (module 'network'): void ns3::Mac48Address::CopyFrom(uint8_t const * buffer) [member function] cls.add_method('CopyFrom', 'void', [param('uint8_t const *', 'buffer')]) ## mac48-address.h (module 'network'): void ns3::Mac48Address::CopyTo(uint8_t * buffer) const [member function] cls.add_method('CopyTo', 'void', [param('uint8_t *', 'buffer')], is_const=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetBroadcast() [member function] cls.add_method('GetBroadcast', 'ns3::Mac48Address', [], is_static=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticast(ns3::Ipv4Address address) [member function] cls.add_method('GetMulticast', 'ns3::Mac48Address', [param('ns3::Ipv4Address', 'address')], is_static=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticast(ns3::Ipv6Address address) [member function] cls.add_method('GetMulticast', 'ns3::Mac48Address', [param('ns3::Ipv6Address', 'address')], is_static=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticast6Prefix() [member function] cls.add_method('GetMulticast6Prefix', 'ns3::Mac48Address', [], is_static=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticastPrefix() [member function] cls.add_method('GetMulticastPrefix', 'ns3::Mac48Address', [], is_static=True) ## mac48-address.h (module 'network'): bool ns3::Mac48Address::IsBroadcast() const [member function] cls.add_method('IsBroadcast', 'bool', [], is_const=True) ## mac48-address.h (module 'network'): bool ns3::Mac48Address::IsGroup() const [member function] cls.add_method('IsGroup', 'bool', [], is_const=True) ## mac48-address.h (module 'network'): static bool ns3::Mac48Address::IsMatchingType(ns3::Address const & address) [member function] cls.add_method('IsMatchingType', 'bool', [param('ns3::Address const &', 'address')], is_static=True) return def register_Ns3NetDeviceContainer_methods(root_module, cls): ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(ns3::NetDeviceContainer const & arg0) [copy constructor] cls.add_constructor([param('ns3::NetDeviceContainer const &', 'arg0')]) ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer() [constructor] cls.add_constructor([]) ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(ns3::Ptr<ns3::NetDevice> dev) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::NetDevice >', 'dev')]) ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(std::string devName) [constructor] cls.add_constructor([param('std::string', 'devName')]) ## net-device-container.h (module 'network'): 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 (module 'network'): void ns3::NetDeviceContainer::Add(ns3::NetDeviceContainer other) [member function] cls.add_method('Add', 'void', [param('ns3::NetDeviceContainer', 'other')]) ## net-device-container.h (module 'network'): void ns3::NetDeviceContainer::Add(ns3::Ptr<ns3::NetDevice> device) [member function] cls.add_method('Add', 'void', [param('ns3::Ptr< ns3::NetDevice >', 'device')]) ## net-device-container.h (module 'network'): void ns3::NetDeviceContainer::Add(std::string deviceName) [member function] cls.add_method('Add', 'void', [param('std::string', 'deviceName')]) ## net-device-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::NetDevice>*,std::vector<ns3::Ptr<ns3::NetDevice>, std::allocator<ns3::Ptr<ns3::NetDevice> > > > ns3::NetDeviceContainer::Begin() const [member function] cls.add_method('Begin', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::NetDevice > const, std::vector< ns3::Ptr< ns3::NetDevice > > >', [], is_const=True) ## net-device-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::NetDevice>*,std::vector<ns3::Ptr<ns3::NetDevice>, std::allocator<ns3::Ptr<ns3::NetDevice> > > > ns3::NetDeviceContainer::End() const [member function] cls.add_method('End', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::NetDevice > const, std::vector< ns3::Ptr< ns3::NetDevice > > >', [], is_const=True) ## net-device-container.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::NetDeviceContainer::Get(uint32_t i) const [member function] cls.add_method('Get', 'ns3::Ptr< ns3::NetDevice >', [param('uint32_t', 'i')], is_const=True) ## net-device-container.h (module 'network'): uint32_t ns3::NetDeviceContainer::GetN() const [member function] cls.add_method('GetN', 'uint32_t', [], is_const=True) return def register_Ns3ObjectBase_methods(root_module, cls): ## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase() [constructor] cls.add_constructor([]) ## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase(ns3::ObjectBase const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectBase const &', 'arg0')]) ## object-base.h (module 'core'): void ns3::ObjectBase::GetAttribute(std::string name, ns3::AttributeValue & value) const [member function] cls.add_method('GetAttribute', 'void', [param('std::string', 'name'), param('ns3::AttributeValue &', 'value')], is_const=True) ## object-base.h (module 'core'): bool ns3::ObjectBase::GetAttributeFailSafe(std::string name, ns3::AttributeValue & attribute) const [member function] cls.add_method('GetAttributeFailSafe', 'bool', [param('std::string', 'name'), param('ns3::AttributeValue &', 'attribute')], is_const=True) ## object-base.h (module 'core'): ns3::TypeId ns3::ObjectBase::GetInstanceTypeId() const [member function] cls.add_method('GetInstanceTypeId', 'ns3::TypeId', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## object-base.h (module 'core'): static ns3::TypeId ns3::ObjectBase::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## object-base.h (module 'core'): void ns3::ObjectBase::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function] cls.add_method('SetAttribute', 'void', [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::SetAttributeFailSafe(std::string name, ns3::AttributeValue const & value) [member function] cls.add_method('SetAttributeFailSafe', 'bool', [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function] cls.add_method('TraceConnect', 'bool', [param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function] cls.add_method('TraceConnectWithoutContext', 'bool', [param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function] cls.add_method('TraceDisconnect', 'bool', [param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function] cls.add_method('TraceDisconnectWithoutContext', 'bool', [param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')]) ## object-base.h (module 'core'): void ns3::ObjectBase::ConstructSelf(ns3::AttributeConstructionList const & attributes) [member function] cls.add_method('ConstructSelf', 'void', [param('ns3::AttributeConstructionList const &', 'attributes')], visibility='protected') ## object-base.h (module 'core'): void ns3::ObjectBase::NotifyConstructionCompleted() [member function] cls.add_method('NotifyConstructionCompleted', 'void', [], visibility='protected', is_virtual=True) return def register_Ns3ObjectDeleter_methods(root_module, cls): ## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter() [constructor] cls.add_constructor([]) ## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter(ns3::ObjectDeleter const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectDeleter const &', 'arg0')]) ## object.h (module 'core'): static void ns3::ObjectDeleter::Delete(ns3::Object * object) [member function] cls.add_method('Delete', 'void', [param('ns3::Object *', 'object')], is_static=True) return def register_Ns3ObjectFactory_methods(root_module, cls): cls.add_output_stream_operator() ## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory(ns3::ObjectFactory const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectFactory const &', 'arg0')]) ## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory() [constructor] cls.add_constructor([]) ## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory(std::string typeId) [constructor] cls.add_constructor([param('std::string', 'typeId')]) ## object-factory.h (module 'core'): ns3::Ptr<ns3::Object> ns3::ObjectFactory::Create() const [member function] cls.add_method('Create', 'ns3::Ptr< ns3::Object >', [], is_const=True) ## object-factory.h (module 'core'): ns3::TypeId ns3::ObjectFactory::GetTypeId() const [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_const=True) ## object-factory.h (module 'core'): void ns3::ObjectFactory::Set(std::string name, ns3::AttributeValue const & value) [member function] cls.add_method('Set', 'void', [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')]) ## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(ns3::TypeId tid) [member function] cls.add_method('SetTypeId', 'void', [param('ns3::TypeId', 'tid')]) ## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(char const * tid) [member function] cls.add_method('SetTypeId', 'void', [param('char const *', 'tid')]) ## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(std::string tid) [member function] cls.add_method('SetTypeId', 'void', [param('std::string', 'tid')]) return def register_Ns3PacketMetadata_methods(root_module, cls): ## packet-metadata.h (module 'network'): ns3::PacketMetadata::PacketMetadata(uint64_t uid, uint32_t size) [constructor] cls.add_constructor([param('uint64_t', 'uid'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::PacketMetadata(ns3::PacketMetadata const & o) [copy constructor] cls.add_constructor([param('ns3::PacketMetadata const &', 'o')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddAtEnd(ns3::PacketMetadata const & o) [member function] cls.add_method('AddAtEnd', 'void', [param('ns3::PacketMetadata const &', 'o')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddHeader(ns3::Header const & header, uint32_t size) [member function] cls.add_method('AddHeader', 'void', [param('ns3::Header const &', 'header'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddPaddingAtEnd(uint32_t end) [member function] cls.add_method('AddPaddingAtEnd', 'void', [param('uint32_t', 'end')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddTrailer(ns3::Trailer const & trailer, uint32_t size) [member function] cls.add_method('AddTrailer', 'void', [param('ns3::Trailer const &', 'trailer'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator ns3::PacketMetadata::BeginItem(ns3::Buffer buffer) const [member function] cls.add_method('BeginItem', 'ns3::PacketMetadata::ItemIterator', [param('ns3::Buffer', 'buffer')], is_const=True) ## packet-metadata.h (module 'network'): ns3::PacketMetadata ns3::PacketMetadata::CreateFragment(uint32_t start, uint32_t end) const [member function] cls.add_method('CreateFragment', 'ns3::PacketMetadata', [param('uint32_t', 'start'), param('uint32_t', 'end')], is_const=True) ## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::Deserialize(uint8_t const * buffer, uint32_t size) [member function] cls.add_method('Deserialize', 'uint32_t', [param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): static void ns3::PacketMetadata::Enable() [member function] cls.add_method('Enable', 'void', [], is_static=True) ## packet-metadata.h (module 'network'): static void ns3::PacketMetadata::EnableChecking() [member function] cls.add_method('EnableChecking', 'void', [], is_static=True) ## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## packet-metadata.h (module 'network'): uint64_t ns3::PacketMetadata::GetUid() const [member function] cls.add_method('GetUid', 'uint64_t', [], is_const=True) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveAtEnd(uint32_t end) [member function] cls.add_method('RemoveAtEnd', 'void', [param('uint32_t', 'end')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveAtStart(uint32_t start) [member function] cls.add_method('RemoveAtStart', 'void', [param('uint32_t', 'start')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveHeader(ns3::Header const & header, uint32_t size) [member function] cls.add_method('RemoveHeader', 'void', [param('ns3::Header const &', 'header'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveTrailer(ns3::Trailer const & trailer, uint32_t size) [member function] cls.add_method('RemoveTrailer', 'void', [param('ns3::Trailer const &', 'trailer'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function] cls.add_method('Serialize', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')], is_const=True) return def register_Ns3PacketMetadataItem_methods(root_module, cls): ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::Item() [constructor] cls.add_constructor([]) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::Item(ns3::PacketMetadata::Item const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketMetadata::Item const &', 'arg0')]) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::current [variable] cls.add_instance_attribute('current', 'ns3::Buffer::Iterator', is_const=False) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentSize [variable] cls.add_instance_attribute('currentSize', 'uint32_t', is_const=False) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentTrimedFromEnd [variable] cls.add_instance_attribute('currentTrimedFromEnd', 'uint32_t', is_const=False) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentTrimedFromStart [variable] cls.add_instance_attribute('currentTrimedFromStart', 'uint32_t', is_const=False) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::isFragment [variable] cls.add_instance_attribute('isFragment', 'bool', is_const=False) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::tid [variable] cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False) return def register_Ns3PacketMetadataItemIterator_methods(root_module, cls): ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator::ItemIterator(ns3::PacketMetadata::ItemIterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketMetadata::ItemIterator const &', 'arg0')]) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator::ItemIterator(ns3::PacketMetadata const * metadata, ns3::Buffer buffer) [constructor] cls.add_constructor([param('ns3::PacketMetadata const *', 'metadata'), param('ns3::Buffer', 'buffer')]) ## packet-metadata.h (module 'network'): bool ns3::PacketMetadata::ItemIterator::HasNext() const [member function] cls.add_method('HasNext', 'bool', [], is_const=True) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item ns3::PacketMetadata::ItemIterator::Next() [member function] cls.add_method('Next', 'ns3::PacketMetadata::Item', []) return def register_Ns3PacketTagIterator_methods(root_module, cls): ## packet.h (module 'network'): ns3::PacketTagIterator::PacketTagIterator(ns3::PacketTagIterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketTagIterator const &', 'arg0')]) ## packet.h (module 'network'): bool ns3::PacketTagIterator::HasNext() const [member function] cls.add_method('HasNext', 'bool', [], is_const=True) ## packet.h (module 'network'): ns3::PacketTagIterator::Item ns3::PacketTagIterator::Next() [member function] cls.add_method('Next', 'ns3::PacketTagIterator::Item', []) return def register_Ns3PacketTagIteratorItem_methods(root_module, cls): ## packet.h (module 'network'): ns3::PacketTagIterator::Item::Item(ns3::PacketTagIterator::Item const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketTagIterator::Item const &', 'arg0')]) ## packet.h (module 'network'): void ns3::PacketTagIterator::Item::GetTag(ns3::Tag & tag) const [member function] cls.add_method('GetTag', 'void', [param('ns3::Tag &', 'tag')], is_const=True) ## packet.h (module 'network'): ns3::TypeId ns3::PacketTagIterator::Item::GetTypeId() const [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_const=True) return def register_Ns3PacketTagList_methods(root_module, cls): ## packet-tag-list.h (module 'network'): ns3::PacketTagList::PacketTagList() [constructor] cls.add_constructor([]) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::PacketTagList(ns3::PacketTagList const & o) [copy constructor] cls.add_constructor([param('ns3::PacketTagList const &', 'o')]) ## packet-tag-list.h (module 'network'): void ns3::PacketTagList::Add(ns3::Tag const & tag) const [member function] cls.add_method('Add', 'void', [param('ns3::Tag const &', 'tag')], is_const=True) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData const * ns3::PacketTagList::Head() const [member function] cls.add_method('Head', 'ns3::PacketTagList::TagData const *', [], is_const=True) ## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Peek(ns3::Tag & tag) const [member function] cls.add_method('Peek', 'bool', [param('ns3::Tag &', 'tag')], is_const=True) ## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Remove(ns3::Tag & tag) [member function] cls.add_method('Remove', 'bool', [param('ns3::Tag &', 'tag')]) ## packet-tag-list.h (module 'network'): void ns3::PacketTagList::RemoveAll() [member function] cls.add_method('RemoveAll', 'void', []) return def register_Ns3PacketTagListTagData_methods(root_module, cls): ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData() [constructor] cls.add_constructor([]) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData(ns3::PacketTagList::TagData const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketTagList::TagData const &', 'arg0')]) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::count [variable] cls.add_instance_attribute('count', 'uint32_t', is_const=False) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::data [variable] cls.add_instance_attribute('data', 'uint8_t [ 20 ]', is_const=False) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::next [variable] cls.add_instance_attribute('next', 'ns3::PacketTagList::TagData *', is_const=False) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::tid [variable] cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False) return def register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount(ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SystemMutex_methods(root_module, cls): ## system-mutex.h (module 'core'): ns3::SystemMutex::SystemMutex(ns3::SystemMutex const & arg0) [copy constructor] cls.add_constructor([param('ns3::SystemMutex const &', 'arg0')]) ## system-mutex.h (module 'core'): ns3::SystemMutex::SystemMutex() [constructor] cls.add_constructor([]) ## system-mutex.h (module 'core'): void ns3::SystemMutex::Lock() [member function] cls.add_method('Lock', 'void', []) ## system-mutex.h (module 'core'): void ns3::SystemMutex::Unlock() [member function] cls.add_method('Unlock', 'void', []) return def register_Ns3Tag_methods(root_module, cls): ## tag.h (module 'network'): ns3::Tag::Tag() [constructor] cls.add_constructor([]) ## tag.h (module 'network'): ns3::Tag::Tag(ns3::Tag const & arg0) [copy constructor] cls.add_constructor([param('ns3::Tag const &', 'arg0')]) ## tag.h (module 'network'): void ns3::Tag::Deserialize(ns3::TagBuffer i) [member function] cls.add_method('Deserialize', 'void', [param('ns3::TagBuffer', 'i')], is_pure_virtual=True, is_virtual=True) ## tag.h (module 'network'): uint32_t ns3::Tag::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## tag.h (module 'network'): static ns3::TypeId ns3::Tag::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## tag.h (module 'network'): void ns3::Tag::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_pure_virtual=True, is_const=True, is_virtual=True) ## tag.h (module 'network'): void ns3::Tag::Serialize(ns3::TagBuffer i) const [member function] cls.add_method('Serialize', 'void', [param('ns3::TagBuffer', 'i')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3TagBuffer_methods(root_module, cls): ## tag-buffer.h (module 'network'): ns3::TagBuffer::TagBuffer(ns3::TagBuffer const & arg0) [copy constructor] cls.add_constructor([param('ns3::TagBuffer const &', 'arg0')]) ## tag-buffer.h (module 'network'): ns3::TagBuffer::TagBuffer(uint8_t * start, uint8_t * end) [constructor] cls.add_constructor([param('uint8_t *', 'start'), param('uint8_t *', 'end')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::CopyFrom(ns3::TagBuffer o) [member function] cls.add_method('CopyFrom', 'void', [param('ns3::TagBuffer', 'o')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::Read(uint8_t * buffer, uint32_t size) [member function] cls.add_method('Read', 'void', [param('uint8_t *', 'buffer'), param('uint32_t', 'size')]) ## tag-buffer.h (module 'network'): double ns3::TagBuffer::ReadDouble() [member function] cls.add_method('ReadDouble', 'double', []) ## tag-buffer.h (module 'network'): uint16_t ns3::TagBuffer::ReadU16() [member function] cls.add_method('ReadU16', 'uint16_t', []) ## tag-buffer.h (module 'network'): uint32_t ns3::TagBuffer::ReadU32() [member function] cls.add_method('ReadU32', 'uint32_t', []) ## tag-buffer.h (module 'network'): uint64_t ns3::TagBuffer::ReadU64() [member function] cls.add_method('ReadU64', 'uint64_t', []) ## tag-buffer.h (module 'network'): uint8_t ns3::TagBuffer::ReadU8() [member function] cls.add_method('ReadU8', 'uint8_t', []) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::TrimAtEnd(uint32_t trim) [member function] cls.add_method('TrimAtEnd', 'void', [param('uint32_t', 'trim')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::Write(uint8_t const * buffer, uint32_t size) [member function] cls.add_method('Write', 'void', [param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteDouble(double v) [member function] cls.add_method('WriteDouble', 'void', [param('double', 'v')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU16(uint16_t data) [member function] cls.add_method('WriteU16', 'void', [param('uint16_t', 'data')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU32(uint32_t data) [member function] cls.add_method('WriteU32', 'void', [param('uint32_t', 'data')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU64(uint64_t v) [member function] cls.add_method('WriteU64', 'void', [param('uint64_t', 'v')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU8(uint8_t v) [member function] cls.add_method('WriteU8', 'void', [param('uint8_t', 'v')]) return def register_Ns3TapBridgeHelper_methods(root_module, cls): ## tap-bridge-helper.h (module 'tap-bridge'): ns3::TapBridgeHelper::TapBridgeHelper(ns3::TapBridgeHelper const & arg0) [copy constructor] cls.add_constructor([param('ns3::TapBridgeHelper const &', 'arg0')]) ## tap-bridge-helper.h (module 'tap-bridge'): ns3::TapBridgeHelper::TapBridgeHelper() [constructor] cls.add_constructor([]) ## tap-bridge-helper.h (module 'tap-bridge'): ns3::TapBridgeHelper::TapBridgeHelper(ns3::Ipv4Address gateway) [constructor] cls.add_constructor([param('ns3::Ipv4Address', 'gateway')]) ## tap-bridge-helper.h (module 'tap-bridge'): ns3::Ptr<ns3::NetDevice> ns3::TapBridgeHelper::Install(ns3::Ptr<ns3::Node> node, ns3::Ptr<ns3::NetDevice> 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 (module 'tap-bridge'): ns3::Ptr<ns3::NetDevice> ns3::TapBridgeHelper::Install(std::string nodeName, ns3::Ptr<ns3::NetDevice> 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 (module 'tap-bridge'): ns3::Ptr<ns3::NetDevice> ns3::TapBridgeHelper::Install(ns3::Ptr<ns3::Node> 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 (module 'tap-bridge'): ns3::Ptr<ns3::NetDevice> 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')]) ## tap-bridge-helper.h (module 'tap-bridge'): ns3::Ptr<ns3::NetDevice> ns3::TapBridgeHelper::Install(ns3::Ptr<ns3::Node> node, ns3::Ptr<ns3::NetDevice> nd, ns3::AttributeValue const & bridgeType) [member function] cls.add_method('Install', 'ns3::Ptr< ns3::NetDevice >', [param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('ns3::AttributeValue const &', 'bridgeType')]) ## tap-bridge-helper.h (module 'tap-bridge'): 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')]) return def register_Ns3TypeId_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## type-id.h (module 'core'): ns3::TypeId::TypeId(char const * name) [constructor] cls.add_constructor([param('char const *', 'name')]) ## type-id.h (module 'core'): ns3::TypeId::TypeId() [constructor] cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeId::TypeId(ns3::TypeId const & o) [copy constructor] cls.add_constructor([param('ns3::TypeId const &', 'o')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, ns3::AttributeValue const & initialValue, ns3::Ptr<ns3::AttributeAccessor const> accessor, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('AddAttribute', 'ns3::TypeId', [param('std::string', 'name'), param('std::string', 'help'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, uint32_t flags, ns3::AttributeValue const & initialValue, ns3::Ptr<ns3::AttributeAccessor const> accessor, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('AddAttribute', 'ns3::TypeId', [param('std::string', 'name'), param('std::string', 'help'), param('uint32_t', 'flags'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr<ns3::TraceSourceAccessor const> accessor) [member function] cls.add_method('AddTraceSource', 'ns3::TypeId', [param('std::string', 'name'), param('std::string', 'help'), param('ns3::Ptr< ns3::TraceSourceAccessor const >', 'accessor')]) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation ns3::TypeId::GetAttribute(uint32_t i) const [member function] cls.add_method('GetAttribute', 'ns3::TypeId::AttributeInformation', [param('uint32_t', 'i')], is_const=True) ## type-id.h (module 'core'): std::string ns3::TypeId::GetAttributeFullName(uint32_t i) const [member function] cls.add_method('GetAttributeFullName', 'std::string', [param('uint32_t', 'i')], is_const=True) ## type-id.h (module 'core'): uint32_t ns3::TypeId::GetAttributeN() const [member function] cls.add_method('GetAttributeN', 'uint32_t', [], is_const=True) ## type-id.h (module 'core'): ns3::Callback<ns3::ObjectBase*,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ns3::TypeId::GetConstructor() const [member function] cls.add_method('GetConstructor', 'ns3::Callback< ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', [], is_const=True) ## type-id.h (module 'core'): std::string ns3::TypeId::GetGroupName() const [member function] cls.add_method('GetGroupName', 'std::string', [], is_const=True) ## type-id.h (module 'core'): std::string ns3::TypeId::GetName() const [member function] cls.add_method('GetName', 'std::string', [], is_const=True) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::GetParent() const [member function] cls.add_method('GetParent', 'ns3::TypeId', [], is_const=True) ## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::GetRegistered(uint32_t i) [member function] cls.add_method('GetRegistered', 'ns3::TypeId', [param('uint32_t', 'i')], is_static=True) ## type-id.h (module 'core'): static uint32_t ns3::TypeId::GetRegisteredN() [member function] cls.add_method('GetRegisteredN', 'uint32_t', [], is_static=True) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation ns3::TypeId::GetTraceSource(uint32_t i) const [member function] cls.add_method('GetTraceSource', 'ns3::TypeId::TraceSourceInformation', [param('uint32_t', 'i')], is_const=True) ## type-id.h (module 'core'): uint32_t ns3::TypeId::GetTraceSourceN() const [member function] cls.add_method('GetTraceSourceN', 'uint32_t', [], is_const=True) ## type-id.h (module 'core'): uint16_t ns3::TypeId::GetUid() const [member function] cls.add_method('GetUid', 'uint16_t', [], is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::HasConstructor() const [member function] cls.add_method('HasConstructor', 'bool', [], is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::HasParent() const [member function] cls.add_method('HasParent', 'bool', [], is_const=True) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::HideFromDocumentation() [member function] cls.add_method('HideFromDocumentation', 'ns3::TypeId', []) ## type-id.h (module 'core'): bool ns3::TypeId::IsChildOf(ns3::TypeId other) const [member function] cls.add_method('IsChildOf', 'bool', [param('ns3::TypeId', 'other')], is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::LookupAttributeByName(std::string name, ns3::TypeId::AttributeInformation * info) const [member function] cls.add_method('LookupAttributeByName', 'bool', [param('std::string', 'name'), param('ns3::TypeId::AttributeInformation *', 'info')], is_const=True) ## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::LookupByName(std::string name) [member function] cls.add_method('LookupByName', 'ns3::TypeId', [param('std::string', 'name')], is_static=True) ## type-id.h (module 'core'): ns3::Ptr<ns3::TraceSourceAccessor const> ns3::TypeId::LookupTraceSourceByName(std::string name) const [member function] cls.add_method('LookupTraceSourceByName', 'ns3::Ptr< ns3::TraceSourceAccessor const >', [param('std::string', 'name')], is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::MustHideFromDocumentation() const [member function] cls.add_method('MustHideFromDocumentation', 'bool', [], is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::SetAttributeInitialValue(uint32_t i, ns3::Ptr<ns3::AttributeValue const> initialValue) [member function] cls.add_method('SetAttributeInitialValue', 'bool', [param('uint32_t', 'i'), param('ns3::Ptr< ns3::AttributeValue const >', 'initialValue')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetGroupName(std::string groupName) [member function] cls.add_method('SetGroupName', 'ns3::TypeId', [param('std::string', 'groupName')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetParent(ns3::TypeId tid) [member function] cls.add_method('SetParent', 'ns3::TypeId', [param('ns3::TypeId', 'tid')]) ## type-id.h (module 'core'): void ns3::TypeId::SetUid(uint16_t tid) [member function] cls.add_method('SetUid', 'void', [param('uint16_t', 'tid')]) return def register_Ns3TypeIdAttributeInformation_methods(root_module, cls): ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation() [constructor] cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation(ns3::TypeId::AttributeInformation const & arg0) [copy constructor] cls.add_constructor([param('ns3::TypeId::AttributeInformation const &', 'arg0')]) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::accessor [variable] cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::AttributeAccessor const >', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::checker [variable] cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::flags [variable] cls.add_instance_attribute('flags', 'uint32_t', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::help [variable] cls.add_instance_attribute('help', 'std::string', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::initialValue [variable] cls.add_instance_attribute('initialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::name [variable] cls.add_instance_attribute('name', 'std::string', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::originalInitialValue [variable] cls.add_instance_attribute('originalInitialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False) return def register_Ns3TypeIdTraceSourceInformation_methods(root_module, cls): ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation() [constructor] cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation(ns3::TypeId::TraceSourceInformation const & arg0) [copy constructor] cls.add_constructor([param('ns3::TypeId::TraceSourceInformation const &', 'arg0')]) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::accessor [variable] cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::TraceSourceAccessor const >', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::help [variable] cls.add_instance_attribute('help', 'std::string', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::name [variable] cls.add_instance_attribute('name', 'std::string', is_const=False) return def register_Ns3Empty_methods(root_module, cls): ## empty.h (module 'core'): ns3::empty::empty() [constructor] cls.add_constructor([]) ## empty.h (module 'core'): ns3::empty::empty(ns3::empty const & arg0) [copy constructor] cls.add_constructor([param('ns3::empty const &', 'arg0')]) return def register_Ns3Int64x64_t_methods(root_module, cls): cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short unsigned int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned char const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('signed char const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('double const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short unsigned int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned char const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('signed char const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('double const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short unsigned int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned char const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('signed char const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('double const', 'right')) cls.add_unary_numeric_operator('-') cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short unsigned int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned char const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('signed char const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('double const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right')) cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('>') cls.add_binary_comparison_operator('!=') cls.add_inplace_numeric_operator('*=', param('ns3::int64x64_t const &', 'right')) cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right')) cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', 'right')) cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', 'right')) cls.add_output_stream_operator() cls.add_binary_comparison_operator('<=') cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('>=') ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t() [constructor] cls.add_constructor([]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(double v) [constructor] cls.add_constructor([param('double', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(int v) [constructor] cls.add_constructor([param('int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long int v) [constructor] cls.add_constructor([param('long int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long long int v) [constructor] cls.add_constructor([param('long long int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(unsigned int v) [constructor] cls.add_constructor([param('unsigned int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long unsigned int v) [constructor] cls.add_constructor([param('long unsigned int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long long unsigned int v) [constructor] cls.add_constructor([param('long long unsigned int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(int64_t hi, uint64_t lo) [constructor] cls.add_constructor([param('int64_t', 'hi'), param('uint64_t', 'lo')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(ns3::int64x64_t const & o) [copy constructor] cls.add_constructor([param('ns3::int64x64_t const &', 'o')]) ## int64x64-double.h (module 'core'): double ns3::int64x64_t::GetDouble() const [member function] cls.add_method('GetDouble', 'double', [], is_const=True) ## int64x64-double.h (module 'core'): int64_t ns3::int64x64_t::GetHigh() const [member function] cls.add_method('GetHigh', 'int64_t', [], is_const=True) ## int64x64-double.h (module 'core'): uint64_t ns3::int64x64_t::GetLow() const [member function] cls.add_method('GetLow', 'uint64_t', [], is_const=True) ## int64x64-double.h (module 'core'): static ns3::int64x64_t ns3::int64x64_t::Invert(uint64_t v) [member function] cls.add_method('Invert', 'ns3::int64x64_t', [param('uint64_t', 'v')], is_static=True) ## int64x64-double.h (module 'core'): void ns3::int64x64_t::MulByInvert(ns3::int64x64_t const & o) [member function] cls.add_method('MulByInvert', 'void', [param('ns3::int64x64_t const &', 'o')]) return def register_Ns3Chunk_methods(root_module, cls): ## chunk.h (module 'network'): ns3::Chunk::Chunk() [constructor] cls.add_constructor([]) ## chunk.h (module 'network'): ns3::Chunk::Chunk(ns3::Chunk const & arg0) [copy constructor] cls.add_constructor([param('ns3::Chunk const &', 'arg0')]) ## chunk.h (module 'network'): uint32_t ns3::Chunk::Deserialize(ns3::Buffer::Iterator start) [member function] cls.add_method('Deserialize', 'uint32_t', [param('ns3::Buffer::Iterator', 'start')], is_pure_virtual=True, is_virtual=True) ## chunk.h (module 'network'): static ns3::TypeId ns3::Chunk::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## chunk.h (module 'network'): void ns3::Chunk::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3Header_methods(root_module, cls): cls.add_output_stream_operator() ## header.h (module 'network'): ns3::Header::Header() [constructor] cls.add_constructor([]) ## header.h (module 'network'): ns3::Header::Header(ns3::Header const & arg0) [copy constructor] cls.add_constructor([param('ns3::Header const &', 'arg0')]) ## header.h (module 'network'): uint32_t ns3::Header::Deserialize(ns3::Buffer::Iterator start) [member function] cls.add_method('Deserialize', 'uint32_t', [param('ns3::Buffer::Iterator', 'start')], is_pure_virtual=True, is_virtual=True) ## header.h (module 'network'): uint32_t ns3::Header::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## header.h (module 'network'): static ns3::TypeId ns3::Header::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## header.h (module 'network'): void ns3::Header::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_pure_virtual=True, is_const=True, is_virtual=True) ## header.h (module 'network'): void ns3::Header::Serialize(ns3::Buffer::Iterator start) const [member function] cls.add_method('Serialize', 'void', [param('ns3::Buffer::Iterator', 'start')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3Object_methods(root_module, cls): ## object.h (module 'core'): ns3::Object::Object() [constructor] cls.add_constructor([]) ## object.h (module 'core'): void ns3::Object::AggregateObject(ns3::Ptr<ns3::Object> other) [member function] cls.add_method('AggregateObject', 'void', [param('ns3::Ptr< ns3::Object >', 'other')]) ## object.h (module 'core'): void ns3::Object::Dispose() [member function] cls.add_method('Dispose', 'void', []) ## object.h (module 'core'): ns3::Object::AggregateIterator ns3::Object::GetAggregateIterator() const [member function] cls.add_method('GetAggregateIterator', 'ns3::Object::AggregateIterator', [], is_const=True) ## object.h (module 'core'): ns3::TypeId ns3::Object::GetInstanceTypeId() const [member function] cls.add_method('GetInstanceTypeId', 'ns3::TypeId', [], is_const=True, is_virtual=True) ## object.h (module 'core'): static ns3::TypeId ns3::Object::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## object.h (module 'core'): void ns3::Object::Start() [member function] cls.add_method('Start', 'void', []) ## object.h (module 'core'): ns3::Object::Object(ns3::Object const & o) [copy constructor] cls.add_constructor([param('ns3::Object const &', 'o')], visibility='protected') ## object.h (module 'core'): void ns3::Object::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='protected', is_virtual=True) ## object.h (module 'core'): void ns3::Object::DoStart() [member function] cls.add_method('DoStart', 'void', [], visibility='protected', is_virtual=True) ## object.h (module 'core'): void ns3::Object::NotifyNewAggregate() [member function] cls.add_method('NotifyNewAggregate', 'void', [], visibility='protected', is_virtual=True) return def register_Ns3ObjectAggregateIterator_methods(root_module, cls): ## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator(ns3::Object::AggregateIterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::Object::AggregateIterator const &', 'arg0')]) ## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator() [constructor] cls.add_constructor([]) ## object.h (module 'core'): bool ns3::Object::AggregateIterator::HasNext() const [member function] cls.add_method('HasNext', 'bool', [], is_const=True) ## object.h (module 'core'): ns3::Ptr<ns3::Object const> ns3::Object::AggregateIterator::Next() [member function] cls.add_method('Next', 'ns3::Ptr< ns3::Object const >', []) return def register_Ns3Scheduler_methods(root_module, cls): ## scheduler.h (module 'core'): ns3::Scheduler::Scheduler() [constructor] cls.add_constructor([]) ## scheduler.h (module 'core'): ns3::Scheduler::Scheduler(ns3::Scheduler const & arg0) [copy constructor] cls.add_constructor([param('ns3::Scheduler const &', 'arg0')]) ## scheduler.h (module 'core'): static ns3::TypeId ns3::Scheduler::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## scheduler.h (module 'core'): void ns3::Scheduler::Insert(ns3::Scheduler::Event const & ev) [member function] cls.add_method('Insert', 'void', [param('ns3::Scheduler::Event const &', 'ev')], is_pure_virtual=True, is_virtual=True) ## scheduler.h (module 'core'): bool ns3::Scheduler::IsEmpty() const [member function] cls.add_method('IsEmpty', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## scheduler.h (module 'core'): ns3::Scheduler::Event ns3::Scheduler::PeekNext() const [member function] cls.add_method('PeekNext', 'ns3::Scheduler::Event', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## scheduler.h (module 'core'): void ns3::Scheduler::Remove(ns3::Scheduler::Event const & ev) [member function] cls.add_method('Remove', 'void', [param('ns3::Scheduler::Event const &', 'ev')], is_pure_virtual=True, is_virtual=True) ## scheduler.h (module 'core'): ns3::Scheduler::Event ns3::Scheduler::RemoveNext() [member function] cls.add_method('RemoveNext', 'ns3::Scheduler::Event', [], is_pure_virtual=True, is_virtual=True) return def register_Ns3SchedulerEvent_methods(root_module, cls): cls.add_binary_comparison_operator('<') ## scheduler.h (module 'core'): ns3::Scheduler::Event::Event() [constructor] cls.add_constructor([]) ## scheduler.h (module 'core'): ns3::Scheduler::Event::Event(ns3::Scheduler::Event const & arg0) [copy constructor] cls.add_constructor([param('ns3::Scheduler::Event const &', 'arg0')]) ## scheduler.h (module 'core'): ns3::Scheduler::Event::impl [variable] cls.add_instance_attribute('impl', 'ns3::EventImpl *', is_const=False) ## scheduler.h (module 'core'): ns3::Scheduler::Event::key [variable] cls.add_instance_attribute('key', 'ns3::Scheduler::EventKey', is_const=False) 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 (module 'core'): ns3::Scheduler::EventKey::EventKey() [constructor] cls.add_constructor([]) ## scheduler.h (module 'core'): ns3::Scheduler::EventKey::EventKey(ns3::Scheduler::EventKey const & arg0) [copy constructor] cls.add_constructor([param('ns3::Scheduler::EventKey const &', 'arg0')]) ## scheduler.h (module 'core'): ns3::Scheduler::EventKey::m_context [variable] cls.add_instance_attribute('m_context', 'uint32_t', is_const=False) ## scheduler.h (module 'core'): ns3::Scheduler::EventKey::m_ts [variable] cls.add_instance_attribute('m_ts', 'uint64_t', is_const=False) ## scheduler.h (module 'core'): ns3::Scheduler::EventKey::m_uid [variable] cls.add_instance_attribute('m_uid', 'uint32_t', is_const=False) return def register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter< ns3::AttributeAccessor > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter< ns3::AttributeChecker > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter< ns3::AttributeValue > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount(ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter< ns3::CallbackImplBase > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::SimpleRefCount(ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter< ns3::EventImpl > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3FdReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3FdReader__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >::SimpleRefCount(ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::FdReader, ns3::empty, ns3::DefaultDeleter< ns3::FdReader > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount(ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter< ns3::NixVector > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::SimpleRefCount(ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter< ns3::Packet > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3SystemThread_Ns3Empty_Ns3DefaultDeleter__lt__ns3SystemThread__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >::SimpleRefCount(ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter< ns3::SystemThread > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter< ns3::TraceSourceAccessor > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimulatorImpl_methods(root_module, cls): ## simulator-impl.h (module 'core'): ns3::SimulatorImpl::SimulatorImpl() [constructor] cls.add_constructor([]) ## simulator-impl.h (module 'core'): ns3::SimulatorImpl::SimulatorImpl(ns3::SimulatorImpl const & arg0) [copy constructor] cls.add_constructor([param('ns3::SimulatorImpl const &', 'arg0')]) ## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Cancel(ns3::EventId const & ev) [member function] cls.add_method('Cancel', 'void', [param('ns3::EventId const &', 'ev')], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Destroy() [member function] cls.add_method('Destroy', 'void', [], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): uint32_t ns3::SimulatorImpl::GetContext() const [member function] cls.add_method('GetContext', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::GetDelayLeft(ns3::EventId const & id) const [member function] cls.add_method('GetDelayLeft', 'ns3::Time', [param('ns3::EventId const &', 'id')], is_pure_virtual=True, is_const=True, is_virtual=True) ## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::GetMaximumSimulationTime() const [member function] cls.add_method('GetMaximumSimulationTime', 'ns3::Time', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## simulator-impl.h (module 'core'): uint32_t ns3::SimulatorImpl::GetSystemId() const [member function] cls.add_method('GetSystemId', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## simulator-impl.h (module 'core'): static ns3::TypeId ns3::SimulatorImpl::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## simulator-impl.h (module 'core'): bool ns3::SimulatorImpl::IsExpired(ns3::EventId const & ev) const [member function] cls.add_method('IsExpired', 'bool', [param('ns3::EventId const &', 'ev')], is_pure_virtual=True, is_const=True, is_virtual=True) ## simulator-impl.h (module 'core'): bool ns3::SimulatorImpl::IsFinished() const [member function] cls.add_method('IsFinished', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::Next() const [member function] cls.add_method('Next', 'ns3::Time', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::Now() const [member function] cls.add_method('Now', 'ns3::Time', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Remove(ns3::EventId const & ev) [member function] cls.add_method('Remove', 'void', [param('ns3::EventId const &', 'ev')], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Run() [member function] cls.add_method('Run', 'void', [], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::RunOneEvent() [member function] cls.add_method('RunOneEvent', 'void', [], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): ns3::EventId ns3::SimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function] cls.add_method('Schedule', 'ns3::EventId', [param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): ns3::EventId ns3::SimulatorImpl::ScheduleDestroy(ns3::EventImpl * event) [member function] cls.add_method('ScheduleDestroy', 'ns3::EventId', [param('ns3::EventImpl *', 'event')], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): ns3::EventId ns3::SimulatorImpl::ScheduleNow(ns3::EventImpl * event) [member function] cls.add_method('ScheduleNow', 'ns3::EventId', [param('ns3::EventImpl *', 'event')], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::ScheduleWithContext(uint32_t context, ns3::Time const & time, ns3::EventImpl * event) [member function] cls.add_method('ScheduleWithContext', 'void', [param('uint32_t', 'context'), param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function] cls.add_method('SetScheduler', 'void', [param('ns3::ObjectFactory', 'schedulerFactory')], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Stop() [member function] cls.add_method('Stop', 'void', [], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Stop(ns3::Time const & time) [member function] cls.add_method('Stop', 'void', [param('ns3::Time const &', 'time')], is_pure_virtual=True, is_virtual=True) return def register_Ns3Synchronizer_methods(root_module, cls): ## synchronizer.h (module 'core'): ns3::Synchronizer::Synchronizer(ns3::Synchronizer const & arg0) [copy constructor] cls.add_constructor([param('ns3::Synchronizer const &', 'arg0')]) ## synchronizer.h (module 'core'): ns3::Synchronizer::Synchronizer() [constructor] cls.add_constructor([]) ## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::EventEnd() [member function] cls.add_method('EventEnd', 'uint64_t', []) ## synchronizer.h (module 'core'): void ns3::Synchronizer::EventStart() [member function] cls.add_method('EventStart', 'void', []) ## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::GetCurrentRealtime() [member function] cls.add_method('GetCurrentRealtime', 'uint64_t', []) ## synchronizer.h (module 'core'): int64_t ns3::Synchronizer::GetDrift(uint64_t ts) [member function] cls.add_method('GetDrift', 'int64_t', [param('uint64_t', 'ts')]) ## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::GetOrigin() [member function] cls.add_method('GetOrigin', 'uint64_t', []) ## synchronizer.h (module 'core'): static ns3::TypeId ns3::Synchronizer::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## synchronizer.h (module 'core'): bool ns3::Synchronizer::Realtime() [member function] cls.add_method('Realtime', 'bool', []) ## synchronizer.h (module 'core'): void ns3::Synchronizer::SetCondition(bool arg0) [member function] cls.add_method('SetCondition', 'void', [param('bool', 'arg0')]) ## synchronizer.h (module 'core'): void ns3::Synchronizer::SetOrigin(uint64_t ts) [member function] cls.add_method('SetOrigin', 'void', [param('uint64_t', 'ts')]) ## synchronizer.h (module 'core'): void ns3::Synchronizer::Signal() [member function] cls.add_method('Signal', 'void', []) ## synchronizer.h (module 'core'): bool ns3::Synchronizer::Synchronize(uint64_t tsCurrent, uint64_t tsDelay) [member function] cls.add_method('Synchronize', 'bool', [param('uint64_t', 'tsCurrent'), param('uint64_t', 'tsDelay')]) ## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::DoEventEnd() [member function] cls.add_method('DoEventEnd', 'uint64_t', [], is_pure_virtual=True, visibility='protected', is_virtual=True) ## synchronizer.h (module 'core'): void ns3::Synchronizer::DoEventStart() [member function] cls.add_method('DoEventStart', 'void', [], is_pure_virtual=True, visibility='protected', is_virtual=True) ## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::DoGetCurrentRealtime() [member function] cls.add_method('DoGetCurrentRealtime', 'uint64_t', [], is_pure_virtual=True, visibility='protected', is_virtual=True) ## synchronizer.h (module 'core'): int64_t ns3::Synchronizer::DoGetDrift(uint64_t ns) [member function] cls.add_method('DoGetDrift', 'int64_t', [param('uint64_t', 'ns')], is_pure_virtual=True, visibility='protected', is_virtual=True) ## synchronizer.h (module 'core'): bool ns3::Synchronizer::DoRealtime() [member function] cls.add_method('DoRealtime', 'bool', [], is_pure_virtual=True, visibility='protected', is_virtual=True) ## synchronizer.h (module 'core'): void ns3::Synchronizer::DoSetCondition(bool arg0) [member function] cls.add_method('DoSetCondition', 'void', [param('bool', 'arg0')], is_pure_virtual=True, visibility='protected', is_virtual=True) ## synchronizer.h (module 'core'): void ns3::Synchronizer::DoSetOrigin(uint64_t ns) [member function] cls.add_method('DoSetOrigin', 'void', [param('uint64_t', 'ns')], is_pure_virtual=True, visibility='protected', is_virtual=True) ## synchronizer.h (module 'core'): void ns3::Synchronizer::DoSignal() [member function] cls.add_method('DoSignal', 'void', [], is_pure_virtual=True, visibility='protected', is_virtual=True) ## synchronizer.h (module 'core'): bool ns3::Synchronizer::DoSynchronize(uint64_t nsCurrent, uint64_t nsDelay) [member function] cls.add_method('DoSynchronize', 'bool', [param('uint64_t', 'nsCurrent'), param('uint64_t', 'nsDelay')], is_pure_virtual=True, visibility='protected', is_virtual=True) return def register_Ns3SystemThread_methods(root_module, cls): ## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::SystemThread const & arg0) [copy constructor] cls.add_constructor([param('ns3::SystemThread const &', 'arg0')]) ## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [constructor] cls.add_constructor([param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')]) ## system-thread.h (module 'core'): bool ns3::SystemThread::Break() [member function] cls.add_method('Break', 'bool', []) ## system-thread.h (module 'core'): void ns3::SystemThread::Join() [member function] cls.add_method('Join', 'void', []) ## system-thread.h (module 'core'): void ns3::SystemThread::Shutdown() [member function] cls.add_method('Shutdown', 'void', []) ## system-thread.h (module 'core'): void ns3::SystemThread::Start() [member function] cls.add_method('Start', 'void', []) return def register_Ns3Time_methods(root_module, cls): cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right')) cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('>') cls.add_binary_comparison_operator('!=') cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right')) cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', 'right')) cls.add_output_stream_operator() cls.add_binary_comparison_operator('<=') cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('>=') ## nstime.h (module 'core'): ns3::Time::Time() [constructor] cls.add_constructor([]) ## nstime.h (module 'core'): ns3::Time::Time(ns3::Time const & o) [copy constructor] cls.add_constructor([param('ns3::Time const &', 'o')]) ## nstime.h (module 'core'): ns3::Time::Time(double v) [constructor] cls.add_constructor([param('double', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(int v) [constructor] cls.add_constructor([param('int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(long int v) [constructor] cls.add_constructor([param('long int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(long long int v) [constructor] cls.add_constructor([param('long long int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(unsigned int v) [constructor] cls.add_constructor([param('unsigned int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(long unsigned int v) [constructor] cls.add_constructor([param('long unsigned int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(long long unsigned int v) [constructor] cls.add_constructor([param('long long unsigned int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(std::string const & s) [constructor] cls.add_constructor([param('std::string const &', 's')]) ## nstime.h (module 'core'): ns3::Time::Time(ns3::int64x64_t const & value) [constructor] cls.add_constructor([param('ns3::int64x64_t const &', 'value')]) ## nstime.h (module 'core'): int ns3::Time::Compare(ns3::Time const & o) const [member function] cls.add_method('Compare', 'int', [param('ns3::Time const &', 'o')], is_const=True) ## nstime.h (module 'core'): static ns3::Time ns3::Time::From(ns3::int64x64_t const & from, ns3::Time::Unit timeUnit) [member function] cls.add_method('From', 'ns3::Time', [param('ns3::int64x64_t const &', 'from'), param('ns3::Time::Unit', 'timeUnit')], is_static=True) ## nstime.h (module 'core'): static ns3::Time ns3::Time::From(ns3::int64x64_t const & value) [member function] cls.add_method('From', 'ns3::Time', [param('ns3::int64x64_t const &', 'value')], is_static=True) ## nstime.h (module 'core'): static ns3::Time ns3::Time::FromDouble(double value, ns3::Time::Unit timeUnit) [member function] cls.add_method('FromDouble', 'ns3::Time', [param('double', 'value'), param('ns3::Time::Unit', 'timeUnit')], is_static=True) ## nstime.h (module 'core'): static ns3::Time ns3::Time::FromInteger(uint64_t value, ns3::Time::Unit timeUnit) [member function] cls.add_method('FromInteger', 'ns3::Time', [param('uint64_t', 'value'), param('ns3::Time::Unit', 'timeUnit')], is_static=True) ## nstime.h (module 'core'): double ns3::Time::GetDouble() const [member function] cls.add_method('GetDouble', 'double', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetFemtoSeconds() const [member function] cls.add_method('GetFemtoSeconds', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetInteger() const [member function] cls.add_method('GetInteger', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetMicroSeconds() const [member function] cls.add_method('GetMicroSeconds', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetMilliSeconds() const [member function] cls.add_method('GetMilliSeconds', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetNanoSeconds() const [member function] cls.add_method('GetNanoSeconds', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetPicoSeconds() const [member function] cls.add_method('GetPicoSeconds', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): static ns3::Time::Unit ns3::Time::GetResolution() [member function] cls.add_method('GetResolution', 'ns3::Time::Unit', [], is_static=True) ## nstime.h (module 'core'): double ns3::Time::GetSeconds() const [member function] cls.add_method('GetSeconds', 'double', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetTimeStep() const [member function] cls.add_method('GetTimeStep', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): bool ns3::Time::IsNegative() const [member function] cls.add_method('IsNegative', 'bool', [], is_const=True) ## nstime.h (module 'core'): bool ns3::Time::IsPositive() const [member function] cls.add_method('IsPositive', 'bool', [], is_const=True) ## nstime.h (module 'core'): bool ns3::Time::IsStrictlyNegative() const [member function] cls.add_method('IsStrictlyNegative', 'bool', [], is_const=True) ## nstime.h (module 'core'): bool ns3::Time::IsStrictlyPositive() const [member function] cls.add_method('IsStrictlyPositive', 'bool', [], is_const=True) ## nstime.h (module 'core'): bool ns3::Time::IsZero() const [member function] cls.add_method('IsZero', 'bool', [], is_const=True) ## nstime.h (module 'core'): static void ns3::Time::SetResolution(ns3::Time::Unit resolution) [member function] cls.add_method('SetResolution', 'void', [param('ns3::Time::Unit', 'resolution')], is_static=True) ## nstime.h (module 'core'): ns3::int64x64_t ns3::Time::To(ns3::Time::Unit timeUnit) const [member function] cls.add_method('To', 'ns3::int64x64_t', [param('ns3::Time::Unit', 'timeUnit')], is_const=True) ## nstime.h (module 'core'): double ns3::Time::ToDouble(ns3::Time::Unit timeUnit) const [member function] cls.add_method('ToDouble', 'double', [param('ns3::Time::Unit', 'timeUnit')], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::ToInteger(ns3::Time::Unit timeUnit) const [member function] cls.add_method('ToInteger', 'int64_t', [param('ns3::Time::Unit', 'timeUnit')], is_const=True) return def register_Ns3TraceSourceAccessor_methods(root_module, cls): ## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor(ns3::TraceSourceAccessor const & arg0) [copy constructor] cls.add_constructor([param('ns3::TraceSourceAccessor const &', 'arg0')]) ## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor() [constructor] cls.add_constructor([]) ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Connect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function] cls.add_method('Connect', 'bool', [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')], is_pure_virtual=True, is_const=True, is_virtual=True) ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::ConnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function] cls.add_method('ConnectWithoutContext', 'bool', [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')], is_pure_virtual=True, is_const=True, is_virtual=True) ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Disconnect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function] cls.add_method('Disconnect', 'bool', [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')], is_pure_virtual=True, is_const=True, is_virtual=True) ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::DisconnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function] cls.add_method('DisconnectWithoutContext', 'bool', [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3Trailer_methods(root_module, cls): cls.add_output_stream_operator() ## trailer.h (module 'network'): ns3::Trailer::Trailer() [constructor] cls.add_constructor([]) ## trailer.h (module 'network'): ns3::Trailer::Trailer(ns3::Trailer const & arg0) [copy constructor] cls.add_constructor([param('ns3::Trailer const &', 'arg0')]) ## trailer.h (module 'network'): uint32_t ns3::Trailer::Deserialize(ns3::Buffer::Iterator end) [member function] cls.add_method('Deserialize', 'uint32_t', [param('ns3::Buffer::Iterator', 'end')], is_pure_virtual=True, is_virtual=True) ## trailer.h (module 'network'): uint32_t ns3::Trailer::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## trailer.h (module 'network'): static ns3::TypeId ns3::Trailer::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## trailer.h (module 'network'): void ns3::Trailer::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_pure_virtual=True, is_const=True, is_virtual=True) ## trailer.h (module 'network'): void ns3::Trailer::Serialize(ns3::Buffer::Iterator start) const [member function] cls.add_method('Serialize', 'void', [param('ns3::Buffer::Iterator', 'start')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3AttributeAccessor_methods(root_module, cls): ## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor(ns3::AttributeAccessor const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeAccessor const &', 'arg0')]) ## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor() [constructor] cls.add_constructor([]) ## attribute.h (module 'core'): bool ns3::AttributeAccessor::Get(ns3::ObjectBase const * object, ns3::AttributeValue & attribute) const [member function] cls.add_method('Get', 'bool', [param('ns3::ObjectBase const *', 'object'), param('ns3::AttributeValue &', 'attribute')], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasGetter() const [member function] cls.add_method('HasGetter', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasSetter() const [member function] cls.add_method('HasSetter', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeAccessor::Set(ns3::ObjectBase * object, ns3::AttributeValue const & value) const [member function] cls.add_method('Set', 'bool', [param('ns3::ObjectBase *', 'object', transfer_ownership=False), param('ns3::AttributeValue const &', 'value')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3AttributeChecker_methods(root_module, cls): ## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker(ns3::AttributeChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeChecker const &', 'arg0')]) ## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker() [constructor] cls.add_constructor([]) ## attribute.h (module 'core'): bool ns3::AttributeChecker::Check(ns3::AttributeValue const & value) const [member function] cls.add_method('Check', 'bool', [param('ns3::AttributeValue const &', 'value')], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeChecker::Copy(ns3::AttributeValue const & source, ns3::AttributeValue & destination) const [member function] cls.add_method('Copy', 'bool', [param('ns3::AttributeValue const &', 'source'), param('ns3::AttributeValue &', 'destination')], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::Create() const [member function] cls.add_method('Create', 'ns3::Ptr< ns3::AttributeValue >', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::CreateValidValue(ns3::AttributeValue const & value) const [member function] cls.add_method('CreateValidValue', 'ns3::Ptr< ns3::AttributeValue >', [param('ns3::AttributeValue const &', 'value')], is_const=True) ## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetUnderlyingTypeInformation() const [member function] cls.add_method('GetUnderlyingTypeInformation', 'std::string', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetValueTypeName() const [member function] cls.add_method('GetValueTypeName', 'std::string', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeChecker::HasUnderlyingTypeInformation() const [member function] cls.add_method('HasUnderlyingTypeInformation', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3AttributeValue_methods(root_module, cls): ## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue(ns3::AttributeValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeValue const &', 'arg0')]) ## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue() [constructor] cls.add_constructor([]) ## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_pure_virtual=True, is_virtual=True) ## attribute.h (module 'core'): std::string ns3::AttributeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3CallbackChecker_methods(root_module, cls): ## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker() [constructor] cls.add_constructor([]) ## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker(ns3::CallbackChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::CallbackChecker const &', 'arg0')]) return def register_Ns3CallbackImplBase_methods(root_module, cls): ## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase() [constructor] cls.add_constructor([]) ## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase(ns3::CallbackImplBase const & arg0) [copy constructor] cls.add_constructor([param('ns3::CallbackImplBase const &', 'arg0')]) ## callback.h (module 'core'): bool ns3::CallbackImplBase::IsEqual(ns3::Ptr<ns3::CallbackImplBase const> other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ptr< ns3::CallbackImplBase const >', 'other')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3CallbackValue_methods(root_module, cls): ## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::CallbackValue const &', 'arg0')]) ## callback.h (module 'core'): ns3::CallbackValue::CallbackValue() [constructor] cls.add_constructor([]) ## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackBase const & base) [constructor] cls.add_constructor([param('ns3::CallbackBase const &', 'base')]) ## callback.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::CallbackValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## callback.h (module 'core'): bool ns3::CallbackValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## callback.h (module 'core'): std::string ns3::CallbackValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## callback.h (module 'core'): void ns3::CallbackValue::Set(ns3::CallbackBase base) [member function] cls.add_method('Set', 'void', [param('ns3::CallbackBase', 'base')]) return def register_Ns3DataRateChecker_methods(root_module, cls): ## data-rate.h (module 'network'): ns3::DataRateChecker::DataRateChecker() [constructor] cls.add_constructor([]) ## data-rate.h (module 'network'): ns3::DataRateChecker::DataRateChecker(ns3::DataRateChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::DataRateChecker const &', 'arg0')]) return def register_Ns3DataRateValue_methods(root_module, cls): ## data-rate.h (module 'network'): ns3::DataRateValue::DataRateValue() [constructor] cls.add_constructor([]) ## data-rate.h (module 'network'): ns3::DataRateValue::DataRateValue(ns3::DataRateValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::DataRateValue const &', 'arg0')]) ## data-rate.h (module 'network'): ns3::DataRateValue::DataRateValue(ns3::DataRate const & value) [constructor] cls.add_constructor([param('ns3::DataRate const &', 'value')]) ## data-rate.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::DataRateValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## data-rate.h (module 'network'): bool ns3::DataRateValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## data-rate.h (module 'network'): ns3::DataRate ns3::DataRateValue::Get() const [member function] cls.add_method('Get', 'ns3::DataRate', [], is_const=True) ## data-rate.h (module 'network'): std::string ns3::DataRateValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## data-rate.h (module 'network'): void ns3::DataRateValue::Set(ns3::DataRate const & value) [member function] cls.add_method('Set', 'void', [param('ns3::DataRate const &', 'value')]) return def register_Ns3EmptyAttributeValue_methods(root_module, cls): ## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue(ns3::EmptyAttributeValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::EmptyAttributeValue const &', 'arg0')]) ## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue() [constructor] cls.add_constructor([]) ## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EmptyAttributeValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, visibility='private', is_virtual=True) ## attribute.h (module 'core'): bool ns3::EmptyAttributeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], visibility='private', is_virtual=True) ## attribute.h (module 'core'): std::string ns3::EmptyAttributeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, visibility='private', is_virtual=True) return def register_Ns3EventImpl_methods(root_module, cls): ## event-impl.h (module 'core'): ns3::EventImpl::EventImpl(ns3::EventImpl const & arg0) [copy constructor] cls.add_constructor([param('ns3::EventImpl const &', 'arg0')]) ## event-impl.h (module 'core'): ns3::EventImpl::EventImpl() [constructor] cls.add_constructor([]) ## event-impl.h (module 'core'): void ns3::EventImpl::Cancel() [member function] cls.add_method('Cancel', 'void', []) ## event-impl.h (module 'core'): void ns3::EventImpl::Invoke() [member function] cls.add_method('Invoke', 'void', []) ## event-impl.h (module 'core'): bool ns3::EventImpl::IsCancelled() [member function] cls.add_method('IsCancelled', 'bool', []) ## event-impl.h (module 'core'): void ns3::EventImpl::Notify() [member function] cls.add_method('Notify', 'void', [], is_pure_virtual=True, visibility='protected', is_virtual=True) return def register_Ns3FdReader_methods(root_module, cls): ## unix-fd-reader.h (module 'core'): ns3::FdReader::FdReader(ns3::FdReader const & arg0) [copy constructor] cls.add_constructor([param('ns3::FdReader const &', 'arg0')]) ## unix-fd-reader.h (module 'core'): ns3::FdReader::FdReader() [constructor] cls.add_constructor([]) ## unix-fd-reader.h (module 'core'): void ns3::FdReader::Start(int fd, ns3::Callback<void, unsigned char*, int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> readCallback) [member function] cls.add_method('Start', 'void', [param('int', 'fd'), param('ns3::Callback< void, unsigned char *, int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'readCallback')]) ## unix-fd-reader.h (module 'core'): void ns3::FdReader::Stop() [member function] cls.add_method('Stop', 'void', []) ## unix-fd-reader.h (module 'core'): ns3::FdReader::Data ns3::FdReader::DoRead() [member function] cls.add_method('DoRead', 'ns3::FdReader::Data', [], is_pure_virtual=True, visibility='protected', is_virtual=True) return def register_Ns3Ipv4AddressChecker_methods(root_module, cls): ## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker::Ipv4AddressChecker() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker::Ipv4AddressChecker(ns3::Ipv4AddressChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4AddressChecker const &', 'arg0')]) return def register_Ns3Ipv4AddressValue_methods(root_module, cls): ## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue(ns3::Ipv4AddressValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4AddressValue const &', 'arg0')]) ## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue(ns3::Ipv4Address const & value) [constructor] cls.add_constructor([param('ns3::Ipv4Address const &', 'value')]) ## ipv4-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv4AddressValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4AddressValue::Get() const [member function] cls.add_method('Get', 'ns3::Ipv4Address', [], is_const=True) ## ipv4-address.h (module 'network'): std::string ns3::Ipv4AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4AddressValue::Set(ns3::Ipv4Address const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Ipv4Address const &', 'value')]) return def register_Ns3Ipv4MaskChecker_methods(root_module, cls): ## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker::Ipv4MaskChecker() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker::Ipv4MaskChecker(ns3::Ipv4MaskChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4MaskChecker const &', 'arg0')]) return def register_Ns3Ipv4MaskValue_methods(root_module, cls): ## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue(ns3::Ipv4MaskValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4MaskValue const &', 'arg0')]) ## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue(ns3::Ipv4Mask const & value) [constructor] cls.add_constructor([param('ns3::Ipv4Mask const &', 'value')]) ## ipv4-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv4MaskValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4MaskValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask ns3::Ipv4MaskValue::Get() const [member function] cls.add_method('Get', 'ns3::Ipv4Mask', [], is_const=True) ## ipv4-address.h (module 'network'): std::string ns3::Ipv4MaskValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4MaskValue::Set(ns3::Ipv4Mask const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Ipv4Mask const &', 'value')]) return def register_Ns3Ipv6AddressChecker_methods(root_module, cls): ## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker::Ipv6AddressChecker() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker::Ipv6AddressChecker(ns3::Ipv6AddressChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv6AddressChecker const &', 'arg0')]) return def register_Ns3Ipv6AddressValue_methods(root_module, cls): ## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue(ns3::Ipv6AddressValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv6AddressValue const &', 'arg0')]) ## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue(ns3::Ipv6Address const & value) [constructor] cls.add_constructor([param('ns3::Ipv6Address const &', 'value')]) ## ipv6-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv6AddressValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## ipv6-address.h (module 'network'): ns3::Ipv6Address ns3::Ipv6AddressValue::Get() const [member function] cls.add_method('Get', 'ns3::Ipv6Address', [], is_const=True) ## ipv6-address.h (module 'network'): std::string ns3::Ipv6AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6AddressValue::Set(ns3::Ipv6Address const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Ipv6Address const &', 'value')]) return def register_Ns3Ipv6PrefixChecker_methods(root_module, cls): ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker::Ipv6PrefixChecker() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker::Ipv6PrefixChecker(ns3::Ipv6PrefixChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv6PrefixChecker const &', 'arg0')]) return def register_Ns3Ipv6PrefixValue_methods(root_module, cls): ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue(ns3::Ipv6PrefixValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv6PrefixValue const &', 'arg0')]) ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue(ns3::Ipv6Prefix const & value) [constructor] cls.add_constructor([param('ns3::Ipv6Prefix const &', 'value')]) ## ipv6-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv6PrefixValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6PrefixValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix ns3::Ipv6PrefixValue::Get() const [member function] cls.add_method('Get', 'ns3::Ipv6Prefix', [], is_const=True) ## ipv6-address.h (module 'network'): std::string ns3::Ipv6PrefixValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6PrefixValue::Set(ns3::Ipv6Prefix const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Ipv6Prefix const &', 'value')]) return def register_Ns3Mac48AddressChecker_methods(root_module, cls): ## mac48-address.h (module 'network'): ns3::Mac48AddressChecker::Mac48AddressChecker() [constructor] cls.add_constructor([]) ## mac48-address.h (module 'network'): ns3::Mac48AddressChecker::Mac48AddressChecker(ns3::Mac48AddressChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::Mac48AddressChecker const &', 'arg0')]) return def register_Ns3Mac48AddressValue_methods(root_module, cls): ## mac48-address.h (module 'network'): ns3::Mac48AddressValue::Mac48AddressValue() [constructor] cls.add_constructor([]) ## mac48-address.h (module 'network'): ns3::Mac48AddressValue::Mac48AddressValue(ns3::Mac48AddressValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Mac48AddressValue const &', 'arg0')]) ## mac48-address.h (module 'network'): ns3::Mac48AddressValue::Mac48AddressValue(ns3::Mac48Address const & value) [constructor] cls.add_constructor([param('ns3::Mac48Address const &', 'value')]) ## mac48-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Mac48AddressValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## mac48-address.h (module 'network'): bool ns3::Mac48AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## mac48-address.h (module 'network'): ns3::Mac48Address ns3::Mac48AddressValue::Get() const [member function] cls.add_method('Get', 'ns3::Mac48Address', [], is_const=True) ## mac48-address.h (module 'network'): std::string ns3::Mac48AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## mac48-address.h (module 'network'): void ns3::Mac48AddressValue::Set(ns3::Mac48Address const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Mac48Address const &', 'value')]) return def register_Ns3NetDevice_methods(root_module, cls): ## net-device.h (module 'network'): ns3::NetDevice::NetDevice() [constructor] cls.add_constructor([]) ## net-device.h (module 'network'): ns3::NetDevice::NetDevice(ns3::NetDevice const & arg0) [copy constructor] cls.add_constructor([param('ns3::NetDevice const &', 'arg0')]) ## net-device.h (module 'network'): void ns3::NetDevice::AddLinkChangeCallback(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function] cls.add_method('AddLinkChangeCallback', 'void', [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetAddress() const [member function] cls.add_method('GetAddress', 'ns3::Address', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetBroadcast() const [member function] cls.add_method('GetBroadcast', 'ns3::Address', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Ptr<ns3::Channel> ns3::NetDevice::GetChannel() const [member function] cls.add_method('GetChannel', 'ns3::Ptr< ns3::Channel >', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): uint32_t ns3::NetDevice::GetIfIndex() const [member function] cls.add_method('GetIfIndex', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): uint16_t ns3::NetDevice::GetMtu() const [member function] cls.add_method('GetMtu', 'uint16_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetMulticast(ns3::Ipv4Address multicastGroup) const [member function] cls.add_method('GetMulticast', 'ns3::Address', [param('ns3::Ipv4Address', 'multicastGroup')], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetMulticast(ns3::Ipv6Address addr) const [member function] cls.add_method('GetMulticast', 'ns3::Address', [param('ns3::Ipv6Address', 'addr')], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Ptr<ns3::Node> ns3::NetDevice::GetNode() const [member function] cls.add_method('GetNode', 'ns3::Ptr< ns3::Node >', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): static ns3::TypeId ns3::NetDevice::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsBridge() const [member function] cls.add_method('IsBridge', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsBroadcast() const [member function] cls.add_method('IsBroadcast', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsLinkUp() const [member function] cls.add_method('IsLinkUp', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsMulticast() const [member function] cls.add_method('IsMulticast', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsPointToPoint() const [member function] cls.add_method('IsPointToPoint', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::NeedsArp() const [member function] cls.add_method('NeedsArp', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::Send(ns3::Ptr<ns3::Packet> 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_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::SendFrom(ns3::Ptr<ns3::Packet> 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_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::SetAddress(ns3::Address address) [member function] cls.add_method('SetAddress', 'void', [param('ns3::Address', 'address')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::SetIfIndex(uint32_t const index) [member function] cls.add_method('SetIfIndex', 'void', [param('uint32_t const', 'index')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::SetMtu(uint16_t const mtu) [member function] cls.add_method('SetMtu', 'bool', [param('uint16_t const', 'mtu')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::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) ## net-device.h (module 'network'): void ns3::NetDevice::SetPromiscReceiveCallback(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) [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_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::SetReceiveCallback(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) [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_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::SupportsSendFrom() const [member function] cls.add_method('SupportsSendFrom', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3NixVector_methods(root_module, cls): cls.add_output_stream_operator() ## nix-vector.h (module 'network'): ns3::NixVector::NixVector() [constructor] cls.add_constructor([]) ## nix-vector.h (module 'network'): ns3::NixVector::NixVector(ns3::NixVector const & o) [copy constructor] cls.add_constructor([param('ns3::NixVector const &', 'o')]) ## nix-vector.h (module 'network'): void ns3::NixVector::AddNeighborIndex(uint32_t newBits, uint32_t numberOfBits) [member function] cls.add_method('AddNeighborIndex', 'void', [param('uint32_t', 'newBits'), param('uint32_t', 'numberOfBits')]) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::BitCount(uint32_t numberOfNeighbors) const [member function] cls.add_method('BitCount', 'uint32_t', [param('uint32_t', 'numberOfNeighbors')], is_const=True) ## nix-vector.h (module 'network'): ns3::Ptr<ns3::NixVector> ns3::NixVector::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::NixVector >', [], is_const=True) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::Deserialize(uint32_t const * buffer, uint32_t size) [member function] cls.add_method('Deserialize', 'uint32_t', [param('uint32_t const *', 'buffer'), param('uint32_t', 'size')]) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::ExtractNeighborIndex(uint32_t numberOfBits) [member function] cls.add_method('ExtractNeighborIndex', 'uint32_t', [param('uint32_t', 'numberOfBits')]) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::GetRemainingBits() [member function] cls.add_method('GetRemainingBits', 'uint32_t', []) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::Serialize(uint32_t * buffer, uint32_t maxSize) const [member function] cls.add_method('Serialize', 'uint32_t', [param('uint32_t *', 'buffer'), param('uint32_t', 'maxSize')], is_const=True) return def register_Ns3Node_methods(root_module, cls): ## node.h (module 'network'): ns3::Node::Node(ns3::Node const & arg0) [copy constructor] cls.add_constructor([param('ns3::Node const &', 'arg0')]) ## node.h (module 'network'): ns3::Node::Node() [constructor] cls.add_constructor([]) ## node.h (module 'network'): ns3::Node::Node(uint32_t systemId) [constructor] cls.add_constructor([param('uint32_t', 'systemId')]) ## node.h (module 'network'): uint32_t ns3::Node::AddApplication(ns3::Ptr<ns3::Application> application) [member function] cls.add_method('AddApplication', 'uint32_t', [param('ns3::Ptr< ns3::Application >', 'application')]) ## node.h (module 'network'): uint32_t ns3::Node::AddDevice(ns3::Ptr<ns3::NetDevice> device) [member function] cls.add_method('AddDevice', 'uint32_t', [param('ns3::Ptr< ns3::NetDevice >', 'device')]) ## node.h (module 'network'): static bool ns3::Node::ChecksumEnabled() [member function] cls.add_method('ChecksumEnabled', 'bool', [], is_static=True) ## node.h (module 'network'): ns3::Ptr<ns3::Application> ns3::Node::GetApplication(uint32_t index) const [member function] cls.add_method('GetApplication', 'ns3::Ptr< ns3::Application >', [param('uint32_t', 'index')], is_const=True) ## node.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::Node::GetDevice(uint32_t index) const [member function] cls.add_method('GetDevice', 'ns3::Ptr< ns3::NetDevice >', [param('uint32_t', 'index')], is_const=True) ## node.h (module 'network'): uint32_t ns3::Node::GetId() const [member function] cls.add_method('GetId', 'uint32_t', [], is_const=True) ## node.h (module 'network'): uint32_t ns3::Node::GetNApplications() const [member function] cls.add_method('GetNApplications', 'uint32_t', [], is_const=True) ## node.h (module 'network'): uint32_t ns3::Node::GetNDevices() const [member function] cls.add_method('GetNDevices', 'uint32_t', [], is_const=True) ## node.h (module 'network'): uint32_t ns3::Node::GetSystemId() const [member function] cls.add_method('GetSystemId', 'uint32_t', [], is_const=True) ## node.h (module 'network'): static ns3::TypeId ns3::Node::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## node.h (module 'network'): void ns3::Node::RegisterDeviceAdditionListener(ns3::Callback<void,ns3::Ptr<ns3::NetDevice>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> listener) [member function] cls.add_method('RegisterDeviceAdditionListener', 'void', [param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'listener')]) ## node.h (module 'network'): void ns3::Node::RegisterProtocolHandler(ns3::Callback<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> handler, uint16_t protocolType, ns3::Ptr<ns3::NetDevice> device, bool promiscuous=false) [member function] cls.add_method('RegisterProtocolHandler', 'void', [param('ns3::Callback< 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 >', 'handler'), param('uint16_t', 'protocolType'), param('ns3::Ptr< ns3::NetDevice >', 'device'), param('bool', 'promiscuous', default_value='false')]) ## node.h (module 'network'): void ns3::Node::UnregisterDeviceAdditionListener(ns3::Callback<void,ns3::Ptr<ns3::NetDevice>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> listener) [member function] cls.add_method('UnregisterDeviceAdditionListener', 'void', [param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'listener')]) ## node.h (module 'network'): void ns3::Node::UnregisterProtocolHandler(ns3::Callback<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> handler) [member function] cls.add_method('UnregisterProtocolHandler', 'void', [param('ns3::Callback< 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 >', 'handler')]) ## node.h (module 'network'): void ns3::Node::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='protected', is_virtual=True) ## node.h (module 'network'): void ns3::Node::DoStart() [member function] cls.add_method('DoStart', 'void', [], visibility='protected', is_virtual=True) return def register_Ns3ObjectFactoryChecker_methods(root_module, cls): ## object-factory.h (module 'core'): ns3::ObjectFactoryChecker::ObjectFactoryChecker() [constructor] cls.add_constructor([]) ## object-factory.h (module 'core'): ns3::ObjectFactoryChecker::ObjectFactoryChecker(ns3::ObjectFactoryChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectFactoryChecker const &', 'arg0')]) return def register_Ns3ObjectFactoryValue_methods(root_module, cls): ## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue() [constructor] cls.add_constructor([]) ## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue(ns3::ObjectFactoryValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectFactoryValue const &', 'arg0')]) ## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue(ns3::ObjectFactory const & value) [constructor] cls.add_constructor([param('ns3::ObjectFactory const &', 'value')]) ## object-factory.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::ObjectFactoryValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## object-factory.h (module 'core'): bool ns3::ObjectFactoryValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## object-factory.h (module 'core'): ns3::ObjectFactory ns3::ObjectFactoryValue::Get() const [member function] cls.add_method('Get', 'ns3::ObjectFactory', [], is_const=True) ## object-factory.h (module 'core'): std::string ns3::ObjectFactoryValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## object-factory.h (module 'core'): void ns3::ObjectFactoryValue::Set(ns3::ObjectFactory const & value) [member function] cls.add_method('Set', 'void', [param('ns3::ObjectFactory const &', 'value')]) return def register_Ns3Packet_methods(root_module, cls): cls.add_output_stream_operator() ## packet.h (module 'network'): ns3::Packet::Packet() [constructor] cls.add_constructor([]) ## packet.h (module 'network'): ns3::Packet::Packet(ns3::Packet const & o) [copy constructor] cls.add_constructor([param('ns3::Packet const &', 'o')]) ## packet.h (module 'network'): ns3::Packet::Packet(uint32_t size) [constructor] cls.add_constructor([param('uint32_t', 'size')]) ## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size, bool magic) [constructor] cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size'), param('bool', 'magic')]) ## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size) [constructor] cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## packet.h (module 'network'): void ns3::Packet::AddAtEnd(ns3::Ptr<const ns3::Packet> packet) [member function] cls.add_method('AddAtEnd', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) ## packet.h (module 'network'): void ns3::Packet::AddByteTag(ns3::Tag const & tag) const [member function] cls.add_method('AddByteTag', 'void', [param('ns3::Tag const &', 'tag')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::AddHeader(ns3::Header const & header) [member function] cls.add_method('AddHeader', 'void', [param('ns3::Header const &', 'header')]) ## packet.h (module 'network'): void ns3::Packet::AddPacketTag(ns3::Tag const & tag) const [member function] cls.add_method('AddPacketTag', 'void', [param('ns3::Tag const &', 'tag')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::AddPaddingAtEnd(uint32_t size) [member function] cls.add_method('AddPaddingAtEnd', 'void', [param('uint32_t', 'size')]) ## packet.h (module 'network'): void ns3::Packet::AddTrailer(ns3::Trailer const & trailer) [member function] cls.add_method('AddTrailer', 'void', [param('ns3::Trailer const &', 'trailer')]) ## packet.h (module 'network'): ns3::PacketMetadata::ItemIterator ns3::Packet::BeginItem() const [member function] cls.add_method('BeginItem', 'ns3::PacketMetadata::ItemIterator', [], is_const=True) ## packet.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Packet::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::Packet >', [], is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::CopyData(uint8_t * buffer, uint32_t size) const [member function] cls.add_method('CopyData', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint32_t', 'size')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::CopyData(std::ostream * os, uint32_t size) const [member function] cls.add_method('CopyData', 'void', [param('std::ostream *', 'os'), param('uint32_t', 'size')], is_const=True) ## packet.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Packet::CreateFragment(uint32_t start, uint32_t length) const [member function] cls.add_method('CreateFragment', 'ns3::Ptr< ns3::Packet >', [param('uint32_t', 'start'), param('uint32_t', 'length')], is_const=True) ## packet.h (module 'network'): static void ns3::Packet::EnableChecking() [member function] cls.add_method('EnableChecking', 'void', [], is_static=True) ## packet.h (module 'network'): static void ns3::Packet::EnablePrinting() [member function] cls.add_method('EnablePrinting', 'void', [], is_static=True) ## packet.h (module 'network'): bool ns3::Packet::FindFirstMatchingByteTag(ns3::Tag & tag) const [member function] cls.add_method('FindFirstMatchingByteTag', 'bool', [param('ns3::Tag &', 'tag')], is_const=True) ## packet.h (module 'network'): ns3::ByteTagIterator ns3::Packet::GetByteTagIterator() const [member function] cls.add_method('GetByteTagIterator', 'ns3::ByteTagIterator', [], is_const=True) ## packet.h (module 'network'): ns3::Ptr<ns3::NixVector> ns3::Packet::GetNixVector() const [member function] cls.add_method('GetNixVector', 'ns3::Ptr< ns3::NixVector >', [], is_const=True) ## packet.h (module 'network'): ns3::PacketTagIterator ns3::Packet::GetPacketTagIterator() const [member function] cls.add_method('GetPacketTagIterator', 'ns3::PacketTagIterator', [], is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::GetSize() const [member function] cls.add_method('GetSize', 'uint32_t', [], is_const=True) ## packet.h (module 'network'): uint64_t ns3::Packet::GetUid() const [member function] cls.add_method('GetUid', 'uint64_t', [], is_const=True) ## packet.h (module 'network'): uint8_t const * ns3::Packet::PeekData() const [member function] cls.add_method('PeekData', 'uint8_t const *', [], deprecated=True, is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::PeekHeader(ns3::Header & header) const [member function] cls.add_method('PeekHeader', 'uint32_t', [param('ns3::Header &', 'header')], is_const=True) ## packet.h (module 'network'): bool ns3::Packet::PeekPacketTag(ns3::Tag & tag) const [member function] cls.add_method('PeekPacketTag', 'bool', [param('ns3::Tag &', 'tag')], is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::PeekTrailer(ns3::Trailer & trailer) [member function] cls.add_method('PeekTrailer', 'uint32_t', [param('ns3::Trailer &', 'trailer')]) ## packet.h (module 'network'): void ns3::Packet::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::PrintByteTags(std::ostream & os) const [member function] cls.add_method('PrintByteTags', 'void', [param('std::ostream &', 'os')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::PrintPacketTags(std::ostream & os) const [member function] cls.add_method('PrintPacketTags', 'void', [param('std::ostream &', 'os')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::RemoveAllByteTags() [member function] cls.add_method('RemoveAllByteTags', 'void', []) ## packet.h (module 'network'): void ns3::Packet::RemoveAllPacketTags() [member function] cls.add_method('RemoveAllPacketTags', 'void', []) ## packet.h (module 'network'): void ns3::Packet::RemoveAtEnd(uint32_t size) [member function] cls.add_method('RemoveAtEnd', 'void', [param('uint32_t', 'size')]) ## packet.h (module 'network'): void ns3::Packet::RemoveAtStart(uint32_t size) [member function] cls.add_method('RemoveAtStart', 'void', [param('uint32_t', 'size')]) ## packet.h (module 'network'): uint32_t ns3::Packet::RemoveHeader(ns3::Header & header) [member function] cls.add_method('RemoveHeader', 'uint32_t', [param('ns3::Header &', 'header')]) ## packet.h (module 'network'): bool ns3::Packet::RemovePacketTag(ns3::Tag & tag) [member function] cls.add_method('RemovePacketTag', 'bool', [param('ns3::Tag &', 'tag')]) ## packet.h (module 'network'): uint32_t ns3::Packet::RemoveTrailer(ns3::Trailer & trailer) [member function] cls.add_method('RemoveTrailer', 'uint32_t', [param('ns3::Trailer &', 'trailer')]) ## packet.h (module 'network'): uint32_t ns3::Packet::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function] cls.add_method('Serialize', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::SetNixVector(ns3::Ptr<ns3::NixVector> arg0) [member function] cls.add_method('SetNixVector', 'void', [param('ns3::Ptr< ns3::NixVector >', 'arg0')]) return def register_Ns3RealtimeSimulatorImpl_methods(root_module, cls): ## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::RealtimeSimulatorImpl(ns3::RealtimeSimulatorImpl const & arg0) [copy constructor] cls.add_constructor([param('ns3::RealtimeSimulatorImpl const &', 'arg0')]) ## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::RealtimeSimulatorImpl() [constructor] cls.add_constructor([]) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Cancel(ns3::EventId const & ev) [member function] cls.add_method('Cancel', 'void', [param('ns3::EventId const &', 'ev')], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Destroy() [member function] cls.add_method('Destroy', 'void', [], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): uint32_t ns3::RealtimeSimulatorImpl::GetContext() const [member function] cls.add_method('GetContext', 'uint32_t', [], is_const=True, is_virtual=True) ## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::GetDelayLeft(ns3::EventId const & id) const [member function] cls.add_method('GetDelayLeft', 'ns3::Time', [param('ns3::EventId const &', 'id')], is_const=True, is_virtual=True) ## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::GetHardLimit() const [member function] cls.add_method('GetHardLimit', 'ns3::Time', [], is_const=True) ## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::GetMaximumSimulationTime() const [member function] cls.add_method('GetMaximumSimulationTime', 'ns3::Time', [], is_const=True, is_virtual=True) ## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::SynchronizationMode ns3::RealtimeSimulatorImpl::GetSynchronizationMode() const [member function] cls.add_method('GetSynchronizationMode', 'ns3::RealtimeSimulatorImpl::SynchronizationMode', [], is_const=True) ## realtime-simulator-impl.h (module 'core'): uint32_t ns3::RealtimeSimulatorImpl::GetSystemId() const [member function] cls.add_method('GetSystemId', 'uint32_t', [], is_const=True, is_virtual=True) ## realtime-simulator-impl.h (module 'core'): static ns3::TypeId ns3::RealtimeSimulatorImpl::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## realtime-simulator-impl.h (module 'core'): bool ns3::RealtimeSimulatorImpl::IsExpired(ns3::EventId const & ev) const [member function] cls.add_method('IsExpired', 'bool', [param('ns3::EventId const &', 'ev')], is_const=True, is_virtual=True) ## realtime-simulator-impl.h (module 'core'): bool ns3::RealtimeSimulatorImpl::IsFinished() const [member function] cls.add_method('IsFinished', 'bool', [], is_const=True, is_virtual=True) ## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::Next() const [member function] cls.add_method('Next', 'ns3::Time', [], is_const=True, is_virtual=True) ## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::Now() const [member function] cls.add_method('Now', 'ns3::Time', [], is_const=True, is_virtual=True) ## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::RealtimeNow() const [member function] cls.add_method('RealtimeNow', 'ns3::Time', [], is_const=True) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Remove(ns3::EventId const & ev) [member function] cls.add_method('Remove', 'void', [param('ns3::EventId const &', 'ev')], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Run() [member function] cls.add_method('Run', 'void', [], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::RunOneEvent() [member function] cls.add_method('RunOneEvent', 'void', [], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): ns3::EventId ns3::RealtimeSimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function] cls.add_method('Schedule', 'ns3::EventId', [param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): ns3::EventId ns3::RealtimeSimulatorImpl::ScheduleDestroy(ns3::EventImpl * event) [member function] cls.add_method('ScheduleDestroy', 'ns3::EventId', [param('ns3::EventImpl *', 'event')], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): ns3::EventId ns3::RealtimeSimulatorImpl::ScheduleNow(ns3::EventImpl * event) [member function] cls.add_method('ScheduleNow', 'ns3::EventId', [param('ns3::EventImpl *', 'event')], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtime(ns3::Time const & time, ns3::EventImpl * event) [member function] cls.add_method('ScheduleRealtime', 'void', [param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')]) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtimeNow(ns3::EventImpl * event) [member function] cls.add_method('ScheduleRealtimeNow', 'void', [param('ns3::EventImpl *', 'event')]) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtimeNowWithContext(uint32_t context, ns3::EventImpl * event) [member function] cls.add_method('ScheduleRealtimeNowWithContext', 'void', [param('uint32_t', 'context'), param('ns3::EventImpl *', 'event')]) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtimeWithContext(uint32_t context, ns3::Time const & time, ns3::EventImpl * event) [member function] cls.add_method('ScheduleRealtimeWithContext', 'void', [param('uint32_t', 'context'), param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')]) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleWithContext(uint32_t context, ns3::Time const & time, ns3::EventImpl * event) [member function] cls.add_method('ScheduleWithContext', 'void', [param('uint32_t', 'context'), param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::SetHardLimit(ns3::Time limit) [member function] cls.add_method('SetHardLimit', 'void', [param('ns3::Time', 'limit')]) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function] cls.add_method('SetScheduler', 'void', [param('ns3::ObjectFactory', 'schedulerFactory')], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::SetSynchronizationMode(ns3::RealtimeSimulatorImpl::SynchronizationMode mode) [member function] cls.add_method('SetSynchronizationMode', 'void', [param('ns3::RealtimeSimulatorImpl::SynchronizationMode', 'mode')]) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Stop() [member function] cls.add_method('Stop', 'void', [], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Stop(ns3::Time const & time) [member function] cls.add_method('Stop', 'void', [param('ns3::Time const &', 'time')], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='private', is_virtual=True) return def register_Ns3TapBridge_methods(root_module, cls): ## tap-bridge.h (module 'tap-bridge'): ns3::TapBridge::TapBridge(ns3::TapBridge const & arg0) [copy constructor] cls.add_constructor([param('ns3::TapBridge const &', 'arg0')]) ## tap-bridge.h (module 'tap-bridge'): ns3::TapBridge::TapBridge() [constructor] cls.add_constructor([]) ## tap-bridge.h (module 'tap-bridge'): void ns3::TapBridge::AddLinkChangeCallback(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function] cls.add_method('AddLinkChangeCallback', 'void', [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')], is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): ns3::Address ns3::TapBridge::GetAddress() const [member function] cls.add_method('GetAddress', 'ns3::Address', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): ns3::Ptr<ns3::NetDevice> ns3::TapBridge::GetBridgedNetDevice() [member function] cls.add_method('GetBridgedNetDevice', 'ns3::Ptr< ns3::NetDevice >', []) ## tap-bridge.h (module 'tap-bridge'): ns3::Address ns3::TapBridge::GetBroadcast() const [member function] cls.add_method('GetBroadcast', 'ns3::Address', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): ns3::Ptr<ns3::Channel> ns3::TapBridge::GetChannel() const [member function] cls.add_method('GetChannel', 'ns3::Ptr< ns3::Channel >', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): uint32_t ns3::TapBridge::GetIfIndex() const [member function] cls.add_method('GetIfIndex', 'uint32_t', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): ns3::TapBridge::Mode ns3::TapBridge::GetMode() [member function] cls.add_method('GetMode', 'ns3::TapBridge::Mode', []) ## tap-bridge.h (module 'tap-bridge'): uint16_t ns3::TapBridge::GetMtu() const [member function] cls.add_method('GetMtu', 'uint16_t', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): 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 (module 'tap-bridge'): 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 (module 'tap-bridge'): ns3::Ptr<ns3::Node> ns3::TapBridge::GetNode() const [member function] cls.add_method('GetNode', 'ns3::Ptr< ns3::Node >', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): static ns3::TypeId ns3::TapBridge::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## tap-bridge.h (module 'tap-bridge'): bool ns3::TapBridge::IsBridge() const [member function] cls.add_method('IsBridge', 'bool', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): bool ns3::TapBridge::IsBroadcast() const [member function] cls.add_method('IsBroadcast', 'bool', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): bool ns3::TapBridge::IsLinkUp() const [member function] cls.add_method('IsLinkUp', 'bool', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): bool ns3::TapBridge::IsMulticast() const [member function] cls.add_method('IsMulticast', 'bool', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): bool ns3::TapBridge::IsPointToPoint() const [member function] cls.add_method('IsPointToPoint', 'bool', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): bool ns3::TapBridge::NeedsArp() const [member function] cls.add_method('NeedsArp', 'bool', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): bool ns3::TapBridge::Send(ns3::Ptr<ns3::Packet> 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 (module 'tap-bridge'): bool ns3::TapBridge::SendFrom(ns3::Ptr<ns3::Packet> 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 (module 'tap-bridge'): void ns3::TapBridge::SetAddress(ns3::Address address) [member function] cls.add_method('SetAddress', 'void', [param('ns3::Address', 'address')], is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): void ns3::TapBridge::SetBridgedNetDevice(ns3::Ptr<ns3::NetDevice> bridgedDevice) [member function] cls.add_method('SetBridgedNetDevice', 'void', [param('ns3::Ptr< ns3::NetDevice >', 'bridgedDevice')]) ## tap-bridge.h (module 'tap-bridge'): 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 (module 'tap-bridge'): void ns3::TapBridge::SetMode(ns3::TapBridge::Mode mode) [member function] cls.add_method('SetMode', 'void', [param('ns3::TapBridge::Mode', 'mode')]) ## tap-bridge.h (module 'tap-bridge'): 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 (module 'tap-bridge'): void ns3::TapBridge::SetNode(ns3::Ptr<ns3::Node> node) [member function] cls.add_method('SetNode', 'void', [param('ns3::Ptr< ns3::Node >', 'node')], is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): void ns3::TapBridge::SetPromiscReceiveCallback(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) [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 (module 'tap-bridge'): void ns3::TapBridge::SetReceiveCallback(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) [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 (module 'tap-bridge'): void ns3::TapBridge::Start(ns3::Time tStart) [member function] cls.add_method('Start', 'void', [param('ns3::Time', 'tStart')]) ## tap-bridge.h (module 'tap-bridge'): void ns3::TapBridge::Stop(ns3::Time tStop) [member function] cls.add_method('Stop', 'void', [param('ns3::Time', 'tStop')]) ## tap-bridge.h (module 'tap-bridge'): bool ns3::TapBridge::SupportsSendFrom() const [member function] cls.add_method('SupportsSendFrom', 'bool', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): bool ns3::TapBridge::DiscardFromBridgedDevice(ns3::Ptr<ns3::NetDevice> device, ns3::Ptr<const ns3::Packet> packet, uint16_t protocol, ns3::Address const & src) [member function] cls.add_method('DiscardFromBridgedDevice', 'bool', [param('ns3::Ptr< ns3::NetDevice >', 'device'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('uint16_t', 'protocol'), param('ns3::Address const &', 'src')], visibility='protected') ## tap-bridge.h (module 'tap-bridge'): void ns3::TapBridge::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='protected', is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): bool ns3::TapBridge::ReceiveFromBridgedDevice(ns3::Ptr<ns3::NetDevice> device, ns3::Ptr<const ns3::Packet> packet, uint16_t protocol, ns3::Address const & src, ns3::Address const & dst, ns3::NetDevice::PacketType packetType) [member function] cls.add_method('ReceiveFromBridgedDevice', 'bool', [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_Ns3TapBridgeFdReader_methods(root_module, cls): ## tap-bridge.h (module 'tap-bridge'): ns3::TapBridgeFdReader::TapBridgeFdReader() [constructor] cls.add_constructor([]) ## tap-bridge.h (module 'tap-bridge'): ns3::TapBridgeFdReader::TapBridgeFdReader(ns3::TapBridgeFdReader const & arg0) [copy constructor] cls.add_constructor([param('ns3::TapBridgeFdReader const &', 'arg0')]) ## tap-bridge.h (module 'tap-bridge'): ns3::FdReader::Data ns3::TapBridgeFdReader::DoRead() [member function] cls.add_method('DoRead', 'ns3::FdReader::Data', [], visibility='private', is_virtual=True) return def register_Ns3TimeChecker_methods(root_module, cls): ## nstime.h (module 'core'): ns3::TimeChecker::TimeChecker() [constructor] cls.add_constructor([]) ## nstime.h (module 'core'): ns3::TimeChecker::TimeChecker(ns3::TimeChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::TimeChecker const &', 'arg0')]) return def register_Ns3TimeValue_methods(root_module, cls): ## nstime.h (module 'core'): ns3::TimeValue::TimeValue() [constructor] cls.add_constructor([]) ## nstime.h (module 'core'): ns3::TimeValue::TimeValue(ns3::TimeValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::TimeValue const &', 'arg0')]) ## nstime.h (module 'core'): ns3::TimeValue::TimeValue(ns3::Time const & value) [constructor] cls.add_constructor([param('ns3::Time const &', 'value')]) ## nstime.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::TimeValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## nstime.h (module 'core'): bool ns3::TimeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## nstime.h (module 'core'): ns3::Time ns3::TimeValue::Get() const [member function] cls.add_method('Get', 'ns3::Time', [], is_const=True) ## nstime.h (module 'core'): std::string ns3::TimeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## nstime.h (module 'core'): void ns3::TimeValue::Set(ns3::Time const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Time const &', 'value')]) return def register_Ns3TypeIdChecker_methods(root_module, cls): ## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker() [constructor] cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker(ns3::TypeIdChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::TypeIdChecker const &', 'arg0')]) return def register_Ns3TypeIdValue_methods(root_module, cls): ## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue() [constructor] cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeIdValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::TypeIdValue const &', 'arg0')]) ## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeId const & value) [constructor] cls.add_constructor([param('ns3::TypeId const &', 'value')]) ## type-id.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::TypeIdValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## type-id.h (module 'core'): bool ns3::TypeIdValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeIdValue::Get() const [member function] cls.add_method('Get', 'ns3::TypeId', [], is_const=True) ## type-id.h (module 'core'): std::string ns3::TypeIdValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## type-id.h (module 'core'): void ns3::TypeIdValue::Set(ns3::TypeId const & value) [member function] cls.add_method('Set', 'void', [param('ns3::TypeId const &', 'value')]) return def register_Ns3AddressChecker_methods(root_module, cls): ## address.h (module 'network'): ns3::AddressChecker::AddressChecker() [constructor] cls.add_constructor([]) ## address.h (module 'network'): ns3::AddressChecker::AddressChecker(ns3::AddressChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::AddressChecker const &', 'arg0')]) return def register_Ns3AddressValue_methods(root_module, cls): ## address.h (module 'network'): ns3::AddressValue::AddressValue() [constructor] cls.add_constructor([]) ## address.h (module 'network'): ns3::AddressValue::AddressValue(ns3::AddressValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::AddressValue const &', 'arg0')]) ## address.h (module 'network'): ns3::AddressValue::AddressValue(ns3::Address const & value) [constructor] cls.add_constructor([param('ns3::Address const &', 'value')]) ## address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::AddressValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## address.h (module 'network'): bool ns3::AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## address.h (module 'network'): ns3::Address ns3::AddressValue::Get() const [member function] cls.add_method('Get', 'ns3::Address', [], is_const=True) ## address.h (module 'network'): std::string ns3::AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## address.h (module 'network'): void ns3::AddressValue::Set(ns3::Address const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Address const &', 'value')]) return def register_functions(root_module): module = root_module register_functions_ns3_FatalImpl(module.get_submodule('FatalImpl'), root_module) return def register_functions_ns3_FatalImpl(module, root_module): return def main(): out = FileCodeSink(sys.stdout) root_module = module_init() register_types(root_module) register_methods(root_module) register_functions(root_module) root_module.generate(out) if __name__ == '__main__': main()
zy901002-gpsr
src/tap-bridge/bindings/modulegen__gcc_ILP32.py
Python
gpl2
278,048
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers import pybindgen.settings import warnings class ErrorHandler(pybindgen.settings.ErrorHandler): def handle_error(self, wrapper, exception, traceback_): warnings.warn("exception %r in wrapper %s" % (exception, wrapper)) return True pybindgen.settings.error_handler = ErrorHandler() import sys def module_init(): root_module = Module('ns.tap_bridge', cpp_namespace='::ns3') return root_module def register_types(module): root_module = module.get_root() ## log.h (module 'core'): ns3::LogLevel [enumeration] module.add_enum('LogLevel', ['LOG_NONE', 'LOG_ERROR', 'LOG_LEVEL_ERROR', 'LOG_WARN', 'LOG_LEVEL_WARN', 'LOG_DEBUG', 'LOG_LEVEL_DEBUG', 'LOG_INFO', 'LOG_LEVEL_INFO', 'LOG_FUNCTION', 'LOG_LEVEL_FUNCTION', 'LOG_LOGIC', 'LOG_LEVEL_LOGIC', 'LOG_ALL', 'LOG_LEVEL_ALL', 'LOG_PREFIX_FUNC', 'LOG_PREFIX_TIME', 'LOG_PREFIX_NODE'], import_from_module='ns.core') ## address.h (module 'network'): ns3::Address [class] module.add_class('Address', import_from_module='ns.network') ## address.h (module 'network'): ns3::Address::MaxSize_e [enumeration] module.add_enum('MaxSize_e', ['MAX_SIZE'], outer_class=root_module['ns3::Address'], import_from_module='ns.network') ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList [class] module.add_class('AttributeConstructionList', import_from_module='ns.core') ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item [struct] module.add_class('Item', import_from_module='ns.core', outer_class=root_module['ns3::AttributeConstructionList']) ## buffer.h (module 'network'): ns3::Buffer [class] module.add_class('Buffer', import_from_module='ns.network') ## buffer.h (module 'network'): ns3::Buffer::Iterator [class] module.add_class('Iterator', import_from_module='ns.network', outer_class=root_module['ns3::Buffer']) ## packet.h (module 'network'): ns3::ByteTagIterator [class] module.add_class('ByteTagIterator', import_from_module='ns.network') ## packet.h (module 'network'): ns3::ByteTagIterator::Item [class] module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagIterator']) ## byte-tag-list.h (module 'network'): ns3::ByteTagList [class] module.add_class('ByteTagList', import_from_module='ns.network') ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator [class] module.add_class('Iterator', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagList']) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item [struct] module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagList::Iterator']) ## callback.h (module 'core'): ns3::CallbackBase [class] module.add_class('CallbackBase', import_from_module='ns.core') ## system-mutex.h (module 'core'): ns3::CriticalSection [class] module.add_class('CriticalSection', import_from_module='ns.core') ## data-rate.h (module 'network'): ns3::DataRate [class] module.add_class('DataRate', import_from_module='ns.network') ## event-id.h (module 'core'): ns3::EventId [class] module.add_class('EventId', import_from_module='ns.core') ## ipv4-address.h (module 'network'): ns3::Ipv4Address [class] module.add_class('Ipv4Address', import_from_module='ns.network') ## ipv4-address.h (module 'network'): ns3::Ipv4Address [class] root_module['ns3::Ipv4Address'].implicitly_converts_to(root_module['ns3::Address']) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask [class] module.add_class('Ipv4Mask', import_from_module='ns.network') ## ipv6-address.h (module 'network'): ns3::Ipv6Address [class] module.add_class('Ipv6Address', import_from_module='ns.network') ## ipv6-address.h (module 'network'): ns3::Ipv6Address [class] root_module['ns3::Ipv6Address'].implicitly_converts_to(root_module['ns3::Address']) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix [class] module.add_class('Ipv6Prefix', import_from_module='ns.network') ## log.h (module 'core'): ns3::LogComponent [class] module.add_class('LogComponent', import_from_module='ns.core') ## mac48-address.h (module 'network'): ns3::Mac48Address [class] module.add_class('Mac48Address', import_from_module='ns.network') ## mac48-address.h (module 'network'): ns3::Mac48Address [class] root_module['ns3::Mac48Address'].implicitly_converts_to(root_module['ns3::Address']) ## net-device-container.h (module 'network'): ns3::NetDeviceContainer [class] module.add_class('NetDeviceContainer', import_from_module='ns.network') ## object-base.h (module 'core'): ns3::ObjectBase [class] module.add_class('ObjectBase', allow_subclassing=True, import_from_module='ns.core') ## object.h (module 'core'): ns3::ObjectDeleter [struct] module.add_class('ObjectDeleter', import_from_module='ns.core') ## object-factory.h (module 'core'): ns3::ObjectFactory [class] module.add_class('ObjectFactory', import_from_module='ns.core') ## packet-metadata.h (module 'network'): ns3::PacketMetadata [class] module.add_class('PacketMetadata', import_from_module='ns.network') ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [struct] module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::PacketMetadata']) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [enumeration] module.add_enum('', ['PAYLOAD', 'HEADER', 'TRAILER'], outer_class=root_module['ns3::PacketMetadata::Item'], import_from_module='ns.network') ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator [class] module.add_class('ItemIterator', import_from_module='ns.network', outer_class=root_module['ns3::PacketMetadata']) ## packet.h (module 'network'): ns3::PacketTagIterator [class] module.add_class('PacketTagIterator', import_from_module='ns.network') ## packet.h (module 'network'): ns3::PacketTagIterator::Item [class] module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagIterator']) ## packet-tag-list.h (module 'network'): ns3::PacketTagList [class] module.add_class('PacketTagList', import_from_module='ns.network') ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData [struct] module.add_class('TagData', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagList']) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Object', 'ns3::ObjectBase', 'ns3::ObjectDeleter'], parent=root_module['ns3::ObjectBase'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## system-mutex.h (module 'core'): ns3::SystemMutex [class] module.add_class('SystemMutex', import_from_module='ns.core') ## tag.h (module 'network'): ns3::Tag [class] module.add_class('Tag', import_from_module='ns.network', parent=root_module['ns3::ObjectBase']) ## tag-buffer.h (module 'network'): ns3::TagBuffer [class] module.add_class('TagBuffer', import_from_module='ns.network') ## tap-bridge-helper.h (module 'tap-bridge'): ns3::TapBridgeHelper [class] module.add_class('TapBridgeHelper') ## type-id.h (module 'core'): ns3::TypeId [class] module.add_class('TypeId', import_from_module='ns.core') ## type-id.h (module 'core'): ns3::TypeId::AttributeFlag [enumeration] module.add_enum('AttributeFlag', ['ATTR_GET', 'ATTR_SET', 'ATTR_CONSTRUCT', 'ATTR_SGC'], outer_class=root_module['ns3::TypeId'], import_from_module='ns.core') ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation [struct] module.add_class('AttributeInformation', import_from_module='ns.core', outer_class=root_module['ns3::TypeId']) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation [struct] module.add_class('TraceSourceInformation', import_from_module='ns.core', outer_class=root_module['ns3::TypeId']) ## empty.h (module 'core'): ns3::empty [class] module.add_class('empty', import_from_module='ns.core') ## int64x64-double.h (module 'core'): ns3::int64x64_t [class] module.add_class('int64x64_t', import_from_module='ns.core') ## chunk.h (module 'network'): ns3::Chunk [class] module.add_class('Chunk', import_from_module='ns.network', parent=root_module['ns3::ObjectBase']) ## header.h (module 'network'): ns3::Header [class] module.add_class('Header', import_from_module='ns.network', parent=root_module['ns3::Chunk']) ## object.h (module 'core'): ns3::Object [class] module.add_class('Object', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >']) ## object.h (module 'core'): ns3::Object::AggregateIterator [class] module.add_class('AggregateIterator', import_from_module='ns.core', outer_class=root_module['ns3::Object']) ## scheduler.h (module 'core'): ns3::Scheduler [class] module.add_class('Scheduler', import_from_module='ns.core', parent=root_module['ns3::Object']) ## scheduler.h (module 'core'): ns3::Scheduler::Event [struct] module.add_class('Event', import_from_module='ns.core', outer_class=root_module['ns3::Scheduler']) ## scheduler.h (module 'core'): ns3::Scheduler::EventKey [struct] module.add_class('EventKey', import_from_module='ns.core', outer_class=root_module['ns3::Scheduler']) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeChecker', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeChecker>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeValue', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeValue>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::CallbackImplBase', 'ns3::empty', 'ns3::DefaultDeleter<ns3::CallbackImplBase>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::EventImpl', 'ns3::empty', 'ns3::DefaultDeleter<ns3::EventImpl>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::FdReader', 'ns3::empty', 'ns3::DefaultDeleter<ns3::FdReader>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::NixVector', 'ns3::empty', 'ns3::DefaultDeleter<ns3::NixVector>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Packet', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Packet>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::SystemThread', 'ns3::empty', 'ns3::DefaultDeleter<ns3::SystemThread>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simulator-impl.h (module 'core'): ns3::SimulatorImpl [class] module.add_class('SimulatorImpl', import_from_module='ns.core', parent=root_module['ns3::Object']) ## synchronizer.h (module 'core'): ns3::Synchronizer [class] module.add_class('Synchronizer', import_from_module='ns.core', parent=root_module['ns3::Object']) ## system-thread.h (module 'core'): ns3::SystemThread [class] module.add_class('SystemThread', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >']) ## nstime.h (module 'core'): ns3::Time [class] module.add_class('Time', import_from_module='ns.core') ## nstime.h (module 'core'): ns3::Time::Unit [enumeration] module.add_enum('Unit', ['S', 'MS', 'US', 'NS', 'PS', 'FS', 'LAST'], outer_class=root_module['ns3::Time'], import_from_module='ns.core') ## nstime.h (module 'core'): ns3::Time [class] root_module['ns3::Time'].implicitly_converts_to(root_module['ns3::int64x64_t']) ## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor [class] module.add_class('TraceSourceAccessor', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >']) ## trailer.h (module 'network'): ns3::Trailer [class] module.add_class('Trailer', import_from_module='ns.network', parent=root_module['ns3::Chunk']) ## attribute.h (module 'core'): ns3::AttributeAccessor [class] module.add_class('AttributeAccessor', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >']) ## attribute.h (module 'core'): ns3::AttributeChecker [class] module.add_class('AttributeChecker', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >']) ## attribute.h (module 'core'): ns3::AttributeValue [class] module.add_class('AttributeValue', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >']) ## callback.h (module 'core'): ns3::CallbackChecker [class] module.add_class('CallbackChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) ## callback.h (module 'core'): ns3::CallbackImplBase [class] module.add_class('CallbackImplBase', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >']) ## callback.h (module 'core'): ns3::CallbackValue [class] module.add_class('CallbackValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## data-rate.h (module 'network'): ns3::DataRateChecker [class] module.add_class('DataRateChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) ## data-rate.h (module 'network'): ns3::DataRateValue [class] module.add_class('DataRateValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) ## attribute.h (module 'core'): ns3::EmptyAttributeValue [class] module.add_class('EmptyAttributeValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## event-impl.h (module 'core'): ns3::EventImpl [class] module.add_class('EventImpl', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >']) ## unix-fd-reader.h (module 'core'): ns3::FdReader [class] module.add_class('FdReader', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >']) ## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker [class] module.add_class('Ipv4AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) ## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue [class] module.add_class('Ipv4AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) ## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker [class] module.add_class('Ipv4MaskChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) ## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue [class] module.add_class('Ipv4MaskValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) ## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker [class] module.add_class('Ipv6AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) ## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue [class] module.add_class('Ipv6AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker [class] module.add_class('Ipv6PrefixChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue [class] module.add_class('Ipv6PrefixValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) ## mac48-address.h (module 'network'): ns3::Mac48AddressChecker [class] module.add_class('Mac48AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) ## mac48-address.h (module 'network'): ns3::Mac48AddressValue [class] module.add_class('Mac48AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) ## net-device.h (module 'network'): ns3::NetDevice [class] module.add_class('NetDevice', import_from_module='ns.network', parent=root_module['ns3::Object']) ## net-device.h (module 'network'): ns3::NetDevice::PacketType [enumeration] module.add_enum('PacketType', ['PACKET_HOST', 'NS3_PACKET_HOST', 'PACKET_BROADCAST', 'NS3_PACKET_BROADCAST', 'PACKET_MULTICAST', 'NS3_PACKET_MULTICAST', 'PACKET_OTHERHOST', 'NS3_PACKET_OTHERHOST'], outer_class=root_module['ns3::NetDevice'], import_from_module='ns.network') ## nix-vector.h (module 'network'): ns3::NixVector [class] module.add_class('NixVector', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >']) ## node.h (module 'network'): ns3::Node [class] module.add_class('Node', import_from_module='ns.network', parent=root_module['ns3::Object']) ## object-factory.h (module 'core'): ns3::ObjectFactoryChecker [class] module.add_class('ObjectFactoryChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) ## object-factory.h (module 'core'): ns3::ObjectFactoryValue [class] module.add_class('ObjectFactoryValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## packet.h (module 'network'): ns3::Packet [class] module.add_class('Packet', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >']) ## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl [class] module.add_class('RealtimeSimulatorImpl', import_from_module='ns.core', parent=root_module['ns3::SimulatorImpl']) ## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::SynchronizationMode [enumeration] module.add_enum('SynchronizationMode', ['SYNC_BEST_EFFORT', 'SYNC_HARD_LIMIT'], outer_class=root_module['ns3::RealtimeSimulatorImpl'], import_from_module='ns.core') ## tap-bridge.h (module 'tap-bridge'): ns3::TapBridge [class] module.add_class('TapBridge', parent=root_module['ns3::NetDevice']) ## tap-bridge.h (module 'tap-bridge'): ns3::TapBridge::Mode [enumeration] module.add_enum('Mode', ['ILLEGAL', 'CONFIGURE_LOCAL', 'USE_LOCAL', 'USE_BRIDGE'], outer_class=root_module['ns3::TapBridge']) ## tap-bridge.h (module 'tap-bridge'): ns3::TapBridgeFdReader [class] module.add_class('TapBridgeFdReader', parent=root_module['ns3::FdReader']) ## nstime.h (module 'core'): ns3::TimeChecker [class] module.add_class('TimeChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) ## nstime.h (module 'core'): ns3::TimeValue [class] module.add_class('TimeValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## type-id.h (module 'core'): ns3::TypeIdChecker [class] module.add_class('TypeIdChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) ## type-id.h (module 'core'): ns3::TypeIdValue [class] module.add_class('TypeIdValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## address.h (module 'network'): ns3::AddressChecker [class] module.add_class('AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) ## address.h (module 'network'): ns3::AddressValue [class] module.add_class('AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *', 'ns3::LogTimePrinter') typehandlers.add_type_alias('void ( * ) ( std::ostream & ) **', 'ns3::LogTimePrinter*') typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *&', 'ns3::LogTimePrinter&') typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *', 'ns3::LogNodePrinter') typehandlers.add_type_alias('void ( * ) ( std::ostream & ) **', 'ns3::LogNodePrinter*') typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *&', 'ns3::LogNodePrinter&') ## Register a nested module for the namespace FatalImpl nested_module = module.add_cpp_namespace('FatalImpl') register_types_ns3_FatalImpl(nested_module) def register_types_ns3_FatalImpl(module): root_module = module.get_root() def register_methods(root_module): register_Ns3Address_methods(root_module, root_module['ns3::Address']) register_Ns3AttributeConstructionList_methods(root_module, root_module['ns3::AttributeConstructionList']) register_Ns3AttributeConstructionListItem_methods(root_module, root_module['ns3::AttributeConstructionList::Item']) register_Ns3Buffer_methods(root_module, root_module['ns3::Buffer']) register_Ns3BufferIterator_methods(root_module, root_module['ns3::Buffer::Iterator']) register_Ns3ByteTagIterator_methods(root_module, root_module['ns3::ByteTagIterator']) register_Ns3ByteTagIteratorItem_methods(root_module, root_module['ns3::ByteTagIterator::Item']) register_Ns3ByteTagList_methods(root_module, root_module['ns3::ByteTagList']) register_Ns3ByteTagListIterator_methods(root_module, root_module['ns3::ByteTagList::Iterator']) register_Ns3ByteTagListIteratorItem_methods(root_module, root_module['ns3::ByteTagList::Iterator::Item']) register_Ns3CallbackBase_methods(root_module, root_module['ns3::CallbackBase']) register_Ns3CriticalSection_methods(root_module, root_module['ns3::CriticalSection']) register_Ns3DataRate_methods(root_module, root_module['ns3::DataRate']) register_Ns3EventId_methods(root_module, root_module['ns3::EventId']) register_Ns3Ipv4Address_methods(root_module, root_module['ns3::Ipv4Address']) register_Ns3Ipv4Mask_methods(root_module, root_module['ns3::Ipv4Mask']) register_Ns3Ipv6Address_methods(root_module, root_module['ns3::Ipv6Address']) register_Ns3Ipv6Prefix_methods(root_module, root_module['ns3::Ipv6Prefix']) register_Ns3LogComponent_methods(root_module, root_module['ns3::LogComponent']) register_Ns3Mac48Address_methods(root_module, root_module['ns3::Mac48Address']) register_Ns3NetDeviceContainer_methods(root_module, root_module['ns3::NetDeviceContainer']) register_Ns3ObjectBase_methods(root_module, root_module['ns3::ObjectBase']) register_Ns3ObjectDeleter_methods(root_module, root_module['ns3::ObjectDeleter']) register_Ns3ObjectFactory_methods(root_module, root_module['ns3::ObjectFactory']) register_Ns3PacketMetadata_methods(root_module, root_module['ns3::PacketMetadata']) register_Ns3PacketMetadataItem_methods(root_module, root_module['ns3::PacketMetadata::Item']) register_Ns3PacketMetadataItemIterator_methods(root_module, root_module['ns3::PacketMetadata::ItemIterator']) register_Ns3PacketTagIterator_methods(root_module, root_module['ns3::PacketTagIterator']) register_Ns3PacketTagIteratorItem_methods(root_module, root_module['ns3::PacketTagIterator::Item']) register_Ns3PacketTagList_methods(root_module, root_module['ns3::PacketTagList']) register_Ns3PacketTagListTagData_methods(root_module, root_module['ns3::PacketTagList::TagData']) register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >']) register_Ns3SystemMutex_methods(root_module, root_module['ns3::SystemMutex']) register_Ns3Tag_methods(root_module, root_module['ns3::Tag']) register_Ns3TagBuffer_methods(root_module, root_module['ns3::TagBuffer']) register_Ns3TapBridgeHelper_methods(root_module, root_module['ns3::TapBridgeHelper']) register_Ns3TypeId_methods(root_module, root_module['ns3::TypeId']) register_Ns3TypeIdAttributeInformation_methods(root_module, root_module['ns3::TypeId::AttributeInformation']) register_Ns3TypeIdTraceSourceInformation_methods(root_module, root_module['ns3::TypeId::TraceSourceInformation']) register_Ns3Empty_methods(root_module, root_module['ns3::empty']) register_Ns3Int64x64_t_methods(root_module, root_module['ns3::int64x64_t']) register_Ns3Chunk_methods(root_module, root_module['ns3::Chunk']) register_Ns3Header_methods(root_module, root_module['ns3::Header']) register_Ns3Object_methods(root_module, root_module['ns3::Object']) register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator']) register_Ns3Scheduler_methods(root_module, root_module['ns3::Scheduler']) register_Ns3SchedulerEvent_methods(root_module, root_module['ns3::Scheduler::Event']) register_Ns3SchedulerEventKey_methods(root_module, root_module['ns3::Scheduler::EventKey']) register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >']) register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >']) register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >']) register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >']) register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >']) register_Ns3SimpleRefCount__Ns3FdReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3FdReader__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >']) register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >']) register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >']) register_Ns3SimpleRefCount__Ns3SystemThread_Ns3Empty_Ns3DefaultDeleter__lt__ns3SystemThread__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >']) register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >']) register_Ns3SimulatorImpl_methods(root_module, root_module['ns3::SimulatorImpl']) register_Ns3Synchronizer_methods(root_module, root_module['ns3::Synchronizer']) register_Ns3SystemThread_methods(root_module, root_module['ns3::SystemThread']) register_Ns3Time_methods(root_module, root_module['ns3::Time']) register_Ns3TraceSourceAccessor_methods(root_module, root_module['ns3::TraceSourceAccessor']) register_Ns3Trailer_methods(root_module, root_module['ns3::Trailer']) register_Ns3AttributeAccessor_methods(root_module, root_module['ns3::AttributeAccessor']) register_Ns3AttributeChecker_methods(root_module, root_module['ns3::AttributeChecker']) register_Ns3AttributeValue_methods(root_module, root_module['ns3::AttributeValue']) register_Ns3CallbackChecker_methods(root_module, root_module['ns3::CallbackChecker']) register_Ns3CallbackImplBase_methods(root_module, root_module['ns3::CallbackImplBase']) register_Ns3CallbackValue_methods(root_module, root_module['ns3::CallbackValue']) register_Ns3DataRateChecker_methods(root_module, root_module['ns3::DataRateChecker']) register_Ns3DataRateValue_methods(root_module, root_module['ns3::DataRateValue']) register_Ns3EmptyAttributeValue_methods(root_module, root_module['ns3::EmptyAttributeValue']) register_Ns3EventImpl_methods(root_module, root_module['ns3::EventImpl']) register_Ns3FdReader_methods(root_module, root_module['ns3::FdReader']) register_Ns3Ipv4AddressChecker_methods(root_module, root_module['ns3::Ipv4AddressChecker']) register_Ns3Ipv4AddressValue_methods(root_module, root_module['ns3::Ipv4AddressValue']) register_Ns3Ipv4MaskChecker_methods(root_module, root_module['ns3::Ipv4MaskChecker']) register_Ns3Ipv4MaskValue_methods(root_module, root_module['ns3::Ipv4MaskValue']) register_Ns3Ipv6AddressChecker_methods(root_module, root_module['ns3::Ipv6AddressChecker']) register_Ns3Ipv6AddressValue_methods(root_module, root_module['ns3::Ipv6AddressValue']) register_Ns3Ipv6PrefixChecker_methods(root_module, root_module['ns3::Ipv6PrefixChecker']) register_Ns3Ipv6PrefixValue_methods(root_module, root_module['ns3::Ipv6PrefixValue']) register_Ns3Mac48AddressChecker_methods(root_module, root_module['ns3::Mac48AddressChecker']) register_Ns3Mac48AddressValue_methods(root_module, root_module['ns3::Mac48AddressValue']) register_Ns3NetDevice_methods(root_module, root_module['ns3::NetDevice']) register_Ns3NixVector_methods(root_module, root_module['ns3::NixVector']) register_Ns3Node_methods(root_module, root_module['ns3::Node']) register_Ns3ObjectFactoryChecker_methods(root_module, root_module['ns3::ObjectFactoryChecker']) register_Ns3ObjectFactoryValue_methods(root_module, root_module['ns3::ObjectFactoryValue']) register_Ns3Packet_methods(root_module, root_module['ns3::Packet']) register_Ns3RealtimeSimulatorImpl_methods(root_module, root_module['ns3::RealtimeSimulatorImpl']) register_Ns3TapBridge_methods(root_module, root_module['ns3::TapBridge']) register_Ns3TapBridgeFdReader_methods(root_module, root_module['ns3::TapBridgeFdReader']) register_Ns3TimeChecker_methods(root_module, root_module['ns3::TimeChecker']) register_Ns3TimeValue_methods(root_module, root_module['ns3::TimeValue']) register_Ns3TypeIdChecker_methods(root_module, root_module['ns3::TypeIdChecker']) register_Ns3TypeIdValue_methods(root_module, root_module['ns3::TypeIdValue']) register_Ns3AddressChecker_methods(root_module, root_module['ns3::AddressChecker']) register_Ns3AddressValue_methods(root_module, root_module['ns3::AddressValue']) return def register_Ns3Address_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## address.h (module 'network'): ns3::Address::Address() [constructor] cls.add_constructor([]) ## address.h (module 'network'): ns3::Address::Address(uint8_t type, uint8_t const * buffer, uint8_t len) [constructor] cls.add_constructor([param('uint8_t', 'type'), param('uint8_t const *', 'buffer'), param('uint8_t', 'len')]) ## address.h (module 'network'): ns3::Address::Address(ns3::Address const & address) [copy constructor] cls.add_constructor([param('ns3::Address const &', 'address')]) ## address.h (module 'network'): bool ns3::Address::CheckCompatible(uint8_t type, uint8_t len) const [member function] cls.add_method('CheckCompatible', 'bool', [param('uint8_t', 'type'), param('uint8_t', 'len')], is_const=True) ## address.h (module 'network'): uint32_t ns3::Address::CopyAllFrom(uint8_t const * buffer, uint8_t len) [member function] cls.add_method('CopyAllFrom', 'uint32_t', [param('uint8_t const *', 'buffer'), param('uint8_t', 'len')]) ## address.h (module 'network'): uint32_t ns3::Address::CopyAllTo(uint8_t * buffer, uint8_t len) const [member function] cls.add_method('CopyAllTo', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint8_t', 'len')], is_const=True) ## address.h (module 'network'): uint32_t ns3::Address::CopyFrom(uint8_t const * buffer, uint8_t len) [member function] cls.add_method('CopyFrom', 'uint32_t', [param('uint8_t const *', 'buffer'), param('uint8_t', 'len')]) ## address.h (module 'network'): uint32_t ns3::Address::CopyTo(uint8_t * buffer) const [member function] cls.add_method('CopyTo', 'uint32_t', [param('uint8_t *', 'buffer')], is_const=True) ## address.h (module 'network'): void ns3::Address::Deserialize(ns3::TagBuffer buffer) [member function] cls.add_method('Deserialize', 'void', [param('ns3::TagBuffer', 'buffer')]) ## address.h (module 'network'): uint8_t ns3::Address::GetLength() const [member function] cls.add_method('GetLength', 'uint8_t', [], is_const=True) ## address.h (module 'network'): uint32_t ns3::Address::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## address.h (module 'network'): bool ns3::Address::IsInvalid() const [member function] cls.add_method('IsInvalid', 'bool', [], is_const=True) ## address.h (module 'network'): bool ns3::Address::IsMatchingType(uint8_t type) const [member function] cls.add_method('IsMatchingType', 'bool', [param('uint8_t', 'type')], is_const=True) ## address.h (module 'network'): static uint8_t ns3::Address::Register() [member function] cls.add_method('Register', 'uint8_t', [], is_static=True) ## address.h (module 'network'): void ns3::Address::Serialize(ns3::TagBuffer buffer) const [member function] cls.add_method('Serialize', 'void', [param('ns3::TagBuffer', 'buffer')], is_const=True) return def register_Ns3AttributeConstructionList_methods(root_module, cls): ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList(ns3::AttributeConstructionList const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeConstructionList const &', 'arg0')]) ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList() [constructor] cls.add_constructor([]) ## attribute-construction-list.h (module 'core'): void ns3::AttributeConstructionList::Add(std::string name, ns3::Ptr<ns3::AttributeChecker const> checker, ns3::Ptr<ns3::AttributeValue> value) [member function] cls.add_method('Add', 'void', [param('std::string', 'name'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker'), param('ns3::Ptr< ns3::AttributeValue >', 'value')]) ## attribute-construction-list.h (module 'core'): std::_List_const_iterator<ns3::AttributeConstructionList::Item> ns3::AttributeConstructionList::Begin() const [member function] cls.add_method('Begin', 'std::_List_const_iterator< ns3::AttributeConstructionList::Item >', [], is_const=True) ## attribute-construction-list.h (module 'core'): std::_List_const_iterator<ns3::AttributeConstructionList::Item> ns3::AttributeConstructionList::End() const [member function] cls.add_method('End', 'std::_List_const_iterator< ns3::AttributeConstructionList::Item >', [], is_const=True) ## attribute-construction-list.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeConstructionList::Find(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('Find', 'ns3::Ptr< ns3::AttributeValue >', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True) return def register_Ns3AttributeConstructionListItem_methods(root_module, cls): ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item() [constructor] cls.add_constructor([]) ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item(ns3::AttributeConstructionList::Item const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeConstructionList::Item const &', 'arg0')]) ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::checker [variable] cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False) ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::name [variable] cls.add_instance_attribute('name', 'std::string', is_const=False) ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::value [variable] cls.add_instance_attribute('value', 'ns3::Ptr< ns3::AttributeValue >', is_const=False) return def register_Ns3Buffer_methods(root_module, cls): ## buffer.h (module 'network'): ns3::Buffer::Buffer() [constructor] cls.add_constructor([]) ## buffer.h (module 'network'): ns3::Buffer::Buffer(uint32_t dataSize) [constructor] cls.add_constructor([param('uint32_t', 'dataSize')]) ## buffer.h (module 'network'): ns3::Buffer::Buffer(uint32_t dataSize, bool initialize) [constructor] cls.add_constructor([param('uint32_t', 'dataSize'), param('bool', 'initialize')]) ## buffer.h (module 'network'): ns3::Buffer::Buffer(ns3::Buffer const & o) [copy constructor] cls.add_constructor([param('ns3::Buffer const &', 'o')]) ## buffer.h (module 'network'): bool ns3::Buffer::AddAtEnd(uint32_t end) [member function] cls.add_method('AddAtEnd', 'bool', [param('uint32_t', 'end')]) ## buffer.h (module 'network'): void ns3::Buffer::AddAtEnd(ns3::Buffer const & o) [member function] cls.add_method('AddAtEnd', 'void', [param('ns3::Buffer const &', 'o')]) ## buffer.h (module 'network'): bool ns3::Buffer::AddAtStart(uint32_t start) [member function] cls.add_method('AddAtStart', 'bool', [param('uint32_t', 'start')]) ## buffer.h (module 'network'): ns3::Buffer::Iterator ns3::Buffer::Begin() const [member function] cls.add_method('Begin', 'ns3::Buffer::Iterator', [], is_const=True) ## buffer.h (module 'network'): void ns3::Buffer::CopyData(std::ostream * os, uint32_t size) const [member function] cls.add_method('CopyData', 'void', [param('std::ostream *', 'os'), param('uint32_t', 'size')], is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::CopyData(uint8_t * buffer, uint32_t size) const [member function] cls.add_method('CopyData', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint32_t', 'size')], is_const=True) ## buffer.h (module 'network'): ns3::Buffer ns3::Buffer::CreateFragment(uint32_t start, uint32_t length) const [member function] cls.add_method('CreateFragment', 'ns3::Buffer', [param('uint32_t', 'start'), param('uint32_t', 'length')], is_const=True) ## buffer.h (module 'network'): ns3::Buffer ns3::Buffer::CreateFullCopy() const [member function] cls.add_method('CreateFullCopy', 'ns3::Buffer', [], is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Deserialize(uint8_t const * buffer, uint32_t size) [member function] cls.add_method('Deserialize', 'uint32_t', [param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## buffer.h (module 'network'): ns3::Buffer::Iterator ns3::Buffer::End() const [member function] cls.add_method('End', 'ns3::Buffer::Iterator', [], is_const=True) ## buffer.h (module 'network'): int32_t ns3::Buffer::GetCurrentEndOffset() const [member function] cls.add_method('GetCurrentEndOffset', 'int32_t', [], is_const=True) ## buffer.h (module 'network'): int32_t ns3::Buffer::GetCurrentStartOffset() const [member function] cls.add_method('GetCurrentStartOffset', 'int32_t', [], is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::GetSize() const [member function] cls.add_method('GetSize', 'uint32_t', [], is_const=True) ## buffer.h (module 'network'): uint8_t const * ns3::Buffer::PeekData() const [member function] cls.add_method('PeekData', 'uint8_t const *', [], is_const=True) ## buffer.h (module 'network'): void ns3::Buffer::RemoveAtEnd(uint32_t end) [member function] cls.add_method('RemoveAtEnd', 'void', [param('uint32_t', 'end')]) ## buffer.h (module 'network'): void ns3::Buffer::RemoveAtStart(uint32_t start) [member function] cls.add_method('RemoveAtStart', 'void', [param('uint32_t', 'start')]) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function] cls.add_method('Serialize', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')], is_const=True) return def register_Ns3BufferIterator_methods(root_module, cls): ## buffer.h (module 'network'): ns3::Buffer::Iterator::Iterator(ns3::Buffer::Iterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::Buffer::Iterator const &', 'arg0')]) ## buffer.h (module 'network'): ns3::Buffer::Iterator::Iterator() [constructor] cls.add_constructor([]) ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::CalculateIpChecksum(uint16_t size) [member function] cls.add_method('CalculateIpChecksum', 'uint16_t', [param('uint16_t', 'size')]) ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::CalculateIpChecksum(uint16_t size, uint32_t initialChecksum) [member function] cls.add_method('CalculateIpChecksum', 'uint16_t', [param('uint16_t', 'size'), param('uint32_t', 'initialChecksum')]) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetDistanceFrom(ns3::Buffer::Iterator const & o) const [member function] cls.add_method('GetDistanceFrom', 'uint32_t', [param('ns3::Buffer::Iterator const &', 'o')], is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetSize() const [member function] cls.add_method('GetSize', 'uint32_t', [], is_const=True) ## buffer.h (module 'network'): bool ns3::Buffer::Iterator::IsEnd() const [member function] cls.add_method('IsEnd', 'bool', [], is_const=True) ## buffer.h (module 'network'): bool ns3::Buffer::Iterator::IsStart() const [member function] cls.add_method('IsStart', 'bool', [], is_const=True) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Next() [member function] cls.add_method('Next', 'void', []) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Next(uint32_t delta) [member function] cls.add_method('Next', 'void', [param('uint32_t', 'delta')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev() [member function] cls.add_method('Prev', 'void', []) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev(uint32_t delta) [member function] cls.add_method('Prev', 'void', [param('uint32_t', 'delta')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(uint8_t * buffer, uint32_t size) [member function] cls.add_method('Read', 'void', [param('uint8_t *', 'buffer'), param('uint32_t', 'size')]) ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadLsbtohU16() [member function] cls.add_method('ReadLsbtohU16', 'uint16_t', []) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadLsbtohU32() [member function] cls.add_method('ReadLsbtohU32', 'uint32_t', []) ## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadLsbtohU64() [member function] cls.add_method('ReadLsbtohU64', 'uint64_t', []) ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadNtohU16() [member function] cls.add_method('ReadNtohU16', 'uint16_t', []) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadNtohU32() [member function] cls.add_method('ReadNtohU32', 'uint32_t', []) ## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadNtohU64() [member function] cls.add_method('ReadNtohU64', 'uint64_t', []) ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadU16() [member function] cls.add_method('ReadU16', 'uint16_t', []) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadU32() [member function] cls.add_method('ReadU32', 'uint32_t', []) ## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadU64() [member function] cls.add_method('ReadU64', 'uint64_t', []) ## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::ReadU8() [member function] cls.add_method('ReadU8', 'uint8_t', []) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Write(uint8_t const * buffer, uint32_t size) [member function] cls.add_method('Write', 'void', [param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Write(ns3::Buffer::Iterator start, ns3::Buffer::Iterator end) [member function] cls.add_method('Write', 'void', [param('ns3::Buffer::Iterator', 'start'), param('ns3::Buffer::Iterator', 'end')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU16(uint16_t data) [member function] cls.add_method('WriteHtolsbU16', 'void', [param('uint16_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU32(uint32_t data) [member function] cls.add_method('WriteHtolsbU32', 'void', [param('uint32_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU64(uint64_t data) [member function] cls.add_method('WriteHtolsbU64', 'void', [param('uint64_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU16(uint16_t data) [member function] cls.add_method('WriteHtonU16', 'void', [param('uint16_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU32(uint32_t data) [member function] cls.add_method('WriteHtonU32', 'void', [param('uint32_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU64(uint64_t data) [member function] cls.add_method('WriteHtonU64', 'void', [param('uint64_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU16(uint16_t data) [member function] cls.add_method('WriteU16', 'void', [param('uint16_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU32(uint32_t data) [member function] cls.add_method('WriteU32', 'void', [param('uint32_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU64(uint64_t data) [member function] cls.add_method('WriteU64', 'void', [param('uint64_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU8(uint8_t data) [member function] cls.add_method('WriteU8', 'void', [param('uint8_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU8(uint8_t data, uint32_t len) [member function] cls.add_method('WriteU8', 'void', [param('uint8_t', 'data'), param('uint32_t', 'len')]) return def register_Ns3ByteTagIterator_methods(root_module, cls): ## packet.h (module 'network'): ns3::ByteTagIterator::ByteTagIterator(ns3::ByteTagIterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::ByteTagIterator const &', 'arg0')]) ## packet.h (module 'network'): bool ns3::ByteTagIterator::HasNext() const [member function] cls.add_method('HasNext', 'bool', [], is_const=True) ## packet.h (module 'network'): ns3::ByteTagIterator::Item ns3::ByteTagIterator::Next() [member function] cls.add_method('Next', 'ns3::ByteTagIterator::Item', []) return def register_Ns3ByteTagIteratorItem_methods(root_module, cls): ## packet.h (module 'network'): ns3::ByteTagIterator::Item::Item(ns3::ByteTagIterator::Item const & arg0) [copy constructor] cls.add_constructor([param('ns3::ByteTagIterator::Item const &', 'arg0')]) ## packet.h (module 'network'): uint32_t ns3::ByteTagIterator::Item::GetEnd() const [member function] cls.add_method('GetEnd', 'uint32_t', [], is_const=True) ## packet.h (module 'network'): uint32_t ns3::ByteTagIterator::Item::GetStart() const [member function] cls.add_method('GetStart', 'uint32_t', [], is_const=True) ## packet.h (module 'network'): void ns3::ByteTagIterator::Item::GetTag(ns3::Tag & tag) const [member function] cls.add_method('GetTag', 'void', [param('ns3::Tag &', 'tag')], is_const=True) ## packet.h (module 'network'): ns3::TypeId ns3::ByteTagIterator::Item::GetTypeId() const [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_const=True) return def register_Ns3ByteTagList_methods(root_module, cls): ## byte-tag-list.h (module 'network'): ns3::ByteTagList::ByteTagList() [constructor] cls.add_constructor([]) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::ByteTagList(ns3::ByteTagList const & o) [copy constructor] cls.add_constructor([param('ns3::ByteTagList const &', 'o')]) ## byte-tag-list.h (module 'network'): ns3::TagBuffer ns3::ByteTagList::Add(ns3::TypeId tid, uint32_t bufferSize, int32_t start, int32_t end) [member function] cls.add_method('Add', 'ns3::TagBuffer', [param('ns3::TypeId', 'tid'), param('uint32_t', 'bufferSize'), param('int32_t', 'start'), param('int32_t', 'end')]) ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::Add(ns3::ByteTagList const & o) [member function] cls.add_method('Add', 'void', [param('ns3::ByteTagList const &', 'o')]) ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::AddAtEnd(int32_t adjustment, int32_t appendOffset) [member function] cls.add_method('AddAtEnd', 'void', [param('int32_t', 'adjustment'), param('int32_t', 'appendOffset')]) ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::AddAtStart(int32_t adjustment, int32_t prependOffset) [member function] cls.add_method('AddAtStart', 'void', [param('int32_t', 'adjustment'), param('int32_t', 'prependOffset')]) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator ns3::ByteTagList::Begin(int32_t offsetStart, int32_t offsetEnd) const [member function] cls.add_method('Begin', 'ns3::ByteTagList::Iterator', [param('int32_t', 'offsetStart'), param('int32_t', 'offsetEnd')], is_const=True) ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::RemoveAll() [member function] cls.add_method('RemoveAll', 'void', []) return def register_Ns3ByteTagListIterator_methods(root_module, cls): ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Iterator(ns3::ByteTagList::Iterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::ByteTagList::Iterator const &', 'arg0')]) ## byte-tag-list.h (module 'network'): uint32_t ns3::ByteTagList::Iterator::GetOffsetStart() const [member function] cls.add_method('GetOffsetStart', 'uint32_t', [], is_const=True) ## byte-tag-list.h (module 'network'): bool ns3::ByteTagList::Iterator::HasNext() const [member function] cls.add_method('HasNext', 'bool', [], is_const=True) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item ns3::ByteTagList::Iterator::Next() [member function] cls.add_method('Next', 'ns3::ByteTagList::Iterator::Item', []) return def register_Ns3ByteTagListIteratorItem_methods(root_module, cls): ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::Item(ns3::ByteTagList::Iterator::Item const & arg0) [copy constructor] cls.add_constructor([param('ns3::ByteTagList::Iterator::Item const &', 'arg0')]) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::Item(ns3::TagBuffer buf) [constructor] cls.add_constructor([param('ns3::TagBuffer', 'buf')]) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::buf [variable] cls.add_instance_attribute('buf', 'ns3::TagBuffer', is_const=False) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::end [variable] cls.add_instance_attribute('end', 'int32_t', is_const=False) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::size [variable] cls.add_instance_attribute('size', 'uint32_t', is_const=False) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::start [variable] cls.add_instance_attribute('start', 'int32_t', is_const=False) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::tid [variable] cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False) return def register_Ns3CallbackBase_methods(root_module, cls): ## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::CallbackBase const & arg0) [copy constructor] cls.add_constructor([param('ns3::CallbackBase const &', 'arg0')]) ## callback.h (module 'core'): ns3::CallbackBase::CallbackBase() [constructor] cls.add_constructor([]) ## callback.h (module 'core'): ns3::Ptr<ns3::CallbackImplBase> ns3::CallbackBase::GetImpl() const [member function] cls.add_method('GetImpl', 'ns3::Ptr< ns3::CallbackImplBase >', [], is_const=True) ## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::Ptr<ns3::CallbackImplBase> impl) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::CallbackImplBase >', 'impl')], visibility='protected') ## callback.h (module 'core'): static std::string ns3::CallbackBase::Demangle(std::string const & mangled) [member function] cls.add_method('Demangle', 'std::string', [param('std::string const &', 'mangled')], is_static=True, visibility='protected') return def register_Ns3CriticalSection_methods(root_module, cls): ## system-mutex.h (module 'core'): ns3::CriticalSection::CriticalSection(ns3::CriticalSection const & arg0) [copy constructor] cls.add_constructor([param('ns3::CriticalSection const &', 'arg0')]) ## system-mutex.h (module 'core'): ns3::CriticalSection::CriticalSection(ns3::SystemMutex & mutex) [constructor] cls.add_constructor([param('ns3::SystemMutex &', 'mutex')]) return def register_Ns3DataRate_methods(root_module, cls): cls.add_output_stream_operator() cls.add_binary_comparison_operator('!=') cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('<=') cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('>') cls.add_binary_comparison_operator('>=') ## data-rate.h (module 'network'): ns3::DataRate::DataRate(ns3::DataRate const & arg0) [copy constructor] cls.add_constructor([param('ns3::DataRate const &', 'arg0')]) ## data-rate.h (module 'network'): ns3::DataRate::DataRate() [constructor] cls.add_constructor([]) ## data-rate.h (module 'network'): ns3::DataRate::DataRate(uint64_t bps) [constructor] cls.add_constructor([param('uint64_t', 'bps')]) ## data-rate.h (module 'network'): ns3::DataRate::DataRate(std::string rate) [constructor] cls.add_constructor([param('std::string', 'rate')]) ## data-rate.h (module 'network'): double ns3::DataRate::CalculateTxTime(uint32_t bytes) const [member function] cls.add_method('CalculateTxTime', 'double', [param('uint32_t', 'bytes')], is_const=True) ## data-rate.h (module 'network'): uint64_t ns3::DataRate::GetBitRate() const [member function] cls.add_method('GetBitRate', 'uint64_t', [], is_const=True) return def register_Ns3EventId_methods(root_module, cls): cls.add_binary_comparison_operator('!=') cls.add_binary_comparison_operator('==') ## event-id.h (module 'core'): ns3::EventId::EventId(ns3::EventId const & arg0) [copy constructor] cls.add_constructor([param('ns3::EventId const &', 'arg0')]) ## event-id.h (module 'core'): ns3::EventId::EventId() [constructor] cls.add_constructor([]) ## event-id.h (module 'core'): ns3::EventId::EventId(ns3::Ptr<ns3::EventImpl> const & impl, uint64_t ts, uint32_t context, uint32_t uid) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::EventImpl > const &', 'impl'), param('uint64_t', 'ts'), param('uint32_t', 'context'), param('uint32_t', 'uid')]) ## event-id.h (module 'core'): void ns3::EventId::Cancel() [member function] cls.add_method('Cancel', 'void', []) ## event-id.h (module 'core'): uint32_t ns3::EventId::GetContext() const [member function] cls.add_method('GetContext', 'uint32_t', [], is_const=True) ## event-id.h (module 'core'): uint64_t ns3::EventId::GetTs() const [member function] cls.add_method('GetTs', 'uint64_t', [], is_const=True) ## event-id.h (module 'core'): uint32_t ns3::EventId::GetUid() const [member function] cls.add_method('GetUid', 'uint32_t', [], is_const=True) ## event-id.h (module 'core'): bool ns3::EventId::IsExpired() const [member function] cls.add_method('IsExpired', 'bool', [], is_const=True) ## event-id.h (module 'core'): bool ns3::EventId::IsRunning() const [member function] cls.add_method('IsRunning', 'bool', [], is_const=True) ## event-id.h (module 'core'): ns3::EventImpl * ns3::EventId::PeekEventImpl() const [member function] cls.add_method('PeekEventImpl', 'ns3::EventImpl *', [], is_const=True) return def register_Ns3Ipv4Address_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(ns3::Ipv4Address const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4Address const &', 'arg0')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(uint32_t address) [constructor] cls.add_constructor([param('uint32_t', 'address')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(char const * address) [constructor] cls.add_constructor([param('char const *', 'address')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4Address::CombineMask(ns3::Ipv4Mask const & mask) const [member function] cls.add_method('CombineMask', 'ns3::Ipv4Address', [param('ns3::Ipv4Mask const &', 'mask')], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::ConvertFrom(ns3::Address const & address) [member function] cls.add_method('ConvertFrom', 'ns3::Ipv4Address', [param('ns3::Address const &', 'address')], is_static=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::Deserialize(uint8_t const * buf) [member function] cls.add_method('Deserialize', 'ns3::Ipv4Address', [param('uint8_t const *', 'buf')], is_static=True) ## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Address::Get() const [member function] cls.add_method('Get', 'uint32_t', [], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetAny() [member function] cls.add_method('GetAny', 'ns3::Ipv4Address', [], is_static=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetBroadcast() [member function] cls.add_method('GetBroadcast', 'ns3::Ipv4Address', [], is_static=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetLoopback() [member function] cls.add_method('GetLoopback', 'ns3::Ipv4Address', [], is_static=True) ## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4Address::GetSubnetDirectedBroadcast(ns3::Ipv4Mask const & mask) const [member function] cls.add_method('GetSubnetDirectedBroadcast', 'ns3::Ipv4Address', [param('ns3::Ipv4Mask const &', 'mask')], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetZero() [member function] cls.add_method('GetZero', 'ns3::Ipv4Address', [], is_static=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsBroadcast() const [member function] cls.add_method('IsBroadcast', 'bool', [], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsEqual(ns3::Ipv4Address const & other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ipv4Address const &', 'other')], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsLocalMulticast() const [member function] cls.add_method('IsLocalMulticast', 'bool', [], is_const=True) ## ipv4-address.h (module 'network'): static bool ns3::Ipv4Address::IsMatchingType(ns3::Address const & address) [member function] cls.add_method('IsMatchingType', 'bool', [param('ns3::Address const &', 'address')], is_static=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsMulticast() const [member function] cls.add_method('IsMulticast', 'bool', [], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsSubnetDirectedBroadcast(ns3::Ipv4Mask const & mask) const [member function] cls.add_method('IsSubnetDirectedBroadcast', 'bool', [param('ns3::Ipv4Mask const &', 'mask')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Serialize(uint8_t * buf) const [member function] cls.add_method('Serialize', 'void', [param('uint8_t *', 'buf')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Set(uint32_t address) [member function] cls.add_method('Set', 'void', [param('uint32_t', 'address')]) ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Set(char const * address) [member function] cls.add_method('Set', 'void', [param('char const *', 'address')]) return def register_Ns3Ipv4Mask_methods(root_module, cls): cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(ns3::Ipv4Mask const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4Mask const &', 'arg0')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(uint32_t mask) [constructor] cls.add_constructor([param('uint32_t', 'mask')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(char const * mask) [constructor] cls.add_constructor([param('char const *', 'mask')]) ## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Mask::Get() const [member function] cls.add_method('Get', 'uint32_t', [], is_const=True) ## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Mask::GetInverse() const [member function] cls.add_method('GetInverse', 'uint32_t', [], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetLoopback() [member function] cls.add_method('GetLoopback', 'ns3::Ipv4Mask', [], is_static=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetOnes() [member function] cls.add_method('GetOnes', 'ns3::Ipv4Mask', [], is_static=True) ## ipv4-address.h (module 'network'): uint16_t ns3::Ipv4Mask::GetPrefixLength() const [member function] cls.add_method('GetPrefixLength', 'uint16_t', [], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetZero() [member function] cls.add_method('GetZero', 'ns3::Ipv4Mask', [], is_static=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Mask::IsEqual(ns3::Ipv4Mask other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ipv4Mask', 'other')], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Mask::IsMatch(ns3::Ipv4Address a, ns3::Ipv4Address b) const [member function] cls.add_method('IsMatch', 'bool', [param('ns3::Ipv4Address', 'a'), param('ns3::Ipv4Address', 'b')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Mask::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Mask::Set(uint32_t mask) [member function] cls.add_method('Set', 'void', [param('uint32_t', 'mask')]) return def register_Ns3Ipv6Address_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(char const * address) [constructor] cls.add_constructor([param('char const *', 'address')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(uint8_t * address) [constructor] cls.add_constructor([param('uint8_t *', 'address')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(ns3::Ipv6Address const & addr) [copy constructor] cls.add_constructor([param('ns3::Ipv6Address const &', 'addr')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(ns3::Ipv6Address const * addr) [constructor] cls.add_constructor([param('ns3::Ipv6Address const *', 'addr')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address ns3::Ipv6Address::CombinePrefix(ns3::Ipv6Prefix const & prefix) [member function] cls.add_method('CombinePrefix', 'ns3::Ipv6Address', [param('ns3::Ipv6Prefix const &', 'prefix')]) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::ConvertFrom(ns3::Address const & address) [member function] cls.add_method('ConvertFrom', 'ns3::Ipv6Address', [param('ns3::Address const &', 'address')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::Deserialize(uint8_t const * buf) [member function] cls.add_method('Deserialize', 'ns3::Ipv6Address', [param('uint8_t const *', 'buf')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllHostsMulticast() [member function] cls.add_method('GetAllHostsMulticast', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllNodesMulticast() [member function] cls.add_method('GetAllNodesMulticast', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllRoutersMulticast() [member function] cls.add_method('GetAllRoutersMulticast', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAny() [member function] cls.add_method('GetAny', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::GetBytes(uint8_t * buf) const [member function] cls.add_method('GetBytes', 'void', [param('uint8_t *', 'buf')], is_const=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetLoopback() [member function] cls.add_method('GetLoopback', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetOnes() [member function] cls.add_method('GetOnes', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetZero() [member function] cls.add_method('GetZero', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllHostsMulticast() const [member function] cls.add_method('IsAllHostsMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllNodesMulticast() const [member function] cls.add_method('IsAllNodesMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllRoutersMulticast() const [member function] cls.add_method('IsAllRoutersMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAny() const [member function] cls.add_method('IsAny', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsEqual(ns3::Ipv6Address const & other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ipv6Address const &', 'other')], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLinkLocal() const [member function] cls.add_method('IsLinkLocal', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLocalhost() const [member function] cls.add_method('IsLocalhost', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): static bool ns3::Ipv6Address::IsMatchingType(ns3::Address const & address) [member function] cls.add_method('IsMatchingType', 'bool', [param('ns3::Address const &', 'address')], is_static=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsMulticast() const [member function] cls.add_method('IsMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsSolicitedMulticast() const [member function] cls.add_method('IsSolicitedMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress(ns3::Mac48Address addr, ns3::Ipv6Address prefix) [member function] cls.add_method('MakeAutoconfiguredAddress', 'ns3::Ipv6Address', [param('ns3::Mac48Address', 'addr'), param('ns3::Ipv6Address', 'prefix')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(ns3::Mac48Address mac) [member function] cls.add_method('MakeAutoconfiguredLinkLocalAddress', 'ns3::Ipv6Address', [param('ns3::Mac48Address', 'mac')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeSolicitedAddress(ns3::Ipv6Address addr) [member function] cls.add_method('MakeSolicitedAddress', 'ns3::Ipv6Address', [param('ns3::Ipv6Address', 'addr')], is_static=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Serialize(uint8_t * buf) const [member function] cls.add_method('Serialize', 'void', [param('uint8_t *', 'buf')], is_const=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Set(char const * address) [member function] cls.add_method('Set', 'void', [param('char const *', 'address')]) ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Set(uint8_t * address) [member function] cls.add_method('Set', 'void', [param('uint8_t *', 'address')]) return def register_Ns3Ipv6Prefix_methods(root_module, cls): cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(uint8_t * prefix) [constructor] cls.add_constructor([param('uint8_t *', 'prefix')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(char const * prefix) [constructor] cls.add_constructor([param('char const *', 'prefix')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(uint8_t prefix) [constructor] cls.add_constructor([param('uint8_t', 'prefix')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(ns3::Ipv6Prefix const & prefix) [copy constructor] cls.add_constructor([param('ns3::Ipv6Prefix const &', 'prefix')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(ns3::Ipv6Prefix const * prefix) [constructor] cls.add_constructor([param('ns3::Ipv6Prefix const *', 'prefix')]) ## ipv6-address.h (module 'network'): void ns3::Ipv6Prefix::GetBytes(uint8_t * buf) const [member function] cls.add_method('GetBytes', 'void', [param('uint8_t *', 'buf')], is_const=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetLoopback() [member function] cls.add_method('GetLoopback', 'ns3::Ipv6Prefix', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetOnes() [member function] cls.add_method('GetOnes', 'ns3::Ipv6Prefix', [], is_static=True) ## ipv6-address.h (module 'network'): uint8_t ns3::Ipv6Prefix::GetPrefixLength() const [member function] cls.add_method('GetPrefixLength', 'uint8_t', [], is_const=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetZero() [member function] cls.add_method('GetZero', 'ns3::Ipv6Prefix', [], is_static=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Prefix::IsEqual(ns3::Ipv6Prefix const & other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ipv6Prefix const &', 'other')], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Prefix::IsMatch(ns3::Ipv6Address a, ns3::Ipv6Address b) const [member function] cls.add_method('IsMatch', 'bool', [param('ns3::Ipv6Address', 'a'), param('ns3::Ipv6Address', 'b')], is_const=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Prefix::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) return def register_Ns3LogComponent_methods(root_module, cls): ## log.h (module 'core'): ns3::LogComponent::LogComponent(ns3::LogComponent const & arg0) [copy constructor] cls.add_constructor([param('ns3::LogComponent const &', 'arg0')]) ## log.h (module 'core'): ns3::LogComponent::LogComponent(char const * name) [constructor] cls.add_constructor([param('char const *', 'name')]) ## log.h (module 'core'): void ns3::LogComponent::Disable(ns3::LogLevel level) [member function] cls.add_method('Disable', 'void', [param('ns3::LogLevel', 'level')]) ## log.h (module 'core'): void ns3::LogComponent::Enable(ns3::LogLevel level) [member function] cls.add_method('Enable', 'void', [param('ns3::LogLevel', 'level')]) ## log.h (module 'core'): void ns3::LogComponent::EnvVarCheck(char const * name) [member function] cls.add_method('EnvVarCheck', 'void', [param('char const *', 'name')]) ## log.h (module 'core'): bool ns3::LogComponent::IsEnabled(ns3::LogLevel level) const [member function] cls.add_method('IsEnabled', 'bool', [param('ns3::LogLevel', 'level')], is_const=True) ## log.h (module 'core'): bool ns3::LogComponent::IsNoneEnabled() const [member function] cls.add_method('IsNoneEnabled', 'bool', [], is_const=True) ## log.h (module 'core'): char const * ns3::LogComponent::Name() const [member function] cls.add_method('Name', 'char const *', [], is_const=True) return def register_Ns3Mac48Address_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address(ns3::Mac48Address const & arg0) [copy constructor] cls.add_constructor([param('ns3::Mac48Address const &', 'arg0')]) ## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address() [constructor] cls.add_constructor([]) ## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address(char const * str) [constructor] cls.add_constructor([param('char const *', 'str')]) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::Allocate() [member function] cls.add_method('Allocate', 'ns3::Mac48Address', [], is_static=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::ConvertFrom(ns3::Address const & address) [member function] cls.add_method('ConvertFrom', 'ns3::Mac48Address', [param('ns3::Address const &', 'address')], is_static=True) ## mac48-address.h (module 'network'): void ns3::Mac48Address::CopyFrom(uint8_t const * buffer) [member function] cls.add_method('CopyFrom', 'void', [param('uint8_t const *', 'buffer')]) ## mac48-address.h (module 'network'): void ns3::Mac48Address::CopyTo(uint8_t * buffer) const [member function] cls.add_method('CopyTo', 'void', [param('uint8_t *', 'buffer')], is_const=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetBroadcast() [member function] cls.add_method('GetBroadcast', 'ns3::Mac48Address', [], is_static=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticast(ns3::Ipv4Address address) [member function] cls.add_method('GetMulticast', 'ns3::Mac48Address', [param('ns3::Ipv4Address', 'address')], is_static=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticast(ns3::Ipv6Address address) [member function] cls.add_method('GetMulticast', 'ns3::Mac48Address', [param('ns3::Ipv6Address', 'address')], is_static=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticast6Prefix() [member function] cls.add_method('GetMulticast6Prefix', 'ns3::Mac48Address', [], is_static=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticastPrefix() [member function] cls.add_method('GetMulticastPrefix', 'ns3::Mac48Address', [], is_static=True) ## mac48-address.h (module 'network'): bool ns3::Mac48Address::IsBroadcast() const [member function] cls.add_method('IsBroadcast', 'bool', [], is_const=True) ## mac48-address.h (module 'network'): bool ns3::Mac48Address::IsGroup() const [member function] cls.add_method('IsGroup', 'bool', [], is_const=True) ## mac48-address.h (module 'network'): static bool ns3::Mac48Address::IsMatchingType(ns3::Address const & address) [member function] cls.add_method('IsMatchingType', 'bool', [param('ns3::Address const &', 'address')], is_static=True) return def register_Ns3NetDeviceContainer_methods(root_module, cls): ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(ns3::NetDeviceContainer const & arg0) [copy constructor] cls.add_constructor([param('ns3::NetDeviceContainer const &', 'arg0')]) ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer() [constructor] cls.add_constructor([]) ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(ns3::Ptr<ns3::NetDevice> dev) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::NetDevice >', 'dev')]) ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(std::string devName) [constructor] cls.add_constructor([param('std::string', 'devName')]) ## net-device-container.h (module 'network'): 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 (module 'network'): void ns3::NetDeviceContainer::Add(ns3::NetDeviceContainer other) [member function] cls.add_method('Add', 'void', [param('ns3::NetDeviceContainer', 'other')]) ## net-device-container.h (module 'network'): void ns3::NetDeviceContainer::Add(ns3::Ptr<ns3::NetDevice> device) [member function] cls.add_method('Add', 'void', [param('ns3::Ptr< ns3::NetDevice >', 'device')]) ## net-device-container.h (module 'network'): void ns3::NetDeviceContainer::Add(std::string deviceName) [member function] cls.add_method('Add', 'void', [param('std::string', 'deviceName')]) ## net-device-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::NetDevice>*,std::vector<ns3::Ptr<ns3::NetDevice>, std::allocator<ns3::Ptr<ns3::NetDevice> > > > ns3::NetDeviceContainer::Begin() const [member function] cls.add_method('Begin', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::NetDevice > const, std::vector< ns3::Ptr< ns3::NetDevice > > >', [], is_const=True) ## net-device-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::NetDevice>*,std::vector<ns3::Ptr<ns3::NetDevice>, std::allocator<ns3::Ptr<ns3::NetDevice> > > > ns3::NetDeviceContainer::End() const [member function] cls.add_method('End', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::NetDevice > const, std::vector< ns3::Ptr< ns3::NetDevice > > >', [], is_const=True) ## net-device-container.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::NetDeviceContainer::Get(uint32_t i) const [member function] cls.add_method('Get', 'ns3::Ptr< ns3::NetDevice >', [param('uint32_t', 'i')], is_const=True) ## net-device-container.h (module 'network'): uint32_t ns3::NetDeviceContainer::GetN() const [member function] cls.add_method('GetN', 'uint32_t', [], is_const=True) return def register_Ns3ObjectBase_methods(root_module, cls): ## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase() [constructor] cls.add_constructor([]) ## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase(ns3::ObjectBase const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectBase const &', 'arg0')]) ## object-base.h (module 'core'): void ns3::ObjectBase::GetAttribute(std::string name, ns3::AttributeValue & value) const [member function] cls.add_method('GetAttribute', 'void', [param('std::string', 'name'), param('ns3::AttributeValue &', 'value')], is_const=True) ## object-base.h (module 'core'): bool ns3::ObjectBase::GetAttributeFailSafe(std::string name, ns3::AttributeValue & attribute) const [member function] cls.add_method('GetAttributeFailSafe', 'bool', [param('std::string', 'name'), param('ns3::AttributeValue &', 'attribute')], is_const=True) ## object-base.h (module 'core'): ns3::TypeId ns3::ObjectBase::GetInstanceTypeId() const [member function] cls.add_method('GetInstanceTypeId', 'ns3::TypeId', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## object-base.h (module 'core'): static ns3::TypeId ns3::ObjectBase::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## object-base.h (module 'core'): void ns3::ObjectBase::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function] cls.add_method('SetAttribute', 'void', [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::SetAttributeFailSafe(std::string name, ns3::AttributeValue const & value) [member function] cls.add_method('SetAttributeFailSafe', 'bool', [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function] cls.add_method('TraceConnect', 'bool', [param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function] cls.add_method('TraceConnectWithoutContext', 'bool', [param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function] cls.add_method('TraceDisconnect', 'bool', [param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function] cls.add_method('TraceDisconnectWithoutContext', 'bool', [param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')]) ## object-base.h (module 'core'): void ns3::ObjectBase::ConstructSelf(ns3::AttributeConstructionList const & attributes) [member function] cls.add_method('ConstructSelf', 'void', [param('ns3::AttributeConstructionList const &', 'attributes')], visibility='protected') ## object-base.h (module 'core'): void ns3::ObjectBase::NotifyConstructionCompleted() [member function] cls.add_method('NotifyConstructionCompleted', 'void', [], visibility='protected', is_virtual=True) return def register_Ns3ObjectDeleter_methods(root_module, cls): ## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter() [constructor] cls.add_constructor([]) ## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter(ns3::ObjectDeleter const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectDeleter const &', 'arg0')]) ## object.h (module 'core'): static void ns3::ObjectDeleter::Delete(ns3::Object * object) [member function] cls.add_method('Delete', 'void', [param('ns3::Object *', 'object')], is_static=True) return def register_Ns3ObjectFactory_methods(root_module, cls): cls.add_output_stream_operator() ## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory(ns3::ObjectFactory const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectFactory const &', 'arg0')]) ## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory() [constructor] cls.add_constructor([]) ## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory(std::string typeId) [constructor] cls.add_constructor([param('std::string', 'typeId')]) ## object-factory.h (module 'core'): ns3::Ptr<ns3::Object> ns3::ObjectFactory::Create() const [member function] cls.add_method('Create', 'ns3::Ptr< ns3::Object >', [], is_const=True) ## object-factory.h (module 'core'): ns3::TypeId ns3::ObjectFactory::GetTypeId() const [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_const=True) ## object-factory.h (module 'core'): void ns3::ObjectFactory::Set(std::string name, ns3::AttributeValue const & value) [member function] cls.add_method('Set', 'void', [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')]) ## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(ns3::TypeId tid) [member function] cls.add_method('SetTypeId', 'void', [param('ns3::TypeId', 'tid')]) ## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(char const * tid) [member function] cls.add_method('SetTypeId', 'void', [param('char const *', 'tid')]) ## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(std::string tid) [member function] cls.add_method('SetTypeId', 'void', [param('std::string', 'tid')]) return def register_Ns3PacketMetadata_methods(root_module, cls): ## packet-metadata.h (module 'network'): ns3::PacketMetadata::PacketMetadata(uint64_t uid, uint32_t size) [constructor] cls.add_constructor([param('uint64_t', 'uid'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::PacketMetadata(ns3::PacketMetadata const & o) [copy constructor] cls.add_constructor([param('ns3::PacketMetadata const &', 'o')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddAtEnd(ns3::PacketMetadata const & o) [member function] cls.add_method('AddAtEnd', 'void', [param('ns3::PacketMetadata const &', 'o')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddHeader(ns3::Header const & header, uint32_t size) [member function] cls.add_method('AddHeader', 'void', [param('ns3::Header const &', 'header'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddPaddingAtEnd(uint32_t end) [member function] cls.add_method('AddPaddingAtEnd', 'void', [param('uint32_t', 'end')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddTrailer(ns3::Trailer const & trailer, uint32_t size) [member function] cls.add_method('AddTrailer', 'void', [param('ns3::Trailer const &', 'trailer'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator ns3::PacketMetadata::BeginItem(ns3::Buffer buffer) const [member function] cls.add_method('BeginItem', 'ns3::PacketMetadata::ItemIterator', [param('ns3::Buffer', 'buffer')], is_const=True) ## packet-metadata.h (module 'network'): ns3::PacketMetadata ns3::PacketMetadata::CreateFragment(uint32_t start, uint32_t end) const [member function] cls.add_method('CreateFragment', 'ns3::PacketMetadata', [param('uint32_t', 'start'), param('uint32_t', 'end')], is_const=True) ## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::Deserialize(uint8_t const * buffer, uint32_t size) [member function] cls.add_method('Deserialize', 'uint32_t', [param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): static void ns3::PacketMetadata::Enable() [member function] cls.add_method('Enable', 'void', [], is_static=True) ## packet-metadata.h (module 'network'): static void ns3::PacketMetadata::EnableChecking() [member function] cls.add_method('EnableChecking', 'void', [], is_static=True) ## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## packet-metadata.h (module 'network'): uint64_t ns3::PacketMetadata::GetUid() const [member function] cls.add_method('GetUid', 'uint64_t', [], is_const=True) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveAtEnd(uint32_t end) [member function] cls.add_method('RemoveAtEnd', 'void', [param('uint32_t', 'end')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveAtStart(uint32_t start) [member function] cls.add_method('RemoveAtStart', 'void', [param('uint32_t', 'start')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveHeader(ns3::Header const & header, uint32_t size) [member function] cls.add_method('RemoveHeader', 'void', [param('ns3::Header const &', 'header'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveTrailer(ns3::Trailer const & trailer, uint32_t size) [member function] cls.add_method('RemoveTrailer', 'void', [param('ns3::Trailer const &', 'trailer'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function] cls.add_method('Serialize', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')], is_const=True) return def register_Ns3PacketMetadataItem_methods(root_module, cls): ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::Item() [constructor] cls.add_constructor([]) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::Item(ns3::PacketMetadata::Item const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketMetadata::Item const &', 'arg0')]) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::current [variable] cls.add_instance_attribute('current', 'ns3::Buffer::Iterator', is_const=False) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentSize [variable] cls.add_instance_attribute('currentSize', 'uint32_t', is_const=False) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentTrimedFromEnd [variable] cls.add_instance_attribute('currentTrimedFromEnd', 'uint32_t', is_const=False) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentTrimedFromStart [variable] cls.add_instance_attribute('currentTrimedFromStart', 'uint32_t', is_const=False) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::isFragment [variable] cls.add_instance_attribute('isFragment', 'bool', is_const=False) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::tid [variable] cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False) return def register_Ns3PacketMetadataItemIterator_methods(root_module, cls): ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator::ItemIterator(ns3::PacketMetadata::ItemIterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketMetadata::ItemIterator const &', 'arg0')]) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator::ItemIterator(ns3::PacketMetadata const * metadata, ns3::Buffer buffer) [constructor] cls.add_constructor([param('ns3::PacketMetadata const *', 'metadata'), param('ns3::Buffer', 'buffer')]) ## packet-metadata.h (module 'network'): bool ns3::PacketMetadata::ItemIterator::HasNext() const [member function] cls.add_method('HasNext', 'bool', [], is_const=True) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item ns3::PacketMetadata::ItemIterator::Next() [member function] cls.add_method('Next', 'ns3::PacketMetadata::Item', []) return def register_Ns3PacketTagIterator_methods(root_module, cls): ## packet.h (module 'network'): ns3::PacketTagIterator::PacketTagIterator(ns3::PacketTagIterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketTagIterator const &', 'arg0')]) ## packet.h (module 'network'): bool ns3::PacketTagIterator::HasNext() const [member function] cls.add_method('HasNext', 'bool', [], is_const=True) ## packet.h (module 'network'): ns3::PacketTagIterator::Item ns3::PacketTagIterator::Next() [member function] cls.add_method('Next', 'ns3::PacketTagIterator::Item', []) return def register_Ns3PacketTagIteratorItem_methods(root_module, cls): ## packet.h (module 'network'): ns3::PacketTagIterator::Item::Item(ns3::PacketTagIterator::Item const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketTagIterator::Item const &', 'arg0')]) ## packet.h (module 'network'): void ns3::PacketTagIterator::Item::GetTag(ns3::Tag & tag) const [member function] cls.add_method('GetTag', 'void', [param('ns3::Tag &', 'tag')], is_const=True) ## packet.h (module 'network'): ns3::TypeId ns3::PacketTagIterator::Item::GetTypeId() const [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_const=True) return def register_Ns3PacketTagList_methods(root_module, cls): ## packet-tag-list.h (module 'network'): ns3::PacketTagList::PacketTagList() [constructor] cls.add_constructor([]) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::PacketTagList(ns3::PacketTagList const & o) [copy constructor] cls.add_constructor([param('ns3::PacketTagList const &', 'o')]) ## packet-tag-list.h (module 'network'): void ns3::PacketTagList::Add(ns3::Tag const & tag) const [member function] cls.add_method('Add', 'void', [param('ns3::Tag const &', 'tag')], is_const=True) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData const * ns3::PacketTagList::Head() const [member function] cls.add_method('Head', 'ns3::PacketTagList::TagData const *', [], is_const=True) ## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Peek(ns3::Tag & tag) const [member function] cls.add_method('Peek', 'bool', [param('ns3::Tag &', 'tag')], is_const=True) ## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Remove(ns3::Tag & tag) [member function] cls.add_method('Remove', 'bool', [param('ns3::Tag &', 'tag')]) ## packet-tag-list.h (module 'network'): void ns3::PacketTagList::RemoveAll() [member function] cls.add_method('RemoveAll', 'void', []) return def register_Ns3PacketTagListTagData_methods(root_module, cls): ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData() [constructor] cls.add_constructor([]) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData(ns3::PacketTagList::TagData const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketTagList::TagData const &', 'arg0')]) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::count [variable] cls.add_instance_attribute('count', 'uint32_t', is_const=False) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::data [variable] cls.add_instance_attribute('data', 'uint8_t [ 20 ]', is_const=False) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::next [variable] cls.add_instance_attribute('next', 'ns3::PacketTagList::TagData *', is_const=False) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::tid [variable] cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False) return def register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount(ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SystemMutex_methods(root_module, cls): ## system-mutex.h (module 'core'): ns3::SystemMutex::SystemMutex(ns3::SystemMutex const & arg0) [copy constructor] cls.add_constructor([param('ns3::SystemMutex const &', 'arg0')]) ## system-mutex.h (module 'core'): ns3::SystemMutex::SystemMutex() [constructor] cls.add_constructor([]) ## system-mutex.h (module 'core'): void ns3::SystemMutex::Lock() [member function] cls.add_method('Lock', 'void', []) ## system-mutex.h (module 'core'): void ns3::SystemMutex::Unlock() [member function] cls.add_method('Unlock', 'void', []) return def register_Ns3Tag_methods(root_module, cls): ## tag.h (module 'network'): ns3::Tag::Tag() [constructor] cls.add_constructor([]) ## tag.h (module 'network'): ns3::Tag::Tag(ns3::Tag const & arg0) [copy constructor] cls.add_constructor([param('ns3::Tag const &', 'arg0')]) ## tag.h (module 'network'): void ns3::Tag::Deserialize(ns3::TagBuffer i) [member function] cls.add_method('Deserialize', 'void', [param('ns3::TagBuffer', 'i')], is_pure_virtual=True, is_virtual=True) ## tag.h (module 'network'): uint32_t ns3::Tag::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## tag.h (module 'network'): static ns3::TypeId ns3::Tag::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## tag.h (module 'network'): void ns3::Tag::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_pure_virtual=True, is_const=True, is_virtual=True) ## tag.h (module 'network'): void ns3::Tag::Serialize(ns3::TagBuffer i) const [member function] cls.add_method('Serialize', 'void', [param('ns3::TagBuffer', 'i')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3TagBuffer_methods(root_module, cls): ## tag-buffer.h (module 'network'): ns3::TagBuffer::TagBuffer(ns3::TagBuffer const & arg0) [copy constructor] cls.add_constructor([param('ns3::TagBuffer const &', 'arg0')]) ## tag-buffer.h (module 'network'): ns3::TagBuffer::TagBuffer(uint8_t * start, uint8_t * end) [constructor] cls.add_constructor([param('uint8_t *', 'start'), param('uint8_t *', 'end')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::CopyFrom(ns3::TagBuffer o) [member function] cls.add_method('CopyFrom', 'void', [param('ns3::TagBuffer', 'o')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::Read(uint8_t * buffer, uint32_t size) [member function] cls.add_method('Read', 'void', [param('uint8_t *', 'buffer'), param('uint32_t', 'size')]) ## tag-buffer.h (module 'network'): double ns3::TagBuffer::ReadDouble() [member function] cls.add_method('ReadDouble', 'double', []) ## tag-buffer.h (module 'network'): uint16_t ns3::TagBuffer::ReadU16() [member function] cls.add_method('ReadU16', 'uint16_t', []) ## tag-buffer.h (module 'network'): uint32_t ns3::TagBuffer::ReadU32() [member function] cls.add_method('ReadU32', 'uint32_t', []) ## tag-buffer.h (module 'network'): uint64_t ns3::TagBuffer::ReadU64() [member function] cls.add_method('ReadU64', 'uint64_t', []) ## tag-buffer.h (module 'network'): uint8_t ns3::TagBuffer::ReadU8() [member function] cls.add_method('ReadU8', 'uint8_t', []) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::TrimAtEnd(uint32_t trim) [member function] cls.add_method('TrimAtEnd', 'void', [param('uint32_t', 'trim')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::Write(uint8_t const * buffer, uint32_t size) [member function] cls.add_method('Write', 'void', [param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteDouble(double v) [member function] cls.add_method('WriteDouble', 'void', [param('double', 'v')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU16(uint16_t data) [member function] cls.add_method('WriteU16', 'void', [param('uint16_t', 'data')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU32(uint32_t data) [member function] cls.add_method('WriteU32', 'void', [param('uint32_t', 'data')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU64(uint64_t v) [member function] cls.add_method('WriteU64', 'void', [param('uint64_t', 'v')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU8(uint8_t v) [member function] cls.add_method('WriteU8', 'void', [param('uint8_t', 'v')]) return def register_Ns3TapBridgeHelper_methods(root_module, cls): ## tap-bridge-helper.h (module 'tap-bridge'): ns3::TapBridgeHelper::TapBridgeHelper(ns3::TapBridgeHelper const & arg0) [copy constructor] cls.add_constructor([param('ns3::TapBridgeHelper const &', 'arg0')]) ## tap-bridge-helper.h (module 'tap-bridge'): ns3::TapBridgeHelper::TapBridgeHelper() [constructor] cls.add_constructor([]) ## tap-bridge-helper.h (module 'tap-bridge'): ns3::TapBridgeHelper::TapBridgeHelper(ns3::Ipv4Address gateway) [constructor] cls.add_constructor([param('ns3::Ipv4Address', 'gateway')]) ## tap-bridge-helper.h (module 'tap-bridge'): ns3::Ptr<ns3::NetDevice> ns3::TapBridgeHelper::Install(ns3::Ptr<ns3::Node> node, ns3::Ptr<ns3::NetDevice> 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 (module 'tap-bridge'): ns3::Ptr<ns3::NetDevice> ns3::TapBridgeHelper::Install(std::string nodeName, ns3::Ptr<ns3::NetDevice> 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 (module 'tap-bridge'): ns3::Ptr<ns3::NetDevice> ns3::TapBridgeHelper::Install(ns3::Ptr<ns3::Node> 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 (module 'tap-bridge'): ns3::Ptr<ns3::NetDevice> 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')]) ## tap-bridge-helper.h (module 'tap-bridge'): ns3::Ptr<ns3::NetDevice> ns3::TapBridgeHelper::Install(ns3::Ptr<ns3::Node> node, ns3::Ptr<ns3::NetDevice> nd, ns3::AttributeValue const & bridgeType) [member function] cls.add_method('Install', 'ns3::Ptr< ns3::NetDevice >', [param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('ns3::AttributeValue const &', 'bridgeType')]) ## tap-bridge-helper.h (module 'tap-bridge'): 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')]) return def register_Ns3TypeId_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## type-id.h (module 'core'): ns3::TypeId::TypeId(char const * name) [constructor] cls.add_constructor([param('char const *', 'name')]) ## type-id.h (module 'core'): ns3::TypeId::TypeId() [constructor] cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeId::TypeId(ns3::TypeId const & o) [copy constructor] cls.add_constructor([param('ns3::TypeId const &', 'o')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, ns3::AttributeValue const & initialValue, ns3::Ptr<ns3::AttributeAccessor const> accessor, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('AddAttribute', 'ns3::TypeId', [param('std::string', 'name'), param('std::string', 'help'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, uint32_t flags, ns3::AttributeValue const & initialValue, ns3::Ptr<ns3::AttributeAccessor const> accessor, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('AddAttribute', 'ns3::TypeId', [param('std::string', 'name'), param('std::string', 'help'), param('uint32_t', 'flags'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr<ns3::TraceSourceAccessor const> accessor) [member function] cls.add_method('AddTraceSource', 'ns3::TypeId', [param('std::string', 'name'), param('std::string', 'help'), param('ns3::Ptr< ns3::TraceSourceAccessor const >', 'accessor')]) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation ns3::TypeId::GetAttribute(uint32_t i) const [member function] cls.add_method('GetAttribute', 'ns3::TypeId::AttributeInformation', [param('uint32_t', 'i')], is_const=True) ## type-id.h (module 'core'): std::string ns3::TypeId::GetAttributeFullName(uint32_t i) const [member function] cls.add_method('GetAttributeFullName', 'std::string', [param('uint32_t', 'i')], is_const=True) ## type-id.h (module 'core'): uint32_t ns3::TypeId::GetAttributeN() const [member function] cls.add_method('GetAttributeN', 'uint32_t', [], is_const=True) ## type-id.h (module 'core'): ns3::Callback<ns3::ObjectBase*,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ns3::TypeId::GetConstructor() const [member function] cls.add_method('GetConstructor', 'ns3::Callback< ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', [], is_const=True) ## type-id.h (module 'core'): std::string ns3::TypeId::GetGroupName() const [member function] cls.add_method('GetGroupName', 'std::string', [], is_const=True) ## type-id.h (module 'core'): std::string ns3::TypeId::GetName() const [member function] cls.add_method('GetName', 'std::string', [], is_const=True) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::GetParent() const [member function] cls.add_method('GetParent', 'ns3::TypeId', [], is_const=True) ## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::GetRegistered(uint32_t i) [member function] cls.add_method('GetRegistered', 'ns3::TypeId', [param('uint32_t', 'i')], is_static=True) ## type-id.h (module 'core'): static uint32_t ns3::TypeId::GetRegisteredN() [member function] cls.add_method('GetRegisteredN', 'uint32_t', [], is_static=True) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation ns3::TypeId::GetTraceSource(uint32_t i) const [member function] cls.add_method('GetTraceSource', 'ns3::TypeId::TraceSourceInformation', [param('uint32_t', 'i')], is_const=True) ## type-id.h (module 'core'): uint32_t ns3::TypeId::GetTraceSourceN() const [member function] cls.add_method('GetTraceSourceN', 'uint32_t', [], is_const=True) ## type-id.h (module 'core'): uint16_t ns3::TypeId::GetUid() const [member function] cls.add_method('GetUid', 'uint16_t', [], is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::HasConstructor() const [member function] cls.add_method('HasConstructor', 'bool', [], is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::HasParent() const [member function] cls.add_method('HasParent', 'bool', [], is_const=True) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::HideFromDocumentation() [member function] cls.add_method('HideFromDocumentation', 'ns3::TypeId', []) ## type-id.h (module 'core'): bool ns3::TypeId::IsChildOf(ns3::TypeId other) const [member function] cls.add_method('IsChildOf', 'bool', [param('ns3::TypeId', 'other')], is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::LookupAttributeByName(std::string name, ns3::TypeId::AttributeInformation * info) const [member function] cls.add_method('LookupAttributeByName', 'bool', [param('std::string', 'name'), param('ns3::TypeId::AttributeInformation *', 'info')], is_const=True) ## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::LookupByName(std::string name) [member function] cls.add_method('LookupByName', 'ns3::TypeId', [param('std::string', 'name')], is_static=True) ## type-id.h (module 'core'): ns3::Ptr<ns3::TraceSourceAccessor const> ns3::TypeId::LookupTraceSourceByName(std::string name) const [member function] cls.add_method('LookupTraceSourceByName', 'ns3::Ptr< ns3::TraceSourceAccessor const >', [param('std::string', 'name')], is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::MustHideFromDocumentation() const [member function] cls.add_method('MustHideFromDocumentation', 'bool', [], is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::SetAttributeInitialValue(uint32_t i, ns3::Ptr<ns3::AttributeValue const> initialValue) [member function] cls.add_method('SetAttributeInitialValue', 'bool', [param('uint32_t', 'i'), param('ns3::Ptr< ns3::AttributeValue const >', 'initialValue')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetGroupName(std::string groupName) [member function] cls.add_method('SetGroupName', 'ns3::TypeId', [param('std::string', 'groupName')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetParent(ns3::TypeId tid) [member function] cls.add_method('SetParent', 'ns3::TypeId', [param('ns3::TypeId', 'tid')]) ## type-id.h (module 'core'): void ns3::TypeId::SetUid(uint16_t tid) [member function] cls.add_method('SetUid', 'void', [param('uint16_t', 'tid')]) return def register_Ns3TypeIdAttributeInformation_methods(root_module, cls): ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation() [constructor] cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation(ns3::TypeId::AttributeInformation const & arg0) [copy constructor] cls.add_constructor([param('ns3::TypeId::AttributeInformation const &', 'arg0')]) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::accessor [variable] cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::AttributeAccessor const >', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::checker [variable] cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::flags [variable] cls.add_instance_attribute('flags', 'uint32_t', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::help [variable] cls.add_instance_attribute('help', 'std::string', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::initialValue [variable] cls.add_instance_attribute('initialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::name [variable] cls.add_instance_attribute('name', 'std::string', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::originalInitialValue [variable] cls.add_instance_attribute('originalInitialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False) return def register_Ns3TypeIdTraceSourceInformation_methods(root_module, cls): ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation() [constructor] cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation(ns3::TypeId::TraceSourceInformation const & arg0) [copy constructor] cls.add_constructor([param('ns3::TypeId::TraceSourceInformation const &', 'arg0')]) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::accessor [variable] cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::TraceSourceAccessor const >', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::help [variable] cls.add_instance_attribute('help', 'std::string', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::name [variable] cls.add_instance_attribute('name', 'std::string', is_const=False) return def register_Ns3Empty_methods(root_module, cls): ## empty.h (module 'core'): ns3::empty::empty() [constructor] cls.add_constructor([]) ## empty.h (module 'core'): ns3::empty::empty(ns3::empty const & arg0) [copy constructor] cls.add_constructor([param('ns3::empty const &', 'arg0')]) return def register_Ns3Int64x64_t_methods(root_module, cls): cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short unsigned int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned char const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('signed char const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('double const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short unsigned int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned char const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('signed char const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('double const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short unsigned int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned char const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('signed char const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('double const', 'right')) cls.add_unary_numeric_operator('-') cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short unsigned int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned char const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('signed char const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('double const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right')) cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('>') cls.add_binary_comparison_operator('!=') cls.add_inplace_numeric_operator('*=', param('ns3::int64x64_t const &', 'right')) cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right')) cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', 'right')) cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', 'right')) cls.add_output_stream_operator() cls.add_binary_comparison_operator('<=') cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('>=') ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t() [constructor] cls.add_constructor([]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(double v) [constructor] cls.add_constructor([param('double', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(int v) [constructor] cls.add_constructor([param('int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long int v) [constructor] cls.add_constructor([param('long int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long long int v) [constructor] cls.add_constructor([param('long long int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(unsigned int v) [constructor] cls.add_constructor([param('unsigned int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long unsigned int v) [constructor] cls.add_constructor([param('long unsigned int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long long unsigned int v) [constructor] cls.add_constructor([param('long long unsigned int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(int64_t hi, uint64_t lo) [constructor] cls.add_constructor([param('int64_t', 'hi'), param('uint64_t', 'lo')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(ns3::int64x64_t const & o) [copy constructor] cls.add_constructor([param('ns3::int64x64_t const &', 'o')]) ## int64x64-double.h (module 'core'): double ns3::int64x64_t::GetDouble() const [member function] cls.add_method('GetDouble', 'double', [], is_const=True) ## int64x64-double.h (module 'core'): int64_t ns3::int64x64_t::GetHigh() const [member function] cls.add_method('GetHigh', 'int64_t', [], is_const=True) ## int64x64-double.h (module 'core'): uint64_t ns3::int64x64_t::GetLow() const [member function] cls.add_method('GetLow', 'uint64_t', [], is_const=True) ## int64x64-double.h (module 'core'): static ns3::int64x64_t ns3::int64x64_t::Invert(uint64_t v) [member function] cls.add_method('Invert', 'ns3::int64x64_t', [param('uint64_t', 'v')], is_static=True) ## int64x64-double.h (module 'core'): void ns3::int64x64_t::MulByInvert(ns3::int64x64_t const & o) [member function] cls.add_method('MulByInvert', 'void', [param('ns3::int64x64_t const &', 'o')]) return def register_Ns3Chunk_methods(root_module, cls): ## chunk.h (module 'network'): ns3::Chunk::Chunk() [constructor] cls.add_constructor([]) ## chunk.h (module 'network'): ns3::Chunk::Chunk(ns3::Chunk const & arg0) [copy constructor] cls.add_constructor([param('ns3::Chunk const &', 'arg0')]) ## chunk.h (module 'network'): uint32_t ns3::Chunk::Deserialize(ns3::Buffer::Iterator start) [member function] cls.add_method('Deserialize', 'uint32_t', [param('ns3::Buffer::Iterator', 'start')], is_pure_virtual=True, is_virtual=True) ## chunk.h (module 'network'): static ns3::TypeId ns3::Chunk::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## chunk.h (module 'network'): void ns3::Chunk::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3Header_methods(root_module, cls): cls.add_output_stream_operator() ## header.h (module 'network'): ns3::Header::Header() [constructor] cls.add_constructor([]) ## header.h (module 'network'): ns3::Header::Header(ns3::Header const & arg0) [copy constructor] cls.add_constructor([param('ns3::Header const &', 'arg0')]) ## header.h (module 'network'): uint32_t ns3::Header::Deserialize(ns3::Buffer::Iterator start) [member function] cls.add_method('Deserialize', 'uint32_t', [param('ns3::Buffer::Iterator', 'start')], is_pure_virtual=True, is_virtual=True) ## header.h (module 'network'): uint32_t ns3::Header::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## header.h (module 'network'): static ns3::TypeId ns3::Header::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## header.h (module 'network'): void ns3::Header::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_pure_virtual=True, is_const=True, is_virtual=True) ## header.h (module 'network'): void ns3::Header::Serialize(ns3::Buffer::Iterator start) const [member function] cls.add_method('Serialize', 'void', [param('ns3::Buffer::Iterator', 'start')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3Object_methods(root_module, cls): ## object.h (module 'core'): ns3::Object::Object() [constructor] cls.add_constructor([]) ## object.h (module 'core'): void ns3::Object::AggregateObject(ns3::Ptr<ns3::Object> other) [member function] cls.add_method('AggregateObject', 'void', [param('ns3::Ptr< ns3::Object >', 'other')]) ## object.h (module 'core'): void ns3::Object::Dispose() [member function] cls.add_method('Dispose', 'void', []) ## object.h (module 'core'): ns3::Object::AggregateIterator ns3::Object::GetAggregateIterator() const [member function] cls.add_method('GetAggregateIterator', 'ns3::Object::AggregateIterator', [], is_const=True) ## object.h (module 'core'): ns3::TypeId ns3::Object::GetInstanceTypeId() const [member function] cls.add_method('GetInstanceTypeId', 'ns3::TypeId', [], is_const=True, is_virtual=True) ## object.h (module 'core'): static ns3::TypeId ns3::Object::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## object.h (module 'core'): void ns3::Object::Start() [member function] cls.add_method('Start', 'void', []) ## object.h (module 'core'): ns3::Object::Object(ns3::Object const & o) [copy constructor] cls.add_constructor([param('ns3::Object const &', 'o')], visibility='protected') ## object.h (module 'core'): void ns3::Object::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='protected', is_virtual=True) ## object.h (module 'core'): void ns3::Object::DoStart() [member function] cls.add_method('DoStart', 'void', [], visibility='protected', is_virtual=True) ## object.h (module 'core'): void ns3::Object::NotifyNewAggregate() [member function] cls.add_method('NotifyNewAggregate', 'void', [], visibility='protected', is_virtual=True) return def register_Ns3ObjectAggregateIterator_methods(root_module, cls): ## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator(ns3::Object::AggregateIterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::Object::AggregateIterator const &', 'arg0')]) ## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator() [constructor] cls.add_constructor([]) ## object.h (module 'core'): bool ns3::Object::AggregateIterator::HasNext() const [member function] cls.add_method('HasNext', 'bool', [], is_const=True) ## object.h (module 'core'): ns3::Ptr<ns3::Object const> ns3::Object::AggregateIterator::Next() [member function] cls.add_method('Next', 'ns3::Ptr< ns3::Object const >', []) return def register_Ns3Scheduler_methods(root_module, cls): ## scheduler.h (module 'core'): ns3::Scheduler::Scheduler() [constructor] cls.add_constructor([]) ## scheduler.h (module 'core'): ns3::Scheduler::Scheduler(ns3::Scheduler const & arg0) [copy constructor] cls.add_constructor([param('ns3::Scheduler const &', 'arg0')]) ## scheduler.h (module 'core'): static ns3::TypeId ns3::Scheduler::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## scheduler.h (module 'core'): void ns3::Scheduler::Insert(ns3::Scheduler::Event const & ev) [member function] cls.add_method('Insert', 'void', [param('ns3::Scheduler::Event const &', 'ev')], is_pure_virtual=True, is_virtual=True) ## scheduler.h (module 'core'): bool ns3::Scheduler::IsEmpty() const [member function] cls.add_method('IsEmpty', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## scheduler.h (module 'core'): ns3::Scheduler::Event ns3::Scheduler::PeekNext() const [member function] cls.add_method('PeekNext', 'ns3::Scheduler::Event', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## scheduler.h (module 'core'): void ns3::Scheduler::Remove(ns3::Scheduler::Event const & ev) [member function] cls.add_method('Remove', 'void', [param('ns3::Scheduler::Event const &', 'ev')], is_pure_virtual=True, is_virtual=True) ## scheduler.h (module 'core'): ns3::Scheduler::Event ns3::Scheduler::RemoveNext() [member function] cls.add_method('RemoveNext', 'ns3::Scheduler::Event', [], is_pure_virtual=True, is_virtual=True) return def register_Ns3SchedulerEvent_methods(root_module, cls): cls.add_binary_comparison_operator('<') ## scheduler.h (module 'core'): ns3::Scheduler::Event::Event() [constructor] cls.add_constructor([]) ## scheduler.h (module 'core'): ns3::Scheduler::Event::Event(ns3::Scheduler::Event const & arg0) [copy constructor] cls.add_constructor([param('ns3::Scheduler::Event const &', 'arg0')]) ## scheduler.h (module 'core'): ns3::Scheduler::Event::impl [variable] cls.add_instance_attribute('impl', 'ns3::EventImpl *', is_const=False) ## scheduler.h (module 'core'): ns3::Scheduler::Event::key [variable] cls.add_instance_attribute('key', 'ns3::Scheduler::EventKey', is_const=False) 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 (module 'core'): ns3::Scheduler::EventKey::EventKey() [constructor] cls.add_constructor([]) ## scheduler.h (module 'core'): ns3::Scheduler::EventKey::EventKey(ns3::Scheduler::EventKey const & arg0) [copy constructor] cls.add_constructor([param('ns3::Scheduler::EventKey const &', 'arg0')]) ## scheduler.h (module 'core'): ns3::Scheduler::EventKey::m_context [variable] cls.add_instance_attribute('m_context', 'uint32_t', is_const=False) ## scheduler.h (module 'core'): ns3::Scheduler::EventKey::m_ts [variable] cls.add_instance_attribute('m_ts', 'uint64_t', is_const=False) ## scheduler.h (module 'core'): ns3::Scheduler::EventKey::m_uid [variable] cls.add_instance_attribute('m_uid', 'uint32_t', is_const=False) return def register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter< ns3::AttributeAccessor > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter< ns3::AttributeChecker > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter< ns3::AttributeValue > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount(ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter< ns3::CallbackImplBase > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::SimpleRefCount(ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter< ns3::EventImpl > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3FdReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3FdReader__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >::SimpleRefCount(ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::FdReader, ns3::empty, ns3::DefaultDeleter< ns3::FdReader > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount(ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter< ns3::NixVector > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::SimpleRefCount(ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter< ns3::Packet > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3SystemThread_Ns3Empty_Ns3DefaultDeleter__lt__ns3SystemThread__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >::SimpleRefCount(ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter< ns3::SystemThread > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter< ns3::TraceSourceAccessor > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimulatorImpl_methods(root_module, cls): ## simulator-impl.h (module 'core'): ns3::SimulatorImpl::SimulatorImpl() [constructor] cls.add_constructor([]) ## simulator-impl.h (module 'core'): ns3::SimulatorImpl::SimulatorImpl(ns3::SimulatorImpl const & arg0) [copy constructor] cls.add_constructor([param('ns3::SimulatorImpl const &', 'arg0')]) ## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Cancel(ns3::EventId const & ev) [member function] cls.add_method('Cancel', 'void', [param('ns3::EventId const &', 'ev')], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Destroy() [member function] cls.add_method('Destroy', 'void', [], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): uint32_t ns3::SimulatorImpl::GetContext() const [member function] cls.add_method('GetContext', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::GetDelayLeft(ns3::EventId const & id) const [member function] cls.add_method('GetDelayLeft', 'ns3::Time', [param('ns3::EventId const &', 'id')], is_pure_virtual=True, is_const=True, is_virtual=True) ## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::GetMaximumSimulationTime() const [member function] cls.add_method('GetMaximumSimulationTime', 'ns3::Time', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## simulator-impl.h (module 'core'): uint32_t ns3::SimulatorImpl::GetSystemId() const [member function] cls.add_method('GetSystemId', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## simulator-impl.h (module 'core'): static ns3::TypeId ns3::SimulatorImpl::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## simulator-impl.h (module 'core'): bool ns3::SimulatorImpl::IsExpired(ns3::EventId const & ev) const [member function] cls.add_method('IsExpired', 'bool', [param('ns3::EventId const &', 'ev')], is_pure_virtual=True, is_const=True, is_virtual=True) ## simulator-impl.h (module 'core'): bool ns3::SimulatorImpl::IsFinished() const [member function] cls.add_method('IsFinished', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::Next() const [member function] cls.add_method('Next', 'ns3::Time', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::Now() const [member function] cls.add_method('Now', 'ns3::Time', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Remove(ns3::EventId const & ev) [member function] cls.add_method('Remove', 'void', [param('ns3::EventId const &', 'ev')], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Run() [member function] cls.add_method('Run', 'void', [], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::RunOneEvent() [member function] cls.add_method('RunOneEvent', 'void', [], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): ns3::EventId ns3::SimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function] cls.add_method('Schedule', 'ns3::EventId', [param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): ns3::EventId ns3::SimulatorImpl::ScheduleDestroy(ns3::EventImpl * event) [member function] cls.add_method('ScheduleDestroy', 'ns3::EventId', [param('ns3::EventImpl *', 'event')], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): ns3::EventId ns3::SimulatorImpl::ScheduleNow(ns3::EventImpl * event) [member function] cls.add_method('ScheduleNow', 'ns3::EventId', [param('ns3::EventImpl *', 'event')], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::ScheduleWithContext(uint32_t context, ns3::Time const & time, ns3::EventImpl * event) [member function] cls.add_method('ScheduleWithContext', 'void', [param('uint32_t', 'context'), param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function] cls.add_method('SetScheduler', 'void', [param('ns3::ObjectFactory', 'schedulerFactory')], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Stop() [member function] cls.add_method('Stop', 'void', [], is_pure_virtual=True, is_virtual=True) ## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Stop(ns3::Time const & time) [member function] cls.add_method('Stop', 'void', [param('ns3::Time const &', 'time')], is_pure_virtual=True, is_virtual=True) return def register_Ns3Synchronizer_methods(root_module, cls): ## synchronizer.h (module 'core'): ns3::Synchronizer::Synchronizer(ns3::Synchronizer const & arg0) [copy constructor] cls.add_constructor([param('ns3::Synchronizer const &', 'arg0')]) ## synchronizer.h (module 'core'): ns3::Synchronizer::Synchronizer() [constructor] cls.add_constructor([]) ## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::EventEnd() [member function] cls.add_method('EventEnd', 'uint64_t', []) ## synchronizer.h (module 'core'): void ns3::Synchronizer::EventStart() [member function] cls.add_method('EventStart', 'void', []) ## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::GetCurrentRealtime() [member function] cls.add_method('GetCurrentRealtime', 'uint64_t', []) ## synchronizer.h (module 'core'): int64_t ns3::Synchronizer::GetDrift(uint64_t ts) [member function] cls.add_method('GetDrift', 'int64_t', [param('uint64_t', 'ts')]) ## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::GetOrigin() [member function] cls.add_method('GetOrigin', 'uint64_t', []) ## synchronizer.h (module 'core'): static ns3::TypeId ns3::Synchronizer::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## synchronizer.h (module 'core'): bool ns3::Synchronizer::Realtime() [member function] cls.add_method('Realtime', 'bool', []) ## synchronizer.h (module 'core'): void ns3::Synchronizer::SetCondition(bool arg0) [member function] cls.add_method('SetCondition', 'void', [param('bool', 'arg0')]) ## synchronizer.h (module 'core'): void ns3::Synchronizer::SetOrigin(uint64_t ts) [member function] cls.add_method('SetOrigin', 'void', [param('uint64_t', 'ts')]) ## synchronizer.h (module 'core'): void ns3::Synchronizer::Signal() [member function] cls.add_method('Signal', 'void', []) ## synchronizer.h (module 'core'): bool ns3::Synchronizer::Synchronize(uint64_t tsCurrent, uint64_t tsDelay) [member function] cls.add_method('Synchronize', 'bool', [param('uint64_t', 'tsCurrent'), param('uint64_t', 'tsDelay')]) ## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::DoEventEnd() [member function] cls.add_method('DoEventEnd', 'uint64_t', [], is_pure_virtual=True, visibility='protected', is_virtual=True) ## synchronizer.h (module 'core'): void ns3::Synchronizer::DoEventStart() [member function] cls.add_method('DoEventStart', 'void', [], is_pure_virtual=True, visibility='protected', is_virtual=True) ## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::DoGetCurrentRealtime() [member function] cls.add_method('DoGetCurrentRealtime', 'uint64_t', [], is_pure_virtual=True, visibility='protected', is_virtual=True) ## synchronizer.h (module 'core'): int64_t ns3::Synchronizer::DoGetDrift(uint64_t ns) [member function] cls.add_method('DoGetDrift', 'int64_t', [param('uint64_t', 'ns')], is_pure_virtual=True, visibility='protected', is_virtual=True) ## synchronizer.h (module 'core'): bool ns3::Synchronizer::DoRealtime() [member function] cls.add_method('DoRealtime', 'bool', [], is_pure_virtual=True, visibility='protected', is_virtual=True) ## synchronizer.h (module 'core'): void ns3::Synchronizer::DoSetCondition(bool arg0) [member function] cls.add_method('DoSetCondition', 'void', [param('bool', 'arg0')], is_pure_virtual=True, visibility='protected', is_virtual=True) ## synchronizer.h (module 'core'): void ns3::Synchronizer::DoSetOrigin(uint64_t ns) [member function] cls.add_method('DoSetOrigin', 'void', [param('uint64_t', 'ns')], is_pure_virtual=True, visibility='protected', is_virtual=True) ## synchronizer.h (module 'core'): void ns3::Synchronizer::DoSignal() [member function] cls.add_method('DoSignal', 'void', [], is_pure_virtual=True, visibility='protected', is_virtual=True) ## synchronizer.h (module 'core'): bool ns3::Synchronizer::DoSynchronize(uint64_t nsCurrent, uint64_t nsDelay) [member function] cls.add_method('DoSynchronize', 'bool', [param('uint64_t', 'nsCurrent'), param('uint64_t', 'nsDelay')], is_pure_virtual=True, visibility='protected', is_virtual=True) return def register_Ns3SystemThread_methods(root_module, cls): ## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::SystemThread const & arg0) [copy constructor] cls.add_constructor([param('ns3::SystemThread const &', 'arg0')]) ## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [constructor] cls.add_constructor([param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')]) ## system-thread.h (module 'core'): bool ns3::SystemThread::Break() [member function] cls.add_method('Break', 'bool', []) ## system-thread.h (module 'core'): void ns3::SystemThread::Join() [member function] cls.add_method('Join', 'void', []) ## system-thread.h (module 'core'): void ns3::SystemThread::Shutdown() [member function] cls.add_method('Shutdown', 'void', []) ## system-thread.h (module 'core'): void ns3::SystemThread::Start() [member function] cls.add_method('Start', 'void', []) return def register_Ns3Time_methods(root_module, cls): cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right')) cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('>') cls.add_binary_comparison_operator('!=') cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right')) cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', 'right')) cls.add_output_stream_operator() cls.add_binary_comparison_operator('<=') cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('>=') ## nstime.h (module 'core'): ns3::Time::Time() [constructor] cls.add_constructor([]) ## nstime.h (module 'core'): ns3::Time::Time(ns3::Time const & o) [copy constructor] cls.add_constructor([param('ns3::Time const &', 'o')]) ## nstime.h (module 'core'): ns3::Time::Time(double v) [constructor] cls.add_constructor([param('double', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(int v) [constructor] cls.add_constructor([param('int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(long int v) [constructor] cls.add_constructor([param('long int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(long long int v) [constructor] cls.add_constructor([param('long long int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(unsigned int v) [constructor] cls.add_constructor([param('unsigned int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(long unsigned int v) [constructor] cls.add_constructor([param('long unsigned int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(long long unsigned int v) [constructor] cls.add_constructor([param('long long unsigned int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(std::string const & s) [constructor] cls.add_constructor([param('std::string const &', 's')]) ## nstime.h (module 'core'): ns3::Time::Time(ns3::int64x64_t const & value) [constructor] cls.add_constructor([param('ns3::int64x64_t const &', 'value')]) ## nstime.h (module 'core'): int ns3::Time::Compare(ns3::Time const & o) const [member function] cls.add_method('Compare', 'int', [param('ns3::Time const &', 'o')], is_const=True) ## nstime.h (module 'core'): static ns3::Time ns3::Time::From(ns3::int64x64_t const & from, ns3::Time::Unit timeUnit) [member function] cls.add_method('From', 'ns3::Time', [param('ns3::int64x64_t const &', 'from'), param('ns3::Time::Unit', 'timeUnit')], is_static=True) ## nstime.h (module 'core'): static ns3::Time ns3::Time::From(ns3::int64x64_t const & value) [member function] cls.add_method('From', 'ns3::Time', [param('ns3::int64x64_t const &', 'value')], is_static=True) ## nstime.h (module 'core'): static ns3::Time ns3::Time::FromDouble(double value, ns3::Time::Unit timeUnit) [member function] cls.add_method('FromDouble', 'ns3::Time', [param('double', 'value'), param('ns3::Time::Unit', 'timeUnit')], is_static=True) ## nstime.h (module 'core'): static ns3::Time ns3::Time::FromInteger(uint64_t value, ns3::Time::Unit timeUnit) [member function] cls.add_method('FromInteger', 'ns3::Time', [param('uint64_t', 'value'), param('ns3::Time::Unit', 'timeUnit')], is_static=True) ## nstime.h (module 'core'): double ns3::Time::GetDouble() const [member function] cls.add_method('GetDouble', 'double', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetFemtoSeconds() const [member function] cls.add_method('GetFemtoSeconds', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetInteger() const [member function] cls.add_method('GetInteger', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetMicroSeconds() const [member function] cls.add_method('GetMicroSeconds', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetMilliSeconds() const [member function] cls.add_method('GetMilliSeconds', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetNanoSeconds() const [member function] cls.add_method('GetNanoSeconds', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetPicoSeconds() const [member function] cls.add_method('GetPicoSeconds', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): static ns3::Time::Unit ns3::Time::GetResolution() [member function] cls.add_method('GetResolution', 'ns3::Time::Unit', [], is_static=True) ## nstime.h (module 'core'): double ns3::Time::GetSeconds() const [member function] cls.add_method('GetSeconds', 'double', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetTimeStep() const [member function] cls.add_method('GetTimeStep', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): bool ns3::Time::IsNegative() const [member function] cls.add_method('IsNegative', 'bool', [], is_const=True) ## nstime.h (module 'core'): bool ns3::Time::IsPositive() const [member function] cls.add_method('IsPositive', 'bool', [], is_const=True) ## nstime.h (module 'core'): bool ns3::Time::IsStrictlyNegative() const [member function] cls.add_method('IsStrictlyNegative', 'bool', [], is_const=True) ## nstime.h (module 'core'): bool ns3::Time::IsStrictlyPositive() const [member function] cls.add_method('IsStrictlyPositive', 'bool', [], is_const=True) ## nstime.h (module 'core'): bool ns3::Time::IsZero() const [member function] cls.add_method('IsZero', 'bool', [], is_const=True) ## nstime.h (module 'core'): static void ns3::Time::SetResolution(ns3::Time::Unit resolution) [member function] cls.add_method('SetResolution', 'void', [param('ns3::Time::Unit', 'resolution')], is_static=True) ## nstime.h (module 'core'): ns3::int64x64_t ns3::Time::To(ns3::Time::Unit timeUnit) const [member function] cls.add_method('To', 'ns3::int64x64_t', [param('ns3::Time::Unit', 'timeUnit')], is_const=True) ## nstime.h (module 'core'): double ns3::Time::ToDouble(ns3::Time::Unit timeUnit) const [member function] cls.add_method('ToDouble', 'double', [param('ns3::Time::Unit', 'timeUnit')], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::ToInteger(ns3::Time::Unit timeUnit) const [member function] cls.add_method('ToInteger', 'int64_t', [param('ns3::Time::Unit', 'timeUnit')], is_const=True) return def register_Ns3TraceSourceAccessor_methods(root_module, cls): ## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor(ns3::TraceSourceAccessor const & arg0) [copy constructor] cls.add_constructor([param('ns3::TraceSourceAccessor const &', 'arg0')]) ## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor() [constructor] cls.add_constructor([]) ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Connect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function] cls.add_method('Connect', 'bool', [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')], is_pure_virtual=True, is_const=True, is_virtual=True) ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::ConnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function] cls.add_method('ConnectWithoutContext', 'bool', [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')], is_pure_virtual=True, is_const=True, is_virtual=True) ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Disconnect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function] cls.add_method('Disconnect', 'bool', [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')], is_pure_virtual=True, is_const=True, is_virtual=True) ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::DisconnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function] cls.add_method('DisconnectWithoutContext', 'bool', [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3Trailer_methods(root_module, cls): cls.add_output_stream_operator() ## trailer.h (module 'network'): ns3::Trailer::Trailer() [constructor] cls.add_constructor([]) ## trailer.h (module 'network'): ns3::Trailer::Trailer(ns3::Trailer const & arg0) [copy constructor] cls.add_constructor([param('ns3::Trailer const &', 'arg0')]) ## trailer.h (module 'network'): uint32_t ns3::Trailer::Deserialize(ns3::Buffer::Iterator end) [member function] cls.add_method('Deserialize', 'uint32_t', [param('ns3::Buffer::Iterator', 'end')], is_pure_virtual=True, is_virtual=True) ## trailer.h (module 'network'): uint32_t ns3::Trailer::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## trailer.h (module 'network'): static ns3::TypeId ns3::Trailer::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## trailer.h (module 'network'): void ns3::Trailer::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_pure_virtual=True, is_const=True, is_virtual=True) ## trailer.h (module 'network'): void ns3::Trailer::Serialize(ns3::Buffer::Iterator start) const [member function] cls.add_method('Serialize', 'void', [param('ns3::Buffer::Iterator', 'start')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3AttributeAccessor_methods(root_module, cls): ## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor(ns3::AttributeAccessor const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeAccessor const &', 'arg0')]) ## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor() [constructor] cls.add_constructor([]) ## attribute.h (module 'core'): bool ns3::AttributeAccessor::Get(ns3::ObjectBase const * object, ns3::AttributeValue & attribute) const [member function] cls.add_method('Get', 'bool', [param('ns3::ObjectBase const *', 'object'), param('ns3::AttributeValue &', 'attribute')], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasGetter() const [member function] cls.add_method('HasGetter', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasSetter() const [member function] cls.add_method('HasSetter', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeAccessor::Set(ns3::ObjectBase * object, ns3::AttributeValue const & value) const [member function] cls.add_method('Set', 'bool', [param('ns3::ObjectBase *', 'object', transfer_ownership=False), param('ns3::AttributeValue const &', 'value')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3AttributeChecker_methods(root_module, cls): ## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker(ns3::AttributeChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeChecker const &', 'arg0')]) ## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker() [constructor] cls.add_constructor([]) ## attribute.h (module 'core'): bool ns3::AttributeChecker::Check(ns3::AttributeValue const & value) const [member function] cls.add_method('Check', 'bool', [param('ns3::AttributeValue const &', 'value')], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeChecker::Copy(ns3::AttributeValue const & source, ns3::AttributeValue & destination) const [member function] cls.add_method('Copy', 'bool', [param('ns3::AttributeValue const &', 'source'), param('ns3::AttributeValue &', 'destination')], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::Create() const [member function] cls.add_method('Create', 'ns3::Ptr< ns3::AttributeValue >', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::CreateValidValue(ns3::AttributeValue const & value) const [member function] cls.add_method('CreateValidValue', 'ns3::Ptr< ns3::AttributeValue >', [param('ns3::AttributeValue const &', 'value')], is_const=True) ## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetUnderlyingTypeInformation() const [member function] cls.add_method('GetUnderlyingTypeInformation', 'std::string', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetValueTypeName() const [member function] cls.add_method('GetValueTypeName', 'std::string', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeChecker::HasUnderlyingTypeInformation() const [member function] cls.add_method('HasUnderlyingTypeInformation', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3AttributeValue_methods(root_module, cls): ## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue(ns3::AttributeValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeValue const &', 'arg0')]) ## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue() [constructor] cls.add_constructor([]) ## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_pure_virtual=True, is_virtual=True) ## attribute.h (module 'core'): std::string ns3::AttributeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3CallbackChecker_methods(root_module, cls): ## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker() [constructor] cls.add_constructor([]) ## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker(ns3::CallbackChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::CallbackChecker const &', 'arg0')]) return def register_Ns3CallbackImplBase_methods(root_module, cls): ## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase() [constructor] cls.add_constructor([]) ## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase(ns3::CallbackImplBase const & arg0) [copy constructor] cls.add_constructor([param('ns3::CallbackImplBase const &', 'arg0')]) ## callback.h (module 'core'): bool ns3::CallbackImplBase::IsEqual(ns3::Ptr<ns3::CallbackImplBase const> other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ptr< ns3::CallbackImplBase const >', 'other')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3CallbackValue_methods(root_module, cls): ## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::CallbackValue const &', 'arg0')]) ## callback.h (module 'core'): ns3::CallbackValue::CallbackValue() [constructor] cls.add_constructor([]) ## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackBase const & base) [constructor] cls.add_constructor([param('ns3::CallbackBase const &', 'base')]) ## callback.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::CallbackValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## callback.h (module 'core'): bool ns3::CallbackValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## callback.h (module 'core'): std::string ns3::CallbackValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## callback.h (module 'core'): void ns3::CallbackValue::Set(ns3::CallbackBase base) [member function] cls.add_method('Set', 'void', [param('ns3::CallbackBase', 'base')]) return def register_Ns3DataRateChecker_methods(root_module, cls): ## data-rate.h (module 'network'): ns3::DataRateChecker::DataRateChecker() [constructor] cls.add_constructor([]) ## data-rate.h (module 'network'): ns3::DataRateChecker::DataRateChecker(ns3::DataRateChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::DataRateChecker const &', 'arg0')]) return def register_Ns3DataRateValue_methods(root_module, cls): ## data-rate.h (module 'network'): ns3::DataRateValue::DataRateValue() [constructor] cls.add_constructor([]) ## data-rate.h (module 'network'): ns3::DataRateValue::DataRateValue(ns3::DataRateValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::DataRateValue const &', 'arg0')]) ## data-rate.h (module 'network'): ns3::DataRateValue::DataRateValue(ns3::DataRate const & value) [constructor] cls.add_constructor([param('ns3::DataRate const &', 'value')]) ## data-rate.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::DataRateValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## data-rate.h (module 'network'): bool ns3::DataRateValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## data-rate.h (module 'network'): ns3::DataRate ns3::DataRateValue::Get() const [member function] cls.add_method('Get', 'ns3::DataRate', [], is_const=True) ## data-rate.h (module 'network'): std::string ns3::DataRateValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## data-rate.h (module 'network'): void ns3::DataRateValue::Set(ns3::DataRate const & value) [member function] cls.add_method('Set', 'void', [param('ns3::DataRate const &', 'value')]) return def register_Ns3EmptyAttributeValue_methods(root_module, cls): ## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue(ns3::EmptyAttributeValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::EmptyAttributeValue const &', 'arg0')]) ## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue() [constructor] cls.add_constructor([]) ## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EmptyAttributeValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, visibility='private', is_virtual=True) ## attribute.h (module 'core'): bool ns3::EmptyAttributeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], visibility='private', is_virtual=True) ## attribute.h (module 'core'): std::string ns3::EmptyAttributeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, visibility='private', is_virtual=True) return def register_Ns3EventImpl_methods(root_module, cls): ## event-impl.h (module 'core'): ns3::EventImpl::EventImpl(ns3::EventImpl const & arg0) [copy constructor] cls.add_constructor([param('ns3::EventImpl const &', 'arg0')]) ## event-impl.h (module 'core'): ns3::EventImpl::EventImpl() [constructor] cls.add_constructor([]) ## event-impl.h (module 'core'): void ns3::EventImpl::Cancel() [member function] cls.add_method('Cancel', 'void', []) ## event-impl.h (module 'core'): void ns3::EventImpl::Invoke() [member function] cls.add_method('Invoke', 'void', []) ## event-impl.h (module 'core'): bool ns3::EventImpl::IsCancelled() [member function] cls.add_method('IsCancelled', 'bool', []) ## event-impl.h (module 'core'): void ns3::EventImpl::Notify() [member function] cls.add_method('Notify', 'void', [], is_pure_virtual=True, visibility='protected', is_virtual=True) return def register_Ns3FdReader_methods(root_module, cls): ## unix-fd-reader.h (module 'core'): ns3::FdReader::FdReader(ns3::FdReader const & arg0) [copy constructor] cls.add_constructor([param('ns3::FdReader const &', 'arg0')]) ## unix-fd-reader.h (module 'core'): ns3::FdReader::FdReader() [constructor] cls.add_constructor([]) ## unix-fd-reader.h (module 'core'): void ns3::FdReader::Start(int fd, ns3::Callback<void, unsigned char*, long, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> readCallback) [member function] cls.add_method('Start', 'void', [param('int', 'fd'), param('ns3::Callback< void, unsigned char *, long, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'readCallback')]) ## unix-fd-reader.h (module 'core'): void ns3::FdReader::Stop() [member function] cls.add_method('Stop', 'void', []) ## unix-fd-reader.h (module 'core'): ns3::FdReader::Data ns3::FdReader::DoRead() [member function] cls.add_method('DoRead', 'ns3::FdReader::Data', [], is_pure_virtual=True, visibility='protected', is_virtual=True) return def register_Ns3Ipv4AddressChecker_methods(root_module, cls): ## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker::Ipv4AddressChecker() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker::Ipv4AddressChecker(ns3::Ipv4AddressChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4AddressChecker const &', 'arg0')]) return def register_Ns3Ipv4AddressValue_methods(root_module, cls): ## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue(ns3::Ipv4AddressValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4AddressValue const &', 'arg0')]) ## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue(ns3::Ipv4Address const & value) [constructor] cls.add_constructor([param('ns3::Ipv4Address const &', 'value')]) ## ipv4-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv4AddressValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4AddressValue::Get() const [member function] cls.add_method('Get', 'ns3::Ipv4Address', [], is_const=True) ## ipv4-address.h (module 'network'): std::string ns3::Ipv4AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4AddressValue::Set(ns3::Ipv4Address const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Ipv4Address const &', 'value')]) return def register_Ns3Ipv4MaskChecker_methods(root_module, cls): ## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker::Ipv4MaskChecker() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker::Ipv4MaskChecker(ns3::Ipv4MaskChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4MaskChecker const &', 'arg0')]) return def register_Ns3Ipv4MaskValue_methods(root_module, cls): ## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue(ns3::Ipv4MaskValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4MaskValue const &', 'arg0')]) ## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue(ns3::Ipv4Mask const & value) [constructor] cls.add_constructor([param('ns3::Ipv4Mask const &', 'value')]) ## ipv4-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv4MaskValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4MaskValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask ns3::Ipv4MaskValue::Get() const [member function] cls.add_method('Get', 'ns3::Ipv4Mask', [], is_const=True) ## ipv4-address.h (module 'network'): std::string ns3::Ipv4MaskValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4MaskValue::Set(ns3::Ipv4Mask const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Ipv4Mask const &', 'value')]) return def register_Ns3Ipv6AddressChecker_methods(root_module, cls): ## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker::Ipv6AddressChecker() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker::Ipv6AddressChecker(ns3::Ipv6AddressChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv6AddressChecker const &', 'arg0')]) return def register_Ns3Ipv6AddressValue_methods(root_module, cls): ## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue(ns3::Ipv6AddressValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv6AddressValue const &', 'arg0')]) ## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue(ns3::Ipv6Address const & value) [constructor] cls.add_constructor([param('ns3::Ipv6Address const &', 'value')]) ## ipv6-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv6AddressValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## ipv6-address.h (module 'network'): ns3::Ipv6Address ns3::Ipv6AddressValue::Get() const [member function] cls.add_method('Get', 'ns3::Ipv6Address', [], is_const=True) ## ipv6-address.h (module 'network'): std::string ns3::Ipv6AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6AddressValue::Set(ns3::Ipv6Address const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Ipv6Address const &', 'value')]) return def register_Ns3Ipv6PrefixChecker_methods(root_module, cls): ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker::Ipv6PrefixChecker() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker::Ipv6PrefixChecker(ns3::Ipv6PrefixChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv6PrefixChecker const &', 'arg0')]) return def register_Ns3Ipv6PrefixValue_methods(root_module, cls): ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue(ns3::Ipv6PrefixValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv6PrefixValue const &', 'arg0')]) ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue(ns3::Ipv6Prefix const & value) [constructor] cls.add_constructor([param('ns3::Ipv6Prefix const &', 'value')]) ## ipv6-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv6PrefixValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6PrefixValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix ns3::Ipv6PrefixValue::Get() const [member function] cls.add_method('Get', 'ns3::Ipv6Prefix', [], is_const=True) ## ipv6-address.h (module 'network'): std::string ns3::Ipv6PrefixValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6PrefixValue::Set(ns3::Ipv6Prefix const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Ipv6Prefix const &', 'value')]) return def register_Ns3Mac48AddressChecker_methods(root_module, cls): ## mac48-address.h (module 'network'): ns3::Mac48AddressChecker::Mac48AddressChecker() [constructor] cls.add_constructor([]) ## mac48-address.h (module 'network'): ns3::Mac48AddressChecker::Mac48AddressChecker(ns3::Mac48AddressChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::Mac48AddressChecker const &', 'arg0')]) return def register_Ns3Mac48AddressValue_methods(root_module, cls): ## mac48-address.h (module 'network'): ns3::Mac48AddressValue::Mac48AddressValue() [constructor] cls.add_constructor([]) ## mac48-address.h (module 'network'): ns3::Mac48AddressValue::Mac48AddressValue(ns3::Mac48AddressValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Mac48AddressValue const &', 'arg0')]) ## mac48-address.h (module 'network'): ns3::Mac48AddressValue::Mac48AddressValue(ns3::Mac48Address const & value) [constructor] cls.add_constructor([param('ns3::Mac48Address const &', 'value')]) ## mac48-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Mac48AddressValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## mac48-address.h (module 'network'): bool ns3::Mac48AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## mac48-address.h (module 'network'): ns3::Mac48Address ns3::Mac48AddressValue::Get() const [member function] cls.add_method('Get', 'ns3::Mac48Address', [], is_const=True) ## mac48-address.h (module 'network'): std::string ns3::Mac48AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## mac48-address.h (module 'network'): void ns3::Mac48AddressValue::Set(ns3::Mac48Address const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Mac48Address const &', 'value')]) return def register_Ns3NetDevice_methods(root_module, cls): ## net-device.h (module 'network'): ns3::NetDevice::NetDevice() [constructor] cls.add_constructor([]) ## net-device.h (module 'network'): ns3::NetDevice::NetDevice(ns3::NetDevice const & arg0) [copy constructor] cls.add_constructor([param('ns3::NetDevice const &', 'arg0')]) ## net-device.h (module 'network'): void ns3::NetDevice::AddLinkChangeCallback(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function] cls.add_method('AddLinkChangeCallback', 'void', [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetAddress() const [member function] cls.add_method('GetAddress', 'ns3::Address', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetBroadcast() const [member function] cls.add_method('GetBroadcast', 'ns3::Address', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Ptr<ns3::Channel> ns3::NetDevice::GetChannel() const [member function] cls.add_method('GetChannel', 'ns3::Ptr< ns3::Channel >', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): uint32_t ns3::NetDevice::GetIfIndex() const [member function] cls.add_method('GetIfIndex', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): uint16_t ns3::NetDevice::GetMtu() const [member function] cls.add_method('GetMtu', 'uint16_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetMulticast(ns3::Ipv4Address multicastGroup) const [member function] cls.add_method('GetMulticast', 'ns3::Address', [param('ns3::Ipv4Address', 'multicastGroup')], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetMulticast(ns3::Ipv6Address addr) const [member function] cls.add_method('GetMulticast', 'ns3::Address', [param('ns3::Ipv6Address', 'addr')], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Ptr<ns3::Node> ns3::NetDevice::GetNode() const [member function] cls.add_method('GetNode', 'ns3::Ptr< ns3::Node >', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): static ns3::TypeId ns3::NetDevice::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsBridge() const [member function] cls.add_method('IsBridge', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsBroadcast() const [member function] cls.add_method('IsBroadcast', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsLinkUp() const [member function] cls.add_method('IsLinkUp', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsMulticast() const [member function] cls.add_method('IsMulticast', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsPointToPoint() const [member function] cls.add_method('IsPointToPoint', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::NeedsArp() const [member function] cls.add_method('NeedsArp', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::Send(ns3::Ptr<ns3::Packet> 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_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::SendFrom(ns3::Ptr<ns3::Packet> 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_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::SetAddress(ns3::Address address) [member function] cls.add_method('SetAddress', 'void', [param('ns3::Address', 'address')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::SetIfIndex(uint32_t const index) [member function] cls.add_method('SetIfIndex', 'void', [param('uint32_t const', 'index')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::SetMtu(uint16_t const mtu) [member function] cls.add_method('SetMtu', 'bool', [param('uint16_t const', 'mtu')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::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) ## net-device.h (module 'network'): void ns3::NetDevice::SetPromiscReceiveCallback(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) [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_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::SetReceiveCallback(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) [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_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::SupportsSendFrom() const [member function] cls.add_method('SupportsSendFrom', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3NixVector_methods(root_module, cls): cls.add_output_stream_operator() ## nix-vector.h (module 'network'): ns3::NixVector::NixVector() [constructor] cls.add_constructor([]) ## nix-vector.h (module 'network'): ns3::NixVector::NixVector(ns3::NixVector const & o) [copy constructor] cls.add_constructor([param('ns3::NixVector const &', 'o')]) ## nix-vector.h (module 'network'): void ns3::NixVector::AddNeighborIndex(uint32_t newBits, uint32_t numberOfBits) [member function] cls.add_method('AddNeighborIndex', 'void', [param('uint32_t', 'newBits'), param('uint32_t', 'numberOfBits')]) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::BitCount(uint32_t numberOfNeighbors) const [member function] cls.add_method('BitCount', 'uint32_t', [param('uint32_t', 'numberOfNeighbors')], is_const=True) ## nix-vector.h (module 'network'): ns3::Ptr<ns3::NixVector> ns3::NixVector::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::NixVector >', [], is_const=True) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::Deserialize(uint32_t const * buffer, uint32_t size) [member function] cls.add_method('Deserialize', 'uint32_t', [param('uint32_t const *', 'buffer'), param('uint32_t', 'size')]) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::ExtractNeighborIndex(uint32_t numberOfBits) [member function] cls.add_method('ExtractNeighborIndex', 'uint32_t', [param('uint32_t', 'numberOfBits')]) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::GetRemainingBits() [member function] cls.add_method('GetRemainingBits', 'uint32_t', []) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::Serialize(uint32_t * buffer, uint32_t maxSize) const [member function] cls.add_method('Serialize', 'uint32_t', [param('uint32_t *', 'buffer'), param('uint32_t', 'maxSize')], is_const=True) return def register_Ns3Node_methods(root_module, cls): ## node.h (module 'network'): ns3::Node::Node(ns3::Node const & arg0) [copy constructor] cls.add_constructor([param('ns3::Node const &', 'arg0')]) ## node.h (module 'network'): ns3::Node::Node() [constructor] cls.add_constructor([]) ## node.h (module 'network'): ns3::Node::Node(uint32_t systemId) [constructor] cls.add_constructor([param('uint32_t', 'systemId')]) ## node.h (module 'network'): uint32_t ns3::Node::AddApplication(ns3::Ptr<ns3::Application> application) [member function] cls.add_method('AddApplication', 'uint32_t', [param('ns3::Ptr< ns3::Application >', 'application')]) ## node.h (module 'network'): uint32_t ns3::Node::AddDevice(ns3::Ptr<ns3::NetDevice> device) [member function] cls.add_method('AddDevice', 'uint32_t', [param('ns3::Ptr< ns3::NetDevice >', 'device')]) ## node.h (module 'network'): static bool ns3::Node::ChecksumEnabled() [member function] cls.add_method('ChecksumEnabled', 'bool', [], is_static=True) ## node.h (module 'network'): ns3::Ptr<ns3::Application> ns3::Node::GetApplication(uint32_t index) const [member function] cls.add_method('GetApplication', 'ns3::Ptr< ns3::Application >', [param('uint32_t', 'index')], is_const=True) ## node.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::Node::GetDevice(uint32_t index) const [member function] cls.add_method('GetDevice', 'ns3::Ptr< ns3::NetDevice >', [param('uint32_t', 'index')], is_const=True) ## node.h (module 'network'): uint32_t ns3::Node::GetId() const [member function] cls.add_method('GetId', 'uint32_t', [], is_const=True) ## node.h (module 'network'): uint32_t ns3::Node::GetNApplications() const [member function] cls.add_method('GetNApplications', 'uint32_t', [], is_const=True) ## node.h (module 'network'): uint32_t ns3::Node::GetNDevices() const [member function] cls.add_method('GetNDevices', 'uint32_t', [], is_const=True) ## node.h (module 'network'): uint32_t ns3::Node::GetSystemId() const [member function] cls.add_method('GetSystemId', 'uint32_t', [], is_const=True) ## node.h (module 'network'): static ns3::TypeId ns3::Node::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## node.h (module 'network'): void ns3::Node::RegisterDeviceAdditionListener(ns3::Callback<void,ns3::Ptr<ns3::NetDevice>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> listener) [member function] cls.add_method('RegisterDeviceAdditionListener', 'void', [param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'listener')]) ## node.h (module 'network'): void ns3::Node::RegisterProtocolHandler(ns3::Callback<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> handler, uint16_t protocolType, ns3::Ptr<ns3::NetDevice> device, bool promiscuous=false) [member function] cls.add_method('RegisterProtocolHandler', 'void', [param('ns3::Callback< 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 >', 'handler'), param('uint16_t', 'protocolType'), param('ns3::Ptr< ns3::NetDevice >', 'device'), param('bool', 'promiscuous', default_value='false')]) ## node.h (module 'network'): void ns3::Node::UnregisterDeviceAdditionListener(ns3::Callback<void,ns3::Ptr<ns3::NetDevice>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> listener) [member function] cls.add_method('UnregisterDeviceAdditionListener', 'void', [param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'listener')]) ## node.h (module 'network'): void ns3::Node::UnregisterProtocolHandler(ns3::Callback<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> handler) [member function] cls.add_method('UnregisterProtocolHandler', 'void', [param('ns3::Callback< 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 >', 'handler')]) ## node.h (module 'network'): void ns3::Node::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='protected', is_virtual=True) ## node.h (module 'network'): void ns3::Node::DoStart() [member function] cls.add_method('DoStart', 'void', [], visibility='protected', is_virtual=True) return def register_Ns3ObjectFactoryChecker_methods(root_module, cls): ## object-factory.h (module 'core'): ns3::ObjectFactoryChecker::ObjectFactoryChecker() [constructor] cls.add_constructor([]) ## object-factory.h (module 'core'): ns3::ObjectFactoryChecker::ObjectFactoryChecker(ns3::ObjectFactoryChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectFactoryChecker const &', 'arg0')]) return def register_Ns3ObjectFactoryValue_methods(root_module, cls): ## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue() [constructor] cls.add_constructor([]) ## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue(ns3::ObjectFactoryValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectFactoryValue const &', 'arg0')]) ## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue(ns3::ObjectFactory const & value) [constructor] cls.add_constructor([param('ns3::ObjectFactory const &', 'value')]) ## object-factory.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::ObjectFactoryValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## object-factory.h (module 'core'): bool ns3::ObjectFactoryValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## object-factory.h (module 'core'): ns3::ObjectFactory ns3::ObjectFactoryValue::Get() const [member function] cls.add_method('Get', 'ns3::ObjectFactory', [], is_const=True) ## object-factory.h (module 'core'): std::string ns3::ObjectFactoryValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## object-factory.h (module 'core'): void ns3::ObjectFactoryValue::Set(ns3::ObjectFactory const & value) [member function] cls.add_method('Set', 'void', [param('ns3::ObjectFactory const &', 'value')]) return def register_Ns3Packet_methods(root_module, cls): cls.add_output_stream_operator() ## packet.h (module 'network'): ns3::Packet::Packet() [constructor] cls.add_constructor([]) ## packet.h (module 'network'): ns3::Packet::Packet(ns3::Packet const & o) [copy constructor] cls.add_constructor([param('ns3::Packet const &', 'o')]) ## packet.h (module 'network'): ns3::Packet::Packet(uint32_t size) [constructor] cls.add_constructor([param('uint32_t', 'size')]) ## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size, bool magic) [constructor] cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size'), param('bool', 'magic')]) ## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size) [constructor] cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## packet.h (module 'network'): void ns3::Packet::AddAtEnd(ns3::Ptr<const ns3::Packet> packet) [member function] cls.add_method('AddAtEnd', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) ## packet.h (module 'network'): void ns3::Packet::AddByteTag(ns3::Tag const & tag) const [member function] cls.add_method('AddByteTag', 'void', [param('ns3::Tag const &', 'tag')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::AddHeader(ns3::Header const & header) [member function] cls.add_method('AddHeader', 'void', [param('ns3::Header const &', 'header')]) ## packet.h (module 'network'): void ns3::Packet::AddPacketTag(ns3::Tag const & tag) const [member function] cls.add_method('AddPacketTag', 'void', [param('ns3::Tag const &', 'tag')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::AddPaddingAtEnd(uint32_t size) [member function] cls.add_method('AddPaddingAtEnd', 'void', [param('uint32_t', 'size')]) ## packet.h (module 'network'): void ns3::Packet::AddTrailer(ns3::Trailer const & trailer) [member function] cls.add_method('AddTrailer', 'void', [param('ns3::Trailer const &', 'trailer')]) ## packet.h (module 'network'): ns3::PacketMetadata::ItemIterator ns3::Packet::BeginItem() const [member function] cls.add_method('BeginItem', 'ns3::PacketMetadata::ItemIterator', [], is_const=True) ## packet.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Packet::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::Packet >', [], is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::CopyData(uint8_t * buffer, uint32_t size) const [member function] cls.add_method('CopyData', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint32_t', 'size')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::CopyData(std::ostream * os, uint32_t size) const [member function] cls.add_method('CopyData', 'void', [param('std::ostream *', 'os'), param('uint32_t', 'size')], is_const=True) ## packet.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Packet::CreateFragment(uint32_t start, uint32_t length) const [member function] cls.add_method('CreateFragment', 'ns3::Ptr< ns3::Packet >', [param('uint32_t', 'start'), param('uint32_t', 'length')], is_const=True) ## packet.h (module 'network'): static void ns3::Packet::EnableChecking() [member function] cls.add_method('EnableChecking', 'void', [], is_static=True) ## packet.h (module 'network'): static void ns3::Packet::EnablePrinting() [member function] cls.add_method('EnablePrinting', 'void', [], is_static=True) ## packet.h (module 'network'): bool ns3::Packet::FindFirstMatchingByteTag(ns3::Tag & tag) const [member function] cls.add_method('FindFirstMatchingByteTag', 'bool', [param('ns3::Tag &', 'tag')], is_const=True) ## packet.h (module 'network'): ns3::ByteTagIterator ns3::Packet::GetByteTagIterator() const [member function] cls.add_method('GetByteTagIterator', 'ns3::ByteTagIterator', [], is_const=True) ## packet.h (module 'network'): ns3::Ptr<ns3::NixVector> ns3::Packet::GetNixVector() const [member function] cls.add_method('GetNixVector', 'ns3::Ptr< ns3::NixVector >', [], is_const=True) ## packet.h (module 'network'): ns3::PacketTagIterator ns3::Packet::GetPacketTagIterator() const [member function] cls.add_method('GetPacketTagIterator', 'ns3::PacketTagIterator', [], is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::GetSize() const [member function] cls.add_method('GetSize', 'uint32_t', [], is_const=True) ## packet.h (module 'network'): uint64_t ns3::Packet::GetUid() const [member function] cls.add_method('GetUid', 'uint64_t', [], is_const=True) ## packet.h (module 'network'): uint8_t const * ns3::Packet::PeekData() const [member function] cls.add_method('PeekData', 'uint8_t const *', [], deprecated=True, is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::PeekHeader(ns3::Header & header) const [member function] cls.add_method('PeekHeader', 'uint32_t', [param('ns3::Header &', 'header')], is_const=True) ## packet.h (module 'network'): bool ns3::Packet::PeekPacketTag(ns3::Tag & tag) const [member function] cls.add_method('PeekPacketTag', 'bool', [param('ns3::Tag &', 'tag')], is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::PeekTrailer(ns3::Trailer & trailer) [member function] cls.add_method('PeekTrailer', 'uint32_t', [param('ns3::Trailer &', 'trailer')]) ## packet.h (module 'network'): void ns3::Packet::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::PrintByteTags(std::ostream & os) const [member function] cls.add_method('PrintByteTags', 'void', [param('std::ostream &', 'os')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::PrintPacketTags(std::ostream & os) const [member function] cls.add_method('PrintPacketTags', 'void', [param('std::ostream &', 'os')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::RemoveAllByteTags() [member function] cls.add_method('RemoveAllByteTags', 'void', []) ## packet.h (module 'network'): void ns3::Packet::RemoveAllPacketTags() [member function] cls.add_method('RemoveAllPacketTags', 'void', []) ## packet.h (module 'network'): void ns3::Packet::RemoveAtEnd(uint32_t size) [member function] cls.add_method('RemoveAtEnd', 'void', [param('uint32_t', 'size')]) ## packet.h (module 'network'): void ns3::Packet::RemoveAtStart(uint32_t size) [member function] cls.add_method('RemoveAtStart', 'void', [param('uint32_t', 'size')]) ## packet.h (module 'network'): uint32_t ns3::Packet::RemoveHeader(ns3::Header & header) [member function] cls.add_method('RemoveHeader', 'uint32_t', [param('ns3::Header &', 'header')]) ## packet.h (module 'network'): bool ns3::Packet::RemovePacketTag(ns3::Tag & tag) [member function] cls.add_method('RemovePacketTag', 'bool', [param('ns3::Tag &', 'tag')]) ## packet.h (module 'network'): uint32_t ns3::Packet::RemoveTrailer(ns3::Trailer & trailer) [member function] cls.add_method('RemoveTrailer', 'uint32_t', [param('ns3::Trailer &', 'trailer')]) ## packet.h (module 'network'): uint32_t ns3::Packet::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function] cls.add_method('Serialize', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::SetNixVector(ns3::Ptr<ns3::NixVector> arg0) [member function] cls.add_method('SetNixVector', 'void', [param('ns3::Ptr< ns3::NixVector >', 'arg0')]) return def register_Ns3RealtimeSimulatorImpl_methods(root_module, cls): ## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::RealtimeSimulatorImpl(ns3::RealtimeSimulatorImpl const & arg0) [copy constructor] cls.add_constructor([param('ns3::RealtimeSimulatorImpl const &', 'arg0')]) ## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::RealtimeSimulatorImpl() [constructor] cls.add_constructor([]) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Cancel(ns3::EventId const & ev) [member function] cls.add_method('Cancel', 'void', [param('ns3::EventId const &', 'ev')], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Destroy() [member function] cls.add_method('Destroy', 'void', [], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): uint32_t ns3::RealtimeSimulatorImpl::GetContext() const [member function] cls.add_method('GetContext', 'uint32_t', [], is_const=True, is_virtual=True) ## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::GetDelayLeft(ns3::EventId const & id) const [member function] cls.add_method('GetDelayLeft', 'ns3::Time', [param('ns3::EventId const &', 'id')], is_const=True, is_virtual=True) ## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::GetHardLimit() const [member function] cls.add_method('GetHardLimit', 'ns3::Time', [], is_const=True) ## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::GetMaximumSimulationTime() const [member function] cls.add_method('GetMaximumSimulationTime', 'ns3::Time', [], is_const=True, is_virtual=True) ## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::SynchronizationMode ns3::RealtimeSimulatorImpl::GetSynchronizationMode() const [member function] cls.add_method('GetSynchronizationMode', 'ns3::RealtimeSimulatorImpl::SynchronizationMode', [], is_const=True) ## realtime-simulator-impl.h (module 'core'): uint32_t ns3::RealtimeSimulatorImpl::GetSystemId() const [member function] cls.add_method('GetSystemId', 'uint32_t', [], is_const=True, is_virtual=True) ## realtime-simulator-impl.h (module 'core'): static ns3::TypeId ns3::RealtimeSimulatorImpl::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## realtime-simulator-impl.h (module 'core'): bool ns3::RealtimeSimulatorImpl::IsExpired(ns3::EventId const & ev) const [member function] cls.add_method('IsExpired', 'bool', [param('ns3::EventId const &', 'ev')], is_const=True, is_virtual=True) ## realtime-simulator-impl.h (module 'core'): bool ns3::RealtimeSimulatorImpl::IsFinished() const [member function] cls.add_method('IsFinished', 'bool', [], is_const=True, is_virtual=True) ## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::Next() const [member function] cls.add_method('Next', 'ns3::Time', [], is_const=True, is_virtual=True) ## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::Now() const [member function] cls.add_method('Now', 'ns3::Time', [], is_const=True, is_virtual=True) ## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::RealtimeNow() const [member function] cls.add_method('RealtimeNow', 'ns3::Time', [], is_const=True) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Remove(ns3::EventId const & ev) [member function] cls.add_method('Remove', 'void', [param('ns3::EventId const &', 'ev')], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Run() [member function] cls.add_method('Run', 'void', [], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::RunOneEvent() [member function] cls.add_method('RunOneEvent', 'void', [], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): ns3::EventId ns3::RealtimeSimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function] cls.add_method('Schedule', 'ns3::EventId', [param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): ns3::EventId ns3::RealtimeSimulatorImpl::ScheduleDestroy(ns3::EventImpl * event) [member function] cls.add_method('ScheduleDestroy', 'ns3::EventId', [param('ns3::EventImpl *', 'event')], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): ns3::EventId ns3::RealtimeSimulatorImpl::ScheduleNow(ns3::EventImpl * event) [member function] cls.add_method('ScheduleNow', 'ns3::EventId', [param('ns3::EventImpl *', 'event')], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtime(ns3::Time const & time, ns3::EventImpl * event) [member function] cls.add_method('ScheduleRealtime', 'void', [param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')]) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtimeNow(ns3::EventImpl * event) [member function] cls.add_method('ScheduleRealtimeNow', 'void', [param('ns3::EventImpl *', 'event')]) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtimeNowWithContext(uint32_t context, ns3::EventImpl * event) [member function] cls.add_method('ScheduleRealtimeNowWithContext', 'void', [param('uint32_t', 'context'), param('ns3::EventImpl *', 'event')]) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtimeWithContext(uint32_t context, ns3::Time const & time, ns3::EventImpl * event) [member function] cls.add_method('ScheduleRealtimeWithContext', 'void', [param('uint32_t', 'context'), param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')]) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleWithContext(uint32_t context, ns3::Time const & time, ns3::EventImpl * event) [member function] cls.add_method('ScheduleWithContext', 'void', [param('uint32_t', 'context'), param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::SetHardLimit(ns3::Time limit) [member function] cls.add_method('SetHardLimit', 'void', [param('ns3::Time', 'limit')]) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function] cls.add_method('SetScheduler', 'void', [param('ns3::ObjectFactory', 'schedulerFactory')], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::SetSynchronizationMode(ns3::RealtimeSimulatorImpl::SynchronizationMode mode) [member function] cls.add_method('SetSynchronizationMode', 'void', [param('ns3::RealtimeSimulatorImpl::SynchronizationMode', 'mode')]) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Stop() [member function] cls.add_method('Stop', 'void', [], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Stop(ns3::Time const & time) [member function] cls.add_method('Stop', 'void', [param('ns3::Time const &', 'time')], is_virtual=True) ## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='private', is_virtual=True) return def register_Ns3TapBridge_methods(root_module, cls): ## tap-bridge.h (module 'tap-bridge'): ns3::TapBridge::TapBridge(ns3::TapBridge const & arg0) [copy constructor] cls.add_constructor([param('ns3::TapBridge const &', 'arg0')]) ## tap-bridge.h (module 'tap-bridge'): ns3::TapBridge::TapBridge() [constructor] cls.add_constructor([]) ## tap-bridge.h (module 'tap-bridge'): void ns3::TapBridge::AddLinkChangeCallback(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function] cls.add_method('AddLinkChangeCallback', 'void', [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')], is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): ns3::Address ns3::TapBridge::GetAddress() const [member function] cls.add_method('GetAddress', 'ns3::Address', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): ns3::Ptr<ns3::NetDevice> ns3::TapBridge::GetBridgedNetDevice() [member function] cls.add_method('GetBridgedNetDevice', 'ns3::Ptr< ns3::NetDevice >', []) ## tap-bridge.h (module 'tap-bridge'): ns3::Address ns3::TapBridge::GetBroadcast() const [member function] cls.add_method('GetBroadcast', 'ns3::Address', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): ns3::Ptr<ns3::Channel> ns3::TapBridge::GetChannel() const [member function] cls.add_method('GetChannel', 'ns3::Ptr< ns3::Channel >', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): uint32_t ns3::TapBridge::GetIfIndex() const [member function] cls.add_method('GetIfIndex', 'uint32_t', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): ns3::TapBridge::Mode ns3::TapBridge::GetMode() [member function] cls.add_method('GetMode', 'ns3::TapBridge::Mode', []) ## tap-bridge.h (module 'tap-bridge'): uint16_t ns3::TapBridge::GetMtu() const [member function] cls.add_method('GetMtu', 'uint16_t', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): 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 (module 'tap-bridge'): 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 (module 'tap-bridge'): ns3::Ptr<ns3::Node> ns3::TapBridge::GetNode() const [member function] cls.add_method('GetNode', 'ns3::Ptr< ns3::Node >', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): static ns3::TypeId ns3::TapBridge::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## tap-bridge.h (module 'tap-bridge'): bool ns3::TapBridge::IsBridge() const [member function] cls.add_method('IsBridge', 'bool', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): bool ns3::TapBridge::IsBroadcast() const [member function] cls.add_method('IsBroadcast', 'bool', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): bool ns3::TapBridge::IsLinkUp() const [member function] cls.add_method('IsLinkUp', 'bool', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): bool ns3::TapBridge::IsMulticast() const [member function] cls.add_method('IsMulticast', 'bool', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): bool ns3::TapBridge::IsPointToPoint() const [member function] cls.add_method('IsPointToPoint', 'bool', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): bool ns3::TapBridge::NeedsArp() const [member function] cls.add_method('NeedsArp', 'bool', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): bool ns3::TapBridge::Send(ns3::Ptr<ns3::Packet> 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 (module 'tap-bridge'): bool ns3::TapBridge::SendFrom(ns3::Ptr<ns3::Packet> 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 (module 'tap-bridge'): void ns3::TapBridge::SetAddress(ns3::Address address) [member function] cls.add_method('SetAddress', 'void', [param('ns3::Address', 'address')], is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): void ns3::TapBridge::SetBridgedNetDevice(ns3::Ptr<ns3::NetDevice> bridgedDevice) [member function] cls.add_method('SetBridgedNetDevice', 'void', [param('ns3::Ptr< ns3::NetDevice >', 'bridgedDevice')]) ## tap-bridge.h (module 'tap-bridge'): 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 (module 'tap-bridge'): void ns3::TapBridge::SetMode(ns3::TapBridge::Mode mode) [member function] cls.add_method('SetMode', 'void', [param('ns3::TapBridge::Mode', 'mode')]) ## tap-bridge.h (module 'tap-bridge'): 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 (module 'tap-bridge'): void ns3::TapBridge::SetNode(ns3::Ptr<ns3::Node> node) [member function] cls.add_method('SetNode', 'void', [param('ns3::Ptr< ns3::Node >', 'node')], is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): void ns3::TapBridge::SetPromiscReceiveCallback(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) [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 (module 'tap-bridge'): void ns3::TapBridge::SetReceiveCallback(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) [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 (module 'tap-bridge'): void ns3::TapBridge::Start(ns3::Time tStart) [member function] cls.add_method('Start', 'void', [param('ns3::Time', 'tStart')]) ## tap-bridge.h (module 'tap-bridge'): void ns3::TapBridge::Stop(ns3::Time tStop) [member function] cls.add_method('Stop', 'void', [param('ns3::Time', 'tStop')]) ## tap-bridge.h (module 'tap-bridge'): bool ns3::TapBridge::SupportsSendFrom() const [member function] cls.add_method('SupportsSendFrom', 'bool', [], is_const=True, is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): bool ns3::TapBridge::DiscardFromBridgedDevice(ns3::Ptr<ns3::NetDevice> device, ns3::Ptr<const ns3::Packet> packet, uint16_t protocol, ns3::Address const & src) [member function] cls.add_method('DiscardFromBridgedDevice', 'bool', [param('ns3::Ptr< ns3::NetDevice >', 'device'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('uint16_t', 'protocol'), param('ns3::Address const &', 'src')], visibility='protected') ## tap-bridge.h (module 'tap-bridge'): void ns3::TapBridge::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='protected', is_virtual=True) ## tap-bridge.h (module 'tap-bridge'): bool ns3::TapBridge::ReceiveFromBridgedDevice(ns3::Ptr<ns3::NetDevice> device, ns3::Ptr<const ns3::Packet> packet, uint16_t protocol, ns3::Address const & src, ns3::Address const & dst, ns3::NetDevice::PacketType packetType) [member function] cls.add_method('ReceiveFromBridgedDevice', 'bool', [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_Ns3TapBridgeFdReader_methods(root_module, cls): ## tap-bridge.h (module 'tap-bridge'): ns3::TapBridgeFdReader::TapBridgeFdReader() [constructor] cls.add_constructor([]) ## tap-bridge.h (module 'tap-bridge'): ns3::TapBridgeFdReader::TapBridgeFdReader(ns3::TapBridgeFdReader const & arg0) [copy constructor] cls.add_constructor([param('ns3::TapBridgeFdReader const &', 'arg0')]) ## tap-bridge.h (module 'tap-bridge'): ns3::FdReader::Data ns3::TapBridgeFdReader::DoRead() [member function] cls.add_method('DoRead', 'ns3::FdReader::Data', [], visibility='private', is_virtual=True) return def register_Ns3TimeChecker_methods(root_module, cls): ## nstime.h (module 'core'): ns3::TimeChecker::TimeChecker() [constructor] cls.add_constructor([]) ## nstime.h (module 'core'): ns3::TimeChecker::TimeChecker(ns3::TimeChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::TimeChecker const &', 'arg0')]) return def register_Ns3TimeValue_methods(root_module, cls): ## nstime.h (module 'core'): ns3::TimeValue::TimeValue() [constructor] cls.add_constructor([]) ## nstime.h (module 'core'): ns3::TimeValue::TimeValue(ns3::TimeValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::TimeValue const &', 'arg0')]) ## nstime.h (module 'core'): ns3::TimeValue::TimeValue(ns3::Time const & value) [constructor] cls.add_constructor([param('ns3::Time const &', 'value')]) ## nstime.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::TimeValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## nstime.h (module 'core'): bool ns3::TimeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## nstime.h (module 'core'): ns3::Time ns3::TimeValue::Get() const [member function] cls.add_method('Get', 'ns3::Time', [], is_const=True) ## nstime.h (module 'core'): std::string ns3::TimeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## nstime.h (module 'core'): void ns3::TimeValue::Set(ns3::Time const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Time const &', 'value')]) return def register_Ns3TypeIdChecker_methods(root_module, cls): ## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker() [constructor] cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker(ns3::TypeIdChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::TypeIdChecker const &', 'arg0')]) return def register_Ns3TypeIdValue_methods(root_module, cls): ## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue() [constructor] cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeIdValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::TypeIdValue const &', 'arg0')]) ## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeId const & value) [constructor] cls.add_constructor([param('ns3::TypeId const &', 'value')]) ## type-id.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::TypeIdValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## type-id.h (module 'core'): bool ns3::TypeIdValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeIdValue::Get() const [member function] cls.add_method('Get', 'ns3::TypeId', [], is_const=True) ## type-id.h (module 'core'): std::string ns3::TypeIdValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## type-id.h (module 'core'): void ns3::TypeIdValue::Set(ns3::TypeId const & value) [member function] cls.add_method('Set', 'void', [param('ns3::TypeId const &', 'value')]) return def register_Ns3AddressChecker_methods(root_module, cls): ## address.h (module 'network'): ns3::AddressChecker::AddressChecker() [constructor] cls.add_constructor([]) ## address.h (module 'network'): ns3::AddressChecker::AddressChecker(ns3::AddressChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::AddressChecker const &', 'arg0')]) return def register_Ns3AddressValue_methods(root_module, cls): ## address.h (module 'network'): ns3::AddressValue::AddressValue() [constructor] cls.add_constructor([]) ## address.h (module 'network'): ns3::AddressValue::AddressValue(ns3::AddressValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::AddressValue const &', 'arg0')]) ## address.h (module 'network'): ns3::AddressValue::AddressValue(ns3::Address const & value) [constructor] cls.add_constructor([param('ns3::Address const &', 'value')]) ## address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::AddressValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## address.h (module 'network'): bool ns3::AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## address.h (module 'network'): ns3::Address ns3::AddressValue::Get() const [member function] cls.add_method('Get', 'ns3::Address', [], is_const=True) ## address.h (module 'network'): std::string ns3::AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## address.h (module 'network'): void ns3::AddressValue::Set(ns3::Address const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Address const &', 'value')]) return def register_functions(root_module): module = root_module register_functions_ns3_FatalImpl(module.get_submodule('FatalImpl'), root_module) return def register_functions_ns3_FatalImpl(module, root_module): return def main(): out = FileCodeSink(sys.stdout) root_module = module_init() register_types(root_module) register_methods(root_module) register_functions(root_module) root_module.generate(out) if __name__ == '__main__': main()
zy901002-gpsr
src/tap-bridge/bindings/modulegen__gcc_LP64.py
Python
gpl2
278,050
callback_classes = [ ['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', 'unsigned char*', 'long', 'ns3::empty', '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'], ]
zy901002-gpsr
src/tap-bridge/bindings/callbacks_list.py
Python
gpl2
763
import os def post_register_types(root_module): enabled_features = os.environ['NS3_ENABLED_FEATURES'].split(',') if 'TapBridge' not in enabled_features: for clsname in ['TapBridge', 'TapBridgeHelper', 'TapBridgeFdReader']: root_module.classes.remove(root_module['ns3::%s' % clsname]) root_module.enums.remove(root_module['ns3::TapBridge::Mode'])
zy901002-gpsr
src/tap-bridge/bindings/modulegen_customizations.py
Python
gpl2
384
#! /usr/bin/env python ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- # A list of C++ examples to run in order to ensure that they remain # buildable and runnable over time. Each tuple in the list contains # # (example_name, do_run, do_valgrind_run). # # See test.py for more information. cpp_examples = [ ("tap-wifi-dumbbell", "False", "True"), # Requires manual configuration ] # A list of Python examples to run in order to ensure that they remain # runnable over time. Each tuple in the list contains # # (example_name, do_run). # # See test.py for more information. python_examples = [ ("tap-csma-virtual-machine.py", "False"), # requires enable-sudo ("tap-wifi-virtual-machine.py", "False"), # requires enable-sudo ]
zy901002-gpsr
src/tap-bridge/test/examples-to-run.py
Python
gpl2
784
/* -*- 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 // // +----------+ // | external | // | Linux | // | Host | // | | // | "mytap" | // +----------+ // | n0 n3 n4 // | +--------+ +------------+ +------------+ // +-------| tap | | | | | // | bridge | ... | | | | // +--------+ +------------+ +------------+ // | Wifi | | Wifi | P2P |-----| P2P | CSMA | // +--------+ +------+-----+ +-----+------+ // | | ^ | // ((*)) ((*)) | | // P2P 10.1.2 | // ((*)) ((*)) | n5 n6 n7 // | | | | | | // n1 n2 ================ // Wifi 10.1.1 CSMA LAN 10.1.3 // // The Wifi device on node zero is: 10.1.1.1 // The Wifi device on node one is: 10.1.1.2 // The Wifi device on node two is: 10.1.1.3 // The Wifi device on node three is: 10.1.1.4 // The P2P device on node three is: 10.1.2.1 // The P2P device on node four is: 10.1.2.2 // The CSMA device on node four is: 10.1.3.1 // The CSMA device on node five is: 10.1.3.2 // The CSMA device on node six is: 10.1.3.3 // The CSMA device on node seven is: 10.1.3.4 // // Some simple things to do: // // 1) Ping one of the simulated nodes on the left side of the topology. // // ./waf --run tap-wifi-dumbbell& // ping 10.1.1.3 // // 2) Configure a route in the linux host and ping once of the nodes on the // right, across the point-to-point link. You will see relatively large // delays due to CBR background traffic on the point-to-point (see next // item). // // ./waf --run tap-wifi-dumbbell& // sudo route add -net 10.1.3.0 netmask 255.255.255.0 dev thetap gw 10.1.1.2 // ping 10.1.3.4 // // Take a look at the pcap traces and note that the timing reflects the // addition of the significant delay and low bandwidth configured on the // point-to-point link along with the high traffic. // // 3) Fiddle with the background CBR traffic across the point-to-point // link and watch the ping timing change. The OnOffApplication "DataRate" // attribute defaults to 500kb/s and the "PacketSize" Attribute defaults // to 512. The point-to-point "DataRate" is set to 512kb/s in the script, // so in the default case, the link is pretty full. This should be // reflected in large delays seen by ping. You can crank down the CBR // traffic data rate and watch the ping timing change dramatically. // // ./waf --run "tap-wifi-dumbbell --ns3::OnOffApplication::DataRate=100kb/s"& // sudo route add -net 10.1.3.0 netmask 255.255.255.0 dev thetap gw 10.1.1.2 // ping 10.1.3.4 // // 4) Try to run this in UseBridge mode. This allows you to bridge an ns-3 // simulation to an existing pre-configured bridge. This uses tap devices // just for illustration, you can create your own bridge if you want. // // sudo tunctl -t mytap1 // sudo ifconfig mytap1 0.0.0.0 promisc up // sudo tunctl -t mytap2 // sudo ifconfig mytap2 0.0.0.0 promisc up // sudo brctl addbr mybridge // sudo brctl addif mybridge mytap1 // sudo brctl addif mybridge mytap2 // sudo ifconfig mybridge 10.1.1.5 netmask 255.255.255.0 up // ./waf --run "tap-wifi-dumbbell --mode=UseBridge --tapName=mytap2"& // ping 10.1.1.3 #include <iostream> #include <fstream> #include "ns3/core-module.h" #include "ns3/network-module.h" #include "ns3/mobility-module.h" #include "ns3/point-to-point-module.h" #include "ns3/wifi-module.h" #include "ns3/internet-module.h" #include "ns3/csma-module.h" #include "ns3/applications-module.h" #include "ns3/ipv4-global-routing-helper.h" #include "ns3/tap-bridge-module.h" using namespace ns3; NS_LOG_COMPONENT_DEFINE ("TapDumbbellExample"); int main (int argc, char *argv[]) { std::string mode = "ConfigureLocal"; std::string tapName = "thetap"; CommandLine cmd; cmd.AddValue ("mode", "Mode setting of TapBridge", mode); cmd.AddValue ("tapName", "Name of the OS tap device", tapName); cmd.Parse (argc, argv); GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::RealtimeSimulatorImpl")); GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true)); // // The topology has a Wifi network of four nodes on the left side. We'll make // node zero the AP and have the other three will be the STAs. // NodeContainer nodesLeft; nodesLeft.Create (4); YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default (); wifiPhy.SetChannel (wifiChannel.Create ()); Ssid ssid = Ssid ("left"); WifiHelper wifi = WifiHelper::Default (); NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); wifi.SetRemoteStationManager ("ns3::ArfWifiManager"); wifiMac.SetType ("ns3::ApWifiMac", "Ssid", SsidValue (ssid)); NetDeviceContainer devicesLeft = wifi.Install (wifiPhy, wifiMac, nodesLeft.Get (0)); 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)))); MobilityHelper mobility; mobility.Install (nodesLeft); InternetStackHelper internetLeft; internetLeft.Install (nodesLeft); Ipv4AddressHelper ipv4Left; ipv4Left.SetBase ("10.1.1.0", "255.255.255.0"); Ipv4InterfaceContainer interfacesLeft = ipv4Left.Assign (devicesLeft); TapBridgeHelper tapBridge (interfacesLeft.GetAddress (1)); tapBridge.SetAttribute ("Mode", StringValue (mode)); tapBridge.SetAttribute ("DeviceName", StringValue (tapName)); tapBridge.Install (nodesLeft.Get (0), devicesLeft.Get (0)); // // Now, create the right side. // NodeContainer nodesRight; nodesRight.Create (4); CsmaHelper csmaRight; csmaRight.SetChannelAttribute ("DataRate", DataRateValue (5000000)); csmaRight.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); NetDeviceContainer devicesRight = csmaRight.Install (nodesRight); InternetStackHelper internetRight; internetRight.Install (nodesRight); Ipv4AddressHelper ipv4Right; ipv4Right.SetBase ("10.1.3.0", "255.255.255.0"); Ipv4InterfaceContainer interfacesRight = ipv4Right.Assign (devicesRight); // // Stick in the point-to-point line between the sides. // PointToPointHelper p2p; p2p.SetDeviceAttribute ("DataRate", StringValue ("512kbps")); p2p.SetChannelAttribute ("Delay", StringValue ("10ms")); NodeContainer nodes = NodeContainer (nodesLeft.Get (3), nodesRight.Get (0)); NetDeviceContainer devices = p2p.Install (nodes); Ipv4AddressHelper ipv4; ipv4.SetBase ("10.1.2.0", "255.255.255.192"); Ipv4InterfaceContainer interfaces = ipv4.Assign (devices); // // Simulate some CBR traffic over the point-to-point link // uint16_t port = 9; // Discard port (RFC 863) OnOffHelper onoff ("ns3::UdpSocketFactory", InetSocketAddress (interfaces.GetAddress (1), port)); onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); ApplicationContainer apps = onoff.Install (nodesLeft.Get (3)); apps.Start (Seconds (1.0)); // Create a packet sink to receive these packets PacketSinkHelper sink ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), port)); apps = sink.Install (nodesRight.Get (0)); apps.Start (Seconds (1.0)); wifiPhy.EnablePcapAll ("tap-wifi-dumbbell"); csmaRight.EnablePcapAll ("tap-wifi-dumbbell", false); Ipv4GlobalRoutingHelper::PopulateRoutingTables (); Simulator::Stop (Seconds (60.)); Simulator::Run (); Simulator::Destroy (); }
zy901002-gpsr
src/tap-bridge/examples/tap-wifi-dumbbell.cc
C++
gpl2
8,837
# -*- Mode: Python; -*- # # Copyright 2010 University of Washington # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # import sys import ns.core import ns.internet import ns.mobility import ns.network import ns.tap_bridge import ns.wifi def main(argv): # # We are interacting with the outside, real, world. This means we have to # interact in real-time and therefore we have to use the real-time simulator # and take the time to calculate checksums. # ns.core.GlobalValue.Bind("SimulatorImplementationType", ns.core.StringValue("ns3::RealtimeSimulatorImpl")) ns.core.GlobalValue.Bind("ChecksumEnabled", ns.core.BooleanValue("true")) # # Create two ghost nodes. The first will represent the virtual machine host # on the left side of the network; and the second will represent the VM on # the right side. # nodes = ns.network.NodeContainer() nodes.Create (2); # # We're going to use 802.11 A so set up a wifi helper to reflect that. # wifi = ns.wifi.WifiHelper.Default() wifi.SetStandard (ns.wifi.WIFI_PHY_STANDARD_80211a); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", ns.core.StringValue ("OfdmRate54Mbps")); # # No reason for pesky access points, so we'll use an ad-hoc network. # wifiMac = ns.wifi.NqosWifiMacHelper.Default() wifiMac.SetType ("ns3::AdhocWifiMac"); # # Configure the physcial layer. # wifiChannel = ns.wifi.YansWifiChannelHelper.Default() wifiPhy = ns.wifi.YansWifiPhyHelper.Default() wifiPhy.SetChannel(wifiChannel.Create()) # # Install the wireless devices onto our ghost nodes. # devices = wifi.Install(wifiPhy, wifiMac, nodes) # # We need location information since we are talking about wifi, so add a # constant position to the ghost nodes. # mobility = ns.mobility.MobilityHelper() positionAlloc = ns.mobility.ListPositionAllocator() positionAlloc.Add(ns.core.Vector(0.0, 0.0, 0.0)) positionAlloc.Add(ns.core.Vector(5.0, 0.0, 0.0)) mobility.SetPositionAllocator(positionAlloc) mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel") mobility.Install(nodes) # # Use the TapBridgeHelper to connect to the pre-configured tap devices for # the left side. We go with "UseLocal" mode since the wifi devices do not # support promiscuous mode (because of their natures0. This is a special # case mode that allows us to extend a linux bridge into ns-3 IFF we will # only see traffic from one other device on that bridge. That is the case # for this configuration. # tapBridge = ns.tap_bridge.TapBridgeHelper() tapBridge.SetAttribute ("Mode", ns.core.StringValue ("UseLocal")); tapBridge.SetAttribute ("DeviceName", ns.core.StringValue ("tap-left")); tapBridge.Install (nodes.Get (0), devices.Get (0)); # # Connect the right side tap to the right side wifi device on the right-side # ghost node. # tapBridge.SetAttribute ("DeviceName", ns.core.StringValue ("tap-right")); tapBridge.Install (nodes.Get (1), devices.Get (1)); # # Run the simulation for ten minutes to give the user time to play around # ns.core.Simulator.Stop (ns.core.Seconds (600)); ns.core.Simulator.Run(signal_check_frequency = -1) ns.core.Simulator.Destroy() return 0 if __name__ == '__main__': sys.exit(main(sys.argv))
zy901002-gpsr
src/tap-bridge/examples/tap-wifi-virtual-machine.py
Python
gpl2
4,041
/* -*- 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 // // Packets sent to the device "thetap" on the Linux host will be sent to the // tap bridge on node zero and then emitted onto the ns-3 simulated CSMA // network. ARP will be used on the CSMA network to resolve MAC addresses. // Packets destined for the CSMA device on node zero will be sent to the // device "thetap" on the linux Host. // // +----------+ // | external | // | Linux | // | Host | // | | // | "thetap" | // +----------+ // | n0 n1 n2 n3 // | +--------+ +--------+ +--------+ +--------+ // +-------| tap | | | | | | | // | bridge | | | | | | | // +--------+ +--------+ +--------+ +--------+ // | CSMA | | CSMA | | CSMA | | CSMA | // +--------+ +--------+ +--------+ +--------+ // | | | | // | | | | // | | | | // =========================================== // CSMA LAN 10.1.1 // // The CSMA device on node zero is: 10.1.1.1 // The CSMA device on node one is: 10.1.1.2 // The CSMA device on node two is: 10.1.1.3 // The CSMA device on node three is: 10.1.1.4 // // Some simple things to do: // // 1) Ping one of the simulated nodes // // ./waf --run tap-csma& // ping 10.1.1.2 // #include <iostream> #include <fstream> #include "ns3/core-module.h" #include "ns3/network-module.h" #include "ns3/wifi-module.h" #include "ns3/csma-module.h" #include "ns3/internet-module.h" #include "ns3/ipv4-global-routing-helper.h" #include "ns3/tap-bridge-module.h" using namespace ns3; NS_LOG_COMPONENT_DEFINE ("TapCsmaExample"); int main (int argc, char *argv[]) { std::string mode = "ConfigureLocal"; std::string tapName = "thetap"; CommandLine cmd; cmd.AddValue ("mode", "Mode setting of TapBridge", mode); cmd.AddValue ("tapName", "Name of the OS tap device", tapName); cmd.Parse (argc, argv); GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::RealtimeSimulatorImpl")); GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true)); NodeContainer nodes; nodes.Create (4); CsmaHelper csma; csma.SetChannelAttribute ("DataRate", DataRateValue (5000000)); csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); NetDeviceContainer devices = csma.Install (nodes); InternetStackHelper stack; stack.Install (nodes); Ipv4AddressHelper addresses; addresses.SetBase ("10.1.1.0", "255.255.255.0"); Ipv4InterfaceContainer interfaces = addresses.Assign (devices); TapBridgeHelper tapBridge; tapBridge.SetAttribute ("Mode", StringValue (mode)); tapBridge.SetAttribute ("DeviceName", StringValue (tapName)); tapBridge.Install (nodes.Get (0), devices.Get (0)); csma.EnablePcapAll ("tap-csma", false); Ipv4GlobalRoutingHelper::PopulateRoutingTables (); Simulator::Stop (Seconds (60.)); Simulator::Run (); Simulator::Destroy (); }
zy901002-gpsr
src/tap-bridge/examples/tap-csma.cc
C++
gpl2
3,935
# -*- Mode: Python; -*- # # Copyright 2010 University of Washington # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # import sys import ns.core import ns.csma import ns.internet import ns.network import ns.tap_bridge def main(argv): # # We are interacting with the outside, real, world. This means we have to # interact in real-time and therefore we have to use the real-time simulator # and take the time to calculate checksums. # ns.core.GlobalValue.Bind("SimulatorImplementationType", ns.core.StringValue("ns3::RealtimeSimulatorImpl")) ns.core.GlobalValue.Bind("ChecksumEnabled", ns.core.BooleanValue("true")) # # Create two ghost nodes. The first will represent the virtual machine host # on the left side of the network; and the second will represent the VM on # the right side. # nodes = ns.network.NodeContainer() nodes.Create (2) # # Use a CsmaHelper to get a CSMA channel created, and the needed net # devices installed on both of the nodes. The data rate and delay for the # channel can be set through the command-line parser. # csma = ns.csma.CsmaHelper() devices = csma.Install(nodes) # # Use the TapBridgeHelper to connect to the pre-configured tap devices for # the left side. We go with "UseLocal" mode since the wifi devices do not # support promiscuous mode (because of their natures0. This is a special # case mode that allows us to extend a linux bridge into ns-3 IFF we will # only see traffic from one other device on that bridge. That is the case # for this configuration. # tapBridge = ns.tap_bridge.TapBridgeHelper() tapBridge.SetAttribute ("Mode", ns.core.StringValue ("UseLocal")) tapBridge.SetAttribute ("DeviceName", ns.core.StringValue ("tap-left")) tapBridge.Install (nodes.Get (0), devices.Get (0)) # # Connect the right side tap to the right side wifi device on the right-side # ghost node. # tapBridge.SetAttribute ("DeviceName", ns.core.StringValue ("tap-right")) tapBridge.Install (nodes.Get (1), devices.Get (1)) # # Run the simulation for ten minutes to give the user time to play around # ns.core.Simulator.Stop (ns.core.Seconds (600)) ns.core.Simulator.Run(signal_check_frequency = -1) ns.core.Simulator.Destroy() return 0 if __name__ == '__main__': sys.exit(main(sys.argv))
zy901002-gpsr
src/tap-bridge/examples/tap-csma-virtual-machine.py
Python
gpl2
3,012
/* -*- 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 */ // // This is an illustration of how one could use virtualization techniques to // allow running applications on virtual machines talking over simulated // networks. // // The actual steps required to configure the virtual machines can be rather // involved, so we don't go into that here. Please have a look at one of // our HOWTOs on the nsnam wiki for more details about how to get the // system confgured. For an example, have a look at "HOWTO Use Linux // Containers to set up virtual networks" which uses this code as an // example. // // The configuration you are after is explained in great detail in the // HOWTO, but looks like the following: // // +----------+ +----------+ // | virtual | | virtual | // | Linux | | Linux | // | Host | | Host | // | | | | // | eth0 | | eth0 | // +----------+ +----------+ // | | // +----------+ +----------+ // | Linux | | Linux | // | Bridge | | Bridge | // +----------+ +----------+ // | | // +------------+ +-------------+ // | "tap-left" | | "tap-right" | // +------------+ +-------------+ // | n0 n1 | // | +--------+ +--------+ | // +-------| tap | | tap |-------+ // | bridge | | bridge | // +--------+ +--------+ // | wifi | | wifi | // +--------+ +--------+ // | | // ((*)) ((*)) // // Wifi LAN // // ((*)) // | // +--------+ // | wifi | // +--------+ // | access | // | point | // +--------+ // #include <iostream> #include <fstream> #include "ns3/core-module.h" #include "ns3/network-module.h" #include "ns3/mobility-module.h" #include "ns3/wifi-module.h" #include "ns3/tap-bridge-module.h" using namespace ns3; NS_LOG_COMPONENT_DEFINE ("TapWifiVirtualMachineExample"); int main (int argc, char *argv[]) { CommandLine cmd; cmd.Parse (argc, argv); // // We are interacting with the outside, real, world. This means we have to // interact in real-time and therefore means we have to use the real-time // simulator and take the time to calculate checksums. // GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::RealtimeSimulatorImpl")); GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true)); // // Create two ghost nodes. The first will represent the virtual machine host // on the left side of the network; and the second will represent the VM on // the right side. // NodeContainer nodes; nodes.Create (2); // // We're going to use 802.11 A so set up a wifi helper to reflect that. // WifiHelper wifi = WifiHelper::Default (); wifi.SetStandard (WIFI_PHY_STANDARD_80211a); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("OfdmRate54Mbps")); // // No reason for pesky access points, so we'll use an ad-hoc network. // NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); wifiMac.SetType ("ns3::AdhocWifiMac"); // // Configure the physcial layer. // YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default (); YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); wifiPhy.SetChannel (wifiChannel.Create ()); // // Install the wireless devices onto our ghost nodes. // NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, nodes); // // We need location information since we are talking about wifi, so add a // constant position to the ghost nodes. // MobilityHelper mobility; Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> (); positionAlloc->Add (Vector (0.0, 0.0, 0.0)); positionAlloc->Add (Vector (5.0, 0.0, 0.0)); mobility.SetPositionAllocator (positionAlloc); mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (nodes); // // Use the TapBridgeHelper to connect to the pre-configured tap devices for // the left side. We go with "UseLocal" mode since the wifi devices do not // support promiscuous mode (because of their natures0. This is a special // case mode that allows us to extend a linux bridge into ns-3 IFF we will // only see traffic from one other device on that bridge. That is the case // for this configuration. // TapBridgeHelper tapBridge; tapBridge.SetAttribute ("Mode", StringValue ("UseLocal")); tapBridge.SetAttribute ("DeviceName", StringValue ("tap-left")); tapBridge.Install (nodes.Get (0), devices.Get (0)); // // Connect the right side tap to the right side wifi device on the right-side // ghost node. // tapBridge.SetAttribute ("DeviceName", StringValue ("tap-right")); tapBridge.Install (nodes.Get (1), devices.Get (1)); // // Run the simulation for ten minutes to give the user time to play around // Simulator::Stop (Seconds (600.)); Simulator::Run (); Simulator::Destroy (); }
zy901002-gpsr
src/tap-bridge/examples/tap-wifi-virtual-machine.cc
C++
gpl2
6,309
/* -*- 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 */ // // This is an illustration of how one could use virtualization techniques to // allow running applications on virtual machines talking over simulated // networks. // // The actual steps required to configure the virtual machines can be rather // involved, so we don't go into that here. Please have a look at one of // our HOWTOs on the nsnam wiki for more details about how to get the // system confgured. For an example, have a look at "HOWTO Use Linux // Containers to set up virtual networks" which uses this code as an // example. // // The configuration you are after is explained in great detail in the // HOWTO, but looks like the following: // // +----------+ +----------+ // | virtual | | virtual | // | Linux | | Linux | // | Host | | Host | // | | | | // | eth0 | | eth0 | // +----------+ +----------+ // | | // +----------+ +----------+ // | Linux | | Linux | // | Bridge | | Bridge | // +----------+ +----------+ // | | // +------------+ +-------------+ // | "tap-left" | | "tap-right" | // +------------+ +-------------+ // | n0 n1 | // | +--------+ +--------+ | // +-------| tap | | tap |-------+ // | bridge | | bridge | // +--------+ +--------+ // | CSMA | | CSMA | // +--------+ +--------+ // | | // | | // | | // =============== // CSMA LAN // #include <iostream> #include <fstream> #include "ns3/core-module.h" #include "ns3/network-module.h" #include "ns3/csma-module.h" #include "ns3/tap-bridge-module.h" using namespace ns3; NS_LOG_COMPONENT_DEFINE ("TapCsmaVirtualMachineExample"); int main (int argc, char *argv[]) { CommandLine cmd; cmd.Parse (argc, argv); // // We are interacting with the outside, real, world. This means we have to // interact in real-time and therefore means we have to use the real-time // simulator and take the time to calculate checksums. // GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::RealtimeSimulatorImpl")); GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true)); // // Create two ghost nodes. The first will represent the virtual machine host // on the left side of the network; and the second will represent the VM on // the right side. // NodeContainer nodes; nodes.Create (2); // // Use a CsmaHelper to get a CSMA channel created, and the needed net // devices installed on both of the nodes. The data rate and delay for the // channel can be set through the command-line parser. For example, // // ./waf --run "tap=csma-virtual-machine --ns3::CsmaChannel::DataRate=10000000" // CsmaHelper csma; NetDeviceContainer devices = csma.Install (nodes); // // Use the TapBridgeHelper to connect to the pre-configured tap devices for // the left side. We go with "UseBridge" mode since the CSMA devices support // promiscuous mode and can therefore make it appear that the bridge is // extended into ns-3. The install method essentially bridges the specified // tap to the specified CSMA device. // TapBridgeHelper tapBridge; tapBridge.SetAttribute ("Mode", StringValue ("UseBridge")); tapBridge.SetAttribute ("DeviceName", StringValue ("tap-left")); tapBridge.Install (nodes.Get (0), devices.Get (0)); // // Connect the right side tap to the right side CSMA device on the right-side // ghost node. // tapBridge.SetAttribute ("DeviceName", StringValue ("tap-right")); tapBridge.Install (nodes.Get (1), devices.Get (1)); // // Run the simulation for ten minutes to give the user time to play around // Simulator::Stop (Seconds (600.)); Simulator::Run (); Simulator::Destroy (); }
zy901002-gpsr
src/tap-bridge/examples/tap-csma-virtual-machine.cc
C++
gpl2
5,087
#!/bin/sh brctl addbr br-left brctl addbr br-right tunctl -t tap-left tunctl -t tap-right ifconfig tap-left 0.0.0.0 promisc up ifconfig tap-right 0.0.0.0 promisc up brctl addif br-left tap-left ifconfig br-left up brctl addif br-right tap-right ifconfig br-right up pushd /proc/sys/net/bridge for f in bridge-nf-*; do echo 0 > $f; done popd lxc-create -n left -f lxc-left.conf lxc-create -n right -f lxc-right.conf
zy901002-gpsr
src/tap-bridge/examples/virtual-network-setup.sh
Shell
gpl2
415
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- def build(bld): env = bld.env if env['ENABLE_TAP']: obj = bld.create_ns3_program('tap-csma', ['csma', 'tap-bridge', 'internet', 'wifi']) obj.source = 'tap-csma.cc' obj = bld.create_ns3_program('tap-csma-virtual-machine', ['csma', 'tap-bridge', 'internet']) obj.source = 'tap-csma-virtual-machine.cc' bld.register_ns3_script('tap-csma-virtual-machine.py', ['csma', 'tap-bridge', 'internet']) obj = bld.create_ns3_program('tap-wifi-virtual-machine', ['csma', 'tap-bridge', 'internet', 'wifi', 'mobility']) obj.source = 'tap-wifi-virtual-machine.cc' bld.register_ns3_script('tap-wifi-virtual-machine.py', ['csma', 'tap-bridge', 'internet', 'wifi', 'mobility']) obj = bld.create_ns3_program('tap-wifi-dumbbell', ['wifi', 'csma', 'point-to-point', 'tap-bridge', 'internet']) obj.source = 'tap-wifi-dumbbell.cc'
zy901002-gpsr
src/tap-bridge/examples/wscript
Python
gpl2
979
#!/bin/sh lxc-destroy -n left lxc-destroy -n right ifconfig br-left down ifconfig br-right down brctl delif br-left tap-left brctl delif br-right tap-right brctl delbr br-left brctl delbr br-right ifconfig tap-left down ifconfig tap-right down tunctl -d tap-left tunctl -d tap-right
zy901002-gpsr
src/tap-bridge/examples/virtual-network-teardown.sh
Shell
gpl2
283
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2009 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef TAP_BRIDGE_HELPER_H #define TAP_BRIDGE_HELPER_H #include "ns3/net-device-container.h" #include "ns3/object-factory.h" #include "ns3/tap-bridge.h" #include <string> namespace ns3 { class Node; class AttributeValue; /** * \brief build TapBridge to allow ns-3 simulations to interact with Linux * tap devices and processes on the Linux host. */ class TapBridgeHelper { public: /** * Construct a TapBridgeHelper to make life easier for people wanting to * have their simulations interact with Linux tap devices and processes * on the Linux host. */ TapBridgeHelper (); /** * Construct a TapBridgeHelper to make life easier for people wanting to * have their simulations interact with Linux tap devices and processes * on the Linux host. * * \param gateway An Ipv4Address to be used as the default gateway for * the created bridges, */ TapBridgeHelper (Ipv4Address gateway); /* * Set an attribute in the underlying TapBridge net device when these * devices are automatically created. * * \param n1 the name of the attribute to set * \param v1 the value of the attribute to set */ void SetAttribute (std::string n1, const AttributeValue &v1); /** * This method installs a TapBridge on the specified Node and forms the * bridge with the NetDevice specified. The Node is specified using * a Ptr<Node> and the NetDevice is specified using a Ptr<NetDevice> * * \param node The Ptr<Node> to install the TapBridge in * \param nd The Ptr<NetDevice> to attach to the bridge. * \returns A pointer to the new TapBridge NetDevice. */ Ptr<NetDevice> Install (Ptr<Node> node, Ptr<NetDevice> nd); /** * This method installs a TapBridge on the specified Node and forms the * bridge with the NetDevice specified. The node is specified by a * name string that has previously been associated with the Node using * the Object Name Service. The NetDevice is specified by a Ptr<NetDevice>. * * \param nodeName The name of the Node to install the TapBridge in * \param nd The Ptr<NetDevice> to attach to the bridge. * \returns A pointer to the new TapBridge NetDevice. */ Ptr<NetDevice> Install (std::string nodeName, Ptr<NetDevice> nd); /** * This method installs a TapBridge on the specified Node and forms the * bridge with the NetDevice specified. The NetDevice is specified by a * name string that has previously been associated with the NetDevice * using the Object Name Service. * * \param node The Ptr<Node> to install the TapBridge in * \param ndName The name of the NetDevice to attach to the bridge. * \returns A pointer to the new TapBridge NetDevice. */ Ptr<NetDevice> Install (Ptr<Node> node, std::string ndName); /** * This method installs a TapBridge on the specified Node and forms the * bridge with the NetDevice specified. The node is specified by a * name string that has previously been associated with the Node using * the Object Name Service. The NetDevice is specified by a name * string that has previously been associated with the Object Name * Service. * * \param nodeName The name of the Node to install the TapBridge in * \param ndName The name of the NetDevice to attach to the bridge. * \returns A pointer to the new TapBridge NetDevice. */ Ptr<NetDevice> Install (std::string nodeName, std::string ndName); /** * This method installs a TapBridge on the specified Node and forms the * bridge with the NetDevice specified. The Node is specified using * a Ptr<Node> and the NetDevice is specified using a Ptr<NetDevice>. * The type of the actual Bridge device is specified with the * provided AttributeValue (typically "ns3::TapBridge"). * * \param node The Ptr<Node> to install the TapBridge in * \param nd The Ptr<NetDevice> to attach to the bridge. * \param bridgeType The TypeId of the bridge that will be automatically * created. * \returns A pointer to the new TapBridge NetDevice. */ Ptr<NetDevice> Install (Ptr<Node> node, Ptr<NetDevice> nd, const AttributeValue &bridgeType); private: ObjectFactory m_deviceFactory; }; } // namespace ns3 #endif /* TAP_BRIDGE_HELPER_H */
zy901002-gpsr
src/tap-bridge/helper/tap-bridge-helper.h
C++
gpl2
5,050
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2009 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "ns3/log.h" #include "ns3/node.h" #include "ns3/enum.h" #include "ns3/tap-bridge.h" #include "ns3/names.h" #include "tap-bridge-helper.h" NS_LOG_COMPONENT_DEFINE ("TapBridgeHelper"); namespace ns3 { TapBridgeHelper::TapBridgeHelper () { NS_LOG_FUNCTION_NOARGS (); m_deviceFactory.SetTypeId ("ns3::TapBridge"); } TapBridgeHelper::TapBridgeHelper (Ipv4Address gateway) { NS_LOG_FUNCTION_NOARGS (); m_deviceFactory.SetTypeId ("ns3::TapBridge"); SetAttribute ("Gateway", Ipv4AddressValue (gateway)); SetAttribute ("Mode", EnumValue (TapBridge::CONFIGURE_LOCAL)); } void TapBridgeHelper::SetAttribute (std::string n1, const AttributeValue &v1) { NS_LOG_FUNCTION (n1 << &v1); m_deviceFactory.Set (n1, v1); } Ptr<NetDevice> TapBridgeHelper::Install (Ptr<Node> node, Ptr<NetDevice> nd, const AttributeValue &v1) { NS_LOG_FUNCTION (node << nd << &v1); m_deviceFactory.Set ("DeviceName", v1); return Install (node, nd); } Ptr<NetDevice> TapBridgeHelper::Install (Ptr<Node> node, Ptr<NetDevice> nd) { NS_LOG_FUNCTION (node << nd); NS_LOG_LOGIC ("Install TapBridge on node " << node->GetId () << " bridging net device " << nd); Ptr<TapBridge> bridge = m_deviceFactory.Create<TapBridge> (); node->AddDevice (bridge); bridge->SetBridgedNetDevice (nd); return bridge; } Ptr<NetDevice> TapBridgeHelper::Install (std::string nodeName, Ptr<NetDevice> nd) { Ptr<Node> node = Names::Find<Node> (nodeName); return Install (node, nd); } Ptr<NetDevice> TapBridgeHelper::Install (Ptr<Node> node, std::string ndName) { Ptr<NetDevice> nd = Names::Find<NetDevice> (ndName); return Install (node, nd); } Ptr<NetDevice> TapBridgeHelper::Install (std::string nodeName, std::string ndName) { Ptr<Node> node = Names::Find<Node> (nodeName); Ptr<NetDevice> nd = Names::Find<NetDevice> (ndName); return Install (node, nd); } } // namespace ns3
zy901002-gpsr
src/tap-bridge/helper/tap-bridge-helper.cc
C++
gpl2
2,653
/** * \defgroup tap-bridge Tap Bridge Device * * This section documents the API of the ns-3 tap-bridge module. For a * generic functional description, please refer to the ns-3 manual. */
zy901002-gpsr
src/tap-bridge/doc/tap.h
C
gpl2
192
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- import os.path def configure(conf): if conf.env['ENABLE_THREADING']: conf.env['ENABLE_TAP'] = conf.check_nonfatal(header_name='linux/if_tun.h', define_name='HAVE_IF_TUN_H') conf.report_optional_feature("TapBridge", "Tap Bridge", conf.env['ENABLE_TAP'], "<linux/if_tun.h> include not detected") else: conf.report_optional_feature("TapBridge", "Tap Bridge", False, "needs threading support which is not available") if conf.env['ENABLE_TAP']: blddir = os.path.abspath(os.path.join(conf.bldnode.abspath(), conf.variant)) tapcreatordir = os.path.abspath(os.path.join(blddir, "src/tap-bridge")) conf.env.append_value('NS3_EXECUTABLE_PATH', tapcreatordir) else: # Add this module to the list of modules that won't be built # if they are enabled. conf.env['MODULES_NOT_BUILT'].append('tap-bridge') def build(bld): # Don't do anything for this module if tap-bridge's not enabled. if not bld.env['ENABLE_TAP']: return module = bld.create_ns3_module('tap-bridge', ['network', 'internet']) module.source = [ 'model/tap-bridge.cc', 'model/tap-encode-decode.cc', 'helper/tap-bridge-helper.cc', ] headers = bld.new_task_gen(features=['ns3header']) headers.module = 'tap-bridge' headers.source = [ 'model/tap-bridge.h', 'helper/tap-bridge-helper.h', 'doc/tap.h', ] if not bld.env['PLATFORM'].startswith('freebsd'): obj = bld.create_suid_program('tap-creator') obj.source = [ 'model/tap-creator.cc', 'model/tap-encode-decode.cc', ] if bld.env['ENABLE_EXAMPLES']: bld.add_subdirs('examples') bld.ns3_python_bindings()
zy901002-gpsr
src/tap-bridge/wscript
Python
gpl2
2,044
/* -*- 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 * * Author: Blake Hurd <naimorai@gmail.com> */ /** * \defgroup openflow OpenFlow Switch Device * This section documents the API of the ns-3 OpenFlow module. For a generic functional description, please refer to the ns-3 manual. */ #ifndef OPENFLOW_SWITCH_NET_DEVICE_H #define OPENFLOW_SWITCH_NET_DEVICE_H #include "ns3/simulator.h" #include "ns3/log.h" #include "ns3/mac48-address.h" #include "ns3/ethernet-header.h" #include "ns3/arp-header.h" #include "ns3/tcp-header.h" #include "ns3/udp-header.h" #include "ns3/ipv4-l3-protocol.h" #include "ns3/arp-l3-protocol.h" #include "ns3/bridge-channel.h" #include "ns3/node.h" #include "ns3/enum.h" #include "ns3/string.h" #include "ns3/integer.h" #include "ns3/uinteger.h" #include <map> #include <set> #include "openflow-interface.h" namespace ns3 { /** * \ingroup openflow * \brief A net device that switches multiple LAN segments via an OpenFlow-compatible flow table * * The OpenFlowSwitchNetDevice object aggregates multiple netdevices as ports * and acts like a switch. It implements OpenFlow-compatibility, * according to the OpenFlow Switch Specification v0.8.9 * <www.openflowswitch.org/documents/openflow-spec-v0.8.9.pdf>. * It implements a flow table that all received packets are run through. * It implements a connection to a controller via a subclass of the Controller class, * which can send messages to manipulate the flow table, thereby manipulating * how the OpenFlow switch behaves. * * There are two controllers available in the original package. DropController * builds a flow for each received packet to drop all packets it matches (this * demonstrates the flow table's basic implementation), and the LearningController * implements a "learning switch" algorithm (see 802.1D), where incoming unicast * frames from one port may occasionally be forwarded throughout all other ports, * but usually they are forwarded only to a single correct output port. * * \attention The Spanning Tree Protocol part of 802.1D is not * implemented. Therefore, you have to be careful not to create * bridging loops, or else the network will collapse. * * \attention Each NetDevice used must only be assigned a Mac Address, adding it * to an Ipv4 or Ipv6 layer will cause an error. It also must support a SendFrom * call. */ /** * \ingroup openflow * \brief A net device that switches multiple LAN segments via an OpenFlow-compatible flow table */ class OpenFlowSwitchNetDevice : public NetDevice { public: static TypeId GetTypeId (void); /** * \name OpenFlowSwitchNetDevice Description Data * \brief These four data describe the OpenFlowSwitchNetDevice as if it were a real OpenFlow switch. * * There is a type of stats request that OpenFlow switches are supposed * to handle that returns the description of the OpenFlow switch. Currently * manufactured by "The ns-3 team", software description is "Simulated * OpenFlow Switch", and the other two are "N/A". */ //\{ static const char * GetManufacturerDescription (); static const char * GetHardwareDescription (); static const char * GetSoftwareDescription (); static const char * GetSerialNumber (); //\} OpenFlowSwitchNetDevice (); virtual ~OpenFlowSwitchNetDevice (); /** * \brief Set up the Switch's controller connection. * * \param c Pointer to a Controller. */ void SetController (Ptr<ofi::Controller> c); /** * \brief Add a 'port' to a switch device * * This method adds a new switch port to a OpenFlowSwitchNetDevice, so that * the new switch port NetDevice becomes part of the switch and L2 * frames start being forwarded to/from this NetDevice. * * \attention The netdevice that is being added as switch port must * _not_ have an IP address. In order to add IP connectivity to a * bridging node you must enable IP on the OpenFlowSwitchNetDevice itself, * never on its port netdevices. * * \param switchPort The port to add. * \return 0 if everything's ok, otherwise an error number. * \sa #EXFULL */ int AddSwitchPort (Ptr<NetDevice> switchPort); /** * \brief Add a virtual port to a switch device * * The Ericsson OFSID has the concept of virtual ports and virtual * port tables. These are implemented in the OpenFlowSwitchNetDevice, but * don't have an understood use [perhaps it may have to do with * MPLS integration]. * * \sa #EINVAL * * \param ovpm The data for adding a virtual port. * \return 0 if everything's ok, otherwise an error number. */ int AddVPort (const ofp_vport_mod *ovpm); /** * \brief Stats callback is ready for a dump. * * Controllers have a callback system for status requests which calls this function. * * \param cb_ The callback data. * \return 0 if everything's ok, otherwise an error number. */ int StatsDump (ofi::StatsDumpCallback *cb_); /** * \brief Stats callback is done. * * Controllers have a callback system for status requests which calls this function. * * \param cb_ The callback data. */ void StatsDone (ofi::StatsDumpCallback *cb_); /** * \brief Called from the OpenFlow Interface to output the Packet on either a Port or the Controller * * \param packet_uid Packet UID; used to fetch the packet and its metadata. * \param in_port The index of the port the Packet was initially received on. * \param max_len The maximum number of bytes the caller wants to be sent; a value of 0 indicates the entire packet should be sent. Used when outputting to controller. * \param out_port The port we want to output on. * \param ignore_no_fwd If true, Ports that are set to not forward are forced to forward. */ void DoOutput (uint32_t packet_uid, int in_port, size_t max_len, int out_port, bool ignore_no_fwd); /** * \brief The registered controller calls this method when sending a message to the switch. * * \param msg The message received from the controller. * \param length Length of the message. * \return 0 if everything's ok, otherwise an error number. */ int ForwardControlInput (const void *msg, size_t length); /** * \return The flow table chain. */ sw_chain* GetChain (); /** * \return Number of switch ports attached to this switch. */ uint32_t GetNSwitchPorts (void) const; /** * \param p The Port to get the index of. * \return The index of the provided Port. */ int GetSwitchPortIndex (ofi::Port p); /** * \param n index of the Port. * \return The Port. */ ofi::Port GetSwitchPort (uint32_t n) const; /** * \return The virtual port table. */ vport_table_t GetVPortTable (); ///\name From NetDevice //\{ virtual void SetIfIndex (const uint32_t index); virtual uint32_t GetIfIndex (void) const; virtual Ptr<Channel> GetChannel (void) const; virtual void SetAddress (Address address); virtual Address GetAddress (void) const; virtual bool SetMtu (const uint16_t mtu); virtual uint16_t GetMtu (void) const; virtual bool IsLinkUp (void) const; virtual void AddLinkChangeCallback (Callback<void> callback); virtual bool IsBroadcast (void) const; virtual Address GetBroadcast (void) const; virtual bool IsMulticast (void) const; virtual Address GetMulticast (Ipv4Address multicastGroup) const; virtual bool IsPointToPoint (void) const; virtual bool IsBridge (void) const; virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber); virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber); virtual Ptr<Node> GetNode (void) const; virtual void SetNode (Ptr<Node> node); virtual bool NeedsArp (void) const; virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb); virtual void SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb); virtual bool SupportsSendFrom () const; virtual Address GetMulticast (Ipv6Address addr) const; //\} protected: virtual void DoDispose (void); /** * \internal * * Called when a packet is received on one of the switch's ports. * * \param netdev The port the packet was received on. * \param packet The Packet itself. * \param protocol The protocol defining the Packet. * \param src The source address of the Packet. * \param dst The destination address of the Packet. * \param PacketType Type of the packet. */ void ReceiveFromDevice (Ptr<NetDevice> netdev, Ptr<const Packet> packet, uint16_t protocol, const Address& src, const Address& dst, PacketType packetType); /** * \internal * * Takes a packet and generates an OpenFlow buffer from it, loading the packet data as well as its headers. * * \param packet The packet. * \param src The source address. * \param dst The destination address. * \param mtu The Maximum Transmission Unit. * \param protocol The protocol defining the packet. * \return The OpenFlow Buffer created from the packet. */ ofpbuf * BufferFromPacket (Ptr<Packet> packet, Address src, Address dst, int mtu, uint16_t protocol); private: /** * \internal * * Add a flow. * * \sa #ENOMEM, #ENOBUFS, #ESRCH * * \param ofm The flow data to add. * \return 0 if everything's ok, otherwise an error number. */ int AddFlow (const ofp_flow_mod *ofm); /** * \internal * * Modify a flow. * * \param ofm The flow data to modify. * \return 0 if everything's ok, otherwise an error number. */ int ModFlow (const ofp_flow_mod *ofm); /** * \internal * * Send packets out all the ports except the originating one * * \param packet_uid Packet UID; used to fetch the packet and its metadata. * \param in_port The index of the port the Packet was initially received on. This port doesn't forward when flooding. * \param flood If true, don't send out on the ports with flooding disabled. * \return 0 if everything's ok, otherwise an error number. */ int OutputAll (uint32_t packet_uid, int in_port, bool flood); /** * \internal * * Sends a copy of the Packet over the provided output port * * \param packet_uid Packet UID; used to fetch the packet and its metadata. */ void OutputPacket (uint32_t packet_uid, int out_port); /** * \internal * * Seeks to send out a Packet over the provided output port. This is called generically * when we may or may not know the specific port we're outputting on. There are many * pre-set types of port options besides a Port that's hooked to our OpenFlowSwitchNetDevice. * For example, it could be outputting as a flood, or seeking to output to the controller. * * \param packet_uid Packet UID; used to fetch the packet and its metadata. * \param in_port The index of the port the Packet was initially received on. * \param out_port The port we want to output on. * \param ignore_no_fwd If true, Ports that are set to not forward are forced to forward. */ void OutputPort (uint32_t packet_uid, int in_port, int out_port, bool ignore_no_fwd); /** * \internal * * Sends a copy of the Packet to the controller. If the packet can be saved * in an OpenFlow buffer, then only the first 'max_len' bytes of the packet * are sent; otherwise, all of the packet is sent. * * \param packet_uid Packet UID; used to fetch the packet and its metadata. * \param in_port The index of the port the Packet was initially received on. * \param max_len The maximum number of bytes that the caller wants to be sent; a value of 0 indicates the entire packet should be sent. * \param reason Why the packet is being sent. */ void OutputControl (uint32_t packet_uid, int in_port, size_t max_len, int reason); /** * \internal * * If an error message happened during the controller's request, send it to the controller. * * \param type The type of error. * \param code The error code. * \param data The faulty data that lead to the error. * \param len The length of the faulty data. */ void SendErrorMsg (uint16_t type, uint16_t code, const void *data, size_t len); /** * \internal * * Send a reply about this OpenFlow switch's features to the controller. * * List of capabilities and actions to support are found in the specification * <www.openflowswitch.org/documents/openflow-spec-v0.8.9.pdf>. * * Supported capabilities and actions are defined in the openflow interface. * To recap, flow status, flow table status, port status, virtual port table * status can all be requested. It can also transmit over multiple physical * interfaces. * * It supports every action: outputting over a port, and all of the flow table * manipulation actions: setting the 802.1q VLAN ID, the 802.1q priority, * stripping the 802.1 header, setting the Ethernet source address and destination, * setting the IP source address and destination, setting the TCP/UDP source address * and destination, and setting the MPLS label and EXP bits. * * \attention Capabilities STP (Spanning Tree Protocol) and IP packet * reassembly are not currently supported. * */ void SendFeaturesReply (); /** * \internal * * Send a reply to the controller that a specific flow has expired. * * \param flow The flow that expired. * \param reason The reason for sending this expiration notification. */ void SendFlowExpired (sw_flow *flow, enum ofp_flow_expired_reason reason); /** * \internal * * Send a reply about a Port's status to the controller. * * \param p The port to get status from. * \param status The reason for sending this reply. */ void SendPortStatus (ofi::Port p, uint8_t status); /** * \internal * * Send a reply about this OpenFlow switch's virtual port table features to the controller. */ void SendVPortTableFeatures (); /** * \internal * * Send a message to the controller. This method is the key * to communicating with the controller, it does the actual * sending. The other Send methods call this one when they * are ready to send a message. * * \param buffer Buffer of the message to send out. * \return 0 if successful, otherwise an error number. */ int SendOpenflowBuffer (ofpbuf *buffer); /** * \internal * * Run the packet through the flow table. Looks up in the flow table for a match. * If it doesn't match, it forwards the packet to the registered controller, if the flag is set. * * \param packet_uid Packet UID; used to fetch the packet and its metadata. * \param port The port this packet was received over. * \param send_to_controller If set, sends to the controller if the packet isn't matched. */ void RunThroughFlowTable (uint32_t packet_uid, int port, bool send_to_controller = true); /** * \internal * * Run the packet through the vport table. As with AddVPort, * this doesn't have an understood use yet. * * \param packet_uid Packet UID; used to fetch the packet and its metadata. * \param port The port this packet was received over. * \param vport The virtual port this packet identifies itself by. * \return 0 if everything's ok, otherwise an error number. */ int RunThroughVPortTable (uint32_t packet_uid, int port, uint32_t vport); /** * \internal * * Called by RunThroughFlowTable on a scheduled delay * to account for the flow table lookup overhead. * * \param key Matching key to look up in the flow table. * \param buffer Buffer of the packet received. * \param packet_uid Packet UID; used to fetch the packet and its metadata. * \param port The port the packet was received over. * \param send_to_controller */ void FlowTableLookup (sw_flow_key key, ofpbuf* buffer, uint32_t packet_uid, int port, bool send_to_controller); /** * \internal * * Update the port status field of the switch port. * A non-zero return value indicates some field has changed. * * \param p A reference to a Port; used to change its config and flag fields. * \return true if the status of the Port is changed, false if unchanged (was already the right status). */ int UpdatePortStatus (ofi::Port& p); /** * \internal * * Fill out a description of the switch port. * * \param p The port to get the description from. * \param desc A pointer to the description message; used to fill the description message with the data from the port. */ void FillPortDesc (ofi::Port p, ofp_phy_port *desc); /** * \internal * * Generates an OpenFlow reply message based on the type. * * \param openflow_len Length of the reply to make. * \param type Type of reply message to make. * \param bufferp Message buffer; used to make the reply. * \return The OpenFlow reply message. */ void* MakeOpenflowReply (size_t openflow_len, uint8_t type, ofpbuf **bufferp); /** * \internal * \name Receive Methods * * Actions to do when a specific OpenFlow message/packet is received * * \param msg The OpenFlow message received. * \return 0 if everything's ok, otherwise an error number. */ //\{ int ReceiveFeaturesRequest (const void *msg); int ReceiveGetConfigRequest (const void *msg); int ReceiveSetConfig (const void *msg); int ReceivePacketOut (const void *msg); int ReceiveFlow (const void *msg); int ReceivePortMod (const void *msg); int ReceiveStatsRequest (const void *oh); int ReceiveEchoRequest (const void *oh); int ReceiveEchoReply (const void *oh); int ReceiveVPortMod (const void *msg); int ReceiveVPortTableFeaturesRequest (const void *msg); //\} /// Callbacks NetDevice::ReceiveCallback m_rxCallback; NetDevice::PromiscReceiveCallback m_promiscRxCallback; Mac48Address m_address; ///< Address of this device. Ptr<Node> m_node; ///< Node this device is installed on. Ptr<BridgeChannel> m_channel; ///< Collection of port channels into the Switch Channel. uint32_t m_ifIndex; ///< Interface Index uint16_t m_mtu; ///< Maximum Transmission Unit typedef std::map<uint32_t,ofi::SwitchPacketMetadata> PacketData_t; PacketData_t m_packetData; ///< Packet data typedef std::vector<ofi::Port> Ports_t; Ports_t m_ports; ///< Switch's ports Ptr<ofi::Controller> m_controller; ///< Connection to controller. uint64_t m_id; ///< Unique identifier for this switch, needed for OpenFlow Time m_lookupDelay; ///< Flow Table Lookup Delay [overhead]. Time m_lastExecute; ///< Last time the periodic execution occurred. uint16_t m_flags; ///< Flags; configurable by the controller. uint16_t m_missSendLen; ///< Flow Table Miss Send Length; configurable by the controller. sw_chain *m_chain; ///< Flow Table; forwarding rules. vport_table_t m_vportTable; ///< Virtual Port Table }; } // namespace ns3 #endif /* OPENFLOW_SWITCH_NET_DEVICE_H */
zy901002-gpsr
src/openflow/model/openflow-switch-net-device.h
C++
gpl2
19,922
/* -*- 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 * * Author: Blake Hurd <naimorai@gmail.com> */ #ifdef NS3_OPENFLOW #include "openflow-interface.h" #include "openflow-switch-net-device.h" namespace ns3 { namespace ofi { NS_LOG_COMPONENT_DEFINE ("OpenFlowInterface"); Stats::Stats (ofp_stats_types _type, size_t body_len) { type = _type; size_t min_body = 0, max_body = 0; switch (type) { case OFPST_DESC: break; case OFPST_FLOW: min_body = max_body = sizeof(ofp_flow_stats_request); break; case OFPST_AGGREGATE: min_body = max_body = sizeof(ofp_aggregate_stats_request); break; case OFPST_TABLE: break; case OFPST_PORT: min_body = 0; max_body = std::numeric_limits<size_t>::max (); // Not sure about this one. This would guarantee that the body_len is always acceptable. break; case OFPST_PORT_TABLE: break; default: NS_LOG_ERROR ("received stats request of unknown type " << type); return; // -EINVAL; } if ((min_body != 0 || max_body != 0) && (body_len < min_body || body_len > max_body)) { NS_LOG_ERROR ("stats request type " << type << " with bad body length " << body_len); return; // -EINVAL; } } int Stats::DoInit (const void *body, int body_len, void **state) { switch (type) { case OFPST_DESC: return 0; case OFPST_FLOW: return FlowStatsInit (body, body_len, state); case OFPST_AGGREGATE: return AggregateStatsInit (body, body_len, state); case OFPST_TABLE: return 0; case OFPST_PORT: return PortStatsInit (body, body_len, state); case OFPST_PORT_TABLE: return 0; case OFPST_VENDOR: return 0; } return 0; } int Stats::DoDump (Ptr<OpenFlowSwitchNetDevice> swtch, void *state, ofpbuf *buffer) { switch (type) { case OFPST_DESC: return DescStatsDump (state, buffer); case OFPST_FLOW: return FlowStatsDump (swtch, (FlowStatsState *)state, buffer); case OFPST_AGGREGATE: return AggregateStatsDump (swtch, (ofp_aggregate_stats_request *)state, buffer); case OFPST_TABLE: return TableStatsDump (swtch, state, buffer); case OFPST_PORT: return PortStatsDump (swtch, (PortStatsState *)state, buffer); case OFPST_PORT_TABLE: return PortTableStatsDump (swtch, state, buffer); case OFPST_VENDOR: return 0; } return 0; } void Stats::DoCleanup (void *state) { switch (type) { case OFPST_DESC: break; case OFPST_FLOW: free ((FlowStatsState *)state); break; case OFPST_AGGREGATE: free ((ofp_aggregate_stats_request *)state); break; case OFPST_TABLE: break; case OFPST_PORT: free (((PortStatsState *)state)->ports); free ((PortStatsState *)state); break; case OFPST_PORT_TABLE: break; case OFPST_VENDOR: break; } } int Stats::DescStatsDump (void *state, ofpbuf *buffer) { ofp_desc_stats *ods = (ofp_desc_stats*)ofpbuf_put_zeros (buffer, sizeof *ods); strncpy (ods->mfr_desc, OpenFlowSwitchNetDevice::GetManufacturerDescription (), sizeof ods->mfr_desc); strncpy (ods->hw_desc, OpenFlowSwitchNetDevice::GetHardwareDescription (), sizeof ods->hw_desc); strncpy (ods->sw_desc, OpenFlowSwitchNetDevice::GetSoftwareDescription (), sizeof ods->sw_desc); strncpy (ods->serial_num, OpenFlowSwitchNetDevice::GetSerialNumber (), sizeof ods->serial_num); return 0; } #define MAX_FLOW_STATS_BYTES 4096 int Stats::FlowStatsInit (const void *body, int body_len, void **state) { const ofp_flow_stats_request *fsr = (ofp_flow_stats_request*)body; FlowStatsState *s = (FlowStatsState*)xmalloc (sizeof *s); s->table_idx = fsr->table_id == 0xff ? 0 : fsr->table_id; memset (&s->position, 0, sizeof s->position); s->rq = *fsr; *state = s; return 0; } int Stats_FlowDumpCallback (sw_flow *flow, void* state) { Stats::FlowStatsState *s = (Stats::FlowStatsState*)state; // Fill Flow Stats ofp_flow_stats *ofs; int length = sizeof *ofs + flow->sf_acts->actions_len; ofs = (ofp_flow_stats*)ofpbuf_put_zeros (s->buffer, length); ofs->length = htons (length); ofs->table_id = s->table_idx; ofs->match.wildcards = htonl (flow->key.wildcards); ofs->match.in_port = flow->key.flow.in_port; memcpy (ofs->match.dl_src, flow->key.flow.dl_src, ETH_ADDR_LEN); memcpy (ofs->match.dl_dst, flow->key.flow.dl_dst, ETH_ADDR_LEN); ofs->match.dl_vlan = flow->key.flow.dl_vlan; ofs->match.dl_type = flow->key.flow.dl_type; ofs->match.nw_src = flow->key.flow.nw_src; ofs->match.nw_dst = flow->key.flow.nw_dst; ofs->match.nw_proto = flow->key.flow.nw_proto; ofs->match.tp_src = flow->key.flow.tp_src; ofs->match.tp_dst = flow->key.flow.tp_dst; ofs->duration = htonl (s->now - flow->created); ofs->priority = htons (flow->priority); ofs->idle_timeout = htons (flow->idle_timeout); ofs->hard_timeout = htons (flow->hard_timeout); ofs->packet_count = htonll (flow->packet_count); ofs->byte_count = htonll (flow->byte_count); memcpy (ofs->actions, flow->sf_acts->actions, flow->sf_acts->actions_len); return s->buffer->size >= MAX_FLOW_STATS_BYTES; } int Stats::FlowStatsDump (Ptr<OpenFlowSwitchNetDevice> swtch, FlowStatsState* s, ofpbuf *buffer) { sw_flow_key match_key; flow_extract_match (&match_key, &s->rq.match); s->buffer = buffer; s->now = time_now (); while (s->table_idx < swtch->GetChain ()->n_tables && (s->rq.table_id == 0xff || s->rq.table_id == s->table_idx)) { sw_table *table = swtch->GetChain ()->tables[s->table_idx]; if (table->iterate (table, &match_key, s->rq.out_port, &s->position, Stats::FlowDumpCallback, s)) { break; } s->table_idx++; memset (&s->position, 0, sizeof s->position); } return s->buffer->size >= MAX_FLOW_STATS_BYTES; } int Stats::AggregateStatsInit (const void *body, int body_len, void **state) { //ofp_aggregate_stats_request *s = (ofp_aggregate_stats_request*)body; *state = (ofp_aggregate_stats_request*)body; return 0; } int Stats_AggregateDumpCallback (sw_flow *flow, void *state) { ofp_aggregate_stats_reply *s = (ofp_aggregate_stats_reply*)state; s->packet_count += flow->packet_count; s->byte_count += flow->byte_count; s->flow_count++; return 0; } int Stats::AggregateStatsDump (Ptr<OpenFlowSwitchNetDevice> swtch, ofp_aggregate_stats_request *s, ofpbuf *buffer) { ofp_aggregate_stats_request *rq = s; ofp_aggregate_stats_reply *rpy = (ofp_aggregate_stats_reply*)ofpbuf_put_zeros (buffer, sizeof *rpy); sw_flow_key match_key; flow_extract_match (&match_key, &rq->match); int table_idx = rq->table_id == 0xff ? 0 : rq->table_id; sw_table_position position; memset (&position, 0, sizeof position); while (table_idx < swtch->GetChain ()->n_tables && (rq->table_id == 0xff || rq->table_id == table_idx)) { sw_table *table = swtch->GetChain ()->tables[table_idx]; int error = table->iterate (table, &match_key, rq->out_port, &position, Stats::AggregateDumpCallback, rpy); if (error) { return error; } table_idx++; memset (&position, 0, sizeof position); } rpy->packet_count = htonll (rpy->packet_count); rpy->byte_count = htonll (rpy->byte_count); rpy->flow_count = htonl (rpy->flow_count); return 0; } int Stats::TableStatsDump (Ptr<OpenFlowSwitchNetDevice> swtch, void *state, ofpbuf *buffer) { sw_chain* ft = swtch->GetChain (); for (int i = 0; i < ft->n_tables; i++) { ofp_table_stats *ots = (ofp_table_stats*)ofpbuf_put_zeros (buffer, sizeof *ots); sw_table_stats stats; ft->tables[i]->stats (ft->tables[i], &stats); strncpy (ots->name, stats.name, sizeof ots->name); ots->table_id = i; ots->wildcards = htonl (stats.wildcards); ots->max_entries = htonl (stats.max_flows); ots->active_count = htonl (stats.n_flows); ots->lookup_count = htonll (stats.n_lookup); ots->matched_count = htonll (stats.n_matched); } return 0; } // stats for the port table which is similar to stats for the flow tables int Stats::PortTableStatsDump (Ptr<OpenFlowSwitchNetDevice> swtch, void *state, ofpbuf *buffer) { ofp_vport_table_stats *opts = (ofp_vport_table_stats*)ofpbuf_put_zeros (buffer, sizeof *opts); opts->max_vports = htonl (swtch->GetVPortTable ().max_vports); opts->active_vports = htonl (swtch->GetVPortTable ().active_vports); opts->lookup_count = htonll (swtch->GetVPortTable ().lookup_count); opts->port_match_count = htonll (swtch->GetVPortTable ().port_match_count); opts->chain_match_count = htonll (swtch->GetVPortTable ().chain_match_count); return 0; } int Stats::PortStatsInit (const void *body, int body_len, void **state) { PortStatsState *s = (PortStatsState*)xmalloc (sizeof *s); // the body contains a list of port numbers s->ports = (uint32_t*)xmalloc (body_len); memcpy (s->ports, body, body_len); s->num_ports = body_len / sizeof(uint32_t); *state = s; return 0; } int Stats::PortStatsDump (Ptr<OpenFlowSwitchNetDevice> swtch, PortStatsState *s, ofpbuf *buffer) { ofp_port_stats *ops; uint32_t port; // port stats are different depending on whether port is physical or virtual for (size_t i = 0; i < s->num_ports; i++) { port = ntohl (s->ports[i]); // physical port? if (port <= OFPP_MAX) { Port p = swtch->GetSwitchPort (port); if (p.netdev == 0) { continue; } ops = (ofp_port_stats*)ofpbuf_put_zeros (buffer, sizeof *ops); ops->port_no = htonl (swtch->GetSwitchPortIndex (p)); ops->rx_packets = htonll (p.rx_packets); ops->tx_packets = htonll (p.tx_packets); ops->rx_bytes = htonll (p.rx_bytes); ops->tx_bytes = htonll (p.tx_bytes); ops->rx_dropped = htonll (-1); ops->tx_dropped = htonll (p.tx_dropped); ops->rx_errors = htonll (-1); ops->tx_errors = htonll (-1); ops->rx_frame_err = htonll (-1); ops->rx_over_err = htonll (-1); ops->rx_crc_err = htonll (-1); ops->collisions = htonll (-1); ops->mpls_ttl0_dropped = htonll (p.mpls_ttl0_dropped); ops++; } else if (port >= OFPP_VP_START && port <= OFPP_VP_END) // virtual port? { // lookup the virtual port vport_table_t vt = swtch->GetVPortTable (); vport_table_entry *vpe = vport_table_lookup (&vt, port); if (vpe == 0) { NS_LOG_ERROR ("vport entry not found!"); continue; } // only tx_packets and tx_bytes are really relevant for virtual ports ops = (ofp_port_stats*)ofpbuf_put_zeros (buffer, sizeof *ops); ops->port_no = htonl (vpe->vport); ops->rx_packets = htonll (-1); ops->tx_packets = htonll (vpe->packet_count); ops->rx_bytes = htonll (-1); ops->tx_bytes = htonll (vpe->byte_count); ops->rx_dropped = htonll (-1); ops->tx_dropped = htonll (-1); ops->rx_errors = htonll (-1); ops->tx_errors = htonll (-1); ops->rx_frame_err = htonll (-1); ops->rx_over_err = htonll (-1); ops->rx_crc_err = htonll (-1); ops->collisions = htonll (-1); ops->mpls_ttl0_dropped = htonll (-1); ops++; } } return 0; } bool Action::IsValidType (ofp_action_type type) { switch (type) { case OFPAT_OUTPUT: case OFPAT_SET_VLAN_VID: case OFPAT_SET_VLAN_PCP: case OFPAT_STRIP_VLAN: case OFPAT_SET_DL_SRC: case OFPAT_SET_DL_DST: case OFPAT_SET_NW_SRC: case OFPAT_SET_NW_DST: case OFPAT_SET_TP_SRC: case OFPAT_SET_TP_DST: case OFPAT_SET_MPLS_LABEL: case OFPAT_SET_MPLS_EXP: return true; default: return false; } } uint16_t Action::Validate (ofp_action_type type, size_t len, const sw_flow_key *key, const ofp_action_header *ah) { size_t size = 0; switch (type) { case OFPAT_OUTPUT: { if (len != sizeof(ofp_action_output)) { return OFPBAC_BAD_LEN; } ofp_action_output *oa = (ofp_action_output *)ah; // To prevent loops, make sure there's no action to send to the OFP_TABLE virtual port. // port is now 32-bit if (oa->port == OFPP_NONE || oa->port == key->flow.in_port) // htonl(OFPP_NONE); { // if (oa->port == htons(OFPP_NONE) || oa->port == key->flow.in_port) return OFPBAC_BAD_OUT_PORT; } return ACT_VALIDATION_OK; } case OFPAT_SET_VLAN_VID: size = sizeof(ofp_action_vlan_vid); break; case OFPAT_SET_VLAN_PCP: size = sizeof(ofp_action_vlan_pcp); break; case OFPAT_STRIP_VLAN: size = sizeof(ofp_action_header); break; case OFPAT_SET_DL_SRC: case OFPAT_SET_DL_DST: size = sizeof(ofp_action_dl_addr); break; case OFPAT_SET_NW_SRC: case OFPAT_SET_NW_DST: size = sizeof(ofp_action_nw_addr); break; case OFPAT_SET_TP_SRC: case OFPAT_SET_TP_DST: size = sizeof(ofp_action_tp_port); break; case OFPAT_SET_MPLS_LABEL: size = sizeof(ofp_action_mpls_label); break; case OFPAT_SET_MPLS_EXP: size = sizeof(ofp_action_mpls_exp); break; default: break; } if (len != size) { return OFPBAC_BAD_LEN; } return ACT_VALIDATION_OK; } void Action::Execute (ofp_action_type type, ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah) { switch (type) { case OFPAT_OUTPUT: break; case OFPAT_SET_VLAN_VID: set_vlan_vid (buffer, key, ah); break; case OFPAT_SET_VLAN_PCP: set_vlan_pcp (buffer, key, ah); break; case OFPAT_STRIP_VLAN: strip_vlan (buffer, key, ah); break; case OFPAT_SET_DL_SRC: case OFPAT_SET_DL_DST: set_dl_addr (buffer, key, ah); break; case OFPAT_SET_NW_SRC: case OFPAT_SET_NW_DST: set_nw_addr (buffer, key, ah); break; case OFPAT_SET_TP_SRC: case OFPAT_SET_TP_DST: set_tp_port (buffer, key, ah); break; case OFPAT_SET_MPLS_LABEL: set_mpls_label (buffer, key, ah); break; case OFPAT_SET_MPLS_EXP: set_mpls_exp (buffer, key, ah); break; default: break; } } bool VPortAction::IsValidType (ofp_vport_action_type type) { switch (type) { case OFPPAT_POP_MPLS: case OFPPAT_PUSH_MPLS: case OFPPAT_SET_MPLS_LABEL: case OFPPAT_SET_MPLS_EXP: return true; default: return false; } } uint16_t VPortAction::Validate (ofp_vport_action_type type, size_t len, const ofp_action_header *ah) { size_t size = 0; switch (type) { case OFPPAT_POP_MPLS: size = sizeof(ofp_vport_action_pop_mpls); break; case OFPPAT_PUSH_MPLS: size = sizeof(ofp_vport_action_push_mpls); break; case OFPPAT_SET_MPLS_LABEL: size = sizeof(ofp_vport_action_set_mpls_label); break; case OFPPAT_SET_MPLS_EXP: size = sizeof(ofp_vport_action_set_mpls_exp); break; default: break; } if (len != size) { return OFPBAC_BAD_LEN; } return ACT_VALIDATION_OK; } void VPortAction::Execute (ofp_vport_action_type type, ofpbuf *buffer, const sw_flow_key *key, const ofp_action_header *ah) { switch (type) { case OFPPAT_POP_MPLS: { ofp_vport_action_pop_mpls *opapm = (ofp_vport_action_pop_mpls *)ah; pop_mpls_act (0, buffer, key, &opapm->apm); break; } case OFPPAT_PUSH_MPLS: { ofp_vport_action_push_mpls *opapm = (ofp_vport_action_push_mpls *)ah; push_mpls_act (0, buffer, key, &opapm->apm); break; } case OFPPAT_SET_MPLS_LABEL: { ofp_vport_action_set_mpls_label *oparml = (ofp_vport_action_set_mpls_label *)ah; set_mpls_label_act (buffer, key, oparml->label_out); break; } case OFPPAT_SET_MPLS_EXP: { ofp_vport_action_set_mpls_exp *oparme = (ofp_vport_action_set_mpls_exp *)ah; set_mpls_exp_act (buffer, key, oparme->exp); break; } default: break; } } bool EricssonAction::IsValidType (er_action_type type) { switch (type) { case ERXT_POP_MPLS: case ERXT_PUSH_MPLS: return true; default: return false; } } uint16_t EricssonAction::Validate (er_action_type type, size_t len) { size_t size = 0; switch (type) { case ERXT_POP_MPLS: size = sizeof(er_action_pop_mpls); break; case ERXT_PUSH_MPLS: size = sizeof(er_action_push_mpls); break; default: break; } if (len != size) { return OFPBAC_BAD_LEN; } return ACT_VALIDATION_OK; } void EricssonAction::Execute (er_action_type type, ofpbuf *buffer, const sw_flow_key *key, const er_action_header *ah) { switch (type) { case ERXT_POP_MPLS: { er_action_pop_mpls *erapm = (er_action_pop_mpls *)ah; pop_mpls_act (0, buffer, key, &erapm->apm); break; } case ERXT_PUSH_MPLS: { er_action_push_mpls *erapm = (er_action_push_mpls *)ah; push_mpls_act (0, buffer, key, &erapm->apm); break; } default: break; } } void Controller::AddSwitch (Ptr<OpenFlowSwitchNetDevice> swtch) { if (m_switches.find (swtch) != m_switches.end ()) { NS_LOG_INFO ("This Controller has already registered this switch!"); } else { m_switches.insert (swtch); } } void Controller::SendToSwitch (Ptr<OpenFlowSwitchNetDevice> swtch, void * msg, size_t length) { if (m_switches.find (swtch) == m_switches.end ()) { NS_LOG_ERROR ("Can't send to this switch, not registered to the Controller."); return; } swtch->ForwardControlInput (msg, length); } ofp_flow_mod* Controller::BuildFlow (sw_flow_key key, uint32_t buffer_id, uint16_t command, void* acts, size_t actions_len, int idle_timeout, int hard_timeout) { ofp_flow_mod* ofm = (ofp_flow_mod*)malloc (sizeof(ofp_flow_mod) + actions_len); ofm->header.version = OFP_VERSION; ofm->header.type = OFPT_FLOW_MOD; ofm->header.length = htons (sizeof(ofp_flow_mod) + actions_len); ofm->command = htons (command); ofm->idle_timeout = htons (idle_timeout); ofm->hard_timeout = htons (hard_timeout); ofm->buffer_id = htonl (buffer_id); ofm->priority = OFP_DEFAULT_PRIORITY; memcpy (ofm->actions,acts,actions_len); ofm->match.wildcards = key.wildcards; // Wildcard fields ofm->match.in_port = key.flow.in_port; // Input switch port memcpy (ofm->match.dl_src, key.flow.dl_src, sizeof ofm->match.dl_src); // Ethernet source address. memcpy (ofm->match.dl_dst, key.flow.dl_dst, sizeof ofm->match.dl_dst); // Ethernet destination address. ofm->match.dl_vlan = key.flow.dl_vlan; // Input VLAN OFP_VLAN_NONE; ofm->match.dl_type = key.flow.dl_type; // Ethernet frame type ETH_TYPE_IP; ofm->match.nw_proto = key.flow.nw_proto; // IP Protocol ofm->match.nw_src = key.flow.nw_src; // IP source address ofm->match.nw_dst = key.flow.nw_dst; // IP destination address ofm->match.tp_src = key.flow.tp_src; // TCP/UDP source port ofm->match.tp_dst = key.flow.tp_dst; // TCP/UDP destination port ofm->match.mpls_label1 = key.flow.mpls_label1; // Top of label stack htonl(MPLS_INVALID_LABEL); ofm->match.mpls_label2 = key.flow.mpls_label1; // Second label (if available) htonl(MPLS_INVALID_LABEL); return ofm; } uint8_t Controller::GetPacketType (ofpbuf* buffer) { ofp_header* hdr = (ofp_header*)ofpbuf_try_pull (buffer, sizeof (ofp_header)); uint8_t type = hdr->type; ofpbuf_push_uninit (buffer, sizeof (ofp_header)); return type; } void Controller::StartDump (StatsDumpCallback* cb) { if (cb != 0) { int error = 1; while (error > 0) // Switch's StatsDump returns 1 if the reply isn't complete. { error = cb->swtch->StatsDump (cb); } if (error != 0) // When the reply is complete, error will equal zero if there's no errors. { NS_LOG_WARN ("Dump Callback Error: " << strerror (-error)); } // Clean up cb->swtch->StatsDone (cb); } } void DropController::ReceiveFromSwitch (Ptr<OpenFlowSwitchNetDevice> swtch, ofpbuf* buffer) { if (m_switches.find (swtch) == m_switches.end ()) { NS_LOG_ERROR ("Can't receive from this switch, not registered to the Controller."); return; } // We have received any packet at this point, so we pull the header to figure out what type of packet we're handling. uint8_t type = GetPacketType (buffer); if (type == OFPT_PACKET_IN) // The switch didn't understand the packet it received, so it forwarded it to the controller. { ofp_packet_in * opi = (ofp_packet_in*)ofpbuf_try_pull (buffer, offsetof (ofp_packet_in, data)); int port = ntohs (opi->in_port); // Create matching key. sw_flow_key key; key.wildcards = 0; flow_extract (buffer, port != -1 ? port : OFPP_NONE, &key.flow); ofp_flow_mod* ofm = BuildFlow (key, opi->buffer_id, OFPFC_ADD, 0, 0, OFP_FLOW_PERMANENT, OFP_FLOW_PERMANENT); SendToSwitch (swtch, ofm, ofm->header.length); } } TypeId LearningController::GetTypeId (void) { static TypeId tid = TypeId ("ns3::ofi::LearningController") .SetParent (Controller::GetTypeId ()) .AddConstructor<LearningController> () .AddAttribute ("ExpirationTime", "Time it takes for learned MAC state entry/created flow to expire.", TimeValue (Seconds (0)), MakeTimeAccessor (&LearningController::m_expirationTime), MakeTimeChecker ()) ; return tid; } void LearningController::ReceiveFromSwitch (Ptr<OpenFlowSwitchNetDevice> swtch, ofpbuf* buffer) { if (m_switches.find (swtch) == m_switches.end ()) { NS_LOG_ERROR ("Can't receive from this switch, not registered to the Controller."); return; } // We have received any packet at this point, so we pull the header to figure out what type of packet we're handling. uint8_t type = GetPacketType (buffer); if (type == OFPT_PACKET_IN) // The switch didn't understand the packet it received, so it forwarded it to the controller. { ofp_packet_in * opi = (ofp_packet_in*)ofpbuf_try_pull (buffer, offsetof (ofp_packet_in, data)); int port = ntohs (opi->in_port); // Create matching key. sw_flow_key key; key.wildcards = 0; flow_extract (buffer, port != -1 ? port : OFPP_NONE, &key.flow); uint16_t out_port = OFPP_FLOOD; uint16_t in_port = ntohs (key.flow.in_port); // If the destination address is learned to a specific port, find it. Mac48Address dst_addr; dst_addr.CopyFrom (key.flow.dl_dst); if (!dst_addr.IsBroadcast ()) { LearnState_t::iterator st = m_learnState.find (dst_addr); if (st != m_learnState.end ()) { out_port = st->second.port; } else { NS_LOG_INFO ("Setting to flood; don't know yet what port " << dst_addr << " is connected to"); } } else { NS_LOG_INFO ("Setting to flood; this packet is a broadcast"); } // Create output-to-port action ofp_action_output x[1]; x[0].type = htons (OFPAT_OUTPUT); x[0].len = htons (sizeof(ofp_action_output)); x[0].port = out_port; // Create a new flow that outputs matched packets to a learned port, OFPP_FLOOD if there's no learned port. ofp_flow_mod* ofm = BuildFlow (key, opi->buffer_id, OFPFC_ADD, x, sizeof(x), OFP_FLOW_PERMANENT, m_expirationTime.IsZero () ? OFP_FLOW_PERMANENT : m_expirationTime.GetSeconds ()); SendToSwitch (swtch, ofm, ofm->header.length); // We can learn a specific port for the source address for future use. Mac48Address src_addr; src_addr.CopyFrom (key.flow.dl_src); LearnState_t::iterator st = m_learnState.find (src_addr); if (st == m_learnState.end ()) // We haven't learned our source MAC yet. { LearnedState ls; ls.port = in_port; m_learnState.insert (std::make_pair (src_addr,ls)); NS_LOG_INFO ("Learned that " << src_addr << " can be found over port " << in_port); // Learn src_addr goes to a certain port. ofp_action_output x2[1]; x2[0].type = htons (OFPAT_OUTPUT); x2[0].len = htons (sizeof(ofp_action_output)); x2[0].port = in_port; // Switch MAC Addresses and ports to the flow we're modifying src_addr.CopyTo (key.flow.dl_dst); dst_addr.CopyTo (key.flow.dl_src); key.flow.in_port = out_port; ofp_flow_mod* ofm2 = BuildFlow (key, -1, OFPFC_MODIFY, x2, sizeof(x2), OFP_FLOW_PERMANENT, m_expirationTime.IsZero () ? OFP_FLOW_PERMANENT : m_expirationTime.GetSeconds ()); SendToSwitch (swtch, ofm2, ofm2->header.length); } } } void ExecuteActions (Ptr<OpenFlowSwitchNetDevice> swtch, uint64_t packet_uid, ofpbuf* buffer, sw_flow_key *key, const ofp_action_header *actions, size_t actions_len, int ignore_no_fwd) { NS_LOG_FUNCTION_NOARGS (); /* Every output action needs a separate clone of 'buffer', but the common * case is just a single output action, so that doing a clone and then * freeing the original buffer is wasteful. So the following code is * slightly obscure just to avoid that. */ int prev_port; size_t max_len = 0; // Initialze to make compiler happy uint16_t in_port = key->flow.in_port; // ntohs(key->flow.in_port); uint8_t *p = (uint8_t *)actions; prev_port = -1; if (actions_len == 0) { NS_LOG_INFO ("No actions set to this flow. Dropping packet."); return; } /* The action list was already validated, so we can be a bit looser * in our sanity-checking. */ while (actions_len > 0) { ofp_action_header *ah = (ofp_action_header *)p; size_t len = htons (ah->len); if (prev_port != -1) { swtch->DoOutput (packet_uid, in_port, max_len, prev_port, ignore_no_fwd); prev_port = -1; } if (ah->type == htons (OFPAT_OUTPUT)) { ofp_action_output *oa = (ofp_action_output *)p; // port is now 32-bits prev_port = oa->port; // ntohl(oa->port); // prev_port = ntohs(oa->port); max_len = ntohs (oa->max_len); } else { uint16_t type = ntohs (ah->type); if (Action::IsValidType ((ofp_action_type)type)) // Execute a built-in OpenFlow action against 'buffer'. { Action::Execute ((ofp_action_type)type, buffer, key, ah); } else if (type == OFPAT_VENDOR) { ExecuteVendor (buffer, key, ah); } } p += len; actions_len -= len; } if (prev_port != -1) { swtch->DoOutput (packet_uid, in_port, max_len, prev_port, ignore_no_fwd); } } uint16_t ValidateActions (const sw_flow_key *key, const ofp_action_header *actions, size_t actions_len) { uint8_t *p = (uint8_t *)actions; int err; while (actions_len >= sizeof(ofp_action_header)) { ofp_action_header *ah = (ofp_action_header *)p; size_t len = ntohs (ah->len); uint16_t type; /* Make there's enough remaining data for the specified length * and that the action length is a multiple of 64 bits. */ if ((actions_len < len) || (len % 8) != 0) { return OFPBAC_BAD_LEN; } type = ntohs (ah->type); if (Action::IsValidType ((ofp_action_type)type)) // Validate built-in OpenFlow actions. { err = Action::Validate ((ofp_action_type)type, len, key, ah); if (err != ACT_VALIDATION_OK) { return err; } } else if (type == OFPAT_VENDOR) { err = ValidateVendor (key, ah, len); if (err != ACT_VALIDATION_OK) { return err; } } else { return OFPBAC_BAD_TYPE; } p += len; actions_len -= len; } // Check if there's any trailing garbage. if (actions_len != 0) { return OFPBAC_BAD_LEN; } return ACT_VALIDATION_OK; } void ExecuteVPortActions (Ptr<OpenFlowSwitchNetDevice> swtch, uint64_t packet_uid, ofpbuf* buffer, sw_flow_key *key, const ofp_action_header *actions, size_t actions_len) { /* Every output action needs a separate clone of 'buffer', but the common * case is just a single output action, so that doing a clone and then * freeing the original buffer is wasteful. So the following code is * slightly obscure just to avoid that. */ int prev_port; size_t max_len = 0; // Initialize to make compiler happy uint16_t in_port = ntohs (key->flow.in_port); uint8_t *p = (uint8_t *)actions; uint16_t type; ofp_action_output *oa; prev_port = -1; /* The action list was already validated, so we can be a bit looser * in our sanity-checking. */ while (actions_len > 0) { ofp_action_header *ah = (ofp_action_header *)p; size_t len = htons (ah->len); if (prev_port != -1) { swtch->DoOutput (packet_uid, in_port, max_len, prev_port, false); prev_port = -1; } if (ah->type == htons (OFPAT_OUTPUT)) { oa = (ofp_action_output *)p; prev_port = ntohl (oa->port); max_len = ntohs (oa->max_len); } else { type = ah->type; // ntohs(ah->type); VPortAction::Execute ((ofp_vport_action_type)type, buffer, key, ah); } p += len; actions_len -= len; } if (prev_port != -1) { swtch->DoOutput (packet_uid, in_port, max_len, prev_port, false); } } uint16_t ValidateVPortActions (const ofp_action_header *actions, size_t actions_len) { uint8_t *p = (uint8_t *)actions; int err; while (actions_len >= sizeof(ofp_action_header)) { ofp_action_header *ah = (ofp_action_header *)p; size_t len = ntohs (ah->len); uint16_t type; /* Make there's enough remaining data for the specified length * and that the action length is a multiple of 64 bits. */ if ((actions_len < len) || (len % 8) != 0) { return OFPBAC_BAD_LEN; } type = ntohs (ah->type); if (VPortAction::IsValidType ((ofp_vport_action_type)type)) // Validate "built-in" OpenFlow port table actions. { err = VPortAction::Validate ((ofp_vport_action_type)type, len, ah); if (err != ACT_VALIDATION_OK) { return err; } } else { return OFPBAC_BAD_TYPE; } p += len; actions_len -= len; } // Check if there's any trailing garbage. if (actions_len != 0) { return OFPBAC_BAD_LEN; } return ACT_VALIDATION_OK; } void ExecuteVendor (ofpbuf *buffer, const sw_flow_key *key, const ofp_action_header *ah) { ofp_action_vendor_header *avh = (ofp_action_vendor_header *)ah; switch (ntohl (avh->vendor)) { case NX_VENDOR_ID: // Nothing to execute yet. break; case ER_VENDOR_ID: { const er_action_header *erah = (const er_action_header *)avh; EricssonAction::Execute ((er_action_type)ntohs (erah->subtype), buffer, key, erah); break; } default: // This should not be possible due to prior validation. NS_LOG_INFO ("attempt to execute action with unknown vendor: " << ntohl (avh->vendor)); break; } } uint16_t ValidateVendor (const sw_flow_key *key, const ofp_action_header *ah, uint16_t len) { ofp_action_vendor_header *avh; int ret = ACT_VALIDATION_OK; if (len < sizeof(ofp_action_vendor_header)) { return OFPBAC_BAD_LEN; } avh = (ofp_action_vendor_header *)ah; switch (ntohl (avh->vendor)) { case NX_VENDOR_ID: // Validate Nicara OpenFlow actions. ret = OFPBAC_BAD_VENDOR_TYPE; // Nothing to validate yet. break; case ER_VENDOR_ID: // Validate Ericsson OpenFlow actions. { const er_action_header *erah = (const er_action_header *)avh; ret = EricssonAction::Validate ((er_action_type)ntohs (erah->subtype), len); break; } default: return OFPBAC_BAD_VENDOR; } return ret; } } } #endif // NS3_OPENFLOW
zy901002-gpsr
src/openflow/model/openflow-interface.cc
C++
gpl2
33,932
/* -*- 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 * * Author: Blake Hurd <naimorai@gmail.com> */ #ifdef NS3_OPENFLOW #include "openflow-switch-net-device.h" NS_LOG_COMPONENT_DEFINE ("OpenFlowSwitchNetDevice"); namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (OpenFlowSwitchNetDevice); const char * OpenFlowSwitchNetDevice::GetManufacturerDescription () { return "The ns-3 team"; } const char * OpenFlowSwitchNetDevice::GetHardwareDescription () { return "N/A"; } const char * OpenFlowSwitchNetDevice::GetSoftwareDescription () { return "Simulated OpenFlow Switch"; } const char * OpenFlowSwitchNetDevice::GetSerialNumber () { return "N/A"; } static uint64_t GenerateId () { uint8_t ea[ETH_ADDR_LEN]; eth_addr_random (ea); return eth_addr_to_uint64 (ea); } TypeId OpenFlowSwitchNetDevice::GetTypeId (void) { static TypeId tid = TypeId ("ns3::OpenFlowSwitchNetDevice") .SetParent<NetDevice> () .AddConstructor<OpenFlowSwitchNetDevice> () .AddAttribute ("ID", "The identification of the OpenFlowSwitchNetDevice/Datapath, needed for OpenFlow compatibility.", UintegerValue (GenerateId ()), MakeUintegerAccessor (&OpenFlowSwitchNetDevice::m_id), MakeUintegerChecker<uint64_t> ()) .AddAttribute ("FlowTableLookupDelay", "A real switch will have an overhead for looking up in the flow table. For the default, we simulate a standard TCAM on an FPGA.", TimeValue (NanoSeconds (30)), MakeTimeAccessor (&OpenFlowSwitchNetDevice::m_lookupDelay), MakeTimeChecker ()) .AddAttribute ("Flags", // Note: The Controller can configure this value, overriding the user's setting. "Flags to turn different functionality on/off, such as whether to inform the controller when a flow expires, or how to handle fragments.", UintegerValue (0), // Look at the ofp_config_flags enum in openflow/include/openflow.h for options. MakeUintegerAccessor (&OpenFlowSwitchNetDevice::m_flags), MakeUintegerChecker<uint16_t> ()) .AddAttribute ("FlowTableMissSendLength", // Note: The Controller can configure this value, overriding the user's setting. "When forwarding a packet the switch didn't match up to the controller, it can be more efficient to forward only the first x bytes.", UintegerValue (OFP_DEFAULT_MISS_SEND_LEN), // 128 bytes MakeUintegerAccessor (&OpenFlowSwitchNetDevice::m_missSendLen), MakeUintegerChecker<uint16_t> ()) ; return tid; } OpenFlowSwitchNetDevice::OpenFlowSwitchNetDevice () : m_node (0), m_ifIndex (0), m_mtu (0xffff) { NS_LOG_FUNCTION_NOARGS (); m_channel = CreateObject<BridgeChannel> (); time_init (); // OFSI's clock; needed to use the buffer storage system. // m_lastTimeout = time_now (); m_controller = 0; // m_listenPVConn = 0; m_chain = chain_create (); if (m_chain == 0) { NS_LOG_ERROR ("Not enough memory to create the flow table."); } m_ports.reserve (DP_MAX_PORTS); vport_table_init (&m_vportTable); } OpenFlowSwitchNetDevice::~OpenFlowSwitchNetDevice () { NS_LOG_FUNCTION_NOARGS (); } void OpenFlowSwitchNetDevice::DoDispose () { NS_LOG_FUNCTION_NOARGS (); for (Ports_t::iterator b = m_ports.begin (), e = m_ports.end (); b != e; b++) { SendPortStatus (*b, OFPPR_DELETE); b->netdev = 0; } m_ports.clear (); m_controller = 0; chain_destroy (m_chain); RBTreeDestroy (m_vportTable.table); m_channel = 0; m_node = 0; NetDevice::DoDispose (); } void OpenFlowSwitchNetDevice::SetController (Ptr<ofi::Controller> c) { if (m_controller != 0) { NS_LOG_ERROR ("Controller already set."); return; } m_controller = c; m_controller->AddSwitch (this); } int OpenFlowSwitchNetDevice::AddSwitchPort (Ptr<NetDevice> switchPort) { NS_LOG_FUNCTION_NOARGS (); NS_ASSERT (switchPort != this); if (!Mac48Address::IsMatchingType (switchPort->GetAddress ())) { NS_FATAL_ERROR ("Device does not support eui 48 addresses: cannot be added to switch."); } if (!switchPort->SupportsSendFrom ()) { NS_FATAL_ERROR ("Device does not support SendFrom: cannot be added to switch."); } if (m_address == Mac48Address ()) { m_address = Mac48Address::ConvertFrom (switchPort->GetAddress ()); } if (m_ports.size () < DP_MAX_PORTS) { ofi::Port p; p.config = 0; p.netdev = switchPort; m_ports.push_back (p); // Notify the controller that this port has been added SendPortStatus (p, OFPPR_ADD); NS_LOG_DEBUG ("RegisterProtocolHandler for " << switchPort->GetInstanceTypeId ().GetName ()); m_node->RegisterProtocolHandler (MakeCallback (&OpenFlowSwitchNetDevice::ReceiveFromDevice, this), 0, switchPort, true); m_channel->AddChannel (switchPort->GetChannel ()); } else { return EXFULL; } return 0; } void OpenFlowSwitchNetDevice::SetIfIndex (const uint32_t index) { NS_LOG_FUNCTION_NOARGS (); m_ifIndex = index; } uint32_t OpenFlowSwitchNetDevice::GetIfIndex (void) const { NS_LOG_FUNCTION_NOARGS (); return m_ifIndex; } Ptr<Channel> OpenFlowSwitchNetDevice::GetChannel (void) const { NS_LOG_FUNCTION_NOARGS (); return m_channel; } void OpenFlowSwitchNetDevice::SetAddress (Address address) { NS_LOG_FUNCTION_NOARGS (); m_address = Mac48Address::ConvertFrom (address); } Address OpenFlowSwitchNetDevice::GetAddress (void) const { NS_LOG_FUNCTION_NOARGS (); return m_address; } bool OpenFlowSwitchNetDevice::SetMtu (const uint16_t mtu) { NS_LOG_FUNCTION_NOARGS (); m_mtu = mtu; return true; } uint16_t OpenFlowSwitchNetDevice::GetMtu (void) const { NS_LOG_FUNCTION_NOARGS (); return m_mtu; } bool OpenFlowSwitchNetDevice::IsLinkUp (void) const { NS_LOG_FUNCTION_NOARGS (); return true; } void OpenFlowSwitchNetDevice::AddLinkChangeCallback (Callback<void> callback) { } bool OpenFlowSwitchNetDevice::IsBroadcast (void) const { NS_LOG_FUNCTION_NOARGS (); return true; } Address OpenFlowSwitchNetDevice::GetBroadcast (void) const { NS_LOG_FUNCTION_NOARGS (); return Mac48Address ("ff:ff:ff:ff:ff:ff"); } bool OpenFlowSwitchNetDevice::IsMulticast (void) const { NS_LOG_FUNCTION_NOARGS (); return true; } Address OpenFlowSwitchNetDevice::GetMulticast (Ipv4Address multicastGroup) const { NS_LOG_FUNCTION (this << multicastGroup); Mac48Address multicast = Mac48Address::GetMulticast (multicastGroup); return multicast; } bool OpenFlowSwitchNetDevice::IsPointToPoint (void) const { NS_LOG_FUNCTION_NOARGS (); return false; } bool OpenFlowSwitchNetDevice::IsBridge (void) const { NS_LOG_FUNCTION_NOARGS (); return true; } void OpenFlowSwitchNetDevice::DoOutput (uint32_t packet_uid, int in_port, size_t max_len, int out_port, bool ignore_no_fwd) { if (out_port != OFPP_CONTROLLER) { OutputPort (packet_uid, in_port, out_port, ignore_no_fwd); } else { OutputControl (packet_uid, in_port, max_len, OFPR_ACTION); } } bool OpenFlowSwitchNetDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber) { NS_LOG_FUNCTION_NOARGS (); return SendFrom (packet, m_address, dest, protocolNumber); } bool OpenFlowSwitchNetDevice::SendFrom (Ptr<Packet> packet, const Address& src, const Address& dest, uint16_t protocolNumber) { NS_LOG_FUNCTION_NOARGS (); ofpbuf *buffer = BufferFromPacket (packet,src,dest,GetMtu (),protocolNumber); uint32_t packet_uid = save_buffer (buffer); ofi::SwitchPacketMetadata data; data.packet = packet; data.buffer = buffer; data.protocolNumber = protocolNumber; data.src = Address (src); data.dst = Address (dest); m_packetData.insert (std::make_pair (packet_uid, data)); RunThroughFlowTable (packet_uid, -1); return true; } Ptr<Node> OpenFlowSwitchNetDevice::GetNode (void) const { NS_LOG_FUNCTION_NOARGS (); return m_node; } void OpenFlowSwitchNetDevice::SetNode (Ptr<Node> node) { NS_LOG_FUNCTION_NOARGS (); m_node = node; } bool OpenFlowSwitchNetDevice::NeedsArp (void) const { NS_LOG_FUNCTION_NOARGS (); return true; } void OpenFlowSwitchNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb) { NS_LOG_FUNCTION_NOARGS (); m_rxCallback = cb; } void OpenFlowSwitchNetDevice::SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb) { NS_LOG_FUNCTION_NOARGS (); m_promiscRxCallback = cb; } bool OpenFlowSwitchNetDevice::SupportsSendFrom () const { NS_LOG_FUNCTION_NOARGS (); return true; } Address OpenFlowSwitchNetDevice::GetMulticast (Ipv6Address addr) const { NS_LOG_FUNCTION (this << addr); return Mac48Address::GetMulticast (addr); } // Add a virtual port table entry. int OpenFlowSwitchNetDevice::AddVPort (const ofp_vport_mod *ovpm) { size_t actions_len = ntohs (ovpm->header.length) - sizeof *ovpm; unsigned int vport = ntohl (ovpm->vport); unsigned int parent_port = ntohl (ovpm->parent_port); // check whether port table entry exists for specified port number vport_table_entry *vpe = vport_table_lookup (&m_vportTable, vport); if (vpe != 0) { NS_LOG_ERROR ("vport " << vport << " already exists!"); SendErrorMsg (OFPET_BAD_ACTION, OFPET_VPORT_MOD_FAILED, ovpm, ntohs (ovpm->header.length)); return EINVAL; } // check whether actions are valid uint16_t v_code = ofi::ValidateVPortActions (ovpm->actions, actions_len); if (v_code != ACT_VALIDATION_OK) { SendErrorMsg (OFPET_BAD_ACTION, v_code, ovpm, ntohs (ovpm->header.length)); return EINVAL; } vpe = vport_table_entry_alloc (actions_len); vpe->vport = vport; vpe->parent_port = parent_port; if (vport < OFPP_VP_START || vport > OFPP_VP_END) { NS_LOG_ERROR ("port " << vport << " is not in the virtual port range (" << OFPP_VP_START << "-" << OFPP_VP_END << ")"); SendErrorMsg (OFPET_BAD_ACTION, OFPET_VPORT_MOD_FAILED, ovpm, ntohs (ovpm->header.length)); free_vport_table_entry (vpe); // free allocated entry return EINVAL; } vpe->port_acts->actions_len = actions_len; memcpy (vpe->port_acts->actions, ovpm->actions, actions_len); int error = insert_vport_table_entry (&m_vportTable, vpe); if (error) { NS_LOG_ERROR ("could not insert port table entry for port " << vport); } return error; } ofpbuf * OpenFlowSwitchNetDevice::BufferFromPacket (Ptr<Packet> packet, Address src, Address dst, int mtu, uint16_t protocol) { NS_LOG_INFO ("Creating Openflow buffer from packet."); /* * Allocate buffer with some headroom to add headers in forwarding * to the controller or adding a vlan tag, plus an extra 2 bytes to * allow IP headers to be aligned on a 4-byte boundary. */ const int headroom = 128 + 2; const int hard_header = VLAN_ETH_HEADER_LEN; ofpbuf *buffer = ofpbuf_new (headroom + hard_header + mtu); buffer->data = (char*)buffer->data + headroom + hard_header; int l2_length = 0, l3_length = 0, l4_length = 0; // Load headers EthernetHeader eth_hd; if (packet->PeekHeader (eth_hd)) { buffer->l2 = new eth_header; eth_header* eth_h = (eth_header*)buffer->l2; dst.CopyTo (eth_h->eth_dst); // Destination Mac Address src.CopyTo (eth_h->eth_src); // Source Mac Address eth_h->eth_type = htons (ETH_TYPE_IP); // Ether Type NS_LOG_INFO ("Parsed EthernetHeader"); l2_length = ETH_HEADER_LEN; } // We have to wrap this because PeekHeader has an assert fail if we check for an Ipv4Header that isn't there. if (protocol == Ipv4L3Protocol::PROT_NUMBER) { Ipv4Header ip_hd; if (packet->PeekHeader (ip_hd)) { buffer->l3 = new ip_header; ip_header* ip_h = (ip_header*)buffer->l3; ip_h->ip_ihl_ver = IP_IHL_VER (5, IP_VERSION); // Version ip_h->ip_tos = ip_hd.GetTos (); // Type of Service/Differentiated Services ip_h->ip_tot_len = packet->GetSize (); // Total Length ip_h->ip_id = ip_hd.GetIdentification (); // Identification ip_h->ip_frag_off = ip_hd.GetFragmentOffset (); // Fragment Offset ip_h->ip_ttl = ip_hd.GetTtl (); // Time to Live ip_h->ip_proto = ip_hd.GetProtocol (); // Protocol ip_h->ip_src = htonl (ip_hd.GetSource ().Get ()); // Source Address ip_h->ip_dst = htonl (ip_hd.GetDestination ().Get ()); // Destination Address ip_h->ip_csum = csum (&ip_h, sizeof ip_h); // Header Checksum NS_LOG_INFO ("Parsed Ipv4Header"); l3_length = IP_HEADER_LEN; } } else { // ARP Packet; the underlying OpenFlow header isn't used to match, so this is probably superfluous. ArpHeader arp_hd; if (packet->PeekHeader (arp_hd)) { buffer->l3 = new arp_eth_header; arp_eth_header* arp_h = (arp_eth_header*)buffer->l3; arp_h->ar_hrd = ARP_HRD_ETHERNET; // Hardware type. arp_h->ar_pro = ARP_PRO_IP; // Protocol type. arp_h->ar_op = arp_hd.m_type; // Opcode. arp_hd.GetDestinationHardwareAddress ().CopyTo (arp_h->ar_tha); // Target hardware address. arp_hd.GetSourceHardwareAddress ().CopyTo (arp_h->ar_sha); // Sender hardware address. arp_h->ar_tpa = arp_hd.GetDestinationIpv4Address ().Get (); // Target protocol address. arp_h->ar_spa = arp_hd.GetSourceIpv4Address ().Get (); // Sender protocol address. arp_h->ar_hln = sizeof arp_h->ar_tha; // Hardware address length. arp_h->ar_pln = sizeof arp_h->ar_tpa; // Protocol address length. NS_LOG_INFO ("Parsed ArpHeader"); l3_length = ARP_ETH_HEADER_LEN; } } TcpHeader tcp_hd; if (packet->PeekHeader (tcp_hd)) { buffer->l4 = new tcp_header; tcp_header* tcp_h = (tcp_header*)buffer->l4; tcp_h->tcp_src = htonl (tcp_hd.GetSourcePort ()); // Source Port tcp_h->tcp_dst = htonl (tcp_hd.GetDestinationPort ()); // Destination Port tcp_h->tcp_seq = tcp_hd.GetSequenceNumber ().GetValue (); // Sequence Number tcp_h->tcp_ack = tcp_hd.GetAckNumber ().GetValue (); // ACK Number tcp_h->tcp_ctl = TCP_FLAGS (tcp_hd.GetFlags ()); // Data Offset + Reserved + Flags tcp_h->tcp_winsz = tcp_hd.GetWindowSize (); // Window Size tcp_h->tcp_urg = tcp_hd.GetUrgentPointer (); // Urgent Pointer tcp_h->tcp_csum = csum (&tcp_h, sizeof tcp_h); // Header Checksum NS_LOG_INFO ("Parsed TcpHeader"); l4_length = TCP_HEADER_LEN; } else { UdpHeader udp_hd; if (packet->PeekHeader (udp_hd)) { buffer->l4 = new udp_header; udp_header* udp_h = (udp_header*)buffer->l4; udp_h->udp_src = htonl (udp_hd.GetSourcePort ()); // Source Port udp_h->udp_dst = htonl (udp_hd.GetDestinationPort ()); // Destination Port udp_h->udp_len = htons (UDP_HEADER_LEN + packet->GetSize ()); if (protocol == Ipv4L3Protocol::PROT_NUMBER) { ip_header* ip_h = (ip_header*)buffer->l3; uint32_t udp_csum = csum_add32 (0, ip_h->ip_src); udp_csum = csum_add32 (udp_csum, ip_h->ip_dst); udp_csum = csum_add16 (udp_csum, IP_TYPE_UDP << 8); udp_csum = csum_add16 (udp_csum, udp_h->udp_len); udp_csum = csum_continue (udp_csum, udp_h, sizeof udp_h); udp_h->udp_csum = csum_finish (csum_continue (udp_csum, buffer->data, buffer->size)); // Header Checksum } else { udp_h->udp_csum = htons (0); } NS_LOG_INFO ("Parsed UdpHeader"); l4_length = UDP_HEADER_LEN; } } // Load Packet data into buffer data packet->CopyData ((uint8_t*)buffer->data, packet->GetSize ()); if (buffer->l4) { ofpbuf_push (buffer, buffer->l4, l4_length); delete (tcp_header*)buffer->l4; } if (buffer->l3) { ofpbuf_push (buffer, buffer->l3, l3_length); delete (ip_header*)buffer->l3; } if (buffer->l2) { ofpbuf_push (buffer, buffer->l2, l2_length); delete (eth_header*)buffer->l2; } return buffer; } void OpenFlowSwitchNetDevice::ReceiveFromDevice (Ptr<NetDevice> netdev, Ptr<const Packet> packet, uint16_t protocol, const Address& src, const Address& dst, PacketType packetType) { NS_LOG_FUNCTION_NOARGS (); NS_LOG_INFO ("--------------------------------------------"); NS_LOG_DEBUG ("UID is " << packet->GetUid ()); if (!m_promiscRxCallback.IsNull ()) { m_promiscRxCallback (this, packet, protocol, src, dst, packetType); } Mac48Address dst48 = Mac48Address::ConvertFrom (dst); NS_LOG_INFO ("Received packet from " << Mac48Address::ConvertFrom (src) << " looking for " << dst48); for (size_t i = 0; i < m_ports.size (); i++) { if (m_ports[i].netdev == netdev) { if (packetType == PACKET_HOST && dst48 == m_address) { m_rxCallback (this, packet, protocol, src); } else if (packetType == PACKET_BROADCAST || packetType == PACKET_MULTICAST || packetType == PACKET_OTHERHOST) { if (packetType == PACKET_OTHERHOST && dst48 == m_address) { m_rxCallback (this, packet, protocol, src); } else { if (packetType != PACKET_OTHERHOST) { m_rxCallback (this, packet, protocol, src); } ofi::SwitchPacketMetadata data; data.packet = packet->Copy (); ofpbuf *buffer = BufferFromPacket (data.packet,src,dst,netdev->GetMtu (),protocol); m_ports[i].rx_packets++; m_ports[i].rx_bytes += buffer->size; data.buffer = buffer; uint32_t packet_uid = save_buffer (buffer); data.protocolNumber = protocol; data.src = Address (src); data.dst = Address (dst); m_packetData.insert (std::make_pair (packet_uid, data)); RunThroughFlowTable (packet_uid, i); } } break; } } // Run periodic execution. Time now = Simulator::Now (); if (now >= Seconds (m_lastExecute.GetSeconds () + 1)) // If a second or more has passed from the simulation time, execute. { // If port status is modified in any way, notify the controller. for (size_t i = 0; i < m_ports.size (); i++) { if (UpdatePortStatus (m_ports[i])) { SendPortStatus (m_ports[i], OFPPR_MODIFY); } } // If any flows have expired, delete them and notify the controller. List deleted = LIST_INITIALIZER (&deleted); sw_flow *f, *n; chain_timeout (m_chain, &deleted); LIST_FOR_EACH_SAFE (f, n, sw_flow, node, &deleted) { std::ostringstream str; str << "Flow ["; for (int i = 0; i < 6; i++) str << (i!=0 ? ":" : "") << std::hex << f->key.flow.dl_src[i]/16 << f->key.flow.dl_src[i]%16; str << " -> "; for (int i = 0; i < 6; i++) str << (i!=0 ? ":" : "") << std::hex << f->key.flow.dl_dst[i]/16 << f->key.flow.dl_dst[i]%16; str << "] expired."; NS_LOG_INFO (str.str ()); SendFlowExpired (f, (ofp_flow_expired_reason)f->reason); list_remove (&f->node); flow_free (f); } m_lastExecute = now; } } int OpenFlowSwitchNetDevice::OutputAll (uint32_t packet_uid, int in_port, bool flood) { NS_LOG_FUNCTION_NOARGS (); NS_LOG_INFO ("Flooding over ports."); int prev_port = -1; for (size_t i = 0; i < m_ports.size (); i++) { if (i == (unsigned)in_port) // Originating port { continue; } if (flood && m_ports[i].config & OFPPC_NO_FLOOD) // Port configured to not allow flooding { continue; } if (prev_port != -1) { OutputPort (packet_uid, in_port, prev_port, false); } prev_port = i; } if (prev_port != -1) { OutputPort (packet_uid, in_port, prev_port, false); } return 0; } void OpenFlowSwitchNetDevice::OutputPacket (uint32_t packet_uid, int out_port) { if (out_port >= 0 && out_port < DP_MAX_PORTS) { ofi::Port& p = m_ports[out_port]; if (p.netdev != 0 && !(p.config & OFPPC_PORT_DOWN)) { ofi::SwitchPacketMetadata data = m_packetData.find (packet_uid)->second; size_t bufsize = data.buffer->size; NS_LOG_INFO ("Sending packet " << data.packet->GetUid () << " over port " << out_port); if (p.netdev->SendFrom (data.packet->Copy (), data.src, data.dst, data.protocolNumber)) { p.tx_packets++; p.tx_bytes += bufsize; } else { p.tx_dropped++; } return; } } NS_LOG_DEBUG ("can't forward to bad port " << out_port); } void OpenFlowSwitchNetDevice::OutputPort (uint32_t packet_uid, int in_port, int out_port, bool ignore_no_fwd) { NS_LOG_FUNCTION_NOARGS (); if (out_port == OFPP_FLOOD) { OutputAll (packet_uid, in_port, true); } else if (out_port == OFPP_ALL) { OutputAll (packet_uid, in_port, false); } else if (out_port == OFPP_CONTROLLER) { OutputControl (packet_uid, in_port, 0, OFPR_ACTION); } else if (out_port == OFPP_IN_PORT) { OutputPacket (packet_uid, in_port); } else if (out_port == OFPP_TABLE) { RunThroughFlowTable (packet_uid, in_port < DP_MAX_PORTS ? in_port : -1, false); } else if (out_port >= OFPP_VP_START && out_port <= OFPP_VP_END) { // port is a virtual port NS_LOG_INFO ("packet sent to virtual port " << out_port); if (in_port < DP_MAX_PORTS) { RunThroughVPortTable (packet_uid, in_port, out_port); } else { RunThroughVPortTable (packet_uid, -1, out_port); } } else if (in_port == out_port) { NS_LOG_DEBUG ("can't directly forward to input port"); } else { OutputPacket (packet_uid, out_port); } } void* OpenFlowSwitchNetDevice::MakeOpenflowReply (size_t openflow_len, uint8_t type, ofpbuf **bufferp) { return make_openflow_xid (openflow_len, type, 0, bufferp); } int OpenFlowSwitchNetDevice::SendOpenflowBuffer (ofpbuf *buffer) { if (m_controller != 0) { update_openflow_length (buffer); m_controller->ReceiveFromSwitch (this, buffer); } return 0; } void OpenFlowSwitchNetDevice::OutputControl (uint32_t packet_uid, int in_port, size_t max_len, int reason) { NS_LOG_INFO ("Sending packet to controller"); ofpbuf* buffer = m_packetData.find (packet_uid)->second.buffer; size_t total_len = buffer->size; if (packet_uid != std::numeric_limits<uint32_t>::max () && max_len != 0 && buffer->size > max_len) { buffer->size = max_len; } ofp_packet_in *opi = (ofp_packet_in*)ofpbuf_push_uninit (buffer, offsetof (ofp_packet_in, data)); opi->header.version = OFP_VERSION; opi->header.type = OFPT_PACKET_IN; opi->header.length = htons (buffer->size); opi->header.xid = htonl (0); opi->buffer_id = htonl (packet_uid); opi->total_len = htons (total_len); opi->in_port = htons (in_port); opi->reason = reason; opi->pad = 0; SendOpenflowBuffer (buffer); } void OpenFlowSwitchNetDevice::FillPortDesc (ofi::Port p, ofp_phy_port *desc) { desc->port_no = htons (GetSwitchPortIndex (p)); std::ostringstream nm; nm << "eth" << GetSwitchPortIndex (p); strncpy ((char *)desc->name, nm.str ().c_str (), sizeof desc->name); p.netdev->GetAddress ().CopyTo (desc->hw_addr); desc->config = htonl (p.config); desc->state = htonl (p.state); // TODO: This should probably be fixed eventually to specify different available features. desc->curr = 0; // htonl(netdev_get_features(p->netdev, NETDEV_FEAT_CURRENT)); desc->supported = 0; // htonl(netdev_get_features(p->netdev, NETDEV_FEAT_SUPPORTED)); desc->advertised = 0; // htonl(netdev_get_features(p->netdev, NETDEV_FEAT_ADVERTISED)); desc->peer = 0; // htonl(netdev_get_features(p->netdev, NETDEV_FEAT_PEER)); } void OpenFlowSwitchNetDevice::SendFeaturesReply () { ofpbuf *buffer; ofp_switch_features *ofr = (ofp_switch_features*)MakeOpenflowReply (sizeof *ofr, OFPT_FEATURES_REPLY, &buffer); ofr->datapath_id = htonll (m_id); ofr->n_tables = m_chain->n_tables; ofr->n_buffers = htonl (N_PKT_BUFFERS); ofr->capabilities = htonl (OFP_SUPPORTED_CAPABILITIES); ofr->actions = htonl (OFP_SUPPORTED_ACTIONS); for (size_t i = 0; i < m_ports.size (); i++) { ofp_phy_port* opp = (ofp_phy_port*)ofpbuf_put_zeros (buffer, sizeof *opp); FillPortDesc (m_ports[i], opp); } SendOpenflowBuffer (buffer); } void OpenFlowSwitchNetDevice::SendVPortTableFeatures () { ofpbuf *buffer; ofp_vport_table_features *ovtfr = (ofp_vport_table_features*)MakeOpenflowReply (sizeof *ovtfr, OFPT_VPORT_TABLE_FEATURES_REPLY, &buffer); ovtfr->actions = htonl (OFP_SUPPORTED_VPORT_TABLE_ACTIONS); ovtfr->max_vports = htonl (m_vportTable.max_vports); ovtfr->max_chain_depth = htons (-1); // support a chain depth of 2^16 ovtfr->mixed_chaining = true; SendOpenflowBuffer (buffer); } int OpenFlowSwitchNetDevice::UpdatePortStatus (ofi::Port& p) { uint32_t orig_config = p.config; uint32_t orig_state = p.state; // Port is always enabled because the Net Device is always enabled. p.config &= ~OFPPC_PORT_DOWN; if (p.netdev->IsLinkUp ()) { p.state &= ~OFPPS_LINK_DOWN; } else { p.state |= OFPPS_LINK_DOWN; } return ((orig_config != p.config) || (orig_state != p.state)); } void OpenFlowSwitchNetDevice::SendPortStatus (ofi::Port p, uint8_t status) { ofpbuf *buffer; ofp_port_status *ops = (ofp_port_status*)MakeOpenflowReply (sizeof *ops, OFPT_PORT_STATUS, &buffer); ops->reason = status; memset (ops->pad, 0, sizeof ops->pad); FillPortDesc (p, &ops->desc); SendOpenflowBuffer (buffer); ofpbuf_delete (buffer); } void OpenFlowSwitchNetDevice::SendFlowExpired (sw_flow *flow, enum ofp_flow_expired_reason reason) { ofpbuf *buffer; ofp_flow_expired *ofe = (ofp_flow_expired*)MakeOpenflowReply (sizeof *ofe, OFPT_FLOW_EXPIRED, &buffer); flow_fill_match (&ofe->match, &flow->key); ofe->priority = htons (flow->priority); ofe->reason = reason; memset (ofe->pad, 0, sizeof ofe->pad); ofe->duration = htonl (time_now () - flow->created); memset (ofe->pad2, 0, sizeof ofe->pad2); ofe->packet_count = htonll (flow->packet_count); ofe->byte_count = htonll (flow->byte_count); SendOpenflowBuffer (buffer); } void OpenFlowSwitchNetDevice::SendErrorMsg (uint16_t type, uint16_t code, const void *data, size_t len) { ofpbuf *buffer; ofp_error_msg *oem = (ofp_error_msg*)MakeOpenflowReply (sizeof(*oem) + len, OFPT_ERROR, &buffer); oem->type = htons (type); oem->code = htons (code); memcpy (oem->data, data, len); SendOpenflowBuffer (buffer); } void OpenFlowSwitchNetDevice::FlowTableLookup (sw_flow_key key, ofpbuf* buffer, uint32_t packet_uid, int port, bool send_to_controller) { sw_flow *flow = chain_lookup (m_chain, &key); if (flow != 0) { NS_LOG_INFO ("Flow matched"); flow_used (flow, buffer); ofi::ExecuteActions (this, packet_uid, buffer, &key, flow->sf_acts->actions, flow->sf_acts->actions_len, false); } else { NS_LOG_INFO ("Flow not matched."); if (send_to_controller) { OutputControl (packet_uid, port, m_missSendLen, OFPR_NO_MATCH); } } // Clean up; at this point we're done with the packet. m_packetData.erase (packet_uid); discard_buffer (packet_uid); ofpbuf_delete (buffer); } void OpenFlowSwitchNetDevice::RunThroughFlowTable (uint32_t packet_uid, int port, bool send_to_controller) { ofi::SwitchPacketMetadata data = m_packetData.find (packet_uid)->second; ofpbuf* buffer = data.buffer; sw_flow_key key; key.wildcards = 0; // Lookup cannot take wildcards. // Extract the matching key's flow data from the packet's headers; if the policy is to drop fragments and the message is a fragment, drop it. if (flow_extract (buffer, port != -1 ? port : OFPP_NONE, &key.flow) && (m_flags & OFPC_FRAG_MASK) == OFPC_FRAG_DROP) { ofpbuf_delete (buffer); return; } // drop MPLS packets with TTL 1 if (buffer->l2_5) { mpls_header mpls_h; mpls_h.value = ntohl (*((uint32_t*)buffer->l2_5)); if (mpls_h.ttl == 1) { // increment mpls drop counter if (port != -1) { m_ports[port].mpls_ttl0_dropped++; } return; } } // If we received the packet on a port, and opted not to receive any messages from it... if (port != -1) { uint32_t config = m_ports[port].config; if (config & (OFPPC_NO_RECV | OFPPC_NO_RECV_STP) && config & (!eth_addr_equals (key.flow.dl_dst, stp_eth_addr) ? OFPPC_NO_RECV : OFPPC_NO_RECV_STP)) { return; } } NS_LOG_INFO ("Matching against the flow table."); Simulator::Schedule (m_lookupDelay, &OpenFlowSwitchNetDevice::FlowTableLookup, this, key, buffer, packet_uid, port, send_to_controller); } int OpenFlowSwitchNetDevice::RunThroughVPortTable (uint32_t packet_uid, int port, uint32_t vport) { ofpbuf* buffer = m_packetData.find (packet_uid)->second.buffer; // extract the flow again since we need it // and the layer pointers may changed sw_flow_key key; key.wildcards = 0; if (flow_extract (buffer, port != -1 ? port : OFPP_NONE, &key.flow) && (m_flags & OFPC_FRAG_MASK) == OFPC_FRAG_DROP) { return 0; } // run through the chain of port table entries vport_table_entry *vpe = vport_table_lookup (&m_vportTable, vport); m_vportTable.lookup_count++; if (vpe) { m_vportTable.port_match_count++; } while (vpe != 0) { ofi::ExecuteVPortActions (this, packet_uid, m_packetData.find (packet_uid)->second.buffer, &key, vpe->port_acts->actions, vpe->port_acts->actions_len); vport_used (vpe, buffer); // update counters for virtual port if (vpe->parent_port_ptr == 0) { // if a port table's parent_port_ptr is 0 then // the parent_port should be a physical port if (vpe->parent_port <= OFPP_VP_START) // done traversing port chain, send packet to output port { OutputPort (packet_uid, port != -1 ? port : OFPP_NONE, vpe->parent_port, false); } else { NS_LOG_ERROR ("virtual port points to parent port\n"); } } else // increment the number of port entries accessed by chaining { m_vportTable.chain_match_count++; } // move to the parent port entry vpe = vpe->parent_port_ptr; } return 0; } int OpenFlowSwitchNetDevice::ReceiveFeaturesRequest (const void *msg) { SendFeaturesReply (); return 0; } int OpenFlowSwitchNetDevice::ReceiveVPortTableFeaturesRequest (const void *msg) { SendVPortTableFeatures (); return 0; } int OpenFlowSwitchNetDevice::ReceiveGetConfigRequest (const void *msg) { ofpbuf *buffer; ofp_switch_config *osc = (ofp_switch_config*)MakeOpenflowReply (sizeof *osc, OFPT_GET_CONFIG_REPLY, &buffer); osc->flags = htons (m_flags); osc->miss_send_len = htons (m_missSendLen); return SendOpenflowBuffer (buffer); } int OpenFlowSwitchNetDevice::ReceiveSetConfig (const void *msg) { const ofp_switch_config *osc = (ofp_switch_config*)msg; int n_flags = ntohs (osc->flags) & (OFPC_SEND_FLOW_EXP | OFPC_FRAG_MASK); if ((n_flags & OFPC_FRAG_MASK) != OFPC_FRAG_NORMAL && (n_flags & OFPC_FRAG_MASK) != OFPC_FRAG_DROP) { n_flags = (n_flags & ~OFPC_FRAG_MASK) | OFPC_FRAG_DROP; } m_flags = n_flags; m_missSendLen = ntohs (osc->miss_send_len); return 0; } int OpenFlowSwitchNetDevice::ReceivePacketOut (const void *msg) { const ofp_packet_out *opo = (ofp_packet_out*)msg; ofpbuf *buffer; size_t actions_len = ntohs (opo->actions_len); if (actions_len > (ntohs (opo->header.length) - sizeof *opo)) { NS_LOG_DEBUG ("message too short for number of actions"); return -EINVAL; } if (ntohl (opo->buffer_id) == (uint32_t) -1) { // FIXME: can we avoid copying data here? int data_len = ntohs (opo->header.length) - sizeof *opo - actions_len; buffer = ofpbuf_new (data_len); ofpbuf_put (buffer, (uint8_t *)opo->actions + actions_len, data_len); } else { buffer = retrieve_buffer (ntohl (opo->buffer_id)); if (buffer == 0) { return -ESRCH; } } sw_flow_key key; flow_extract (buffer, opo->in_port, &key.flow); // ntohs(opo->in_port) uint16_t v_code = ofi::ValidateActions (&key, opo->actions, actions_len); if (v_code != ACT_VALIDATION_OK) { SendErrorMsg (OFPET_BAD_ACTION, v_code, msg, ntohs (opo->header.length)); ofpbuf_delete (buffer); return -EINVAL; } ofi::ExecuteActions (this, opo->buffer_id, buffer, &key, opo->actions, actions_len, true); return 0; } int OpenFlowSwitchNetDevice::ReceivePortMod (const void *msg) { ofp_port_mod* opm = (ofp_port_mod*)msg; int port = opm->port_no; // ntohs(opm->port_no); if (port < DP_MAX_PORTS) { ofi::Port& p = m_ports[port]; // Make sure the port id hasn't changed since this was sent Mac48Address hw_addr = Mac48Address (); hw_addr.CopyFrom (opm->hw_addr); if (p.netdev->GetAddress () != hw_addr) { return 0; } if (opm->mask) { uint32_t config_mask = ntohl (opm->mask); p.config &= ~config_mask; p.config |= ntohl (opm->config) & config_mask; } if (opm->mask & htonl (OFPPC_PORT_DOWN)) { if ((opm->config & htonl (OFPPC_PORT_DOWN)) && (p.config & OFPPC_PORT_DOWN) == 0) { p.config |= OFPPC_PORT_DOWN; // TODO: Possibly disable the Port's Net Device via the appropriate interface. } else if ((opm->config & htonl (OFPPC_PORT_DOWN)) == 0 && (p.config & OFPPC_PORT_DOWN)) { p.config &= ~OFPPC_PORT_DOWN; // TODO: Possibly enable the Port's Net Device via the appropriate interface. } } } return 0; } // add or remove a virtual port table entry int OpenFlowSwitchNetDevice::ReceiveVPortMod (const void *msg) { const ofp_vport_mod *ovpm = (ofp_vport_mod*)msg; uint16_t command = ntohs (ovpm->command); if (command == OFPVP_ADD) { return AddVPort (ovpm); } else if (command == OFPVP_DELETE) { if (remove_vport_table_entry (&m_vportTable, ntohl (ovpm->vport))) { SendErrorMsg (OFPET_BAD_ACTION, OFPET_VPORT_MOD_FAILED, ovpm, ntohs (ovpm->header.length)); } } return 0; } int OpenFlowSwitchNetDevice::AddFlow (const ofp_flow_mod *ofm) { size_t actions_len = ntohs (ofm->header.length) - sizeof *ofm; // Allocate memory. sw_flow *flow = flow_alloc (actions_len); if (flow == 0) { if (ntohl (ofm->buffer_id) != (uint32_t) -1) { discard_buffer (ntohl (ofm->buffer_id)); } return -ENOMEM; } flow_extract_match (&flow->key, &ofm->match); uint16_t v_code = ofi::ValidateActions (&flow->key, ofm->actions, actions_len); if (v_code != ACT_VALIDATION_OK) { SendErrorMsg (OFPET_BAD_ACTION, v_code, ofm, ntohs (ofm->header.length)); flow_free (flow); if (ntohl (ofm->buffer_id) != (uint32_t) -1) { discard_buffer (ntohl (ofm->buffer_id)); } return -ENOMEM; } // Fill out flow. flow->priority = flow->key.wildcards ? ntohs (ofm->priority) : -1; flow->idle_timeout = ntohs (ofm->idle_timeout); flow->hard_timeout = ntohs (ofm->hard_timeout); flow->used = flow->created = time_now (); flow->sf_acts->actions_len = actions_len; flow->byte_count = 0; flow->packet_count = 0; memcpy (flow->sf_acts->actions, ofm->actions, actions_len); // Act. int error = chain_insert (m_chain, flow); if (error) { if (error == -ENOBUFS) { SendErrorMsg (OFPET_FLOW_MOD_FAILED, OFPFMFC_ALL_TABLES_FULL, ofm, ntohs (ofm->header.length)); } flow_free (flow); if (ntohl (ofm->buffer_id) != (uint32_t) -1) { discard_buffer (ntohl (ofm->buffer_id)); } return error; } NS_LOG_INFO ("Added new flow."); if (ntohl (ofm->buffer_id) != std::numeric_limits<uint32_t>::max ()) { ofpbuf *buffer = retrieve_buffer (ofm->buffer_id); // ntohl(ofm->buffer_id) if (buffer) { sw_flow_key key; flow_used (flow, buffer); flow_extract (buffer, ofm->match.in_port, &key.flow); // ntohs(ofm->match.in_port); ofi::ExecuteActions (this, ofm->buffer_id, buffer, &key, ofm->actions, actions_len, false); ofpbuf_delete (buffer); } else { return -ESRCH; } } return 0; } int OpenFlowSwitchNetDevice::ModFlow (const ofp_flow_mod *ofm) { sw_flow_key key; flow_extract_match (&key, &ofm->match); size_t actions_len = ntohs (ofm->header.length) - sizeof *ofm; uint16_t v_code = ofi::ValidateActions (&key, ofm->actions, actions_len); if (v_code != ACT_VALIDATION_OK) { SendErrorMsg ((ofp_error_type)OFPET_BAD_ACTION, v_code, ofm, ntohs (ofm->header.length)); if (ntohl (ofm->buffer_id) != (uint32_t) -1) { discard_buffer (ntohl (ofm->buffer_id)); } return -ENOMEM; } uint16_t priority = key.wildcards ? ntohs (ofm->priority) : -1; int strict = (ofm->command == htons (OFPFC_MODIFY_STRICT)) ? 1 : 0; chain_modify (m_chain, &key, priority, strict, ofm->actions, actions_len); if (ntohl (ofm->buffer_id) != std::numeric_limits<uint32_t>::max ()) { ofpbuf *buffer = retrieve_buffer (ofm->buffer_id); // ntohl (ofm->buffer_id) if (buffer) { sw_flow_key skb_key; flow_extract (buffer, ofm->match.in_port, &skb_key.flow); // ntohs(ofm->match.in_port); ofi::ExecuteActions (this, ofm->buffer_id, buffer, &skb_key, ofm->actions, actions_len, false); ofpbuf_delete (buffer); } else { return -ESRCH; } } return 0; } int OpenFlowSwitchNetDevice::ReceiveFlow (const void *msg) { NS_LOG_FUNCTION_NOARGS (); const ofp_flow_mod *ofm = (ofp_flow_mod*)msg; uint16_t command = ntohs (ofm->command); if (command == OFPFC_ADD) { return AddFlow (ofm); } else if ((command == OFPFC_MODIFY) || (command == OFPFC_MODIFY_STRICT)) { return ModFlow (ofm); } else if (command == OFPFC_DELETE) { sw_flow_key key; flow_extract_match (&key, &ofm->match); return chain_delete (m_chain, &key, ofm->out_port, 0, 0) ? 0 : -ESRCH; } else if (command == OFPFC_DELETE_STRICT) { sw_flow_key key; uint16_t priority; flow_extract_match (&key, &ofm->match); priority = key.wildcards ? ntohs (ofm->priority) : -1; return chain_delete (m_chain, &key, ofm->out_port, priority, 1) ? 0 : -ESRCH; } else { return -ENODEV; } } int OpenFlowSwitchNetDevice::StatsDump (ofi::StatsDumpCallback *cb) { ofp_stats_reply *osr; ofpbuf *buffer; int err; if (cb->done) { return 0; } osr = (ofp_stats_reply*)MakeOpenflowReply (sizeof *osr, OFPT_STATS_REPLY, &buffer); osr->type = htons (cb->s->type); osr->flags = 0; err = cb->s->DoDump (this, cb->state, buffer); if (err >= 0) { if (err == 0) { cb->done = true; } else { // Buffer might have been reallocated, so find our data again. osr = (ofp_stats_reply*)ofpbuf_at_assert (buffer, 0, sizeof *osr); osr->flags = ntohs (OFPSF_REPLY_MORE); } int err2 = SendOpenflowBuffer (buffer); if (err2) { err = err2; } } return err; } void OpenFlowSwitchNetDevice::StatsDone (ofi::StatsDumpCallback *cb) { if (cb) { cb->s->DoCleanup (cb->state); free (cb->s); free (cb); } } int OpenFlowSwitchNetDevice::ReceiveStatsRequest (const void *oh) { const ofp_stats_request *rq = (ofp_stats_request*)oh; size_t rq_len = ntohs (rq->header.length); int type = ntohs (rq->type); int body_len = rq_len - offsetof (ofp_stats_request, body); ofi::Stats* st = new ofi::Stats ((ofp_stats_types)type, (unsigned)body_len); if (st == 0) { return -EINVAL; } ofi::StatsDumpCallback cb; cb.done = false; cb.rq = (ofp_stats_request*)xmemdup (rq, rq_len); cb.s = st; cb.state = 0; cb.swtch = this; if (cb.s) { int err = cb.s->DoInit (rq->body, body_len, &cb.state); if (err) { NS_LOG_WARN ("failed initialization of stats request type " << type << ": " << strerror (-err)); free (cb.rq); return err; } } if (m_controller != 0) { m_controller->StartDump (&cb); } else { NS_LOG_ERROR ("Switch needs to be registered to a controller in order to start the stats reply."); } return 0; } int OpenFlowSwitchNetDevice::ReceiveEchoRequest (const void *oh) { return SendOpenflowBuffer (make_echo_reply ((ofp_header*)oh)); } int OpenFlowSwitchNetDevice::ReceiveEchoReply (const void *oh) { return 0; } int OpenFlowSwitchNetDevice::ForwardControlInput (const void *msg, size_t length) { // Check encapsulated length. ofp_header *oh = (ofp_header*) msg; if (ntohs (oh->length) > length) { return -EINVAL; } assert (oh->version == OFP_VERSION); int error = 0; // Figure out how to handle it. switch (oh->type) { case OFPT_FEATURES_REQUEST: error = length < sizeof(ofp_header) ? -EFAULT : ReceiveFeaturesRequest (msg); break; case OFPT_GET_CONFIG_REQUEST: error = length < sizeof(ofp_header) ? -EFAULT : ReceiveGetConfigRequest (msg); break; case OFPT_SET_CONFIG: error = length < sizeof(ofp_switch_config) ? -EFAULT : ReceiveSetConfig (msg); break; case OFPT_PACKET_OUT: error = length < sizeof(ofp_packet_out) ? -EFAULT : ReceivePacketOut (msg); break; case OFPT_FLOW_MOD: error = length < sizeof(ofp_flow_mod) ? -EFAULT : ReceiveFlow (msg); break; case OFPT_PORT_MOD: error = length < sizeof(ofp_port_mod) ? -EFAULT : ReceivePortMod (msg); break; case OFPT_STATS_REQUEST: error = length < sizeof(ofp_stats_request) ? -EFAULT : ReceiveStatsRequest (msg); break; case OFPT_ECHO_REQUEST: error = length < sizeof(ofp_header) ? -EFAULT : ReceiveEchoRequest (msg); break; case OFPT_ECHO_REPLY: error = length < sizeof(ofp_header) ? -EFAULT : ReceiveEchoReply (msg); break; case OFPT_VPORT_MOD: error = length < sizeof(ofp_vport_mod) ? -EFAULT : ReceiveVPortMod (msg); break; case OFPT_VPORT_TABLE_FEATURES_REQUEST: error = length < sizeof(ofp_header) ? -EFAULT : ReceiveVPortTableFeaturesRequest (msg); break; default: SendErrorMsg ((ofp_error_type)OFPET_BAD_REQUEST, (ofp_bad_request_code)OFPBRC_BAD_TYPE, msg, length); error = -EINVAL; } if (msg != 0) { free ((ofpbuf*)msg); } return error; } sw_chain* OpenFlowSwitchNetDevice::GetChain () { return m_chain; } uint32_t OpenFlowSwitchNetDevice::GetNSwitchPorts (void) const { NS_LOG_FUNCTION_NOARGS (); return m_ports.size (); } ofi::Port OpenFlowSwitchNetDevice::GetSwitchPort (uint32_t n) const { NS_LOG_FUNCTION_NOARGS (); return m_ports[n]; } int OpenFlowSwitchNetDevice::GetSwitchPortIndex (ofi::Port p) { for (size_t i = 0; i < m_ports.size (); i++) { if (m_ports[i].netdev == p.netdev) { return i; } } return -1; } vport_table_t OpenFlowSwitchNetDevice::GetVPortTable () { return m_vportTable; } } // namespace ns3 #endif // NS3_OPENFLOW
zy901002-gpsr
src/openflow/model/openflow-switch-net-device.cc
C++
gpl2
45,744
/* -*- 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 * * Author: Blake Hurd <naimorai@gmail.com> */ #ifndef OPENFLOW_INTERFACE_H #define OPENFLOW_INTERFACE_H #include <assert.h> #include <errno.h> // Include OFSI code #include "ns3/simulator.h" #include "ns3/log.h" #include "ns3/net-device.h" #include "ns3/packet.h" #include "ns3/address.h" #include "ns3/nstime.h" #include "ns3/mac48-address.h" #include <set> #include <map> #include <limits> // Include main header and Vendor Extension files #include "openflow/openflow.h" #include "openflow/nicira-ext.h" #include "openflow/ericsson-ext.h" extern "C" { // Inexplicably, the OpenFlow implementation uses these two reserved words as member names. #define private _private #define delete _delete #define list List // Include OFSI Library files #include "openflow/private/csum.h" #include "openflow/private/poll-loop.h" #include "openflow/private/rconn.h" #include "openflow/private/stp.h" #include "openflow/private/vconn.h" #include "openflow/private/xtoxll.h" // Include OFSI Switch files #include "openflow/private/chain.h" #include "openflow/private/table.h" #include "openflow/private/datapath.h" // The functions below are defined in datapath.c uint32_t save_buffer (ofpbuf *); ofpbuf * retrieve_buffer (uint32_t id); void discard_buffer (uint32_t id); #include "openflow/private/dp_act.h" // The functions below are defined in dp_act.c void set_vlan_vid (ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah); void set_vlan_pcp (ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah); void strip_vlan (ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah); void set_dl_addr (ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah); void set_nw_addr (ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah); void set_tp_port (ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah); void set_mpls_label (ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah); void set_mpls_exp (ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah); #include "openflow/private/pt_act.h" // The function below is defined in pt_act.c void update_checksums (ofpbuf *buffer, const sw_flow_key *key, uint32_t old_word, uint32_t new_word); #undef list #undef private #undef delete } // Capabilities supported by this implementation. #define OFP_SUPPORTED_CAPABILITIES ( OFPC_FLOW_STATS \ | OFPC_TABLE_STATS \ | OFPC_PORT_STATS \ | OFPC_MULTI_PHY_TX \ | OFPC_VPORT_TABLE) // Actions supported by this implementation. #define OFP_SUPPORTED_ACTIONS ( (1 << OFPAT_OUTPUT) \ | (1 << OFPAT_SET_VLAN_VID) \ | (1 << OFPAT_SET_VLAN_PCP) \ | (1 << OFPAT_STRIP_VLAN) \ | (1 << OFPAT_SET_DL_SRC) \ | (1 << OFPAT_SET_DL_DST) \ | (1 << OFPAT_SET_NW_SRC) \ | (1 << OFPAT_SET_NW_DST) \ | (1 << OFPAT_SET_TP_SRC) \ | (1 << OFPAT_SET_TP_DST) \ | (1 << OFPAT_SET_MPLS_LABEL) \ | (1 << OFPAT_SET_MPLS_EXP) ) #define OFP_SUPPORTED_VPORT_TABLE_ACTIONS ( (1 << OFPPAT_OUTPUT) \ | (1 << OFPPAT_POP_MPLS) \ | (1 << OFPPAT_PUSH_MPLS) \ | (1 << OFPPAT_SET_MPLS_LABEL) \ | (1 << OFPPAT_SET_MPLS_EXP) ) \ namespace ns3 { class OpenFlowSwitchNetDevice; namespace ofi { /** * \brief Port and its metadata. * * We need to store port metadata, because OpenFlow dictates that there * exists a type of request where the Controller asks for data about a * port, or multiple ports. Otherwise, we'd refer to it via Ptr<NetDevice> * everywhere. */ struct Port { Port () : config (0), state (0), netdev (0), rx_packets (0), tx_packets (0), rx_bytes (0), tx_bytes (0), tx_dropped (0), mpls_ttl0_dropped (0) { } uint32_t config; ///< Some subset of OFPPC_* flags. uint32_t state; ///< Some subset of OFPPS_* flags. Ptr<NetDevice> netdev; unsigned long long int rx_packets, tx_packets; unsigned long long int rx_bytes, tx_bytes; unsigned long long int tx_dropped; unsigned long long int mpls_ttl0_dropped; }; class Stats { public: Stats (ofp_stats_types _type, size_t body_len); /** * \brief Prepares to dump some kind of statistics on the connected OpenFlowSwitchNetDevice. * * \param body Body member of the struct ofp_stats_request. * \param body_len Length of the body member. * \param state State information. * \return 0 if successful, otherwise a negative error code. */ int DoInit (const void *body, int body_len, void **state); /** * \brief Appends statistics for OpenFlowSwitchNetDevice to 'buffer'. * * \param swtch The OpenFlowSwitchNetDevice this callback is associated with. * \param state State information. * \param buffer Buffer to append stats reply to. * \return 1 if it should be called again later with another buffer, 0 if it is done, or a negative errno value on failure. */ int DoDump (Ptr<OpenFlowSwitchNetDevice> swtch, void *state, ofpbuf *buffer); /** * \brief Cleans any state created by the init or dump functions. * * May not be implemented if no cleanup is required. * * \param state State information to clear. */ void DoCleanup (void *state); /** * \brief State of the FlowStats request/reply. */ struct FlowStatsState { int table_idx; sw_table_position position; ofp_flow_stats_request rq; time_t now; ofpbuf *buffer; }; /** * \brief State of the PortStats request/reply. */ struct PortStatsState { uint32_t num_ports; ///< Number of ports in host byte order uint32_t *ports; ///< Array of ports in network byte order }; ofp_stats_types type; private: int DescStatsDump (void *state, ofpbuf *buffer); int FlowStatsInit (const void *body, int body_len, void **state); int (*FlowDumpCallback)(sw_flow *flow, void *state); int FlowStatsDump (Ptr<OpenFlowSwitchNetDevice> dp, FlowStatsState *s, ofpbuf *buffer); int AggregateStatsInit (const void *body, int body_len, void **state); int (*AggregateDumpCallback)(sw_flow *flow, void *state); int AggregateStatsDump (Ptr<OpenFlowSwitchNetDevice> dp, ofp_aggregate_stats_request *s, ofpbuf *buffer); int TableStatsDump (Ptr<OpenFlowSwitchNetDevice> dp, void *state, ofpbuf *buffer); int PortStatsInit (const void *body, int body_len, void **state); int PortStatsDump (Ptr<OpenFlowSwitchNetDevice> dp, PortStatsState *s, ofpbuf *buffer); int PortTableStatsDump (Ptr<OpenFlowSwitchNetDevice> dp, void *state, ofpbuf *buffer); }; /** * \brief Class for handling flow table actions. */ struct Action { /** * \param type Type of Flow Table Action. * \return true if the provided type is a type of flow table action. */ static bool IsValidType (ofp_action_type type); /** * \brief Validates the action on whether its data is valid or not. * * \param type Type of action to validate. * \param len Length of the action data. * \param key Matching key for the flow that is tied to this action. * \param ah Action's data header. * \return ACT_VALIDATION_OK if the action checks out, otherwise an error type. */ static uint16_t Validate (ofp_action_type type, size_t len, const sw_flow_key *key, const ofp_action_header *ah); /** * \brief Executes the action. * * \param type Type of action to execute. * \param buffer Buffer of the Packet if it's needed for the action. * \param key Matching key for the flow that is tied to this action. * \param ah Action's data header. */ static void Execute (ofp_action_type type, ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah); }; /** * \brief Class for handling virtual port table actions. */ struct VPortAction { /** * \param type Type of virtual port table Action. * \return true if the provided type is a type of virtual port table action. */ static bool IsValidType (ofp_vport_action_type type); /** * \brief Validates the action on whether its data is valid or not. * * \param type Type of action to validate. * \param len Length of the action data. * \param ah Action's data header. * \return ACT_VALIDATION_OK if the action checks out, otherwise an error type. */ static uint16_t Validate (ofp_vport_action_type type, size_t len, const ofp_action_header *ah); /** * \brief Executes the action. * * \param type Type of action to execute. * \param buffer Buffer of the Packet if it's needed for the action. * \param key Matching key for the flow that is tied to this action. * \param ah Action's data header. */ static void Execute (ofp_vport_action_type type, ofpbuf *buffer, const sw_flow_key *key, const ofp_action_header *ah); }; /** * \brief Class for handling Ericsson Vendor-defined actions. */ struct EricssonAction { /** * \param type Type of Ericsson Vendor-defined Action. * \return true if the provided type is a type of Ericsson Vendor-defined action. */ static bool IsValidType (er_action_type type); /** * \brief Validates the action on whether its data is valid or not. * * \param type Type of action to validate. * \param len Length of the action data. * \return ACT_VALIDATION_OK if the action checks out, otherwise an error type. */ static uint16_t Validate (er_action_type type, size_t len); /** * \brief Executes the action. * * \param type Type of action to execute. * \param buffer Buffer of the Packet if it's needed for the action. * \param key Matching key for the flow that is tied to this action. * \param ah Action's data header. */ static void Execute (er_action_type type, ofpbuf *buffer, const sw_flow_key *key, const er_action_header *ah); }; /** * \brief Callback for a stats dump request. */ struct StatsDumpCallback { bool done; ///< Whether we are done requesting stats. ofp_stats_request *rq; ///< Current stats request. Stats *s; ///< Handler of the stats request. void *state; ///< Stats request state data. Ptr<OpenFlowSwitchNetDevice> swtch; ///< The switch that we're requesting data from. }; /** * \brief Packet Metadata, allows us to track the packet's metadata as it passes through the switch. */ struct SwitchPacketMetadata { Ptr<Packet> packet; ///< The Packet itself. ofpbuf* buffer; ///< The OpenFlow buffer as created from the Packet, with its data and headers. uint16_t protocolNumber; ///< Protocol type of the Packet when the Packet is received Address src; ///< Source Address of the Packet when the Packet is received Address dst; ///< Destination Address of the Packet when the Packet is received. }; /** * \brief An interface for a Controller of OpenFlowSwitchNetDevices * * Follows the OpenFlow specification for a controller. */ class Controller : public Object { public: static TypeId GetTypeId (void) { static TypeId tid = TypeId ("ns3::ofi::Controller") .SetParent<Object> () .AddConstructor<Controller> () ; return tid; } virtual ~Controller () { m_switches.clear (); } /** * Adds a switch to the controller. * * \param swtch The switch to register. */ virtual void AddSwitch (Ptr<OpenFlowSwitchNetDevice> swtch); /** * A switch calls this method to pass a message on to the Controller. * * \param swtch The switch the message was received from. * \param buffer The message. */ virtual void ReceiveFromSwitch (Ptr<OpenFlowSwitchNetDevice> swtch, ofpbuf* buffer) { } /** * \brief Starts a callback-based, reliable, possibly multi-message reply to a request made by the controller. * * If an incoming request needs to have a reliable reply that might * require multiple messages, it can use StartDump() to set up * a callback that will be called as buffer space for replies. * * A stats request made by the controller is processed by the switch, * the switch then calls this method to tell the controller to start * asking for information. By default (it can be overridden), the * controller stops all work to run through the callback. ReceiveFromSwitch * must be defined appropriately to handle the status reply messages * generated by the switch, or otherwise the status reply messages will be sent * and discarded. * * \param cb The callback data. */ void StartDump (StatsDumpCallback* cb); protected: /** * \internal * * However the controller is implemented, this method is to * be used to pass a message on to a switch. * * \param swtch The switch to receive the message. * \param msg The message to send. * \param length The length of the message. */ virtual void SendToSwitch (Ptr<OpenFlowSwitchNetDevice> swtch, void * msg, size_t length); /** * \internal * * Construct flow data from a matching key to build a flow * entry for adding, modifying, or deleting a flow. * * \param key The matching key data; used to create a flow that matches the packet. * \param buffer_id The OpenFlow Buffer ID; used to run the actions on the packet if we add or modify the flow. * \param command Whether to add, modify, or delete this flow. * \param acts List of actions to execute. * \param actions_len Length of the actions buffer. * \param idle_timeout Flow expires if left inactive for this amount of time (specify OFP_FLOW_PERMANENT to disable feature). * \param hard_timeout Flow expires after this amount of time (specify OFP_FLOW_PERMANENT to disable feature). * \return Flow data that when passed to SetFlow will add, modify, or delete a flow it defines. */ ofp_flow_mod* BuildFlow (sw_flow_key key, uint32_t buffer_id, uint16_t command, void* acts, size_t actions_len, int idle_timeout, int hard_timeout); /** * \internal * * Get the packet type on the buffer, which can then be used * to determine how to handle the buffer. * * \param buffer The packet in OpenFlow buffer format. * \return The packet type, as defined in the ofp_type struct. */ uint8_t GetPacketType (ofpbuf* buffer); typedef std::set<Ptr<OpenFlowSwitchNetDevice> > Switches_t; Switches_t m_switches; ///< The collection of switches registered to this controller. }; /** * Demonstration of a Drop controller. When a connected switch * passes it a packet the switch doesn't recognize, the controller * configures the switch to make a flow that drops alike packets. */ class DropController : public Controller { public: void ReceiveFromSwitch (Ptr<OpenFlowSwitchNetDevice> swtch, ofpbuf* buffer); }; /** * Demonstration of a Learning controller. When a connected switch * passes it a packet the switch doesn't recognize, the controller * delves into its learned states and figures out if we know what * port the packet is supposed to go to, flooding if unknown, and * adjusts the switch's flow table accordingly. */ class LearningController : public Controller { public: static TypeId GetTypeId (void); virtual ~LearningController () { m_learnState.clear (); } void ReceiveFromSwitch (Ptr<OpenFlowSwitchNetDevice> swtch, ofpbuf* buffer); protected: struct LearnedState { uint32_t port; ///< Learned port. }; Time m_expirationTime; ///< Time it takes for learned MAC state entry/created flow to expire. typedef std::map<Mac48Address, LearnedState> LearnState_t; LearnState_t m_learnState; ///< Learned state data. }; /** * \brief Executes a list of flow table actions. * * \param swtch OpenFlowSwitchNetDevice these actions are being executed on. * \param packet_uid Packet UID; used to fetch the packet and its metadata. * \param buffer The Packet OpenFlow buffer. * \param key The matching key for the flow tied to this list of actions. * \param actions A buffer of actions. * \param actions_len Length of actions buffer. * \param ignore_no_fwd If true, during port forwarding actions, ports that are set to not forward are forced to forward. */ void ExecuteActions (Ptr<OpenFlowSwitchNetDevice> swtch, uint64_t packet_uid, ofpbuf* buffer, sw_flow_key *key, const ofp_action_header *actions, size_t actions_len, int ignore_no_fwd); /** * \brief Validates a list of flow table actions. * * \param key The matching key for the flow tied to this list of actions. * \param actions A buffer of actions. * \param actions_len Length of actions buffer. * \return If the action list validates, ACT_VALIDATION_OK is returned. Otherwise, a code for the OFPET_BAD_ACTION error type is returned. */ uint16_t ValidateActions (const sw_flow_key *key, const ofp_action_header *actions, size_t actions_len); /** * \brief Executes a list of virtual port table entry actions. * * \param swtch OpenFlowSwitchNetDevice these actions are being executed on. * \param packet_uid Packet UID; used to fetch the packet and its metadata. * \param buffer The Packet OpenFlow buffer. * \param key The matching key for the flow tied to this list of actions. * \param actions A buffer of actions. * \param actions_len Length of actions buffer. */ void ExecuteVPortActions (Ptr<OpenFlowSwitchNetDevice> swtch, uint64_t packet_uid, ofpbuf* buffer, sw_flow_key *key, const ofp_action_header *actions, size_t actions_len); /** * \brief Validates a list of virtual port table entry actions. * * \param actions A buffer of actions. * \param actions_len Length of actions buffer. * \return If the action list validates, ACT_VALIDATION_OK is returned. Otherwise, a code for the OFPET_BAD_ACTION error type is returned. */ uint16_t ValidateVPortActions (const ofp_action_header *actions, size_t actions_len); /** * \brief Executes a vendor-defined action. * * \param buffer The Packet OpenFlow buffer. * \param key The matching key for the flow tied to this list of actions. * \param ah Header of the action. */ void ExecuteVendor (ofpbuf *buffer, const sw_flow_key *key, const ofp_action_header *ah); /** * \brief Validates a vendor-defined action. * * \param key The matching key for the flow tied to this list of actions. * \param ah Header of the action. * \param len Length of the action. * \return If the action list validates, ACT_VALIDATION_OK is returned. Otherwise, a code for the OFPET_BAD_ACTION error type is returned. */ uint16_t ValidateVendor (const sw_flow_key *key, const ofp_action_header *ah, uint16_t len); /* * From datapath.c * Buffers are identified to userspace by a 31-bit opaque ID. We divide the ID * into a buffer number (low bits) and a cookie (high bits). The buffer number * is an index into an array of buffers. The cookie distinguishes between * different packets that have occupied a single buffer. Thus, the more * buffers we have, the lower-quality the cookie... */ #define PKT_BUFFER_BITS 8 #define N_PKT_BUFFERS (1 << PKT_BUFFER_BITS) #define PKT_BUFFER_MASK (N_PKT_BUFFERS - 1) #define PKT_COOKIE_BITS (32 - PKT_BUFFER_BITS) } } #endif /* OPENFLOW_INTERFACE_H */
zy901002-gpsr
src/openflow/model/openflow-interface.h
C++
gpl2
20,585
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2011 Blake Hurd * * 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: Blake Hurd <naimorai@gmail.com> */ #ifdef NS3_OPENFLOW // An essential include is test.h #include "ns3/test.h" #include "ns3/openflow-switch-net-device.h" #include "ns3/openflow-interface.h" // Do not put your test classes in namespace ns3. You may find it useful // to use the using directive to access the ns3 namespace directly using namespace ns3; // This is an example TestCase. class SwitchFlowTableTestCase : public TestCase { public: SwitchFlowTableTestCase () : TestCase ("Switch test case") { m_chain = chain_create (); } virtual ~SwitchFlowTableTestCase () { chain_destroy (m_chain); } private: virtual void DoRun (void); sw_chain* m_chain; }; void SwitchFlowTableTestCase::DoRun (void) { // Flow Table implementation is used by the OpenFlowSwitchNetDevice under the chain_ methods // we should test its implementation to verify the flow table works. // Initialization time_init (); // OFSI requires this, otherwise we crash before we can do anything. size_t actions_len = 0; // Flow is created with 0 actions. int output_port = 0; // Flow will be modified later with an action to output on port 0. Mac48Address dl_src ("00:00:00:00:00:00"), dl_dst ("00:00:00:00:00:01"); Ipv4Address nw_src ("192.168.1.1"), nw_dst ("192.168.1.2"); int tp_src = 5000, tp_dst = 80; // Create an sw_flow_key; in actual usage this is generated from the received packet's headers. sw_flow_key key; key.wildcards = 0; key.flow.in_port = htons (0); key.flow.dl_vlan = htons (OFP_VLAN_NONE); key.flow.dl_type = htons (ETH_TYPE_IP); key.flow.nw_proto = htons (IP_TYPE_UDP); key.flow.reserved = 0; key.flow.mpls_label1 = htonl (MPLS_INVALID_LABEL); key.flow.mpls_label2 = htonl (MPLS_INVALID_LABEL); // Set Mac Addresses dl_src.CopyTo (key.flow.dl_src); dl_dst.CopyTo (key.flow.dl_dst); // Set IP Addresses key.flow.nw_src = htonl (nw_src.Get ()); key.flow.nw_dst = htonl (nw_dst.Get ()); // Set TCP/UDP Ports key.flow.tp_src = htonl (tp_src); key.flow.tp_dst = htonl (tp_dst); // Create flow ofp_flow_mod ofm; ofm.header.version = OFP_VERSION; ofm.header.type = OFPT_FLOW_MOD; ofm.header.length = htons (sizeof (ofp_flow_mod) + actions_len); ofm.command = htons (OFPFC_ADD); ofm.idle_timeout = htons (OFP_FLOW_PERMANENT); ofm.hard_timeout = htons (OFP_FLOW_PERMANENT); ofm.buffer_id = htonl (-1); ofm.priority = OFP_DEFAULT_PRIORITY; ofm.match.wildcards = key.wildcards; // Wildcard fields ofm.match.in_port = key.flow.in_port; // Input switch port memcpy (ofm.match.dl_src, key.flow.dl_src, sizeof ofm.match.dl_src); // Ethernet source address. memcpy (ofm.match.dl_dst, key.flow.dl_dst, sizeof ofm.match.dl_dst); // Ethernet destination address. ofm.match.dl_vlan = key.flow.dl_vlan; // Input VLAN OFP_VLAN_NONE; ofm.match.dl_type = key.flow.dl_type; // Ethernet frame type ETH_TYPE_IP; ofm.match.nw_proto = key.flow.nw_proto; // IP Protocol ofm.match.nw_src = key.flow.nw_src; // IP source address ofm.match.nw_dst = key.flow.nw_dst; // IP destination address ofm.match.tp_src = key.flow.tp_src; // TCP/UDP source port ofm.match.tp_dst = key.flow.tp_dst; // TCP/UDP destination port ofm.match.mpls_label1 = key.flow.mpls_label1; // Top of label stack ofm.match.mpls_label2 = key.flow.mpls_label1; // Second label (if available) // Build a sw_flow from the ofp_flow_mod sw_flow *flow = flow_alloc (actions_len); NS_TEST_ASSERT_MSG_NE (flow, 0, "Cannot allocate memory for the flow."); flow_extract_match (&flow->key, &ofm.match); // Fill out flow. flow->priority = flow->key.wildcards ? ntohs (ofm.priority) : -1; flow->idle_timeout = ntohs (ofm.idle_timeout); flow->hard_timeout = ntohs (ofm.hard_timeout); flow->used = flow->created = time_now (); flow->sf_acts->actions_len = actions_len; flow->byte_count = 0; flow->packet_count = 0; memcpy (flow->sf_acts->actions, ofm.actions, actions_len); // Insert the flow into the Flow Table NS_TEST_ASSERT_MSG_EQ (chain_insert (m_chain, flow), 0, "Flow table failed to insert Flow."); // Use key to match the flow to verify we created it correctly. NS_TEST_ASSERT_MSG_NE (chain_lookup (m_chain, &key), 0, "Key provided doesn't match to the flow that was created from it."); // Modify key to make sure the flow doesn't match it. dl_dst.CopyTo (key.flow.dl_src); dl_src.CopyTo (key.flow.dl_dst); key.flow.nw_src = htonl (nw_dst.Get ()); key.flow.nw_dst = htonl (nw_src.Get ()); key.flow.tp_src = htonl (tp_dst); key.flow.tp_dst = htonl (tp_src); NS_TEST_ASSERT_MSG_EQ (chain_lookup (m_chain, &key), 0, "Key provided shouldn't match the flow but it does."); // Modify key back to matching the flow so we can test flow modification. dl_dst.CopyTo (key.flow.dl_dst); dl_src.CopyTo (key.flow.dl_src); key.flow.nw_src = htonl (nw_src.Get ()); key.flow.nw_dst = htonl (nw_dst.Get ()); key.flow.tp_src = htonl (tp_src); key.flow.tp_dst = htonl (tp_dst); // Testing Flow Modification; chain_modify should return 1, for 1 flow modified. // Create output-to-port action ofp_action_output acts[1]; acts[0].type = htons (OFPAT_OUTPUT); acts[0].len = htons (sizeof (ofp_action_output)); acts[0].port = output_port; uint16_t priority = key.wildcards ? ntohs (ofm.priority) : -1; NS_TEST_ASSERT_MSG_EQ (chain_modify (m_chain, &key, priority, false, (const ofp_action_header*)acts, sizeof (acts)), 1, "Flow table failed to modify Flow."); // Testing Flow Deletion; chain_delete should return 1, for 1 flow deleted. // Note: By providing chain_delete with output_port, the flow must have an action that outputs on that port in order to delete the flow. // This is how we verify that our action was truly added via the flow modification. NS_TEST_ASSERT_MSG_EQ (chain_delete (m_chain, &key, output_port, 0, 0), 1, "Flow table failed to delete Flow."); NS_TEST_ASSERT_MSG_EQ (chain_lookup (m_chain, &key), 0, "Key provided shouldn't match the flow but it does."); } class SwitchTestSuite : public TestSuite { public: SwitchTestSuite (); }; SwitchTestSuite::SwitchTestSuite () : TestSuite ("openflow", UNIT) { AddTestCase (new SwitchFlowTableTestCase); } // Do not forget to allocate an instance of this TestSuite SwitchTestSuite switchTestSuite; #endif // NS3_OPENFLOW
zy901002-gpsr
src/openflow/test/openflow-switch-test-suite.cc
C++
gpl2
7,441
#! /usr/bin/env python ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- # A list of C++ examples to run in order to ensure that they remain # buildable and runnable over time. Each tuple in the list contains # # (example_name, do_run, do_valgrind_run). # # See test.py for more information. cpp_examples = [ ("openflow-switch", "ENABLE_OPENFLOW == True", "True"), ] # A list of Python examples to run in order to ensure that they remain # runnable over time. Each tuple in the list contains # # (example_name, do_run). # # See test.py for more information. python_examples = []
zy901002-gpsr
src/openflow/test/examples-to-run.py
Python
gpl2
629
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- def build(bld): obj = bld.create_ns3_program('openflow-switch', ['openflow', 'csma', 'internet', 'applications']) obj.source = 'openflow-switch.cc'
zy901002-gpsr
src/openflow/examples/wscript
Python
gpl2
271
/* -*- 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 // | | // ---------- // | Switch | // ---------- // | | // n2 n3 // // // - CBR/UDP flows from n0 to n1 and from n3 to n0 // - DropTail queues // - Tracing of queues and packet receptions to file "openflow-switch.tr" // - If order of adding nodes and netdevices is kept: // n0 = 00:00:00;00:00:01, n1 = 00:00:00:00:00:03, n3 = 00:00:00:00:00:07 // and port number corresponds to node number, so port 0 is connected to n0, for example. #include <iostream> #include <fstream> #include "ns3/core-module.h" #include "ns3/network-module.h" #include "ns3/csma-module.h" #include "ns3/internet-module.h" #include "ns3/applications-module.h" #include "ns3/openflow-module.h" #include "ns3/log.h" using namespace ns3; NS_LOG_COMPONENT_DEFINE ("OpenFlowCsmaSwitchExample"); bool verbose = false; bool use_drop = false; ns3::Time timeout = ns3::Seconds (0); bool SetVerbose (std::string value) { verbose = true; return true; } bool SetDrop (std::string value) { use_drop = true; return true; } bool SetTimeout (std::string value) { try { timeout = ns3::Seconds (atof (value.c_str ())); return true; } catch (...) { return false; } return false; } int main (int argc, char *argv[]) { #ifdef NS3_OPENFLOW // // Allow the user to override any of the defaults and the above Bind() at // run-time, via command-line arguments // CommandLine cmd; cmd.AddValue ("v", "Verbose (turns on logging).", MakeCallback (&SetVerbose)); cmd.AddValue ("verbose", "Verbose (turns on logging).", MakeCallback (&SetVerbose)); cmd.AddValue ("d", "Use Drop Controller (Learning if not specified).", MakeCallback (&SetDrop)); cmd.AddValue ("drop", "Use Drop Controller (Learning if not specified).", MakeCallback (&SetDrop)); cmd.AddValue ("t", "Learning Controller Timeout (has no effect if drop controller is specified).", MakeCallback ( &SetTimeout)); cmd.AddValue ("timeout", "Learning Controller Timeout (has no effect if drop controller is specified).", MakeCallback ( &SetTimeout)); cmd.Parse (argc, argv); if (verbose) { LogComponentEnable ("OpenFlowCsmaSwitchExample", LOG_LEVEL_INFO); LogComponentEnable ("OpenFlowInterface", LOG_LEVEL_INFO); LogComponentEnable ("OpenFlowSwitchNetDevice", LOG_LEVEL_INFO); } // // Explicitly create the nodes required by the topology (shown above). // NS_LOG_INFO ("Create nodes."); NodeContainer terminals; terminals.Create (4); NodeContainer csmaSwitch; csmaSwitch.Create (1); NS_LOG_INFO ("Build Topology"); CsmaHelper csma; csma.SetChannelAttribute ("DataRate", DataRateValue (5000000)); csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); // Create the csma links, from each terminal to the switch NetDeviceContainer terminalDevices; NetDeviceContainer switchDevices; for (int i = 0; i < 4; i++) { NetDeviceContainer link = csma.Install (NodeContainer (terminals.Get (i), csmaSwitch)); terminalDevices.Add (link.Get (0)); switchDevices.Add (link.Get (1)); } // Create the switch netdevice, which will do the packet switching Ptr<Node> switchNode = csmaSwitch.Get (0); OpenFlowSwitchHelper swtch; if (use_drop) { Ptr<ns3::ofi::DropController> controller = CreateObject<ns3::ofi::DropController> (); swtch.Install (switchNode, switchDevices, controller); } else { Ptr<ns3::ofi::LearningController> controller = CreateObject<ns3::ofi::LearningController> (); if (!timeout.IsZero ()) controller->SetAttribute ("ExpirationTime", TimeValue (timeout)); swtch.Install (switchNode, switchDevices, controller); } // Add internet stack to the terminals InternetStackHelper internet; internet.Install (terminals); // 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"); ipv4.Assign (terminalDevices); // Create an OnOff application to send UDP datagrams from n0 to n1. NS_LOG_INFO ("Create Applications."); uint16_t port = 9; // Discard port (RFC 863) OnOffHelper onoff ("ns3::UdpSocketFactory", Address (InetSocketAddress (Ipv4Address ("10.1.1.2"), port))); onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); ApplicationContainer app = onoff.Install (terminals.Get (0)); // Start the application app.Start (Seconds (1.0)); app.Stop (Seconds (10.0)); // Create an optional packet sink to receive these packets PacketSinkHelper sink ("ns3::UdpSocketFactory", Address (InetSocketAddress (Ipv4Address::GetAny (), port))); app = sink.Install (terminals.Get (1)); app.Start (Seconds (0.0)); // // Create a similar flow from n3 to n0, starting at time 1.1 seconds // onoff.SetAttribute ("Remote", AddressValue (InetSocketAddress (Ipv4Address ("10.1.1.1"), port))); app = onoff.Install (terminals.Get (3)); app.Start (Seconds (1.1)); app.Stop (Seconds (10.0)); app = sink.Install (terminals.Get (0)); app.Start (Seconds (0.0)); NS_LOG_INFO ("Configure Tracing."); // // Configure tracing of all enqueue, dequeue, and NetDevice receive events. // Trace output will be sent to the file "openflow-switch.tr" // AsciiTraceHelper ascii; csma.EnableAsciiAll (ascii.CreateFileStream ("openflow-switch.tr")); // // Also configure some tcpdump traces; each interface will be traced. // The output files will be named: // openflow-switch-<nodeId>-<interfaceId>.pcap // and can be read by the "tcpdump -r" command (use "-tt" option to // display timestamps correctly) // csma.EnablePcapAll ("openflow-switch", false); // // Now, do the actual simulation. // NS_LOG_INFO ("Run Simulation."); Simulator::Run (); Simulator::Destroy (); NS_LOG_INFO ("Done."); #else NS_LOG_INFO ("NS-3 OpenFlow is not enabled. Cannot run simulation."); #endif // NS3_OPENFLOW }
zy901002-gpsr
src/openflow/examples/openflow-switch.cc
C++
gpl2
6,912
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2011 Blake Hurd * * 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: Blake Hurd <naimorai@gmail.com> */ #ifndef OPENFLOW_SWITCH_HELPER_H #define OPENFLOW_SWITCH_HELPER_H #include "ns3/openflow-interface.h" #include "ns3/net-device-container.h" #include "ns3/object-factory.h" #include <string> namespace ns3 { class Node; class AttributeValue; class Controller; /** * \brief Add capability to switch multiple LAN segments (IEEE 802.1D bridging) */ class OpenFlowSwitchHelper { public: /* * Construct a OpenFlowSwitchHelper */ OpenFlowSwitchHelper (); /** * Set an attribute on each ns3::OpenFlowSwitchNetDevice created by * OpenFlowSwitchHelper::Install * * \param n1 the name of the attribute to set * \param v1 the value of the attribute to set */ void SetDeviceAttribute (std::string n1, const AttributeValue &v1); /** * This method creates an ns3::OpenFlowSwitchNetDevice with the attributes * configured by OpenFlowSwitchHelper::SetDeviceAttribute, adds the device * to the node, attaches the given NetDevices as ports of the * switch, and sets up a controller connection using the provided * Controller. * * \param node The node to install the device in * \param c Container of NetDevices to add as switch ports * \param controller The controller connection. * \returns A container holding the added net device. */ NetDeviceContainer Install (Ptr<Node> node, NetDeviceContainer c, Ptr<ns3::ofi::Controller> controller); /** * This method creates an ns3::OpenFlowSwitchNetDevice with the attributes * configured by OpenFlowSwitchHelper::SetDeviceAttribute, adds the device * to the node, and attaches the given NetDevices as ports of the * switch. * * \param node The node to install the device in * \param c Container of NetDevices to add as switch ports * \returns A container holding the added net device. */ NetDeviceContainer Install (Ptr<Node> node, NetDeviceContainer c); /** * This method creates an ns3::OpenFlowSwitchNetDevice with the attributes * configured by OpenFlowSwitchHelper::SetDeviceAttribute, adds the device * to the node, and attaches the given NetDevices as ports of the * switch. * * \param nodeName The name of the node to install the device in * \param c Container of NetDevices to add as switch ports * \returns A container holding the added net device. */ NetDeviceContainer Install (std::string nodeName, NetDeviceContainer c); private: ObjectFactory m_deviceFactory; }; } // namespace ns3 #endif /* OPENFLOW_SWITCH_HELPER_H */
zy901002-gpsr
src/openflow/helper/openflow-switch-helper.h
C++
gpl2
3,318
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2011 Blake Hurd * * 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: Blake Hurd <naimorai@gmail.com> */ #ifdef NS3_OPENFLOW #include "openflow-switch-helper.h" #include "ns3/log.h" #include "ns3/openflow-switch-net-device.h" #include "ns3/openflow-interface.h" #include "ns3/node.h" #include "ns3/names.h" NS_LOG_COMPONENT_DEFINE ("OpenFlowSwitchHelper"); namespace ns3 { OpenFlowSwitchHelper::OpenFlowSwitchHelper () { NS_LOG_FUNCTION_NOARGS (); m_deviceFactory.SetTypeId ("ns3::OpenFlowSwitchNetDevice"); } void OpenFlowSwitchHelper::SetDeviceAttribute (std::string n1, const AttributeValue &v1) { NS_LOG_FUNCTION_NOARGS (); m_deviceFactory.Set (n1, v1); } NetDeviceContainer OpenFlowSwitchHelper::Install (Ptr<Node> node, NetDeviceContainer c, Ptr<ns3::ofi::Controller> controller) { NS_LOG_FUNCTION_NOARGS (); NS_LOG_INFO ("**** Install switch device on node " << node->GetId ()); NetDeviceContainer devs; Ptr<OpenFlowSwitchNetDevice> dev = m_deviceFactory.Create<OpenFlowSwitchNetDevice> (); devs.Add (dev); node->AddDevice (dev); NS_LOG_INFO ("**** Set up Controller"); dev->SetController (controller); for (NetDeviceContainer::Iterator i = c.Begin (); i != c.End (); ++i) { NS_LOG_INFO ("**** Add SwitchPort " << *i); dev->AddSwitchPort (*i); } return devs; } NetDeviceContainer OpenFlowSwitchHelper::Install (Ptr<Node> node, NetDeviceContainer c) { NS_LOG_FUNCTION_NOARGS (); NS_LOG_INFO ("**** Install switch device on node " << node->GetId ()); NetDeviceContainer devs; Ptr<OpenFlowSwitchNetDevice> dev = m_deviceFactory.Create<OpenFlowSwitchNetDevice> (); devs.Add (dev); node->AddDevice (dev); for (NetDeviceContainer::Iterator i = c.Begin (); i != c.End (); ++i) { NS_LOG_INFO ("**** Add SwitchPort " << *i); dev->AddSwitchPort (*i); } return devs; } NetDeviceContainer OpenFlowSwitchHelper::Install (std::string nodeName, NetDeviceContainer c) { NS_LOG_FUNCTION_NOARGS (); Ptr<Node> node = Names::Find<Node> (nodeName); return Install (node, c); } } // namespace ns3 #endif // NS3_OPENFLOW
zy901002-gpsr
src/openflow/helper/openflow-switch-helper.cc
C++
gpl2
2,809
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- import os import Options from waflib.Errors import WafError def options(opt): opt.add_option('--with-openflow', help=('Path to OFSID source for NS-3 OpenFlow Integration support'), default='', dest='with_openflow') opt.tool_options('boost', tooldir=["waf-tools"]) def configure(conf): try: conf.check_tool('boost') conf.check_boost(lib='signals filesystem') if not conf.env.LIB_BOOST: conf.check_boost(lib='signals filesystem', libpath="/usr/lib64") except WafError: conf.env['LIB_BOOST'] = [] if not conf.env.LIB_BOOST: conf.report_optional_feature("openflow", "NS-3 OpenFlow Integration", False, "Required boost libraries not found") # Add this module to the list of modules that won't be built # if they are enabled. conf.env['MODULES_NOT_BUILT'].append('openflow') return if Options.options.with_openflow: if os.path.isdir(Options.options.with_openflow): conf.msg("Checking for OpenFlow location", ("%s (given)" % Options.options.with_openflow)) conf.env['WITH_OPENFLOW'] = os.path.abspath(Options.options.with_openflow) else: openflow_dir = os.path.join('..','openflow') if os.path.isdir(openflow_dir): conf.msg("Checking for OpenFlow location", ("%s (guessed)" % openflow_dir)) conf.env['WITH_OPENFLOW'] = os.path.abspath(openflow_dir) del openflow_dir if not conf.env['WITH_OPENFLOW']: conf.msg("Checking for OpenFlow location", False) conf.report_optional_feature("openflow", "NS-3 OpenFlow Integration", False, "OpenFlow not enabled (see option --with-openflow)") # Add this module to the list of modules that won't be built # if they are enabled. conf.env['MODULES_NOT_BUILT'].append('openflow') return test_code = ''' #include "openflow/openflow.h" #include "openflow/nicira-ext.h" #include "openflow/ericsson-ext.h" extern "C" { #define private _private #define delete _delete #define list List #include "openflow/private/csum.h" #include "openflow/private/poll-loop.h" #include "openflow/private/rconn.h" #include "openflow/private/stp.h" #include "openflow/private/vconn.h" #include "openflow/private/xtoxll.h" #include "openflow/private/chain.h" #include "openflow/private/table.h" #include "openflow/private/datapath.h" // The functions below are defined in datapath.c uint32_t save_buffer (ofpbuf *); ofpbuf * retrieve_buffer (uint32_t id); void discard_buffer (uint32_t id); #include "openflow/private/dp_act.h" // The functions below are defined in dp_act.c void set_vlan_vid (ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah); void set_vlan_pcp (ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah); void strip_vlan (ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah); void set_dl_addr (ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah); void set_nw_addr (ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah); void set_tp_port (ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah); void set_mpls_label (ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah); void set_mpls_exp (ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah); #include "openflow/private/pt_act.h" // The function below is defined in pt_act.c void update_checksums (ofpbuf *buffer, const sw_flow_key *key, uint32_t old_word, uint32_t new_word); #undef list #undef private #undef delete } int main() { return 0; } ''' conf.env['DL'] = conf.check(mandatory=True, lib='dl', define_name='DL', uselib_store='DL') conf.env['XML2'] = conf.check(mandatory=True, lib='xml2', define_name='XML2', uselib_store='XML2') conf.env.append_value('NS3_MODULE_PATH',os.path.abspath(os.path.join(conf.env['WITH_OPENFLOW'],'build','default'))) conf.env['INCLUDES_OPENFLOW'] = [ os.path.abspath(os.path.join(conf.env['WITH_OPENFLOW'],'include'))] conf.env['LIBPATH_OPENFLOW'] = [ os.path.abspath(os.path.join(conf.env['WITH_OPENFLOW'],'build','default')), os.path.abspath(os.path.join(conf.env['WITH_OPENFLOW'],'lib'))] conf.env['OPENFLOW'] = conf.check_nonfatal(fragment=test_code, lib='openflow', libpath=conf.env['LIBPATH_OPENFLOW'], use='OPENFLOW DL XML2') conf.report_optional_feature("openflow", "NS-3 OpenFlow Integration", conf.env['OPENFLOW'], "openflow library not found") if conf.env['OPENFLOW']: conf.env['ENABLE_OPENFLOW'] = True else: # Add this module to the list of modules that won't be built # if they are enabled. conf.env['MODULES_NOT_BUILT'].append('openflow') def build(bld): # Don't do anything for this module if openflow's not enabled. if 'openflow' in bld.env['MODULES_NOT_BUILT']: return # Build the Switch module obj = bld.create_ns3_module('openflow', ['internet']) obj.source = [ ] obj_test = bld.create_ns3_module_test_library('openflow') obj_test.source = [ ] if bld.env['OPENFLOW'] and bld.env['DL'] and bld.env['XML2']: obj.use.extend('OPENFLOW DL XML2'.split()) obj_test.use.extend('OPENFLOW DL XML2'.split()) headers = bld.new_task_gen(features=['ns3header']) headers.module = 'openflow' headers.source = [ ] if bld.env['ENABLE_OPENFLOW']: obj.source.append('model/openflow-interface.cc') obj.source.append('model/openflow-switch-net-device.cc') obj.source.append('helper/openflow-switch-helper.cc') obj.env.append_value('DEFINES', 'NS3_OPENFLOW') obj.use.append("OPENFLOW") obj_test.source.append('test/openflow-switch-test-suite.cc') headers.source.append('model/openflow-interface.h') headers.source.append('model/openflow-switch-net-device.h') headers.source.append('helper/openflow-switch-helper.h') if bld.env['ENABLE_EXAMPLES'] and bld.env['ENABLE_OPENFLOW']: bld.add_subdirs('examples')
zy901002-gpsr
src/openflow/wscript
Python
gpl2
6,172
/* -*- 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 * * Author: George Riley <riley@ece.gatech.edu> */ // Provides an interface to aggregate to MPI-compatible NetDevices #ifndef NS3_MPI_RECEIVER_H #define NS3_MPI_RECEIVER_H #include "ns3/object.h" #include "ns3/packet.h" namespace ns3 { /** * \ingroup mpi * * Class to aggregate to a NetDevice if it supports MPI capability * * MpiInterface::ReceiveMessages () needs to send packets to a NetDevice * Receive() method. Since each NetDevice's Receive() method is specific * to the derived class, and since we do not know whether such a NetDevice * is MPI-capable, we aggregate one of these objects to each MPI-capable * device. In addition, we must hook up a NetDevice::Receive() method * to the callback. So the two steps to enable MPI capability are to * aggregate this object to a NetDevice, and to set the callback. */ class MpiReceiver : public Object { public: static TypeId GetTypeId (void); virtual ~MpiReceiver (); /** * \brief Direct an incoming packet to the device Receive() method * \param p Packet to receive */ void Receive (Ptr<Packet> p); /** * \brief Set the receive callback to get packets to net devices * \param callback the callback itself */ void SetReceiveCallback (Callback<void, Ptr<Packet> > callback); private: Callback<void, Ptr<Packet> > m_rxCallback; }; } // namespace ns3 #endif /* NS3_MPI_RECEIVER_H */
zy901002-gpsr
src/mpi/model/mpi-receiver.h
C++
gpl2
2,110
/* -*- 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 * * Author: George Riley <riley@ece.gatech.edu> */ // This object contains static methods that provide an easy interface // to the necessary MPI information. #include <iostream> #include <iomanip> #include <list> #include "mpi-interface.h" #include "mpi-receiver.h" #include "ns3/node.h" #include "ns3/node-list.h" #include "ns3/net-device.h" #include "ns3/simulator.h" #include "ns3/simulator-impl.h" #include "ns3/nstime.h" #ifdef NS3_MPI #include <mpi.h> #endif namespace ns3 { SentBuffer::SentBuffer () { m_buffer = 0; m_request = 0; } SentBuffer::~SentBuffer () { delete [] m_buffer; } uint8_t* SentBuffer::GetBuffer () { return m_buffer; } void SentBuffer::SetBuffer (uint8_t* buffer) { m_buffer = buffer; } #ifdef NS3_MPI MPI_Request* SentBuffer::GetRequest () { return &m_request; } #endif uint32_t MpiInterface::m_sid = 0; uint32_t MpiInterface::m_size = 1; bool MpiInterface::m_initialized = false; bool MpiInterface::m_enabled = false; uint32_t MpiInterface::m_rxCount = 0; uint32_t MpiInterface::m_txCount = 0; std::list<SentBuffer> MpiInterface::m_pendingTx; #ifdef NS3_MPI MPI_Request* MpiInterface::m_requests; char** MpiInterface::m_pRxBuffers; #endif void MpiInterface::Destroy () { #ifdef NS3_MPI for (uint32_t i = 0; i < GetSize (); ++i) { delete [] m_pRxBuffers[i]; } delete [] m_pRxBuffers; delete [] m_requests; m_pendingTx.clear (); #endif } uint32_t MpiInterface::GetRxCount () { return m_rxCount; } uint32_t MpiInterface::GetTxCount () { return m_txCount; } uint32_t MpiInterface::GetSystemId () { if (!m_initialized) { Simulator::GetImplementation (); m_initialized = true; } return m_sid; } uint32_t MpiInterface::GetSize () { if (!m_initialized) { Simulator::GetImplementation (); m_initialized = true; } return m_size; } bool MpiInterface::IsEnabled () { if (!m_initialized) { Simulator::GetImplementation (); m_initialized = true; } return m_enabled; } void MpiInterface::Enable (int* pargc, char*** pargv) { #ifdef NS3_MPI // Initialize the MPI interface MPI_Init (pargc, pargv); MPI_Barrier (MPI_COMM_WORLD); MPI_Comm_rank (MPI_COMM_WORLD, reinterpret_cast <int *> (&m_sid)); MPI_Comm_size (MPI_COMM_WORLD, reinterpret_cast <int *> (&m_size)); m_enabled = true; m_initialized = true; // Post a non-blocking receive for all peers m_pRxBuffers = new char*[m_size]; m_requests = new MPI_Request[m_size]; for (uint32_t i = 0; i < GetSize (); ++i) { m_pRxBuffers[i] = new char[MAX_MPI_MSG_SIZE]; MPI_Irecv (m_pRxBuffers[i], MAX_MPI_MSG_SIZE, MPI_CHAR, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, &m_requests[i]); } #else NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); #endif } void MpiInterface::SendPacket (Ptr<Packet> p, const Time& rxTime, uint32_t node, uint32_t dev) { #ifdef NS3_MPI SentBuffer sendBuf; m_pendingTx.push_back (sendBuf); std::list<SentBuffer>::reverse_iterator i = m_pendingTx.rbegin (); // Points to the last element uint32_t serializedSize = p->GetSerializedSize (); uint8_t* buffer = new uint8_t[serializedSize + 16]; i->SetBuffer (buffer); // Add the time, dest node and dest device uint64_t t = rxTime.GetNanoSeconds (); uint64_t* pTime = reinterpret_cast <uint64_t *> (buffer); *pTime++ = t; uint32_t* pData = reinterpret_cast<uint32_t *> (pTime); *pData++ = node; *pData++ = dev; // Serialize the packet p->Serialize (reinterpret_cast<uint8_t *> (pData), serializedSize); // Find the system id for the destination node Ptr<Node> destNode = NodeList::GetNode (node); uint32_t nodeSysId = destNode->GetSystemId (); MPI_Isend (reinterpret_cast<void *> (i->GetBuffer ()), serializedSize + 16, MPI_CHAR, nodeSysId, 0, MPI_COMM_WORLD, (i->GetRequest ())); m_txCount++; #else NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); #endif } void MpiInterface::ReceiveMessages () { // Poll the non-block reads to see if data arrived #ifdef NS3_MPI while (true) { int flag = 0; int index = 0; MPI_Status status; MPI_Testany (GetSize (), m_requests, &index, &flag, &status); if (!flag) { break; // No more messages } int count; MPI_Get_count (&status, MPI_CHAR, &count); m_rxCount++; // Count this receive // Get the meta data first uint64_t* pTime = reinterpret_cast<uint64_t *> (m_pRxBuffers[index]); uint64_t nanoSeconds = *pTime++; uint32_t* pData = reinterpret_cast<uint32_t *> (pTime); uint32_t node = *pData++; uint32_t dev = *pData++; Time rxTime = NanoSeconds (nanoSeconds); count -= sizeof (nanoSeconds) + sizeof (node) + sizeof (dev); Ptr<Packet> p = Create<Packet> (reinterpret_cast<uint8_t *> (pData), count, true); // Find the correct node/device to schedule receive event Ptr<Node> pNode = NodeList::GetNode (node); Ptr<MpiReceiver> pMpiRec = 0; uint32_t nDevices = pNode->GetNDevices (); for (uint32_t i = 0; i < nDevices; ++i) { Ptr<NetDevice> pThisDev = pNode->GetDevice (i); if (pThisDev->GetIfIndex () == dev) { pMpiRec = pThisDev->GetObject<MpiReceiver> (); break; } } NS_ASSERT (pNode && pMpiRec); // Schedule the rx event Simulator::ScheduleWithContext (pNode->GetId (), rxTime - Simulator::Now (), &MpiReceiver::Receive, pMpiRec, p); // Re-queue the next read MPI_Irecv (m_pRxBuffers[index], MAX_MPI_MSG_SIZE, MPI_CHAR, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, &m_requests[index]); } #else NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); #endif } void MpiInterface::TestSendComplete () { #ifdef NS3_MPI std::list<SentBuffer>::iterator i = m_pendingTx.begin (); while (i != m_pendingTx.end ()) { MPI_Status status; int flag = 0; MPI_Test (i->GetRequest (), &flag, &status); std::list<SentBuffer>::iterator current = i; // Save current for erasing i++; // Advance to next if (flag) { // This message is complete m_pendingTx.erase (current); } } #else NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); #endif } void MpiInterface::Disable () { #ifdef NS3_MPI int flag = 0; MPI_Initialized (&flag); if (flag) { MPI_Finalize (); m_enabled = false; m_initialized = false; } else { NS_FATAL_ERROR ("Cannot disable MPI environment without Initializing it first"); } #else NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); #endif } } // namespace ns3
zy901002-gpsr
src/mpi/model/mpi-interface.cc
C++
gpl2
7,715
/* -*- 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 * * Author: George Riley <riley@ece.gatech.edu> */ #ifndef DISTRIBUTED_SIMULATOR_IMPL_H #define DISTRIBUTED_SIMULATOR_IMPL_H #include "ns3/simulator-impl.h" #include "ns3/scheduler.h" #include "ns3/event-impl.h" #include "ns3/ptr.h" #include <list> namespace ns3 { /** * \ingroup mpi * * \brief Structure used for all-reduce LBTS computation */ class LbtsMessage { public: LbtsMessage () : m_txCount (0), m_rxCount (0), m_myId (0) { } /** * \param rxc received count * \param txc transmitted count * \param id mpi rank * \param t smallest time */ LbtsMessage (uint32_t rxc, uint32_t txc, uint32_t id, const Time& t) : m_txCount (txc), m_rxCount (rxc), m_myId (id), m_smallestTime (t) { } ~LbtsMessage (); /** * \return smallest time */ Time GetSmallestTime (); /** * \return transmitted count */ uint32_t GetTxCount (); /** * \return receieved count */ uint32_t GetRxCount (); /** * \return id which corresponds to mpi rank */ uint32_t GetMyId (); private: uint32_t m_txCount; uint32_t m_rxCount; uint32_t m_myId; Time m_smallestTime; }; /** * \ingroup mpi * * \brief distributed simulator implementation using lookahead */ class DistributedSimulatorImpl : public SimulatorImpl { public: static TypeId GetTypeId (void); DistributedSimulatorImpl (); ~DistributedSimulatorImpl (); // virtual from SimulatorImpl 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; private: virtual void DoDispose (void); void CalculateLookAhead (void); void ProcessOneEvent (void); uint64_t NextTs (void) const; typedef std::list<EventId> DestroyEvents; DestroyEvents m_destroyEvents; bool m_stop; Ptr<Scheduler> m_events; uint32_t m_uid; uint32_t m_currentUid; uint64_t m_currentTs; uint32_t m_currentContext; // number of events that have been inserted but not yet scheduled, // not counting the "destroy" events; this is used for validation int m_unscheduledEvents; LbtsMessage* m_pLBTS; // Allocated once we know how many systems uint32_t m_myId; // MPI Rank uint32_t m_systemCount; // MPI Size Time m_grantedTime; // Last LBTS static Time m_lookAhead; // Lookahead value }; } // namespace ns3 #endif /* DISTRIBUTED_SIMULATOR_IMPL_H */
zy901002-gpsr
src/mpi/model/distributed-simulator-impl.h
C++
gpl2
3,938
/* -*- 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 * * Author: George Riley <riley@ece.gatech.edu> */ #include "distributed-simulator-impl.h" #include "mpi-interface.h" #include "ns3/simulator.h" #include "ns3/scheduler.h" #include "ns3/event-impl.h" #include "ns3/channel.h" #include "ns3/node-container.h" #include "ns3/ptr.h" #include "ns3/pointer.h" #include "ns3/assert.h" #include "ns3/log.h" #include <math.h> #ifdef NS3_MPI #include <mpi.h> #endif NS_LOG_COMPONENT_DEFINE ("DistributedSimulatorImpl"); namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (DistributedSimulatorImpl); LbtsMessage::~LbtsMessage () { } Time LbtsMessage::GetSmallestTime () { return m_smallestTime; } uint32_t LbtsMessage::GetTxCount () { return m_txCount; } uint32_t LbtsMessage::GetRxCount () { return m_rxCount; } uint32_t LbtsMessage::GetMyId () { return m_myId; } Time DistributedSimulatorImpl::m_lookAhead = Seconds (0); TypeId DistributedSimulatorImpl::GetTypeId (void) { static TypeId tid = TypeId ("ns3::DistributedSimulatorImpl") .SetParent<Object> () .AddConstructor<DistributedSimulatorImpl> () ; return tid; } DistributedSimulatorImpl::DistributedSimulatorImpl () { #ifdef NS3_MPI m_myId = MpiInterface::GetSystemId (); m_systemCount = MpiInterface::GetSize (); // Allocate the LBTS message buffer m_pLBTS = new LbtsMessage[m_systemCount]; m_grantedTime = Seconds (0); #else NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); #endif m_stop = false; // uids are allocated from 4. // uid 0 is "invalid" events // uid 1 is "now" events // uid 2 is "destroy" events m_uid = 4; // before ::Run is entered, the m_currentUid will be zero m_currentUid = 0; m_currentTs = 0; m_currentContext = 0xffffffff; m_unscheduledEvents = 0; m_events = 0; } DistributedSimulatorImpl::~DistributedSimulatorImpl () { } void DistributedSimulatorImpl::DoDispose (void) { while (!m_events->IsEmpty ()) { Scheduler::Event next = m_events->RemoveNext (); next.impl->Unref (); } m_events = 0; delete [] m_pLBTS; SimulatorImpl::DoDispose (); } void DistributedSimulatorImpl::Destroy () { while (!m_destroyEvents.empty ()) { Ptr<EventImpl> ev = m_destroyEvents.front ().PeekEventImpl (); m_destroyEvents.pop_front (); NS_LOG_LOGIC ("handle destroy " << ev); if (!ev->IsCancelled ()) { ev->Invoke (); } } MpiInterface::Destroy (); } void DistributedSimulatorImpl::CalculateLookAhead (void) { #ifdef NS3_MPI if (MpiInterface::GetSize () <= 1) { DistributedSimulatorImpl::m_lookAhead = Seconds (0); m_grantedTime = Seconds (0); } else { NodeContainer c = NodeContainer::GetGlobal (); for (NodeContainer::Iterator iter = c.Begin (); iter != c.End (); ++iter) { if ((*iter)->GetSystemId () != MpiInterface::GetSystemId ()) { continue; } for (uint32_t i = 0; i < (*iter)->GetNDevices (); ++i) { Ptr<NetDevice> localNetDevice = (*iter)->GetDevice (i); // only works for p2p links currently if (!localNetDevice->IsPointToPoint ()) { continue; } Ptr<Channel> channel = localNetDevice->GetChannel (); if (channel == 0) { continue; } // grab the adjacent node Ptr<Node> remoteNode; if (channel->GetDevice (0) == localNetDevice) { remoteNode = (channel->GetDevice (1))->GetNode (); } else { remoteNode = (channel->GetDevice (0))->GetNode (); } // if it's not remote, don't consider it if (remoteNode->GetSystemId () == MpiInterface::GetSystemId ()) { continue; } // compare delay on the channel with current value of // m_lookAhead. if delay on channel is smaller, make // it the new lookAhead. TimeValue delay; channel->GetAttribute ("Delay", delay); if (DistributedSimulatorImpl::m_lookAhead.IsZero ()) { DistributedSimulatorImpl::m_lookAhead = delay.Get (); m_grantedTime = delay.Get (); } if (delay.Get ().GetSeconds () < DistributedSimulatorImpl::m_lookAhead.GetSeconds ()) { DistributedSimulatorImpl::m_lookAhead = delay.Get (); m_grantedTime = delay.Get (); } } } } #else NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); #endif } void DistributedSimulatorImpl::SetScheduler (ObjectFactory schedulerFactory) { Ptr<Scheduler> scheduler = schedulerFactory.Create<Scheduler> (); if (m_events != 0) { while (!m_events->IsEmpty ()) { Scheduler::Event next = m_events->RemoveNext (); scheduler->Insert (next); } } m_events = scheduler; } void DistributedSimulatorImpl::ProcessOneEvent (void) { Scheduler::Event next = m_events->RemoveNext (); NS_ASSERT (next.key.m_ts >= m_currentTs); m_unscheduledEvents--; NS_LOG_LOGIC ("handle " << next.key.m_ts); m_currentTs = next.key.m_ts; m_currentContext = next.key.m_context; m_currentUid = next.key.m_uid; next.impl->Invoke (); next.impl->Unref (); } bool DistributedSimulatorImpl::IsFinished (void) const { return m_events->IsEmpty () || m_stop; } uint64_t DistributedSimulatorImpl::NextTs (void) const { NS_ASSERT (!m_events->IsEmpty ()); Scheduler::Event ev = m_events->PeekNext (); return ev.key.m_ts; } Time DistributedSimulatorImpl::Next (void) const { return TimeStep (NextTs ()); } void DistributedSimulatorImpl::Run (void) { #ifdef NS3_MPI CalculateLookAhead (); m_stop = false; while (!m_events->IsEmpty () && !m_stop) { Time nextTime = Next (); if (nextTime > m_grantedTime) { // Can't process, calculate a new LBTS // First receive any pending messages MpiInterface::ReceiveMessages (); // reset next time nextTime = Next (); // And check for send completes MpiInterface::TestSendComplete (); // Finally calculate the lbts LbtsMessage lMsg (MpiInterface::GetRxCount (), MpiInterface::GetTxCount (), m_myId, nextTime); m_pLBTS[m_myId] = lMsg; MPI_Allgather (&lMsg, sizeof (LbtsMessage), MPI_BYTE, m_pLBTS, sizeof (LbtsMessage), MPI_BYTE, MPI_COMM_WORLD); Time smallestTime = m_pLBTS[0].GetSmallestTime (); // The totRx and totTx counts insure there are no transient // messages; If totRx != totTx, there are transients, // so we don't update the granted time. uint32_t totRx = m_pLBTS[0].GetRxCount (); uint32_t totTx = m_pLBTS[0].GetTxCount (); for (uint32_t i = 1; i < m_systemCount; ++i) { if (m_pLBTS[i].GetSmallestTime () < smallestTime) { smallestTime = m_pLBTS[i].GetSmallestTime (); } totRx += m_pLBTS[i].GetRxCount (); totTx += m_pLBTS[i].GetTxCount (); } if (totRx == totTx) { m_grantedTime = smallestTime + DistributedSimulatorImpl::m_lookAhead; } } if (nextTime <= m_grantedTime) { // Save to process ProcessOneEvent (); } } // If the simulator stopped naturally by lack of events, make a // consistency test to check that we didn't lose any events along the way. NS_ASSERT (!m_events->IsEmpty () || m_unscheduledEvents == 0); #else NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); #endif } uint32_t DistributedSimulatorImpl::GetSystemId () const { return m_myId; } void DistributedSimulatorImpl::RunOneEvent (void) { ProcessOneEvent (); } void DistributedSimulatorImpl::Stop (void) { m_stop = true; } void DistributedSimulatorImpl::Stop (Time const &time) { Simulator::Schedule (time, &Simulator::Stop); } // // Schedule an event for a _relative_ time in the future. // EventId DistributedSimulatorImpl::Schedule (Time const &time, EventImpl *event) { Time tAbsolute = time + TimeStep (m_currentTs); NS_ASSERT (tAbsolute.IsPositive ()); NS_ASSERT (tAbsolute >= TimeStep (m_currentTs)); Scheduler::Event ev; ev.impl = event; ev.key.m_ts = static_cast<uint64_t> (tAbsolute.GetTimeStep ()); ev.key.m_context = GetContext (); ev.key.m_uid = m_uid; m_uid++; m_unscheduledEvents++; m_events->Insert (ev); return EventId (event, ev.key.m_ts, ev.key.m_context, ev.key.m_uid); } void DistributedSimulatorImpl::ScheduleWithContext (uint32_t context, Time const &time, EventImpl *event) { NS_LOG_FUNCTION (this << context << time.GetTimeStep () << m_currentTs << event); Scheduler::Event ev; ev.impl = event; ev.key.m_ts = m_currentTs + time.GetTimeStep (); ev.key.m_context = context; ev.key.m_uid = m_uid; m_uid++; m_unscheduledEvents++; m_events->Insert (ev); } EventId DistributedSimulatorImpl::ScheduleNow (EventImpl *event) { Scheduler::Event ev; ev.impl = event; ev.key.m_ts = m_currentTs; ev.key.m_context = GetContext (); ev.key.m_uid = m_uid; m_uid++; m_unscheduledEvents++; m_events->Insert (ev); return EventId (event, ev.key.m_ts, ev.key.m_context, ev.key.m_uid); } EventId DistributedSimulatorImpl::ScheduleDestroy (EventImpl *event) { EventId id (Ptr<EventImpl> (event, false), m_currentTs, 0xffffffff, 2); m_destroyEvents.push_back (id); m_uid++; return id; } Time DistributedSimulatorImpl::Now (void) const { return TimeStep (m_currentTs); } Time DistributedSimulatorImpl::GetDelayLeft (const EventId &id) const { if (IsExpired (id)) { return TimeStep (0); } else { return TimeStep (id.GetTs () - m_currentTs); } } void DistributedSimulatorImpl::Remove (const EventId &id) { if (id.GetUid () == 2) { // destroy events. for (DestroyEvents::iterator i = m_destroyEvents.begin (); i != m_destroyEvents.end (); i++) { if (*i == id) { m_destroyEvents.erase (i); break; } } return; } if (IsExpired (id)) { return; } Scheduler::Event event; event.impl = id.PeekEventImpl (); event.key.m_ts = id.GetTs (); event.key.m_context = id.GetContext (); event.key.m_uid = id.GetUid (); m_events->Remove (event); event.impl->Cancel (); // whenever we remove an event from the event list, we have to unref it. event.impl->Unref (); m_unscheduledEvents--; } void DistributedSimulatorImpl::Cancel (const EventId &id) { if (!IsExpired (id)) { id.PeekEventImpl ()->Cancel (); } } bool DistributedSimulatorImpl::IsExpired (const EventId &ev) const { if (ev.GetUid () == 2) { if (ev.PeekEventImpl () == 0 || ev.PeekEventImpl ()->IsCancelled ()) { return true; } // destroy events. for (DestroyEvents::const_iterator i = m_destroyEvents.begin (); i != m_destroyEvents.end (); i++) { if (*i == ev) { return false; } } return true; } if (ev.PeekEventImpl () == 0 || ev.GetTs () < m_currentTs || (ev.GetTs () == m_currentTs && ev.GetUid () <= m_currentUid) || ev.PeekEventImpl ()->IsCancelled ()) { return true; } else { return false; } } Time DistributedSimulatorImpl::GetMaximumSimulationTime (void) const { // XXX: I am fairly certain other compilers use other non-standard // post-fixes to indicate 64 bit constants. return TimeStep (0x7fffffffffffffffLL); } uint32_t DistributedSimulatorImpl::GetContext (void) const { return m_currentContext; } } // namespace ns3
zy901002-gpsr
src/mpi/model/distributed-simulator-impl.cc
C++
gpl2
12,897