# ns-3: API and model change history

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.

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.

# Changes from ns-3.14 to ns-3.15

## New API:

- A RandomVariableStreamHelper has been introduced to assist with using the Config subsystem path names to assign fixed stream numbers to RandomVariableStream objects.

## Changes to existing API:

- Derived classes of RandomVariable (i.e. the random variable implementations) have been ported to a new RandomVariableStream base class.
- For a given distribution DistributionVariable (such as UniformVariable), the new class name is DistributionRandomVariable (such as UniformRandomVariable).
- The new implementations are also derived from class ns3::Object and are handled using the ns-3 smart pointer (Ptr) class.
- The new variable classes also have a new attributed called "Stream" which allows them to be assigned to a fix stream index when assigned to the underlying pseudo-random stream of numbers.

## Changes to build system:

## Changed behavior:

- Programs using random variables or models that include random variables may exhibit changed output for a given run number or seed, due to a possible change in the order in which random variables are assigned to underlying pseudo-random sequences. Consult the manual for more information regarding this.

# Changes from ns-3.13 to ns-3.14

## New API:

- The new class AntennaModel provides an API for modeling the radiation pattern of antennas.
- The new buildings module introduces an API (classes, helpers, etc) to model the presence of buildings in a wireless network topology.
- The LENA project's implementation of the LTE Mac Scheduler Interface Specification standardized by the Small Cell Forum (formerly Femto Forum) is now available for use with the LTE module.

## Changes to existing API:

- The Ipv6RawSocketImpl "IcmpFilter" attribute has been removed. Six new member functions have been added to enable the same functionality.
- IPv6 support for TCP and UDP has been implemented. Socket functions that take an address [e.g. Send (), Connect (), Bind ()] can accept an ns3::Ipv6Address or a ns3::Address in addition to taking an ns3::Ipv4Address. (Note that the ns3::Address must contain a ns3::Ipv6Address or a ns3::Ipv4Address, otherwise these functions will return an error). Internally, the socket now stores the remote address as a type "ns3::Address" instead of a type "ns3::Ipv4Address". The IPv6 Routing Header extension is not currently supported in ns3 and will not be reflected in the TCP and UDP checksum calculations per RFC 2460. Also note that UDP checksums for IPv6 packets are required per RFC, but remain optional and disabled by default in ns3 (in the interest of performance).
- When calling Bind () on a socket without an address, the behavior remains the same: it will bind to the IPv4 "any" address (0.0.0.0). In order to Bind () to the IPv6 "any" address in a similar fashion, use "Bind6 ()".
- The prototype for the RxCallback function in the Ipv6EndPoint was changed. It now includes the destination IPv6 address of the end point which was needed for TCP. This lead to a small change in the UDP and ICMPv6 L4 protocols as well.
- Ipv6RoutingHelper can now print the IPv6 Routing Tables at specific intervals or time. Exactly like Ipv4RoutingHelper do.
- New "SendIcmpv6Redirect" attribute (and getter/setter functions) to Ipv6L3Protocol. The behavior is similar to Linux's conf "send_redirects", i.e., enable/disable the ICMPv6 Redirect sending.
- The SpectrumPhy abstract class now has a new method

      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.
- The Ns2CalendarScheduler event scheduler has been removed.
- ErrorUnit enum has been moved into RateErrorModel class, and symbols EU_BIT, EU_BYTE and EU_PKT have been renamed to RateErrorModel::ERROR_UNIT_BIT, RateErrorModel::ERROR_UNIT_BYTE and RateErrorModel::ERROR_UNIT_PACKET. RateErrorModel class attribute "ErrorUnit" values have also been renamed for consistency, and are now "ERROR_UNIT_BIT", "ERROR_UNIT_BYTE", "ERROR_UNIT_PACKET".
- QueueMode enum from DropTailQueue and RedQueue classes has been unified and moved to Queueu class. Symbols DropTailQueue::PACKETS and DropTailQueue::BYTES are now named Queue::QUEUE_MODE_PACKETS and DropTailQueue::QUEUE_MODE_BYTES. In addition, DropTailQueue and RedQueue class attributes "Mode" have been renamed for consistency from "Packets" and "Bytes" to "QUEUE_MODE_PACKETS" and "QUEUE_MODE_BYTES".
- The API of the LTE module has undergone a significant redesign with the merge of the code from the LENA project. The new API is not backwards compatible with the previous version of the LTE module.
- The Ipv6AddressHelper API has been aligned with the Ipv4AddressHelper API. The helper can be set with a call to Ipv6AddressHelper::SetBase (Ipv6Address network, Ipv6Prefix prefix) instead of NewNetwork (Ipv6Address network, Ipv6Prefix prefix). A new NewAddress (void) method has been added. Typical usage will involve calls to SetBase (), NewNetwork (), and NewAddress (), as in class Ipv4AddressHelper.

