ns-3 is an evolving system and there will be API or behavioral changes from time to time. Users who try to use scripts or models across versions of ns-3 may encounter problems at compile time, run time, or may see the simulation output change.
We have adopted the development policy that we are going to try to ease the impact of these changes on users by documenting these changes in a single place (this file), and not by providing a temporary or permanent backward-compatibility software layer.
A related file is the RELEASE_NOTES file in the top level directory. This file complements RELEASE_NOTES by focusing on API and behavioral changes that users upgrading from one release to the next may encounter. RELEASE_NOTES attempts to comprehensively list all of the changes that were made. There is generally some overlap in the information contained in RELEASE_NOTES and this file.
The goal is that users who encounter a problem when trying to use older code with newer code should be able to consult this file to find guidance as to how to fix the problem. For instance, if a method name or signature has changed, it should be stated what the new replacement name is.
Note that users who upgrade the simulator across versions, or who work directly out of the development tree, may find that simulation output changes even when the compilation doesn't break, such as when a simulator default value is changed. Therefore, it is good practice for _anyone_ using code across multiple ns-3 releases to consult this file, as well as the RELEASE_NOTES, to understand what has changed over time.
This file is a best-effort approach to solving this issue; we will do our best but can guarantee that there will be things that fall through the cracks, unfortunately. If you, as a user, can suggest improvements to this file based on your experience, please contribute a patch or drop us a note on ns-developers mailing list.
Vector{2,3}D.GetLength ()
.operator+
and operator-
for Vector{2,3}D
.CommandLine cmd; cmd.Parse (argc, argv); ... std::cerr << cmd;or
cmd.PrintHelp (std::cerr);
virtual Ptr<AntennaModel> GetRxAntenna () = 0;that all derived classes need to implement in order to integrate properly with the newly added antenna model. In addition, a new member variable "Ptr<AntennaModel> txAntenna" has been added to SpectrumSignalParameters in order to allow derived SpectrumPhy classes to provide information about the antenna model used for the transmission of a waveform.
src/internet/model/ipv4-l4-protocol.cc src/internet/model/ipv4-l4-protocol.h src/internet/model/ipv6-l4-protocol.cc src/internet/model/ipv6-l4-protocol.hand replaced with:
src/internet/model/ip-l4-protocol.cc src/internet/model/ip-l4-protocol.h
csma-layout/examples/csma-star [*] netanim/examples/star-animation [*] point-to-point-layout/model/point-to-point-star.cc point-to-point-layout/model/point-to-point-grid.cc point-to-point-layout/model/point-to-point-dumbbell.cc examples/udp/udp-echo [*] examples/udp-client-server/udp-client-server [*] examples/udp-client-server/udp-trace-client-server [*] applications/helper/udp-echo-helper applications/model/udp-client applications/model/udp-echo-client applications/model/udp-echo-server applications/model/udp-server applications/model/udp-trace-client [*] Added '--useIpv6' flag to switch between IPv4 and IPv6
./waf configure -o shared ./waf configure --enable-static -o static
- headers = bld.new_task_gen('ns3header') + headers = bld.new_task_gen(features=['ns3header'])
You can now make examples and tests be built in ns-3 in two ways.
./build.py --enable-examples --enable-tests
./waf configure --enable-examples --enable-tests
A new configuration file, .ns3rc, has been added to ns-3 that specifies the modules that should be enabled during the ns-3 build. See the documentation for details.
The int64x64_t type implements all the C++ arithmetic operators to behave like one of the C++ native types. It is a 64.64 integer type which means that it is a 128bit integer type with 64 bits of fractional precision. The existing Time type is now automatically convertible to int64x64_t to allow arbitrarily complex arithmetic operations on the content of Time objects. The implementation of int64x64_t is based on the previously-existing HighPrecision type and supercedes it.
The following static methods have been moved from the InterferenceHelper class to the WifiPhy class:
static Time CalculateTxDuration (uint32_t size, WifiMode payloadMode, enum WifiPreamble preamble); static WifiMode GetPlcpHeaderMode (WifiMode payloadMode, WifiPreamble preamble); static uint32_t GetPlcpHeaderDurationMicroSeconds (WifiMode payloadMode, WifiPreamble preamble); static uint32_t GetPlcpPreambleDurationMicroSeconds (WifiMode payloadMode, WifiPreamble preamble); static uint32_t GetPayloadDurationMicroSeconds (uint32_t size, WifiMode payloadMode);
Unit test case DoRun() functions no longer return a bool value. Now, they don't return a value at all. The motivation for this change was to disallow users from merely returning "true" from a test case to force an error to be recorded. Instead, test case macros should be used.
The PhyMac interface previously defined in phy-mac.h has been renamed to GenericPhy interface and moved to a new file generic-phy.h. The related variables and methods have been renamed accordingly.
The Scalar type has been removed. Typical code such as:
Time tmp = ...; Time result = tmp * Scalar (5);Can now be rewritten as:
Time tmp = ...; Time result = Time (tmp * 5);
As part of bug 1047 rework to enable multicast routes on nodes with more than 16 interfaces, the methods Ipv4MulticastRoute::GetOutputTtl () and Ipv6MulticastRoute::GetOutputTtl () have been modified to return a std::map of interface IDs and TTLs for the route.
All regression testing is now being done in test.py. As a result, a separate reference trace repository is no longer needed to perform regression tests. Tests that require comparison against known good traces can still be run from test.py. The --regression option for waf has been removed. However, the "-r" option to download.py has been kept to allow users to fetch older revisions of ns-3 that contain these traces.
Project documentation (manual, tutorial, and testing) have been converted to Sphinx from the GNU Texinfo markup format.
A Python-based visualizer called pyviz is now integrated with ns-3. For Python simulations, there is an API to start the visualizer. You have to import the visualizer module, and call visualizer.start() instead of ns3.Simulator.Run(). For C++ simulations, there is no API. For C++ simulations (but also works for Python ones) you need to set the GlobalValue SimulatorImplementationType to "ns3::VisualSimulatorImpl". This can be set from the command-line, for example (add the --SimulatorImplementationType=ns3::VisualSimulatorImpl option), or via the waf option --visualizer, in addition to the usual --run option to run programs.
Two attributes were added to WaypointMobility model: LazyNotify and InitialPositionIs Waypoint. See RELEASE_NOTES for details.
New WifiModes of the form ErpOfdmRatexxMbps, where xx is the rate in Mbps (6, 9, 12, 18, 24, 36, 48, 54), are available for 802.11g. More details are in the RELEASE_NOTES.
This is analogous to getsockopt(SO_TYPE). ipv4-raw-socket, ipv6-raw-socket, and packet-socket return NS3_SOCK_RAW. tcp-socket and nsc-tcp-socket return NS3_SOCK_STREAM. udp-socket returns NS3_SOCK_DGRAM.
Sends data as fast as possible up to MaxBytes or unlimited if MaxBytes is zero. Think OnOff, but without the "off" and without the variable data rate. This application only works with NS3_SOCK_STREAM and NS3_SOCK_SEQPACKET sockets, for example TCP sockets and not UDP sockets. A helper class exists to facilitate creating BulkSendApplications. The API for the helper class is similar to existing application helper classes, for example, OnOff.
New class and helper for this battery model.
New class methods and helpers for printing IPv4 routing tables to an output stream.
Derives from Ipv4RoutingProtocol and contains a DsdvHelper class.
More details are in the RELEASE_NOTES.
Wi-Fi MAC high classes have been reorganised in attempt to consolidate shared functionality into a single class. This new class is RegularWifiMac, and it derives from the abstract WifiMac, and is parent of AdhocWifiMac, StaWifiMac, ApWifiMac, and MeshWifiInterfaceMac. The QoS and non-QoS class variants are no longer, with a RegularWifiMac attribute "QosSupported" allowing selection between these two modes of operation. QosWifiMacHelper and NqosWifiMacHelper continue to work as previously, with a behind-the-scenes manipulation of the 'afore-mentioned attribute.
TcpSocketImpl was replaced by a new base class TcpSocketBase and several subclasses implementing different congestion control. From a user-level API perspective, the main change is that a new attribute "SocketType" is available in TcpL4Protocol, to which a TypeIdValue of a specific Tcp variant can be passed. In the same class, the attribute "RttEstimatorFactory" was also renamed "RttEstimatorType" since it now takes a TypeIdValue instead of an ObjectFactoryValue. In most cases, however, no change to existing user programs should be needed.
bug 984 in ns-3 tracker: real devices don't usually understand LLC/SNAP so the default of DIX makes more sense.
As part of the TCP socket refactoring, a new TCP implementation provides slightly different behavior than the previous TcpSocketImpl that provided only fast retransmit. The default behavior now is NewReno which provides fast retransmit and fast recovery with window inflation during recovery.
void QosWifiMacHelper::SetBlockAckThresholdForAc (enum AccessClass accessClass, uint8_t threshold); void QosWifiMacHelper::SetBlockAckInactivityTimeoutForAc (enum AccessClass accessClass, uint16_t timeout);
void Socket::SetRecvPktInfo (bool flag);
- void SetRxCallback (Callback<void,Ptr<Packet>, Ipv4Address, Ipv4Address, uint16_t> callback); + void SetRxCallback (Callback<void,Ptr<Packet>, Ipv4Header, uint16_t, Ptr<Ipv4Interface> > callback); - void ForwardUp (Ptr<Packet> p, Ipv4Address saddr, Ipv4Address daddr, uint16_t sport); + void ForwardUp (Ptr<Packet> p, const Ipv4Header& header, uint16_t sport, + Ptr<Ipv4Interface> incomingInterface);In Ipv4L4Protocol class,
virtual enum RxStatus Receive(Ptr<Packet> p, - Ipv4Address const &source, - Ipv4Address const &destination, + Ipv4Header const &header, Ptr<Ipv4Interface> incomingInterface) = 0;
-Ipv4RawSocketImpl::ForwardUp (Ptr<const Packet> p, Ipv4Header ipHeader, Ptr<NetDevice> device) +Ipv4RawSocketImpl::ForwardUp (Ptr<const Packet> p, Ipv4Header ipHeader, Ptr<Ipv4Interface> incomingInterface) -NscTcpSocketImpl::ForwardUp (Ptr<Packet> packet, Ipv4Address saddr, Ipv4Address daddr, uint16_t port) +NscTcpSocketImpl::ForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port, + Ptr<Ipv4Interface> incomingInterface) -TcpSocketImpl::ForwardUp (Ptr<Packet> packet, Ipv4Address saddr, Ipv4Address daddr, uint16_t port) +TcpSocketImpl::ForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port, + Ptr<Ipv4Interface> incomingInterface) -UdpSocketImpl::ForwardUp (Ptr<Packet> packet, Ipv4Address saddr, Ipv4Address daddr, uint16_t port) +UdpSocketImpl::ForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port, + Ptr<Ipv4Interface> incomingInterface)
ParetoVariable (std::pairparams); ParetoVariable (std::pair params, double b);
CsmaHelper::EnablePcapAll (); std::ofstream ascii; ascii.open ("csma-one-subnet.tr", std::ios_base::binary | std::ios_base::out); CsmaHelper::EnableAsciiAll (ascii); InternetStackHelper::EnableAsciiAll (ascii);After:
CsmaHelper csmaHelper; InternetStackHelper stack; csmaHelper.EnablePcapAll (); AsciiTraceHelper ascii; csma.EnableAsciiAll (ascii.CreateFileStream ("csma-one-subnet.tr")); stack.EnableAsciiIpv4All (stream);
+ uint32_t Buffer::GetSerializedSize (void) const; + uint32_t Buffer::Serialize (uint8_t* buffer, uint32_t maxSize) const; + uint32_t Buffer::Deserialize (uint8_t* buffer, uint32_t size); - void NixVector::Serialize (Buffer::Iterator i, uint32_t size) const; + uint32_t NixVector::Serialize (uint32_t* buffer, uint32_t maxSize) const; - uint32_t NixVector::Deserialize (Buffer::Iterator i); + uint32_t NixVector::Deserialize (uint32_t* buffer, uint32_t size); - void PacketMetadata::Serialize (Buffer::Iterator i, uint32_t size) const; + uint32_t PacketMetadata::Serialize (uint8_t* buffer, uint32_t maxSize) const; - uint32_t PacketMetadata::Deserialize (Buffer::Iterator i); + uint32_t PacketMetadata::Deserialize (uint8_t* buffer, uint32_t size); + uint32_t Packet::GetSerializedSize (void) const; - Buffer Packet::Serialize (void) const; + uint32_t Packet::Serialize (uint8_t* buffer, uint32_t maxSize) const; - void Packet::Deserialize (Buffer buffer); + Packet::Packet (uint8_t const*buffer, uint32_t size, bool magic);
- inline PacketMetadata (uint32_t uid, uint32_t size); + inline PacketMetadata (uint64_t uid, uint32_t size); - uint32_t GetUid (void) const; + uint64_t GetUid (void) const; - PacketMetadata::PacketMetadata (uint32_t uid, uint32_t size); + PacketMetadata::PacketMetadata (uint64_t uid, uint32_t size); - uint32_t Packet::GetUid (void) const; + uint64_t Packet::GetUid (void) const;
virtual void Socket::BindToNetDevice (Ptr<NetDevice> netdevice);
- virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr) = 0; + virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr) = 0;
- virtual Ptr<Ipv6Route> RouteOutput (Ptr<Packet> p, const Ipv6Header &header, uint32_t oif, Socket::SocketErrno &sockerr) = 0; + virtual Ptr<Ipv6Route> RouteOutput (Ptr<Packet> p, const Ipv6Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr) = 0;
void SimpleChannel::Send (Ptr<Packet> p, uint16_t protocol, Mac48Address to, Mac48Address from, Ptr<SimpleNetDevice> 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::ScheduleNow (&SimpleNetDevice::Receive, tmp, p->Copy (), protocol, to, from); } }After:
void SimpleChannel::Send (Ptr<Packet> p, uint16_t protocol, Mac48Address to, Mac48Address from, Ptr<SimpleNetDevice> 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); } }
Ptr<Scheduler> sched = CreateObject<ListScheduler> (); Simulator::SetScheduler (sched);After:
ObjectFactory sched; sched.SetTypeId ("ns3::ListScheduler"); Simulator::SetScheduler (sched);
NodeContainer hubNode; NodeContainer spokeNodes; hubNode.Create (1); Ptr<Node> hub = hubNode.Get (0); spokeNodes.Create (nNodes - 1); PointToPointHelper pointToPoint; pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps")); pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms")); NetDeviceContainer hubDevices, spokeDevices; pointToPoint.InstallStar (hubNode.Get (0), spokeNodes, hubDevices, spokeDevices);After:
PointToPointHelper pointToPoint; pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps")); pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms")); PointToPointStarHelper star (nSpokes, pointToPoint);
"./waf check" now runs the new unit tests of the core part of ns-3.6. In order to run the complete test package, use "./test.py" which is documented in a new manual -- find it in ./doc/testing. "./waf check" no longer generates the introspected Doxygen. Now use "./waf doxygen" to do this and generate the Doxygen documentation in one step.
When performing route lookup, first match for longest prefix, and then based on metrics (default metric = 0). If metrics are equal, most recent addition is picked. Extends API for support of metrics but preserves backward compatibility. One small change is that the default route is no longer stored as index 0 route in the host route table so GetDefaultRoute () must be used.
Add ability to inject and withdraw routes to Ipv4GlobalRouting. This allows a user to insert a route and have it redistributed like an OSPF external LSA to the rest of the topology.
New classes AthstatsWifiTraceSink and AthstatsHelper.
New trace sources exported by WifiRemoteStationManager: MacTxRtsFailed, MacTxDataFailed, MacTxFinalRtsFailed and MacTxFinalDataFailed.
Add an IPv6 protocol and ICMPv6 capability.
Add nix-vector routing protocol
Add TestCase, TestSuite classes
The method InterferenceHelper::CalculateTxDuration (uint32_t size, WifiMode payloadMode, WifiPreamble preamble) has been made static, so that the frame duration depends only on the characteristics of the frame (i.e., the function parameters) and not on the particular standard which is used by the receiving PHY. This makes it now possible to correctly calculate the duration of incoming frames in scenarios in which devices using different PHY configurations coexist in the same channel (e.g., a BSS using short preamble and another BSS using long preamble).
The following member methods have been added to InterferenceHelper:
static WifiMode GetPlcpHeaderMode (WifiMode, WifiPreamble); static uint32_t GetPlcpHeaderDurationMicroSeconds (WifiMode, WifiPreamble); static uint32_t GetPlcpPreambleDurationMicroSeconds (WifiMode, WifiPreamble); static uint32_t GetPayloadDurationMicroSeconds (size, WifiMode);
The following member methods have been removed from InterferenceHelper:
void Configure80211aParameters (void); void Configure80211bParameters (void); void Configure80211_10MhzParameters (void); void Configure80211_5MhzParameters (void);
WifiMode now has a WifiPhyStandard attribute which identifies the standard the WifiMode belongs to. To properly set this attribute when creating a new WifiMode, it is now required to explicitly pass a WifiPhyStandard parameter to all WifiModeFactory::CreateXXXX() methods. The WifiPhyStandard value of an existing WifiMode can be retrieved using the new method WifiMode::GetStandard().
In order to have multiple link change callback in NetDevice (i.e. to flush ARP and IPv6 neighbor discovery caches), the following member method has been renamed:
- virtual void SetLinkChangeCallback (Callback<void> callback); + virtual void AddLinkChangeCallback (Callback<void> callback);Now each NetDevice subclasses have a TracedCallback<> object (list of callbacks) instead of Callback<void> ones.
The newly supported pcap formats can be adopted by calling the following new method of YansWifiPhyHelper:
+ void SetPcapFormat (enum PcapFormat format);where format is one of PCAP_FORMAT_80211_RADIOTAP, PCAP_FORMAT_80211_PRISM or PCAP_FORMAT_80211. By default, PCAP_FORMAT_80211 is used, so the default PCAP format is the same as before.
class Ipv4 now contains attributes in ipv4.cc; the first one is called "IpForward" that will enable/disable Ipv4 forwarding.
class Packet now contains AddPacketTag, RemovePacketTag and PeekPacketTag which can be used to attach a tag to a packet, as opposed to the old AddTag method which attached a tag to a set of bytes. The main semantic difference is in how these tags behave in the presence of fragmentation and reassembly.
The Ipv4Interface API is private to internet-stack module; this method was just a pass-through to GetDevice ()->GetMtu ().
This API has been moved to the helper API and the above functions will be removed in ns-3.6. The new API is:
Ipv4GlobalRoutingHelper::PopulateRoutingTables (); Ipv4GlobalRoutingHelper::RecomputeRoutingTables ();Additionally, these low-level functions in GlobalRouteManager are now public, allowing more API flexibility at the low level ns-3 API:
GlobalRouteManager::DeleteGlobalRoutes (); GlobalRouteManager::BuildGlobalRoutingDatabase (); GlobalRouteManager::InitializeRoutes ();
Four IPv4 CalcChecksum attributes (which enable the computation of checksums that are disabled by default) have been collapsed into one global value in class Node. These four calls:
Config::SetDefault ("ns3::Ipv4L3Protocol::CalcChecksum", BooleanValue (true)); Config::SetDefault ("ns3::Icmpv4L4Protocol::CalcChecksum", BooleanValue (true)); Config::SetDefault ("ns3::TcpL4Protocol::CalcChecksum", BooleanValue (true)); Config::SetDefault ("ns3::UdpL4Protocol::CalcChecksum", BooleanValue (true));are replaced by one call to:
GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
CreateObject is now able to construct objects with a non-default constructor. If you used to pass attribute lists to CreateObject, you must now use CreateObjectWithAttributes.
To accommodate the possibility of configuring the PCAP format used for wifi promiscuous mode traces, several methods of YansWifiPhyHelper had to be made non-static:
- static void EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid); + void EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid); - static void EnablePcap (std::string filename, Ptr<NetDevice> nd); + void EnablePcap (std::string filename, Ptr<NetDevice> nd); - static void EnablePcap (std::string filename, std::string ndName); + void EnablePcap (std::string filename, std::string ndName); - static void EnablePcap (std::string filename, NetDeviceContainer d); + void EnablePcap (std::string filename, NetDeviceContainer d); - static void EnablePcap (std::string filename, NodeContainer n); + void EnablePcap (std::string filename, NodeContainer n); - static void EnablePcapAll (std::string filename); + void EnablePcapAll (std::string filename);
To accommodate support for the radiotap and prism headers in PCAP traces, the interface for promiscuos mode sniff in the wifi device was changed. The new implementation was heavily inspired by the way the madwifi driver handles monitor mode. A distinction between TX and RX events is introduced, to account for the fact that different information is to be put in the radiotap/prism header (e.g., RSSI and noise make sense only for RX packets). The following are the relevant modifications to the WifiPhy class:
- void NotifyPromiscSniff (Ptr<const Packet> packet); + void NotifyPromiscSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint32_t rate, bool isShortPreamble, double signalDbm, double noiseDbm); + void NotifyPromiscSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint32_t rate, bool isShortPreamble); - TracedCallback<Ptr<const Packet> > m_phyPromiscSnifferTrace; + TracedCallback<Ptr<const Packet>, uint16_t, uint32_t, bool, double, double> m_phyPromiscSniffRxTrace; + TracedCallback<Ptr<const Packet>, uint16_t, uint32_t, bool> m_phyPromiscSniffTxTrace;The above mentioned callbacks are expected to be used to call the following method to write Wifi PCAP traces in promiscuous mode:
+ void WriteWifiMonitorPacket(Ptr<const Packet> packet, uint16_t channelFreqMhz, uint32_t rate, bool isShortPreamble, bool isTx, double signalDbm, double noiseDbm);In the above method, the isTx parameter is to be used to differentiate between TX and RX packets. For an example of how to implement these callbacks, see the implementation of PcapSniffTxEvent and PcapSniffRxEvent in src/helper/yans-wifi-helper.cc
All calls of the form "Ipv4::AddHostRouteTo ()" etc. (i.e. to add static routes, both unicast and multicast) have been moved to a new class Ipv4StaticRouting. In addition, class Ipv4 now holds only one possible routing protocol; the previous way to add routing protocols (by ordered list of priority) has been moved to a new class Ipv4ListRouting. Class Ipv4 has a new minimal routing API (just to set and get the routing protocol):
- virtual void AddRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol, int16_t priority) = 0; + virtual void SetRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol) = 0; + virtual Ptr<Ipv4RoutingProtocol> GetRoutingProtocol (void) const = 0;
The abstract base class Ipv4RoutingProtocol has been refactored to align with corresponding Linux Ipv4 routing architecture, and has been moved from ipv4.h to a new file ipv4-routing-protocol.h. The new methods (RouteOutput () and RouteInput ()) are aligned with Linux ip_route_output() and ip_route_input(). However, the general nature of these calls (synchronous routing lookup for locally originated packets, and an asynchronous, callback-based lookup for forwarded packets) is still the same.
- typedef Callback<void, bool, const Ipv4Route&, Ptr<Packet>, const Ipv4Header&> RouteReplyCallback; + typedef Callback<void, Ptr<Ipv4Route>, Ptr<const Packet>, const Ipv4Header &> UnicastForwardCallback; + typedef Callback<void, Ptr<Ipv4MulticastRoute>, Ptr<const Packet>, const Ipv4Header &> MulticastForwardCallback; + typedef Callback<void, Ptr<const Packet>, const Ipv4Header &, uint32_t > LocalDeliverCallback; + typedef Callback<void, Ptr<const Packet>, const Ipv4Header &> ErrorCallback; - virtual bool RequestInterface (Ipv4Address destination, uint32_t& interface) = 0; + virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &errno) = 0; - virtual bool RequestRoute (uint32_t interface, - const Ipv4Header &ipHeader, - Ptr<Packet> packet, - RouteReplyCallback routeReply) = 0; + virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev, + UnicastForwardCallback ucb, MulticastForwardCallback mcb, + LocalDeliverCallback lcb, ErrorCallback ecb) = 0;
The previous class Ipv4Route and Ipv4MulticastRoute are used by Ipv4StaticRouting and Ipv4GlobalRouting to record internal routing table entries, so they were renamed to class Ipv4RoutingTableEntry and Ipv4MulticastRoutingTableEntry, respectively. In their place, new class Ipv4Route and class Ipv4MulticastRoute have been added. These are reference-counted objects that are analogous to Linux struct rtable and struct mfc_cache, respectively, to achieve better compatibility with Linux routing architecture in the future.
There was some general cleanup of functions that involve mappings from Ipv4Address to either NetDevice or Ipv4 interface index.
- virtual uint32_t FindInterfaceForAddr (Ipv4Address addr) const = 0; - virtual uint32_t FindInterfaceForAddr (Ipv4Address addr, Ipv4Mask mask) const = 0; + virtual int32_t GetInterfaceForAddress (Ipv4Address address) const = 0; + virtual int32_t GetInterfaceForPrefix (Ipv4Address address, Ipv4Mask mask) const = 0; - virtual int32_t FindInterfaceForDevice(Ptr<NetDevice> nd) const = 0; + virtual int32_t GetInterfaceForDevice (Ptr<const NetDevice> device) const = 0; - virtual Ipv4Address GetSourceAddress (Ipv4Address destination) const = 0; - virtual bool GetInterfaceForDestination (Ipv4Address dest, - virtual uint32_t GetInterfaceByAddress (Ipv4Address addr, Ipv4Mask mask = Ipv4Mask("255.255.255.255"));
The following methods are not really used in present form since IGMP is not being generated, so they have been removed (planned to be replaced by multicast socket-based calls in the future):
- virtual void JoinMulticastGroup (Ipv4Address origin, Ipv4Address group) = 0; - virtual void LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group) = 0;
All function parameters named "ifIndex" that refer to an Ipv4 interface are instead named "interface".
- static const uint32_t Ipv4RoutingProtocol::IF_INDEX_ANY = 0xffffffff; + static const uint32_t Ipv4RoutingProtocol::INTERFACE_ANY = 0xffffffff; - bool Ipv4RoutingProtocol::RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex); + bool Ipv4RoutingProtocol::RequestInterface (Ipv4Address destination, uint32_t& interface); (N.B. this particular function is planned to be renamed to RouteOutput() in the proposed IPv4 routing refactoring) - uint32_t Ipv4::GetIfIndexByAddress (Ipv4Address addr, Ipv4Mask mask); + int_32t Ipv4::GetInterfaceForAddress (Ipv4Address address, Ipv4Mask mask) const; - bool Ipv4::GetIfIndexForDestination (Ipv4Address dest, uint32_t &ifIndex) const; + bool Ipv4::GetInterfaceForDestination (Ipv4Address dest, uint32_t &interface) const; (N.B. this function is not needed in the proposed Ipv4 routing refactoring)
+ virtual uint32_t AddAddress (uint32_t interface, Ipv4InterfaceAddress address) = 0; + virtual Ipv4InterfaceAddress GetAddress (uint32_t interface, uint32_t addressIndex) const = 0; + virtual uint32_t GetNAddresses (uint32_t interface) const = 0;
ipv4A->SetAddress (ifIndexA, Ipv4Address ("172.16.1.1")); ipv4A->SetNetworkMask (ifIndexA, Ipv4Mask ("255.255.255.255"));you now do:
Ipv4InterfaceAddress ipv4IfAddrA = Ipv4InterfaceAddress (Ipv4Address ("172.16.1.1"), Ipv4Mask ("255.255.255.255")); ipv4A->AddAddress (ifIndexA, ipv4IfAddrA);
Ipv4Address Ipv4InterfaceContainer::GetAddress (uint32_t i) + Ipv4Address Ipv4InterfaceContainer::GetAddress (uint32_t i, uint32_t j)
The type of wifi MAC is now set by two new specific helpers, NqosWifiMacHelper for non QoS MACs and QosWifiMacHelper for Qos MACs. They are passed as argument to WifiHelper::Install methods.
- void WifiHelper::SetMac (std::string type, std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),...) - NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &phyHelper, NodeContainer c) const + NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &phyHelper, const WifiMacHelper &macHelper, NodeContainer c) const - NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &phy, Ptr<Node> node) const + NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &phy, const WifiMacHelper &mac, Ptr<Node> node) const - NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &phy, std::string nodeName) const + NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &phy, const WifiMacHelper &mac, std::string nodeName) constSee src/helper/nqos-wifi-mac-helper.h and src/helper/qos-wifi-mac-helper.h for more details.
This method was considered buggy and unsafe to call. Its replacement is Mac48Address::IsGroup.
Callback<bool,Ptr<NetDevice>,Ptr<Packet>,uint16_t,const Address &> Callback<bool,Ptr<NetDevice>, Ptr<Packet>, uint16_t, const Address &, const Address &, enum PacketType >to:
Callback<bool,Ptr<NetDevice>,Ptr<const Packet>,uint16_t,const Address &> Callback<bool,Ptr<NetDevice>, Ptr<const Packet>, 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.
virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb) = 0;All NetDevices must support this method, and must call this callback when processing packets in the receive direction (the appropriate place to call this is device-dependent). An approach to stub this out temporarily, if you do not care about immediately enabling this functionality, would be to add this to your device:
void ExampleNetDevice::SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb) { NS_ASSERT_MSG (false, "No implementation yet for SetPromiscReceiveCallback"); }To implement this properly, consult the CsmaNetDevice for examples of when the m_promiscRxCallback is called.
class UdpEchoServerHelper { public: - UdpEchoServerHelper (); - void SetPort (uint16_t port); + UdpEchoServerHelper (uint16_t port); + + void SetAttribute (std::string name, const AttributeValue &value); ApplicationContainer Install (NodeContainer c); class UdpEchoClientHelper { public: - UdpEchoClientHelper (); + UdpEchoClientHelper (Ipv4Address ip, uint16_t port); - void SetRemote (Ipv4Address ip, uint16_t port); - void SetAppAttribute (std::string name, const AttributeValue &value); + void SetAttribute (std::string name, const AttributeValue &value); ApplicationContainer Install (NodeContainer c);
- csma.SetChannelParameter ("DataRate", DataRateValue (5000000)); - csma.SetChannelParameter ("Delay", TimeValue (MilliSeconds (2))); + csma.SetChannelAttribute ("DataRate", DataRateValue (5000000)); + csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));