From 21b5431c24587e7aeda172e8d78ed2b11f38821d Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 25 Aug 2008 09:05:41 -0700 Subject: [PATCH 1/7] bug 285: NetDevice base class should define an attribute Mtu. --- src/node/net-device.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/node/net-device.cc b/src/node/net-device.cc index 410cc3f49..431a5e5bc 100644 --- a/src/node/net-device.cc +++ b/src/node/net-device.cc @@ -20,6 +20,7 @@ #include "ns3/object.h" #include "ns3/log.h" +#include "ns3/uinteger.h" #include "net-device.h" NS_LOG_COMPONENT_DEFINE ("NetDevice"); @@ -31,7 +32,15 @@ NS_OBJECT_ENSURE_REGISTERED (NetDevice); TypeId NetDevice::GetTypeId (void) { static TypeId tid = TypeId ("ns3::NetDevice") - .SetParent (); + .SetParent () + .AddAttribute ("Mtu", "The MAC-level Maximum Transmission Unit", + TypeId::ATTR_SET | TypeId::ATTR_GET, + UintegerValue (0xffff), + MakeUintegerAccessor (&NetDevice::SetMtu, + &NetDevice::GetMtu), + MakeUintegerChecker ()) + + ; return tid; } From cfdb301bee135d46cadd5f5a8a878f31221a2466 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 25 Aug 2008 09:13:05 -0700 Subject: [PATCH 2/7] bug 273: constify packet pointers. --- src/devices/bridge/bridge-net-device.cc | 6 +++--- src/devices/bridge/bridge-net-device.h | 6 +++--- src/internet-stack/arp-l3-protocol.cc | 4 +++- src/internet-stack/arp-l3-protocol.h | 2 +- src/internet-stack/ipv4-l3-protocol.cc | 6 ++++-- src/internet-stack/ipv4-l3-protocol.h | 2 +- src/node/net-device.h | 4 ++-- src/node/node.cc | 12 ++++-------- src/node/node.h | 8 ++++---- src/node/packet-socket.cc | 4 ++-- src/node/packet-socket.h | 2 +- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/devices/bridge/bridge-net-device.cc b/src/devices/bridge/bridge-net-device.cc index 8a558236b..958baf5c6 100644 --- a/src/devices/bridge/bridge-net-device.cc +++ b/src/devices/bridge/bridge-net-device.cc @@ -61,7 +61,7 @@ BridgeNetDevice::BridgeNetDevice () } void -BridgeNetDevice::ReceiveFromDevice (Ptr incomingPort, Ptr packet, uint16_t protocol, +BridgeNetDevice::ReceiveFromDevice (Ptr incomingPort, Ptr packet, uint16_t protocol, Address const &src, Address const &dst, PacketType packetType) { NS_LOG_FUNCTION_NOARGS (); @@ -97,7 +97,7 @@ BridgeNetDevice::ReceiveFromDevice (Ptr incomingPort, Ptr pac } void -BridgeNetDevice::ForwardUnicast (Ptr incomingPort, Ptr packet, +BridgeNetDevice::ForwardUnicast (Ptr incomingPort, Ptr packet, uint16_t protocol, Mac48Address src, Mac48Address dst) { NS_LOG_DEBUG ("LearningBridgeForward (incomingPort=" << incomingPort->GetName () @@ -130,7 +130,7 @@ BridgeNetDevice::ForwardUnicast (Ptr incomingPort, Ptr packet } void -BridgeNetDevice::ForwardBroadcast (Ptr incomingPort, Ptr packet, +BridgeNetDevice::ForwardBroadcast (Ptr incomingPort, Ptr packet, uint16_t protocol, Mac48Address src, Mac48Address dst) { NS_LOG_DEBUG ("LearningBridgeForward (incomingPort=" << incomingPort->GetName () diff --git a/src/devices/bridge/bridge-net-device.h b/src/devices/bridge/bridge-net-device.h index be44792d6..5b9716383 100644 --- a/src/devices/bridge/bridge-net-device.h +++ b/src/devices/bridge/bridge-net-device.h @@ -72,11 +72,11 @@ public: protected: virtual void DoDispose (void); - void ReceiveFromDevice (Ptr device, Ptr packet, uint16_t protocol, + void ReceiveFromDevice (Ptr device, Ptr packet, uint16_t protocol, Address const &source, Address const &destination, PacketType packetType); - void ForwardUnicast (Ptr incomingPort, Ptr packet, + void ForwardUnicast (Ptr incomingPort, Ptr packet, uint16_t protocol, Mac48Address src, Mac48Address dst); - void ForwardBroadcast (Ptr incomingPort, Ptr packet, + void ForwardBroadcast (Ptr incomingPort, Ptr packet, uint16_t protocol, Mac48Address src, Mac48Address dst); void Learn (Mac48Address source, Ptr port); Ptr GetLearnedState (Mac48Address source); diff --git a/src/internet-stack/arp-l3-protocol.cc b/src/internet-stack/arp-l3-protocol.cc index 7620b7046..43e597e62 100644 --- a/src/internet-stack/arp-l3-protocol.cc +++ b/src/internet-stack/arp-l3-protocol.cc @@ -117,11 +117,13 @@ ArpL3Protocol::FindCache (Ptr device) } void -ArpL3Protocol::Receive(Ptr device, Ptr packet, uint16_t protocol, const Address &from, +ArpL3Protocol::Receive(Ptr device, Ptr p, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType) { NS_LOG_FUNCTION_NOARGS (); + Ptr packet = p->Copy (); + Ptr cache = FindCache (device); ArpHeader arp; packet->RemoveHeader (arp); diff --git a/src/internet-stack/arp-l3-protocol.h b/src/internet-stack/arp-l3-protocol.h index 61507a13b..289e2296f 100644 --- a/src/internet-stack/arp-l3-protocol.h +++ b/src/internet-stack/arp-l3-protocol.h @@ -54,7 +54,7 @@ public: /** * \brief Receive a packet */ - void Receive(Ptr device, Ptr p, uint16_t protocol, const Address &from, const Address &to, + void Receive(Ptr device, Ptr p, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType); /** * \brief Perform an ARP lookup diff --git a/src/internet-stack/ipv4-l3-protocol.cc b/src/internet-stack/ipv4-l3-protocol.cc index 975071419..95d34d340 100644 --- a/src/internet-stack/ipv4-l3-protocol.cc +++ b/src/internet-stack/ipv4-l3-protocol.cc @@ -449,13 +449,15 @@ Ipv4L3Protocol::FindInterfaceForDevice (Ptr device) } void -Ipv4L3Protocol::Receive( Ptr device, Ptr packet, uint16_t protocol, const Address &from, +Ipv4L3Protocol::Receive( Ptr device, Ptr p, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType) { - NS_LOG_FUNCTION (this << &device << packet << protocol << from); + NS_LOG_FUNCTION (this << &device << p << protocol << from); NS_LOG_LOGIC ("Packet from " << from << " received on node " << m_node->GetId ()); + Ptr packet = p->Copy (); + uint32_t index = 0; Ptr ipv4Interface; for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); diff --git a/src/internet-stack/ipv4-l3-protocol.h b/src/internet-stack/ipv4-l3-protocol.h index e009d2f43..493be5610 100644 --- a/src/internet-stack/ipv4-l3-protocol.h +++ b/src/internet-stack/ipv4-l3-protocol.h @@ -83,7 +83,7 @@ public: * - implement a per-NetDevice ARP cache * - send back arp replies on the right device */ - void Receive( Ptr device, Ptr p, uint16_t protocol, const Address &from, + void Receive( Ptr device, Ptr p, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType); /** diff --git a/src/node/net-device.h b/src/node/net-device.h index b8f799ed3..863530024 100644 --- a/src/node/net-device.h +++ b/src/node/net-device.h @@ -274,7 +274,7 @@ public: * \returns true if the callback could handle the packet successfully, false * otherwise. */ - typedef Callback,Ptr,uint16_t,const Address &> ReceiveCallback; + typedef Callback,Ptr,uint16_t,const Address &> ReceiveCallback; /** * \param cb callback to invoke whenever a packet has been received and must @@ -296,7 +296,7 @@ public: * \returns true if the callback could handle the packet successfully, false * otherwise. */ - typedef Callback< bool, Ptr, Ptr, uint16_t, + typedef Callback< bool, Ptr, Ptr, uint16_t, const Address &, const Address &, PacketType > PromiscReceiveCallback; /** diff --git a/src/node/node.cc b/src/node/node.cc index 1ad596488..d752b4128 100644 --- a/src/node/node.cc +++ b/src/node/node.cc @@ -222,7 +222,7 @@ Node::UnregisterProtocolHandler (ProtocolHandler handler) } bool -Node::PromiscReceiveFromDevice (Ptr device, Ptr packet, uint16_t protocol, +Node::PromiscReceiveFromDevice (Ptr device, Ptr packet, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType) { NS_LOG_FUNCTION(device->GetName ()); @@ -230,7 +230,7 @@ Node::PromiscReceiveFromDevice (Ptr device, Ptr packet, uint1 } bool -Node::NonPromiscReceiveFromDevice (Ptr device, Ptr packet, uint16_t protocol, +Node::NonPromiscReceiveFromDevice (Ptr device, Ptr packet, uint16_t protocol, const Address &from) { NS_LOG_FUNCTION(device->GetName ()); @@ -238,15 +238,11 @@ Node::NonPromiscReceiveFromDevice (Ptr device, Ptr packet, ui } bool -Node::ReceiveFromDevice (Ptr device, Ptr packet, uint16_t protocol, +Node::ReceiveFromDevice (Ptr device, Ptr packet, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType, bool promiscuous) { NS_LOG_FUNCTION(device->GetName ()); bool found = false; - // if there are (potentially) multiple handlers, we need to copy the - // packet before passing it to each handler, because handlers may - // modify it. - bool copyNeeded = (m_handlers.size () > 1); for (ProtocolHandlerList::iterator i = m_handlers.begin (); i != m_handlers.end (); i++) @@ -259,7 +255,7 @@ Node::ReceiveFromDevice (Ptr device, Ptr packet, uint16_t pro { if (promiscuous == i->promiscuous) { - i->handler (device, (copyNeeded ? packet->Copy () : packet), protocol, from, to, packetType); + i->handler (device, packet->Copy (), protocol, from, to, packetType); found = true; } } diff --git a/src/node/node.h b/src/node/node.h index 5f09e66be..b740a175b 100644 --- a/src/node/node.h +++ b/src/node/node.h @@ -145,7 +145,7 @@ public: * this value is only valid for promiscuous mode * protocol handlers. */ - typedef Callback, Ptr,uint16_t,const Address &, + typedef Callback, Ptr,uint16_t,const Address &, const Address &, NetDevice::PacketType> ProtocolHandler; /** * \param handler the handler to register @@ -189,10 +189,10 @@ private: */ virtual void NotifyDeviceAdded (Ptr device); - bool NonPromiscReceiveFromDevice (Ptr device, Ptr, uint16_t protocol, const Address &from); - bool PromiscReceiveFromDevice (Ptr device, Ptr, uint16_t protocol, + bool NonPromiscReceiveFromDevice (Ptr device, Ptr, uint16_t protocol, const Address &from); + bool PromiscReceiveFromDevice (Ptr device, Ptr, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType); - bool ReceiveFromDevice (Ptr device, Ptr, uint16_t protocol, + bool ReceiveFromDevice (Ptr device, Ptr, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType, bool promisc); void Construct (void); diff --git a/src/node/packet-socket.cc b/src/node/packet-socket.cc index 05b8b14d9..0cfc3b514 100644 --- a/src/node/packet-socket.cc +++ b/src/node/packet-socket.cc @@ -344,7 +344,7 @@ PacketSocket::SendTo (Ptr p, uint32_t flags, const Address &address) } void -PacketSocket::ForwardUp (Ptr device, Ptr packet, +PacketSocket::ForwardUp (Ptr device, Ptr packet, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType) { @@ -369,7 +369,7 @@ PacketSocket::ForwardUp (Ptr device, Ptr packet, SocketAddressTag tag; tag.SetAddress (address); packet->AddTag (tag); - m_deliveryQueue.push (packet); + m_deliveryQueue.push (packet->Copy ()); m_rxAvailable += packet->GetSize (); NS_LOG_LOGIC ("UID is " << packet->GetUid() << " PacketSocket " << this); NotifyDataRecv (); diff --git a/src/node/packet-socket.h b/src/node/packet-socket.h index 3bfc4ae3c..1218de2c3 100644 --- a/src/node/packet-socket.h +++ b/src/node/packet-socket.h @@ -103,7 +103,7 @@ public: Address &fromAddress); private: - void ForwardUp (Ptr device, Ptr packet, + void ForwardUp (Ptr device, Ptr packet, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType); int DoBind (const PacketSocketAddress &address); From 5f63fe35ba326d89788ef7a6a996f8da6fd685ed Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 25 Aug 2008 10:02:52 -0700 Subject: [PATCH 3/7] shared Mac48 multicast code --- src/devices/csma/csma-net-device.cc | 76 +++-------------------------- src/devices/wifi/wifi-net-device.cc | 4 +- src/node/mac48-address.cc | 54 ++++++++++++++++++++ src/node/mac48-address.h | 14 ++++++ src/node/simple-net-device.cc | 4 +- 5 files changed, 79 insertions(+), 73 deletions(-) diff --git a/src/devices/csma/csma-net-device.cc b/src/devices/csma/csma-net-device.cc index f0a739631..be5b1ff22 100644 --- a/src/devices/csma/csma-net-device.cc +++ b/src/devices/csma/csma-net-device.cc @@ -670,27 +670,6 @@ CsmaNetDevice::Receive (Ptr packet, Ptr senderDevice) NS_LOG_LOGIC ("Pkt source is " << header.GetSource ()); NS_LOG_LOGIC ("Pkt destination is " << header.GetDestination ()); - // - // An IP host group address is mapped to an Ethernet 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). - // - // We are going to receive all packets destined to any multicast address, - // which means clearing the low-order 23 bits the header destination - // - Mac48Address mcDest; - uint8_t mcBuf[6]; - - header.GetDestination ().CopyTo (mcBuf); - mcBuf[3] &= 0x80; - mcBuf[4] = 0; - mcBuf[5] = 0; - mcDest.CopyFrom (mcBuf); - - Mac48Address multicast = Mac48Address::ConvertFrom (GetMulticast ()); - Mac48Address broadcast = Mac48Address::ConvertFrom (GetBroadcast ()); - Mac48Address destination = Mac48Address::ConvertFrom (GetAddress ()); - if (m_receiveErrorModel && m_receiveErrorModel->IsCorrupt (packet) ) { NS_LOG_LOGIC ("Dropping pkt due to error model "); @@ -723,17 +702,17 @@ CsmaNetDevice::Receive (Ptr packet, Ptr senderDevice) PacketType packetType; - if (header.GetDestination () == broadcast) + if (header.GetDestination ().IsBroadcast ()) { packetType = PACKET_BROADCAST; m_rxTrace (originalPacket); } - else if (mcDest == multicast) + else if (header.GetDestination ().IsMulticast ()) { packetType = PACKET_MULTICAST; m_rxTrace (originalPacket); } - else if (header.GetDestination () == destination) + else if (header.GetDestination () == m_address) { packetType = PACKET_HOST; m_rxTrace (originalPacket); @@ -855,65 +834,24 @@ CsmaNetDevice::IsMulticast (void) const CsmaNetDevice::GetMulticast (void) const { NS_LOG_FUNCTION_NOARGS (); - return Mac48Address ("01:00:5e:00:00:00"); + return Mac48Address::GetMulticastPrefix (); } Address CsmaNetDevice::MakeMulticastAddress (Ipv4Address multicastGroup) const { NS_LOG_FUNCTION (multicastGroup); - // - // First, get the generic multicast address. - // - Address hardwareDestination = GetMulticast (); - NS_LOG_LOGIC ("Device multicast address: " << hardwareDestination); - - // - // It's our address, and we know we're playing with an EUI-48 address here - // primarily since we know that by construction, but also since the parameter - // is an Ipv4Address. - // - Mac48Address etherAddr = Mac48Address::ConvertFrom (hardwareDestination); - - // - // 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, - // - etherAddr.CopyFrom (etherBuffer); + Mac48Address ad = Mac48Address::GetMulticast (multicastGroup); // // Implicit conversion (operator Address ()) is defined for Mac48Address, so // use it by just returning the EUI-48 address which is automagically converted // to an Address. // - NS_LOG_LOGIC ("multicast address is " << etherAddr); + NS_LOG_LOGIC ("multicast address is " << ad); - return etherAddr; + return ad; } bool diff --git a/src/devices/wifi/wifi-net-device.cc b/src/devices/wifi/wifi-net-device.cc index 1148b7783..5d217a08c 100644 --- a/src/devices/wifi/wifi-net-device.cc +++ b/src/devices/wifi/wifi-net-device.cc @@ -255,12 +255,12 @@ WifiNetDevice::IsMulticast (void) const Address WifiNetDevice::GetMulticast (void) const { - return Mac48Address ("01:00:5e:00:00:00"); + return Mac48Address::GetMulticastPrefix (); } Address WifiNetDevice::MakeMulticastAddress (Ipv4Address multicastGroup) const { - return GetMulticast (); + return Mac48Address::GetMulticast (multicastGroup); } bool WifiNetDevice::IsPointToPoint (void) const diff --git a/src/node/mac48-address.cc b/src/node/mac48-address.cc index 6dbb8d312..a6b86dac0 100644 --- a/src/node/mac48-address.cc +++ b/src/node/mac48-address.cc @@ -143,6 +143,18 @@ Mac48Address::IsBroadcast (void) const } bool Mac48Address::IsMulticast (void) const +{ + uint8_t mcBuf[6]; + CopyTo (mcBuf); + mcBuf[3] &= 0x80; + mcBuf[4] = 0; + mcBuf[5] = 0; + Mac48Address prefix; + prefix.CopyFrom (mcBuf); + return prefix == Mac48Address::GetMulticastPrefix (); +} +bool +Mac48Address::IsGroup (void) const { return (m_address[0] & 0x01) == 0x01; } @@ -152,6 +164,48 @@ 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::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; +} bool operator == (const Mac48Address &a, const Mac48Address &b) { diff --git a/src/node/mac48-address.h b/src/node/mac48-address.h index 4572ab484..78084bac4 100644 --- a/src/node/mac48-address.h +++ b/src/node/mac48-address.h @@ -24,6 +24,7 @@ #include #include "ns3/attribute.h" #include "ns3/attribute-helper.h" +#include "ipv4-address.h" namespace ns3 { @@ -92,12 +93,25 @@ public: * \returns true if this is a multicast address, false otherwise. */ bool IsMulticast (void) const; + /** + * \returns true if the group bit is set, false otherwise. + */ + bool IsGroup (void) const; /** * \returns the broadcast address */ static Mac48Address GetBroadcast (void); + /** + * \returns a multicast address + */ + static Mac48Address GetMulticast (Ipv4Address address); + + /** + * \returns the multicast prefix (01:00:5e:00:00:00). + */ + static Mac48Address GetMulticastPrefix (void); private: /** * \returns a new Address instance diff --git a/src/node/simple-net-device.cc b/src/node/simple-net-device.cc index 481306da7..13dd616ba 100644 --- a/src/node/simple-net-device.cc +++ b/src/node/simple-net-device.cc @@ -142,12 +142,12 @@ SimpleNetDevice::IsMulticast (void) const Address SimpleNetDevice::GetMulticast (void) const { - return Mac48Address ("01:00:5e:00:00:00"); + return Mac48Address::GetMulticastPrefix (); } Address SimpleNetDevice::MakeMulticastAddress (Ipv4Address multicastGroup) const { - return Mac48Address ("01:00:5e:00:00:00"); + return Mac48Address::GetMulticast (multicastGroup); } bool SimpleNetDevice::IsPointToPoint (void) const From f5f3b3f057c5437d9c37da6b3989c40f43220e4a Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 25 Aug 2008 10:03:38 -0700 Subject: [PATCH 4/7] repeat enum keyword. --- src/node/net-device.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node/net-device.h b/src/node/net-device.h index 863530024..e12df0118 100644 --- a/src/node/net-device.h +++ b/src/node/net-device.h @@ -297,7 +297,7 @@ public: * otherwise. */ typedef Callback< bool, Ptr, Ptr, uint16_t, - const Address &, const Address &, PacketType > PromiscReceiveCallback; + const Address &, const Address &, enum PacketType > PromiscReceiveCallback; /** * \param cb callback to invoke whenever a packet has been received in promiscuous mode and must From bd37d93222de68fe50bf9db72b95891ca16f00d7 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 25 Aug 2008 15:00:56 -0700 Subject: [PATCH 5/7] document API change --- CHANGES.html | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/CHANGES.html b/CHANGES.html index dd7eb9ac3..8254224c7 100644 --- a/CHANGES.html +++ b/CHANGES.html @@ -61,12 +61,38 @@ mostly for internal use.