## Changes to build system:

- The following files are removed:

        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.h

  and replaced with:

        src/internet/model/ip-l4-protocol.cc
        src/internet/model/ip-l4-protocol.h

## Changed behavior:

- Dual-stacked IPv6 sockets are implemented. An IPv6 socket can accept an IPv4 connection, returning the senders address as an IPv4-mapped address (IPV6_V6ONLY socket option is not implemented).
- The following examples/application/helpers were modified to support IPv6:

      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

# Changes from ns-3.12 to ns-3.13

## Changes to build system:

- The underlying version of waf used by ns-3 was upgraded to 1.6.7. This has a few changes for users and developers:
  - by default, "build" no longer has a subdirectory debug or optimized. To get different build directories for different build types, you can use the waf configure -o <argument> option, e.g.:

          ./waf configure -o shared
          ./waf configure --enable-static -o static

  - (for developers) the ns3headers taskgen needs to be created with a features parameter name:

          -  headers = bld.new_task_gen('ns3header')
          +  headers = bld.new_task_gen(features=['ns3header'])

  - no longer need to edit src/wscript to add a module, just create your module directory inside src and ns-3 will pick it up
  - In WAF 1.6, adding -Dxxx options is done via the DEFINES env. var. instead of CXXDEFINES
  - waf env values are always lists now, e.g. env['PYTHON'] returns ['/usr/bin/python'], so you may need to add [0] to the value in some places

## New API:

- In the mobility module, there is a new MobilityModel::GetRelativeSpeed() method returning the relative speed of two objects.
- A new Ipv6AddressGenerator class was added to generate sequential addresses from a provided base prefix and interfaceId. It also will detect duplicate address assigments.

## Changes to existing API:

- In the spectrum module, the parameters to SpectrumChannel::StartTx () and SpectrumPhy::StartRx () methods are now passed using the new struct SpectrumSignalParameters. This new struct supports inheritance, hence it allows technology-specific PHY implementations to provide technology-specific parameters in SpectrumChannel::StartTx() and SpectrumPhy::StartRx(), while at the same time keeping a set of technology-independent parameters common across all spectrum-enabled PHY implementations (i.e., the duration and the power spectral density which are needed for interference calculation). Additionally, the SpectrumType class has been removed, since now the type of a spectrum signal can be inferred by doing a dynamic cast on SpectrumSignalParameters. See the Spectrum API change discussion on ns-developers for the motivation behind this API change.
- The WifiPhyStandard enumerators for specifying half- and quarter-channel width standards has had a change in capitalization:
  - WIFI_PHY_STANDARD_80211_10Mhz was changed to WIFI_PHY_STANDARD_80211_10MHZ
  - WIFI_PHY_STANDARD_80211_5Mhz was changed to WIFI_PHY_STANDARD_80211_5MHZ
- In the SpectrumPhy base class, the methods to get/set the MobilityModel and the NetDevice were previously working with opaque Ptr<Object>. Now all these methods have been changed so that they work with Ptr<NetDevice> and Ptr<MobilityModel> as appropriate. See Bug 1271 on bugzilla for the motivation.

## Changed behavior:

- TCP bug fixes
  - Connection retries count is a separate variable with the retries limit, so cloned sockets can reset the count
  - Fix bug on RTO that may halt the data flow
  - Make TCP endpoints always holds the accurate address:port info
  - RST packet is sent on closed sockets
  - Fix congestion window sizing problem upon partial ACK in TcpNewReno
  - Acknowledgement is sent, rather than staying silent, upon arrival of unacceptable packets
  - Advance TcpSocketBase::m_nextTxSequence after RTO
- TCP enhancements
  - Latest RTT value now stored in variable TcpSocketBase::m_lastRtt
  - The list variable TcpL4Protocol::m_sockets now always holds all the created, running TcpSocketBase objects
  - Maximum announced window size now an attribute, ns3::TcpSocketBase::MaxWindowSize
  - TcpHeader now recognizes ECE and CWR flags (c.f. RFC3168)
  - Added TCP option handling call in TcpSocketBase for future extension
  - Data out of range (i.e. outsize acceptable range of receive window) now computed on bytes, not packets
  - TCP moves from time-wait state to closed state after twice the time specified by attribute ns3:TcpSocketBase::MaxSegLifeTime
  - TcpNewReno supports limited transmit (RFC3042) if asserting boolean attribute ns3::TcpNewReno::LimitedTransmit
  - Nagle's algorithm supported. Default off, turn on by calling TcpSocket::SetTcpNoDelay(true)

# Changes from ns-3.11 to ns-3.12

## Changes to build system:

## New API:

- New method, RegularWifiMac::SetPromisc (void), to set the interface to promiscuous mode.

## Changes to existing API:

