Network Simulation Cradle Integration

From Nsnam
Revision as of 00:05, 8 May 2008 by Fw (Talk | contribs) (fix nsc wakeup call description, add ISendCallback)

Jump to: navigation, search

Network Simulation Cradle Integration

Network Simulation Crade (nsc) is a project to allow real-world network stacks to be used in simulated networks. A porting effort to bring nsc to version 3 of the network simulator was started by Tom Henderson. This Project continues this work and also will update at least the Linux network stack to current git (2.6.26).


The existing porting effort is in a very early stage. At this time, ns3-nsc is only able to complete a TCP handshake. In particular, the ns-3 code is not yet able to detect state transitions in the nsc TCP connections. This means that e.g. the ConnectionSucceeded callback is never scheduled. Another problem is that -- unlike the ns-3 TCP code -- writes are not queued while in SYN_SENT state. Although the ns-3 queueing mechanism could be adapted without much effort, there are two problems:

  • the ns3-part is never informed about events, e.g. completion of connect() or incoming connections
  • the listening socket would need to call nscSock->accept() once it is informed about an incoming connection to get a new socket to read transmitted data from.


NSC provides its API in the form of a number of classes which are defined in sim/sim_interface.h in the nsc directory.

These are:


INetStack contains the 'low level' operations for the operating system network stack, e.g. in and output functions from and to the network stack (think of this as the 'network driver interface'. There are also functions to create new TCP or UDP sockets.


This is called by NSC when a packet should be sent out to the network. This simulator should use this callback to re-inject the packet into the simulator so the actual data can be delivered/routed to its destination, where it will eventually be handed into Receive() (and eventually back to the receivers NSC instance via INetStack->if_receive() ).


This is the structure defining a particular connection endpoint (file descriptor). It contains methods to operate on this endpoint, e.g. connect, disconnect, accept, listen, send_data/read_data, ...


This contains the wakeup callback, which is called by NSC whenever something of interest happens. Think of wakeup() as a replacement of the operating systems wakeup function: Whenever the operating system would wake up a process that has been waiting for an operation to complete (for example the TCP handshake during connect()), NSC invokes the wakeup() callback to allow the simulator to check for state changes in its connection endpoints.


  • Add required support to allow ns-3 to detect state transitions in NSCs connections.
  • allow ns-3 to schedule the connectionSucceeded/connectionFailed callbacks
  • Add required calls to accept() and friends to allow NSC TCP endpoints to transmit data.
  • make the tcp-large-transfer example work with ns-3-nsc
  • Integrate nsc into ns-3 without circumventing ns-3s tcp/ip infrastructure
  • extend ns-3 API so users can create "Linux-Nodes", "FreeBSD-Nodes", etc.

The first step is to get proper trace support to allow easier debugging/testing during development. Depending on whats required/requested this project will also extend nsc to support a more recent linux kernel release, but this will happen only after the main intergration into ns-3 is complete.

Current Status

A forward-port (to a recent version of ns-3-dev) based on Tom Hendersons earlier nsc integration work has been done. This port also uses the latest nsc release (0.3.0). To ease debugging, PcapWriter::WritePacket was changed to unconditionally skip the ns-3 TCP/IP header. This allows to load trace files into e.g. wireshark to see the 'real' packets sent/received by NSC. For reasons outlined above in the Limitations section, only the TCP handshake can be seen at this time.

Full-Time work (starting with trace support) is expected to commence June 1st.