changes to existing API:

    +
  • 25-08-2008; changeset +e5ab96db540e
  • +
      +
    • +bug 273: constify packet pointers.
      +The normal and the promiscuous receive callbacks of the NetDevice API +have been changed from: +
      +Callback,Ptr,uint16_t,const Address &>
      +Callback, Ptr, uint16_t,
      +         const Address &, const Address &, enum PacketType >
      +
      +to: +
      +Callback,Ptr,uint16_t,const Address &>
      +Callback, Ptr, uint16_t,
      +         const Address &, const Address &, enum PacketType >
      +
      +to avoid the kind of bugs reported in +bug 273. +Users who implement a subclass of the NetDevice base class need to change the signature +of their SetReceiveCallback and SetPromiscReceiveCallback methods. +
    • +
    + + +
  • 04-08-2008; changeset cba7b2b80fe8
    • -Cleanup of MTU confusion and initialization in CsmaNetDevice -
      +Cleanup of MTU confusion and initialization in CsmaNetDevice
      The MTU of the CsmaNetDevice defaulted to 65535. This did not correspond with the expected MTU found in Ethernet-like devices. Also there was not clear documentation regarding which MTU was being set. There are two MTU here, one @@ -77,13 +103,11 @@ MAC level MTU at 1492 by default. We allow users to now set the encapsulation mode, MAC MTU and PHY MTU while keeping the three values consistent. See the Doxygen of CsmaNetDevice::SetMaxPayloadLength for a detailed description of the issues and solution. -
    -