- The spelling of the attribute 'IntialCellVoltage' from LiIonEnergySource was corrected to 'InitialCellVoltage'; this will affect existing users who were using the attribute with the misspelling.
- Two trace sources in class WifiPhy have had their names changed:
  - 'PromiscSnifferRx' is now 'MonitorSnifferRx'
  - 'PromiscSnifferTx' is now 'MonitorSnifferTx'

## Changed behavior:

- IPv4 fragmentation is now supported.

# Changes from ns-3.10 to ns-3.11

## Changes to build system:

- Examples and tests are no longer built by default in ns-3

  You can now make examples and tests be built in ns-3 in two ways.

  1. Using build.py when ns-3 is built for the first time:

             ./build.py --enable-examples --enable-tests

  2. Using waf once ns-3 has been built:

             ./waf configure --enable-examples --enable-tests

- Subsets of modules can be enabled using the ns-3 configuration file

  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.

## New API:

- int64x64_t

  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.

## Changes to existing API:

- Wifi TX duration calculation moved from InterferenceHelper to WifiPhy

  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);

- Test cases no longer return a boolean value

  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.

- PhyMac renamed to GenericPhy

  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.

- Scalar

  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);

- Multicast GetOutputTtl() commands

  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.

## Changed behavior:

# Changes from ns-3.9 to ns-3.10

## Changes to build system:

- Regression tests are no longer run using waf

  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.

- Documentation converted to Sphinx

  Project documentation (manual, tutorial, and testing) have been converted to Sphinx from the GNU Texinfo markup format.

## New API:

- Pyviz visualizer

  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.

- WaypointMobility attributes

  Two attributes were added to WaypointMobility model: LazyNotify and InitialPositionIs Waypoint. See RELEASE_NOTES for details.

- 802.11g rates for ERP-OFDM added

  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.

- Socket::GetSocketType ()

  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.

- BulkSendApplication

  Sends data as fast as possible up to MaxBytes or unlimited if MaxBytes is zero. Think OnOff, but without the "off" and without the variable data rate. This application only works with 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.

- Rakhmatov Vrudhula non-linear battery model

  New class and helper for this battery model.

- Print IPv4 routing tables

  New class methods and helpers for printing IPv4 routing tables to an output stream.

- Destination-Sequenced Distance Vector (DSDV) routing protocol

  Derives from Ipv4RoutingProtocol and contains a DsdvHelper class.

- 3GPP Long Term Evolution (LTE) models

  More details are in the RELEASE_NOTES.

## Changes to existing API:

- Consolidation of Wi-Fi MAC high functionality

  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.

- New TCP architecture

  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.

## Changed behavior:

- EmuNetDevice uses DIX instead of LLC encapsulation by default

  bug 984 in ns-3 tracker: real devices don't usually understand LLC/SNAP so the default of DIX makes more sense.

- TCP defaults to NewReno congestion control

  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.

# Changes from ns-3.8 to ns-3.9

## Changes to build system:

## New API:

- Wifi set block ack threshold: Two methods for setting block ack parameters for a specific access class:

      void QosWifiMacHelper::SetBlockAckThresholdForAc (enum AccessClass accessClass, uint8_t threshold);
      void QosWifiMacHelper::SetBlockAckInactivityTimeoutForAc (enum AccessClass accessClass, uint16_t timeout);

- Receive List Error Model: Another basic error model that allows the user to specify a list of received packets that should be errored. The list corresponds not to the packet UID but to the sequence of received packets as observed by the error model. See src/common/error-model.h
- Respond to interface events: New attribute for Ipv4GlobalRouting, "RespondToInterfaceEvents", which when enabled, will cause global routes to be recomputed upon any interface or address notification event from IPv4.
- Generic sequence number: New generic sequence number class to easily handle comparison, subtraction, etc. for sequence numbers. 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.
- Broadcast socket option: New Socket methods `SetAllowBroadcast` and `GetAllowBroadcast` add to NS-3 `Socket`'s the equivalent to the POSIX SO_BROADCAST socket option (setsockopt/getsockopt). Starting from this NS-3 version, IPv4 sockets do not allow us to send packets to broadcast destinations by default; SetAllowBroadcast must be called beforehand if we wish to send broadcast packets.
- Deliver of packet ancillary information to sockets: A method to deliver ancillary information to the socket interface (fixed in bug 671):

      void Socket::SetRecvPktInfo (bool flag);

## Changes to existing API:

