[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
ns-3 was written to support multiple TCP implementations. The
implementations inherit from a few common header classes in the
src/node
directory, so that user code can swap out implementations
with minimal changes to the scripts.
There are two important abstract base classes:
class TcpSocket
: This is defined in src/node/tcp-socket.{cc,h}
. This class exists for hosting TcpSocket attributes that can be
reused across different implementations. For instance,
TcpSocket::SetInitialCwnd()
can be used for any of the implementations
that derive from class TcpSocket
.
class TcpSocketFactory
: This is used by applications to
create TCP sockets. A typical usage can be seen in this snippet:
// Create the socket if not already created if (!m_socket) { m_socket = Socket::CreateSocket (GetNode(), m_tid); m_socket->Bind (m_local); ... }
The parameter m_tid
controls the TypeId of the actual TCP Socket
implementation that is instantiated. This way, the application can be
written generically and different socket implementations can be swapped out
by specifying the TypeId.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated by root on May 3, 2010 using texi2html 1.82.