-
    +
  • 21-07-2008; changeset 99698bc858e8
  • @@ -112,9 +136,8 @@ when the m_promiscRxCallback is called.
- -
    +
  • 03-07-2008; changeset d5f8e5fae1c6
    • @@ -144,9 +167,8 @@ ApplicationContainer Install (NodeContainer c);
    -
-
    +
  • 03-07-2008; changeset 3cdd9d60f7c7
  • @@ -181,7 +203,7 @@ instability in neighbor detection.
- + From 3ba086cef6de968006e45ada749894a8f938e785 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 25 Aug 2008 15:16:35 -0700 Subject: [PATCH 6/7] bug 273: fix python bindings. --- bindings/python/ns3_module_bridge.py | 4 ++-- bindings/python/ns3_module_csma.py | 4 ++-- bindings/python/ns3_module_node.py | 12 ++++++------ bindings/python/ns3_module_point_to_point.py | 4 ++-- bindings/python/ns3_module_wifi.py | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/bindings/python/ns3_module_bridge.py b/bindings/python/ns3_module_bridge.py index 4ef288764..070bbd033 100644 --- a/bindings/python/ns3_module_bridge.py +++ b/bindings/python/ns3_module_bridge.py @@ -173,12 +173,12 @@ def register_Ns3BridgeNetDevice_methods(root_module, cls): ## bridge-net-device.h: void ns3::BridgeNetDevice::SetReceiveCallback(ns3::Callback, ns3::Ptr, unsigned short, ns3::Address const&, ns3::empty, ns3::empty> cb) [member function] cls.add_method('SetReceiveCallback', 'void', - [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet >, unsigned short, ns3::Address const&, ns3::empty, ns3::empty >', 'cb')], + [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr, unsigned short, ns3::Address const&, ns3::empty, ns3::empty >', 'cb')], is_virtual=True) ## bridge-net-device.h: void ns3::BridgeNetDevice::SetPromiscReceiveCallback(ns3::Callback, ns3::Ptr, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType> cb) [member function] cls.add_method('SetPromiscReceiveCallback', 'void', - [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet >, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType >', 'cb')], + [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType >', 'cb')], is_virtual=True) ## bridge-net-device.h: bool ns3::BridgeNetDevice::SupportsPromiscuous() const [member function] cls.add_method('SupportsPromiscuous', diff --git a/bindings/python/ns3_module_csma.py b/bindings/python/ns3_module_csma.py index 373449180..a85cac32f 100644 --- a/bindings/python/ns3_module_csma.py +++ b/bindings/python/ns3_module_csma.py @@ -387,12 +387,12 @@ def register_Ns3CsmaNetDevice_methods(root_module, cls): ## csma-net-device.h: void ns3::CsmaNetDevice::SetReceiveCallback(ns3::Callback, ns3::Ptr, unsigned short, ns3::Address const&, ns3::empty, ns3::empty> cb) [member function] cls.add_method('SetReceiveCallback', 'void', - [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet >, unsigned short, ns3::Address const&, ns3::empty, ns3::empty >', 'cb')], + [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr, unsigned short, ns3::Address const&, ns3::empty, ns3::empty >', 'cb')], is_virtual=True) ## csma-net-device.h: void ns3::CsmaNetDevice::SetPromiscReceiveCallback(ns3::Callback, ns3::Ptr, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType> cb) [member function] cls.add_method('SetPromiscReceiveCallback', 'void', - [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet >, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType >', 'cb')], + [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType >', 'cb')], is_virtual=True) ## csma-net-device.h: bool ns3::CsmaNetDevice::SupportsPromiscuous() const [member function] cls.add_method('SupportsPromiscuous', diff --git a/bindings/python/ns3_module_node.py b/bindings/python/ns3_module_node.py index 9bd50590e..10155f09d 100644 --- a/bindings/python/ns3_module_node.py +++ b/bindings/python/ns3_module_node.py @@ -1574,12 +1574,12 @@ def register_Ns3NetDevice_methods(root_module, cls): ## net-device.h: void ns3::NetDevice::SetReceiveCallback(ns3::Callback, ns3::Ptr, unsigned short, ns3::Address const&, ns3::empty, ns3::empty> cb) [member function] cls.add_method('SetReceiveCallback', 'void', - [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet >, unsigned short, ns3::Address const&, ns3::empty, ns3::empty >', 'cb')], + [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr, unsigned short, ns3::Address const&, ns3::empty, ns3::empty >', 'cb')], is_pure_virtual=True, is_virtual=True) ## net-device.h: void ns3::NetDevice::SetPromiscReceiveCallback(ns3::Callback, ns3::Ptr, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType> cb) [member function] cls.add_method('SetPromiscReceiveCallback', 'void', - [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet >, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType >', 'cb')], + [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType >', 'cb')], is_pure_virtual=True, is_virtual=True) ## net-device.h: bool ns3::NetDevice::SupportsPromiscuous() const [member function] cls.add_method('SupportsPromiscuous', @@ -1699,11 +1699,11 @@ def register_Ns3Node_methods(root_module, cls): ## node.h: void ns3::Node::RegisterProtocolHandler(ns3::Callback, ns3::Ptr, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType> handler, uint16_t protocolType, ns3::Ptr device, bool promiscuous=false) [member function] cls.add_method('RegisterProtocolHandler', 'void', - [param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet >, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType >', 'handler'), param('uint16_t', 'protocolType'), param('ns3::Ptr< ns3::NetDevice >', 'device'), param('bool', 'promiscuous', default_value='false')]) + [param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType >', 'handler'), param('uint16_t', 'protocolType'), param('ns3::Ptr< ns3::NetDevice >', 'device'), param('bool', 'promiscuous', default_value='false')]) ## node.h: void ns3::Node::UnregisterProtocolHandler(ns3::Callback, ns3::Ptr, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType> handler) [member function] cls.add_method('UnregisterProtocolHandler', 'void', - [param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet >, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType >', 'handler')]) + [param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType >', 'handler')]) ## node.h: void ns3::Node::DoDispose() [member function] cls.add_method('DoDispose', 'void', @@ -2469,12 +2469,12 @@ def register_Ns3SimpleNetDevice_methods(root_module, cls): ## simple-net-device.h: void ns3::SimpleNetDevice::SetReceiveCallback(ns3::Callback, ns3::Ptr, unsigned short, ns3::Address const&, ns3::empty, ns3::empty> cb) [member function] cls.add_method('SetReceiveCallback', 'void', - [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet >, unsigned short, ns3::Address const&, ns3::empty, ns3::empty >', 'cb')], + [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr, unsigned short, ns3::Address const&, ns3::empty, ns3::empty >', 'cb')], is_virtual=True) ## simple-net-device.h: void ns3::SimpleNetDevice::SetPromiscReceiveCallback(ns3::Callback, ns3::Ptr, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType> cb) [member function] cls.add_method('SetPromiscReceiveCallback', 'void', - [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet >, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType >', 'cb')], + [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType >', 'cb')], is_virtual=True) ## simple-net-device.h: bool ns3::SimpleNetDevice::SupportsPromiscuous() const [member function] cls.add_method('SupportsPromiscuous', diff --git a/bindings/python/ns3_module_point_to_point.py b/bindings/python/ns3_module_point_to_point.py index 0e5c489bd..e8c96e8fe 100644 --- a/bindings/python/ns3_module_point_to_point.py +++ b/bindings/python/ns3_module_point_to_point.py @@ -231,12 +231,12 @@ def register_Ns3PointToPointNetDevice_methods(root_module, cls): ## point-to-point-net-device.h: void ns3::PointToPointNetDevice::SetReceiveCallback(ns3::Callback, ns3::Ptr, unsigned short, ns3::Address const&, ns3::empty, ns3::empty> cb) [member function] cls.add_method('SetReceiveCallback', 'void', - [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet >, unsigned short, ns3::Address const&, ns3::empty, ns3::empty >', 'cb')], + [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr, unsigned short, ns3::Address const&, ns3::empty, ns3::empty >', 'cb')], is_virtual=True) ## point-to-point-net-device.h: void ns3::PointToPointNetDevice::SetPromiscReceiveCallback(ns3::Callback, ns3::Ptr, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType> cb) [member function] cls.add_method('SetPromiscReceiveCallback', 'void', - [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet >, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType >', 'cb')], + [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType >', 'cb')], is_virtual=True) ## point-to-point-net-device.h: bool ns3::PointToPointNetDevice::SupportsPromiscuous() const [member function] cls.add_method('SupportsPromiscuous', diff --git a/bindings/python/ns3_module_wifi.py b/bindings/python/ns3_module_wifi.py index e764fc56b..e9e8917a5 100644 --- a/bindings/python/ns3_module_wifi.py +++ b/bindings/python/ns3_module_wifi.py @@ -2179,7 +2179,7 @@ def register_Ns3WifiNetDevice_methods(root_module, cls): ## wifi-net-device.h: void ns3::WifiNetDevice::SetReceiveCallback(ns3::Callback, ns3::Ptr, unsigned short, ns3::Address const&, ns3::empty, ns3::empty> cb) [member function] cls.add_method('SetReceiveCallback', 'void', - [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet >, unsigned short, ns3::Address const&, ns3::empty, ns3::empty >', 'cb')], + [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr, unsigned short, ns3::Address const&, ns3::empty, ns3::empty >', 'cb')], is_virtual=True) ## wifi-net-device.h: bool ns3::WifiNetDevice::SendFrom(ns3::Ptr packet, ns3::Address const & source, ns3::Address const & dest, uint16_t protocolNumber) [member function] cls.add_method('SendFrom', @@ -2189,7 +2189,7 @@ def register_Ns3WifiNetDevice_methods(root_module, cls): ## wifi-net-device.h: void ns3::WifiNetDevice::SetPromiscReceiveCallback(ns3::Callback, ns3::Ptr, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType> cb) [member function] cls.add_method('SetPromiscReceiveCallback', 'void', - [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet >, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType >', 'cb')], + [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType >', 'cb')], is_virtual=True) ## wifi-net-device.h: bool ns3::WifiNetDevice::SupportsPromiscuous() const [member function] cls.add_method('SupportsPromiscuous', From 0500b5353e4a3a5e122e2f1814364498d248031a Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 25 Aug 2008 15:21:01 -0700 Subject: [PATCH 7/7] bug 279: Packets need metadata support for printing without header checking --- examples/wifi-ap.cc | 2 +- src/common/packet-metadata.cc | 32 +++++++++++++++++++++++++---- src/common/packet-metadata.h | 2 ++ src/common/packet.cc | 14 +++++++++++++ src/common/packet.h | 9 ++++++-- src/helper/csma-helper.cc | 2 +- src/helper/point-to-point-helper.cc | 2 +- src/helper/wifi-helper.cc | 2 +- utils/bench-packets.cc | 2 +- 9 files changed, 56 insertions(+), 11 deletions(-) diff --git a/examples/wifi-ap.cc b/examples/wifi-ap.cc index c2445f16b..75b888e7b 100644 --- a/examples/wifi-ap.cc +++ b/examples/wifi-ap.cc @@ -110,7 +110,7 @@ AdvancePosition (Ptr node) int main (int argc, char *argv[]) { - Packet::EnableMetadata (); + Packet::EnablePrinting (); // enable rts cts all the time. Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("0")); diff --git a/src/common/packet-metadata.cc b/src/common/packet-metadata.cc index ba7983248..810a854db 100644 --- a/src/common/packet-metadata.cc +++ b/src/common/packet-metadata.cc @@ -32,6 +32,7 @@ NS_LOG_COMPONENT_DEFINE ("PacketMetadata"); namespace ns3 { bool PacketMetadata::m_enable = false; +bool PacketMetadata::m_enableChecking = false; bool PacketMetadata::m_metadataSkipped = false; uint32_t PacketMetadata::m_maxSize = 0; uint16_t PacketMetadata::m_chunkUid = 0; @@ -59,6 +60,13 @@ PacketMetadata::Enable (void) m_enable = true; } +void +PacketMetadata::EnableChecking (void) +{ + Enable (); + m_enableChecking = true; +} + void PacketMetadata::ReserveCopy (uint32_t size) { @@ -630,13 +638,21 @@ PacketMetadata::RemoveHeader (const Header &header, uint32_t size) if ((item.typeUid & 0xfffffffe) != uid || item.size != size) { - NS_FATAL_ERROR ("Removing unexpected header."); + if (m_enableChecking) + { + NS_FATAL_ERROR ("Removing unexpected header."); + } + return; } else if (item.typeUid != uid && (extraItem.fragmentStart != 0 || extraItem.fragmentEnd != size)) { - NS_FATAL_ERROR ("Removing incomplete header."); + if (m_enableChecking) + { + NS_FATAL_ERROR ("Removing incomplete header."); + } + return; } if (m_head + read == m_used) { @@ -688,13 +704,21 @@ PacketMetadata::RemoveTrailer (const Trailer &trailer, uint32_t size) if ((item.typeUid & 0xfffffffe) != uid || item.size != size) { - NS_FATAL_ERROR ("Removing unexpected trailer."); + if (m_enableChecking) + { + NS_FATAL_ERROR ("Removing unexpected trailer."); + } + return; } else if (item.typeUid != uid && (extraItem.fragmentStart != 0 || extraItem.fragmentEnd != size)) { - NS_FATAL_ERROR ("Removing incomplete trailer."); + if (m_enableChecking) + { + NS_FATAL_ERROR ("Removing incomplete trailer."); + } + return; } if (m_tail + read == m_used) { diff --git a/src/common/packet-metadata.h b/src/common/packet-metadata.h index 569546727..574d2f6e6 100644 --- a/src/common/packet-metadata.h +++ b/src/common/packet-metadata.h @@ -125,6 +125,7 @@ public: }; static void Enable (void); + static void EnableChecking (void); inline PacketMetadata (uint32_t uid, uint32_t size); inline PacketMetadata (PacketMetadata const &o); @@ -279,6 +280,7 @@ private: static DataFreeList m_freeList; static bool m_enable; + static bool m_enableChecking; // set to true when adding metadata to a packet is skipped because // m_enable is false; used to detect enabling of metadata in the diff --git a/src/common/packet.cc b/src/common/packet.cc index a9b95f66f..cda5fbe8e 100644 --- a/src/common/packet.cc +++ b/src/common/packet.cc @@ -457,11 +457,25 @@ Packet::BeginItem (void) const void Packet::EnableMetadata (void) +{ + NS_LOG_FUNCTION_NOARGS (); + EnableChecking (); +} + +void +Packet::EnablePrinting (void) { NS_LOG_FUNCTION_NOARGS (); PacketMetadata::Enable (); } +void +Packet::EnableChecking (void) +{ + NS_LOG_FUNCTION_NOARGS (); + PacketMetadata::EnableChecking (); +} + Buffer Packet::Serialize (void) const { diff --git a/src/common/packet.h b/src/common/packet.h index b51f9c3ab..428297028 100644 --- a/src/common/packet.h +++ b/src/common/packet.h @@ -30,6 +30,7 @@ #include "ns3/callback.h" #include "ns3/assert.h" #include "ns3/ptr.h" +#include "ns3/deprecated.h" namespace ns3 { @@ -310,13 +311,17 @@ public: PacketMetadata::ItemIterator BeginItem (void) const; + static void EnableMetadata (void) NS_DEPRECATED; + /** * By default, packets do not keep around enough metadata to * perform the operations requested by the Print methods. If you * want to be able to invoke any of the two ::Print methods, * you need to invoke this method at least once during the * simulation setup and before any packet is created. - * + */ + static void EnablePrinting (void); + /** * The packet metadata is also used to perform extensive * sanity checks at runtime when performing operations on a * Packet. For example, this metadata is used to verify that @@ -324,7 +329,7 @@ public: * was actually present at the front of the packet. These * errors will be detected and will abort the program. */ - static void EnableMetadata (void); + static void EnableChecking (void); /** * \returns a byte buffer diff --git a/src/helper/csma-helper.cc b/src/helper/csma-helper.cc index 5cea6ec3d..d5d2b379b 100644 --- a/src/helper/csma-helper.cc +++ b/src/helper/csma-helper.cc @@ -122,7 +122,7 @@ CsmaHelper::EnablePcapAll (std::string filename) void CsmaHelper::EnableAscii (std::ostream &os, uint32_t nodeid, uint32_t deviceid) { - Packet::EnableMetadata (); + Packet::EnablePrinting (); std::ostringstream oss; oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::CsmaNetDevice/Rx"; Config::Connect (oss.str (), MakeBoundCallback (&CsmaHelper::AsciiRxEvent, &os)); diff --git a/src/helper/point-to-point-helper.cc b/src/helper/point-to-point-helper.cc index ec2c1a7e6..ed951b56e 100644 --- a/src/helper/point-to-point-helper.cc +++ b/src/helper/point-to-point-helper.cc @@ -122,7 +122,7 @@ PointToPointHelper::EnablePcapAll (std::string filename) void PointToPointHelper::EnableAscii (std::ostream &os, uint32_t nodeid, uint32_t deviceid) { - Packet::EnableMetadata (); + Packet::EnablePrinting (); std::ostringstream oss; oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::PointToPointNetDevice/Rx"; Config::Connect (oss.str (), MakeBoundCallback (&PointToPointHelper::AsciiRxEvent, &os)); diff --git a/src/helper/wifi-helper.cc b/src/helper/wifi-helper.cc index 75ecbdf62..dd4a122c3 100644 --- a/src/helper/wifi-helper.cc +++ b/src/helper/wifi-helper.cc @@ -193,7 +193,7 @@ WifiHelper::EnablePcapAll (std::string filename) void WifiHelper::EnableAscii (std::ostream &os, uint32_t nodeid, uint32_t deviceid) { - Packet::EnableMetadata (); + Packet::EnablePrinting (); std::ostringstream oss; oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/RxOk"; Config::Connect (oss.str (), MakeBoundCallback (&AsciiPhyRxOkEvent, &os)); diff --git a/utils/bench-packets.cc b/utils/bench-packets.cc index 5ea80088e..fda9be7ec 100644 --- a/utils/bench-packets.cc +++ b/utils/bench-packets.cc @@ -282,7 +282,7 @@ int main (int argc, char *argv[]) runBench (&benchC, n, "c"); runBench (&benchD, n, "d"); - Packet::EnableMetadata (); + Packet::EnablePrinting (); runBench (&benchA, n, "meta-a"); runBench (&benchB, n, "meta-b"); runBench (&benchC, n, "meta-c");