- Changes to construction and naming of Wi-Fi transmit rates: A reorganisation of the construction of Wi-Fi transmit rates has been undertaken with the aim of simplifying the task of supporting further IEEE 802.11 PHYs. This work has been completed under the auspices of Bug 871. From the viewpoint of simulation scripts not part of the ns-3 distribution, the key change is that WifiMode names of the form wifix-nmbs are now invalid. Names now take the form CcccRatenMbps[BWbMHz], where n is the root bitrate in megabits-per-second as before (with only significant figures included, and an underscore replacing any decimal point), and Cccc is a representation of the Modulation Class as defined in Table 9-2 of IEEE Std. 802.11-2007. Currently-supported options for Cccc are Ofdm and Dsss. For modulation classes where optional reduced-bandwidth transmission is possible, this is captured in the final part of the form above, with b specifying the nominal signal bandwidth in megahertz.
- Consolidation of classes support Wi-Fi Information Elements: When the mesh module was introduced it added a class hierarchy for modelling of the various Information Elements that were required. In this release, this class hierarchy has extended by moving the base classes (WifiInformationElement and WifiInformationElementVector) into the wifi module. This change is intended to ease the addition of support for modelling of further Wi-Fi functionality.
- Changed for {Ipv4,Ipv6}PacketInfoTag delivery: In order to deliver ancillary information to the socket interface (fixed in bug 671), Ipv4PacketInfoTag and Ipv6PacketInfoTag are implemented. For the delivery of this information, the following changes are made into existing class. In Ipv4EndPoint class,

      -  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)

- The method OutputStreamWrapper::SetStream (std::ostream *ostream) was removed.
)

## Changed behavior:

- Queue trace behavior during Enqueue changed: The behavior of the Enqueue trace source has been changed to be more intuitive and to agree with documentation. Enqueue and Drop events in src/node/queue.cc are now mutually exclusive. In the past, the meaning of an Enqueue event was that the Queue Enqueue operation was being attempted; and this could be followed by a Drop event if the Queue was full. The new behavior is such that a packet is either Enqueue'd successfully or Drop'ped.
- Drop trace logged for Ipv4/6 forwarding failure: Fixed bug 861; this will add ascii traces (drops) in Ipv4 and Ipv6 traces for forwarding failures
- Changed default WiFi error rate model for OFDM modulation types: Adopted more conservative ErrorRateModel for OFDM modulation types (a/g). This will require 4 to 5 more dB of received power to get similar results as before, so users may observe a reduced WiFi range when using the defaults. See tracker issue 944 for more details.

# Changes from ns-3.7 to ns-3.8

## Changes to build system:

## New API:

- Matrix propagation loss model: This radio propagation model uses a two-dimensional matrix of path loss indexed by source and destination nodes.
- WiMAX net device: The developed WiMAX model attempts to provide an accurate MAC and PHY level implementation of the 802.16 specification with the Point-to-Multipoint (PMP) mode and the WirelessMAN-OFDM PHY layer. By adding WimaxNetDevice objects to ns-3 nodes, one can create models of 802.16-based networks. The source code for the WiMAX models lives in the directory src/devices/wimax. The model is mainly composed of three layers:
  - The convergence sublayer (CS)
  - The MAC Common Part Sublayer (MAC-CPS)
  - The Physical layer
  The main way that users who write simulation scripts will typically interact with the Wimax models is through the helper API and through the publicly visible attributes of the model. The helper API is defined in src/helper/wimax-helper.{cc,h}. Three examples containing some code that shows how to setup a 802.16 network are located under examples/wimax/
- MPI Interface for distributed simulation: Enables access to necessary MPI information such as MPI rank and size.
- Point-to-point remote channel: Enables point-to-point connection between net-devices on different simulators, for use with distributed simulation.
- GetSystemId in simulator: For use with distributed simulation, GetSystemId returns zero by non-distributed simulators. For the distributed simulator, it returns the MPI rank.
- Enhancements to src/core/random-variable.cc/h: New Zeta random variable generator. The Zeta random distribution is tightly related to the Zipf distribution (already in ns-3.7). See the documentation, especially because sometimes the Zeta distribution is called Zipf and viceversa. Here we conform to the Wikipedia naming convention, i.e., Zipf is bounded while Zeta isn't.
- Two-ray ground propagation loss model: Calculates the crossover distance under which Friis is used. The antenna height is set to the nodes z coordinate, but can be added to using the model parameter SetHeightAboveZ, which will affect ALL stations
- Pareto random variable has two new constructors to specify scale and shape:

      ParetoVariable (std::pair<double, double> params);
      ParetoVariable (std::pair<double, double> params, double b);

## Changes to existing API:

