Difference between revisions of "Network Simulation Cradle Integration"

From Nsnam
Jump to: navigation, search
 
Line 5: Line 5:
 
was started by Tom Henderson. This Project continues this work
 
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).
 
and also will update at least the Linux network stack to current git (2.6.26).
 +
 +
== Limitations ==
 +
 +
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 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.
 +
 +
=== 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
 +
schedule() function: Whenever the operating system would suspend
 +
the calling process to wait for an operation to complete -- for example, a
 +
call to connect() -- NSC calls the wakeup() function to allow the simulator
 +
to check for state changes in one of its connection endpoints.
 +
  
 
== Plan ==
 
== Plan ==
  
* Allow ns-3-nsc to write proper trace files
+
* Add required support to allow ns-3 to detect state transitions in NSCs connections.
 +
* Add required calls to accept() and friends to allow NSC TCP endpoints to ''transmit'' data.
 
* Integrate nsc into ns-3 without circumventing ns-3s tcp/ip infrastructure
 
* 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.
 
* extend ns-3 API so users can create "Linux-Nodes", "FreeBSD-Nodes", etc.
Line 19: Line 65:
 
A [http://hg.strlen.de/cgi-bin/hgwebdir.cgi/ns-3-nsc/ forward-port] (to a recent version of ns-3-dev) based on Tom Hendersons earlier nsc integration work has been done.
 
A [http://hg.strlen.de/cgi-bin/hgwebdir.cgi/ns-3-nsc/ 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).
 
This port also uses the latest nsc release (0.3.0).
The main problems with the current version are:
+
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
* Hooks into ns-3 ip/tcp stack to redirect calls to nsc
+
the 'real' packets sent/received by NSC.
* cannot write proper trace files (ns-3 adds a second TCP header on top)
+
For reasons outlined above in the [[Network_Simulation_Cradle_Integration#Limitations|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.
 
Full-Time work (starting with trace support) is expected to commence June 1st.

Revision as of 10:32, 7 May 2008

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

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 schedule() function: Whenever the operating system would suspend the calling process to wait for an operation to complete -- for example, a call to connect() -- NSC calls the wakeup() function to allow the simulator to check for state changes in one of its connection endpoints.


Plan

  • Add required support to allow ns-3 to detect state transitions in NSCs connections.
  • Add required calls to accept() and friends to allow NSC TCP endpoints to transmit data.
  • 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.