Network Simulation Cradle Integration

From Nsnam
Revision as of 20:56, 24 May 2008 by Fw (Talk | contribs) (update project status.)

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

Limitations

The existing porting effort is still in an early stage. ns3-nsc is able to run the tcp-large-transfer example that is included in ns-3. However, at this time the socket that accepts the connection leaks the listen socket and nsc-tcp is piggybacked within a ns-3 tcp connection (increasing all packets by 40 bytes).

NSC API

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

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.

ISendCallback

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

INetStreamSocket

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

IInterruptCallback

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.


Plan

  • Integrate nsc into ns-3 without circumventing ns-3s tcp/ip infrastructure
  • allow nsc to use layer2 code directly without having to piggyback data inside ns3-tcp
  • extend ns-3 API so users can create "Linux-Nodes", "FreeBSD-Nodes", etc.
  • allow different nodes to use all kinds of nsc stacks in the same simulation.

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

The ns-3-nsc integration repository contains the current status. This port 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. Work on this is ongoing, the current focus is to move all ns-3 glue code off to its own files within src/internet-node (mostly completed):

  • src/internet-node/nsc-tcp-socket-impl.cc contains ns-3s tcp-socket code, with nsc modifications.
  • src/internet-node/nsc-tcp-l4-protocol.cc contains the ns3 tcp-l4 code, with nsc modifications.

At this time, both are essentially copies of their ns-3 counterpart; this makes it easier to see the actual nsc modifications in diff output; the redundant (and unused) parts will be removed later. AddInternetStack() has been changed to create a NscTcpL4Protocol() object unconditionally, this is currently the only major modification to ns-3 code (in fact, removing this modification disables nsc support).