- Tracing Helpers: The organization of helpers for both pcap and ascii tracing, in devices and protocols, has been reworked. Instead of each device and protocol helper re-implementing trace enable methods, classes have been developed to implement user-level tracing in a consistent way; and device and protocol helpers use those classes to provide tracing functionality.
  In addition to consistent operation across all helpers, the object name service has been integrated into the trace file naming scheme.
  The internet stack helper has been extensively massaged to make it easier to manage traces originating from protocols. It used to be the case that there was essentially no opportunity to filter tracing on interfaces, and resulting trace file names collided with those created by devices. File names are now disambiguated and one can enable traces on a protocol/interface basis analogously to the node/device granularity of device-based helpers.
  The primary user-visible results of this change are that trace-related functions have been changed from static functions to method calls; and a new object has been developed to hold streams for ascii traces.
  New functionality is present for ascii traces. It is now possible to create multiple ascii trace files automatically just as was possible for pcap trace files.
  The implementation of the helper code has been designed also to provide functionality to make it easier for sophisticated users to hook traces of various kinds and write results to (file) streams. Before:

        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);

- Serialization and Deserialization in buffer, nix-vector, packet-metadata, and packet has been modified to use raw character buffers, rather than the Buffer class

      + 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);

- PacketMetadata uid has been changed to a 64-bit value. The lower 32 bits give the uid, while the upper 32-bits give the MPI rank for distributed simulations. For non-distributed simulations, the upper 32 bits are simply zero.

      - 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;

- Moved propagation models from src/devices/wifi to src/common
- Moved Mtu attribute from base class NetDevice This attribute is now found in all NetDevice subclasses.

## Changed behavior:

# Changes from ns-3.6 to ns-3.7

## Changes to build system:

## New API:

- Equal-cost multipath for global routing: Enables quagga's equal cost multipath for Ipv4GlobalRouting, and adds an attribute that can enable it with random packet distribution policy across equal cost routes.
- Binding sockets to devices: A method analogous to a SO_BINDTODEVICE socket option has been introduced to class Socket:

      virtual void Socket::BindToNetDevice (Ptr<NetDevice> netdevice);

- Simulator event contexts: The Simulator API now keeps track of a per-event 'context' (a 32bit integer which, by convention identifies a node by its id). Simulator::GetContext returns the context of the currently-executing event while Simulator::ScheduleWithContext creates an event with a context different from the execution context of the caller. This API is used by the ns-3 logging system to report the execution context of each log line.
- Object::DoStart: Users who need to complete their object setup at the start of a simulation can override this virtual method, perform their adhoc setup, and then, must chain up to their parent.
- Ad hoc On-Demand Distance Vector (AODV) routing model, RFC 3561
- Ipv4::IsDestinationAddress (Ipv4Address address, uint32_t iif) Method added to support checks of whether a destination address should be accepted as one of the host's own addresses. RFC 1122 Strong/Weak end system behavior can be changed with a new attribute (WeakEsModel) in class Ipv4.
- Net-anim interface: Provides an interface to net-anim, a network animator for point-to-point links in ns-3. The interface generates a custom trace file for use with the NetAnim program.
- Topology Helpers: New topology helpers have been introduced including PointToPointStarHelper, PointToPointDumbbellHelper, PointToPointGridHelper, and CsmaStarHelper.
- IPv6 extensions support: Provides API to add IPv6 extensions and options. Two examples (fragmentation and loose routing) are available.

## Changes to existing API:

- Ipv4RoutingProtocol::RouteOutput no longer takes an outgoing interface index but instead takes an outgoing device pointer; this affects all subclasses of Ipv4RoutingProtocol.

      -  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;

- Ipv6RoutingProtocol::RouteOutput no longer takes an outgoing interface index but instead takes an outgoing device pointer; this affects all subclasses of Ipv6RoutingProtocol.

      -  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;

- Application::Start and Application::Stop have been renamed to Application::SetStartTime and Application::SetStopTime.
- Channel::Send: this method does not really exist but each subclass of the Channel base class must implement a similar method which sends a packet from a node to another node. Users must now use Simulator::ScheduleWithContext instead of Simulator::Schedule to schedule the reception event on a remote node.
  For example, before:

      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);
          }
      }

- Simulator::SetScheduler: this method now takes an ObjectFactory instead of an object pointer directly. Existing callers can trivially be updated to use this new method.
  Before:

      Ptr<Scheduler> sched = CreateObject<ListScheduler> ();
      Simulator::SetScheduler (sched);

  After:

      ObjectFactory sched;
      sched.SetTypeId ("ns3::ListScheduler");
      Simulator::SetScheduler (sched);

- Extensions to IPv4 Ping application: verbose output and the ability to configure different ping sizes and time intervals (via new attributes)
- Topology Helpers: Previously, topology helpers such as a point-to-point star existed in the PointToPointHelper class in the form of a method (ex: PointToPointHelper::InstallStar). These topology helpers have been pulled out of the specific helper classes and created as separate classes. Several different topology helper classes now exist including PointToPointStarHelper, PointToPointGridHelper, PointToPointDumbbellHelper, and CsmaStarHelper. For example, a user wishes to create a point-to-point star network:
  Before:

      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);

## Changed behavior:

- Changed default value of YansWifiPhy::EnergyDetectionThreshold from -140.0 dBm to -96.0 dBm. Changed default value of YansWifiPhy::CcaModelThreshold from -140.0 dBm to -99.0 dBm. Rationale can be found here.
- Default TTL of IPv4 broadcast datagrams changed from 1 to 64.
- Changed DcfManager::UpdateBackoff (): using flooring instead of rounding in calculation of remaining slots. See bug 695.

# Changes from ns-3.5 to ns-3.6

## Changes to build system:

- A new test framework is provided with ns-3.6 that primarilay runs outside waf

  "./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.

## New API:

- Longest prefix match, support for metrics, for Ipv4StaticRouting and Ipv6StaticRouting

  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.

- Route injection for global routing

  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.

- Athstats

  New classes AthstatsWifiTraceSink and AthstatsHelper.

- WifiRemoteStationManager

  New trace sources exported by WifiRemoteStationManager: MacTxRtsFailed, MacTxDataFailed, MacTxFinalRtsFailed and MacTxFinalDataFailed.

- IPv6 additions

  Add an IPv6 protocol and ICMPv6 capability.

  - new classes Ipv6, Ipv6Interface, Ipv6L3Protocol, Ipv6L4Protocol
  - Ipv6RawSocket (no UDP or TCP capability yet)
  - a set of classes to implement Icmpv6, including neighbor discovery, router solicitation, DAD
  - new applications Ping6 and Radvd
  - routing objects Ipv6Route and Ipv6MulticastRoute
  - routing protocols Ipv6ListRouting and Ipv6StaticRouting
  - examples: icmpv6-redirect.cc, ping6.cc, radvd.cc, radvd-two-prefix.cc, simple-routing-ping6.cc
- Wireless Mesh Networking models

  - General multi-interface mesh stack infrastructure (devices/mesh module).
  - IEEE 802.11s (Draft 3.0) model including Peering Management Protocol and HWMP.
  - Forwarding Layer for Meshing (FLAME) protocol.
- 802.11 enhancements

  - 10MHz and 5MHz channel width supported by 802.11a model (Ramon Bauza and Kirill Andreev).
  - Channel switching support. YansWifiPhy can now switch among different channels (Ramon Bauza and Pavel Boyko).
- Nix-vector Routing

  Add nix-vector routing protocol

  - new helper class Ipv4NixVectorHelper
  - examples: nix-simple.cc, nms-p2p-nix.cc
- New Test Framework

  Add TestCase, TestSuite classes

  - examples: src/core/names-test-suite.cc, src/core/random-number-test-suite.cc, src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc

## Changes to existing API:

- InterferenceHelper

  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

  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().

- NetDevice

  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.

# Changes from ns-3.4 to ns-3.5

## Changes to build system:

## New API:

- YansWifiPhyHelper supporting radiotap and prism PCAP output

  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.
- attributes for class Ipv4

  class Ipv4 now contains attributes in ipv4.cc; the first one is called "IpForward" that will enable/disable Ipv4 forwarding.

- packet tags

  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.

## Changes to existing API:

- Ipv4Interface::GetMtu () deleted

  The Ipv4Interface API is private to internet-stack module; this method was just a pass-through to GetDevice ()->GetMtu ().

- GlobalRouteManager::PopulateRoutingTables () and RecomputeRoutingTables () are deprecated

  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 ();

- CalcChecksum attribute changes

  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 changes

  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.

- packet byte tags renaming
  - Packet::AddTag to Packet::AddByteTag
  - Packet::FindFirstMatchingTag to Packet::FindFirstMatchingByteTag
  - Packet::RemoveAllTags to Packet::RemoveAllByteTags
  - Packet::PrintTags to Packet::PrintByteTags
  - Packet::GetTagIterator to Packet::GetByteTagIterator
- YansWifiPhyHelper::EnablePcap* methods not static any more

  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);

- Wifi Promisc Sniff interface modified

  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
- Routing decoupled from class Ipv4

  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;

- class Ipv4RoutingProtocol is refactored

  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;

- previous class Ipv4Route, Ipv4MulticastRoute renamed; new classes with those same names added

  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.

- class Ipv4 address-to-interface mapping functions changed

  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"));

- class Ipv4 multicast join API deleted

  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;

- Deconflict NetDevice::ifIndex and Ipv4::ifIndex (bug 85).

  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)

- Allow multiple IPv4 addresses to be assigned to an interface (bug 188)
  - Add class Ipv4InterfaceAddress: This is a new class to resemble Linux's struct in_ifaddr. It holds IP addressing information, including mask, broadcast address, scope, whether primary or secondary, etc.

        +  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;

  - Regarding legacy API usage, typically where you once did the following, using the public Ipv4 class interface (e.g.):

          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);

  - At the helper API level, one often gets an address from an interface container. We preserve the legacy GetAddress (uint32_t i) but it is documented that this will return only the first (address index 0) address on the interface, if there are multiple such addresses. We provide also an overloaded variant for the multi-address case:

        Ipv4Address Ipv4InterfaceContainer::GetAddress (uint32_t i)
        + Ipv4Address Ipv4InterfaceContainer::GetAddress (uint32_t i, uint32_t j)

- New WifiMacHelper objects

  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) const

See src/helper/nqos-wifi-mac-helper.h and src/helper/qos-wifi-mac-helper.h for more details.
- Remove Mac48Address::IsMulticast

  This method was considered buggy and unsafe to call. Its replacement is Mac48Address::IsGroup.

## Changed behavior:

# Changes from ns-3.3 to ns-3.4

## Changes to build system:

- A major option regarding the downloading and building of ns-3 has been added for ns-3.4 -- the ns-3-allinone feature. This allows a user to get the most common options for ns-3 downloaded and built with a minimum amount of trouble. See the ns-3 tutorial for a detailed explanation of how to use this new feature.
- The build system now runs build items in parallel by default. This includes the regression tests.

## New API:

- XML support has been added to the ConfigStore in src/contrib/config-store.cc
- The ns-2 calendar queue scheduler option has been ported to src/simulator
- A ThreeLogDistancePropagationLossModel has been added to src/devices/wifi
- ConstantAccelerationMobilityModel in src/mobility/constant-acceleration-mobility-model.h
- A new emulation mode is supported with the TapBridge net device (see src/devices/tap-bridge)
- A new facility for naming ns-3 Objects is included (see src/core/names.{cc,h})
- Wifi multicast support has been added in src/devices/wifi

## Changes to existing API:

- Some fairly significant changes have been made to the API of the random variable code. Please see the ns-3 manual and src/core/random-variable.cc for details.
- The trace sources in the various NetDevice classes has been completely reworked to allow for a consistent set of trace sources across the devices. The names of the trace sources have been changed to provide some context with respect to the level at which the trace occurred. A new set of trace sources has been added which emulates the behavior of packet sniffers. These sources have been used to implement tcpdump- like functionality and are plumbed up into the helper classes. The user-visible changes are the trace source name changes and the ability to do promiscuous-mode pcap tracing via helpers. For further information regarding these changes, please see the ns-3 manual
- StaticMobilityModel has been renamed ConstantPositionMobilityModel StaticSpeedMobilityModel has been renamed ConstantVelocityMobilityModel
- The Callback templates have been extended to support more parameters. See src/core/callback.h
- Many helper API have been changed to allow passing Object-based parameters as string names to ease working with the object name service.
- The Config APIs now accept path segments that are names defined by the object name service.
- Minor changes were made to make the system build under the Intel C++ compiler.
- Trace hooks for association and deassociation to/from an access point were added to src/devices/wifi/nqsta-wifi-mac.cc

## Changed behavior:

- The tracing system rework has introduced some significant changes in the behavior of some trace sources, specifically in the positioning of trace sources in the device code. For example, there were cases where the packet transmit trace source was hit before the packet was enqueued on the device transmit quueue. This now happens just before the packet is transmitted over the channel medium. The scope of the changes is too large to be included here. If you have concerns regarding trace semantics, please consult the net device documentation for details. As is usual, the ultimate source for documentation is the net device source code.

# Changes from ns-3.2 to ns-3.3

## New API:

- ns-3 ABORT macros in src/core/abort.h Config::MatchContainer ConstCast and DynamicCast helper functions for Ptr casting StarTopology added to several topology helpers NetDevice::IsBridge ()
- 17-11-2008; changeset 4c1c3f6bcd03

- The PppHeader previously defined in the point-to-point-net-device code has been made public.

- 17-11-2008; changeset 16c2970a0344

- An emulated net device has been added as enabling technology for ns-3 emulation scenarios. See src/devices/emu and examples/emu-udp-echo.cc for details.

- 17-11-2008; changeset 4222173d1e6d

- Added method InternetStackHelper::EnableAsciiChange to allow allow a user to hook ascii trace to the drop trace events in Ipv4L3Protocol and ArpL3Protocol.

## Changes to existing API:

- NetDevice::MakeMulticastAddress() was renamed to NetDevice::GetMulticast() and the original GetMulticast() removed
- Socket API changes:
  - return type of SetDataSentCallback () changed from bool to void
  - Socket::Listen() no longer takes a queueLimit argument
- As part of the Wifi Phy rework, there have been several API changes at the low level and helper API level.

- At the helper API level, the WifiHelper was split to three classes: a WifiHelper, a YansWifiChannel helper, and a YansWifiPhy helper. Some functions like Ascii and Pcap tracing functions were moved from class WifiHelper to class YansWifiPhyHelper.
- At the low-level API, there have been a number of changes to make the Phy more modular:

- composite-propagation-loss-model.h is removed
- DcfManager::NotifyCcaBusyStartNow() has changed name
- fragmentation related functions (e.g. DcaTxop::GetNFragments()) have changed API to account for some implementation changes
- Interference helper and error rate model added
- JakesPropagationLossModel::GetLoss() moved to PropagationLoss() class
- base class WifiChannel made abstract
- WifiNetDevice::SetChannel() removed
- a WifiPhyState helper class added
- addition of the YansWifiChannel and YansWifiPhy classes

- 17-11-2008; changeset dacfd1f07538

- Change attribute "RxErrorModel" to "ReceiveErrorModel" in CsmaNetDevice for consistency between devices.

## changed behavior:

- 17-11-2008; changeset ed0dfce40459

- Relax reasonableness testing in Ipv4AddressHelper::SetBase to allow the assignment of /32 addresses.

- 17-11-2008; changeset 756887a9bbea

- Global routing supports bridge devices.

# Changes from ns-3.1 to ns-3.2

## New API:

- 26-08-2008; changeset 5aa65b1ea001

- Add multithreaded and real-time simulator implementation. Allows for emulated net devices running in threads other than the main simulation thread to schedule events. Allows for pacing the simulation clock at 1x real-time.

- 26-08-2008; changeset c69779f5e51e

- Add threading and synchronization primitives. Enabling technology for multithreaded simulator implementation.

## New API in existing classes:

- 01-08-2008; changeset a18520551cdf

- class ArpCache has two new attributes: MaxRetries and a Drop trace. It also has some new public methods but these are mostly for internal use.

## Changes to existing API:

- 05-09-2008; changeset aa1fb0f43571

- Change naming of MTU and packet size attributes in CSMA and Point-to-Point devices
  After much discussion it was decided that the preferred way to think about the different senses of transmission units and encapsulations was to call the MAC MTU simply MTU and to use the overall packet size as the PHY-level attribute of interest. See the Doxygen of CsmaNetDevice::SetFrameSize and PointToPointNetDevice::SetFrameSize for a detailed description.

- 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<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.

- 04-08-2008; changeset cba7b2b80fe8

- 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 at the MAC level and one at the PHY level. We split out the MTU setting to make this more clear and set the default PHY level MTU to 1500 to be more like Ethernet. The encapsulation mode defaults to LLC/SNAP which then puts the 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

- class NetDevice has added a pure virtual method that must be implemented by all subclasses:

      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.

- 03-07-2008; changeset d5f8e5fae1c6

- Miscellaneous cleanup of Udp Helper API, to fix bug 234

      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);

- 03-07-2008; changeset 3cdd9d60f7c7

- Rename all instances method names using "Set..Parameter" to "Set..Attribute" (bug 232)
- How to fix your code: Any use of helper API that was using a method "Set...Parameter()" should be changed to read "Set...Attribute()". e.g.

      - csma.SetChannelParameter ("DataRate", DataRateValue (5000000));
      - csma.SetChannelParameter ("Delay", TimeValue (MilliSeconds (2)));
      + csma.SetChannelAttribute ("DataRate", DataRateValue (5000000));
      + csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));

## Changed behavior:

- 07-09-2008; changeset 5d836ab1523b

- Implement a finite receive buffer for TCP
  The native TCP model in TcpSocketImpl did not support a finite receive buffer. This changeset adds the following functionality in this regard:
  - Being able to set the receiver buffer size through the attributes system.
  - This receiver buffer size is now correctly exported in the TCP header as the advertised window. Prior to this changeset, the TCP header advertised window was set to the maximum size of 2^16 bytes. window
  - The aforementioned window size is correctly used for flow control, i.e. the sending TCP will not send more data than available space in the receiver's buffer.
  - In the case of a receiver window collapse, when a advertised zero-window packet is received, the sender enters the persist probing state in which it sends probe packets with one payload byte at exponentially backed-off intervals up to 60s. The receiver will continue to send advertised zero-window ACKs of the old data so long as the receiver buffer remains full. When the receiver window clears up due to an application read, the TCP will finally ACK the probe byte, and update its advertised window appropriately.
  See bug 239 for more.

- 07-09-2008; changeset 7afa66c2b291

- Add correct FIN exchange behavior during TCP closedown
  The behavior of the native TcpSocketImpl TCP model was such that the final FIN exchange was not correct, i.e. calling Socket::Close didn't send a FIN packet, and even if it had, the ACK never came back, and even if it had, the ACK would have incorrect sequence number. All these various problems have been addressed by this changeset. See bug 242 for more.

- 28-07-2008; changeset 6f68f1044df1
  - OLSR: HELLO messages hold time changed to 3*hello interval from hello interval. This is an important bug fix as hold time == refresh time was never intentional, as it leads to instability in neighbor detection.