Hongbo Liu and Andy T. Ogielski
July 31, 1999

SSF TCP Implementation Notes


This brief overview is intended to explain the design of SSF TCP at a high level. Details are available in the code documentation (javadoc for the Java version of SSF.OS.TCP).

SSF TCP is a new implementation, conforming to the general configurable protocol graph architecture provided by the package SSF.OS. The design of SSF.OS has been inspired by the x-kernel, but it is leaner and sufficiently different so that even those familiar with the x-kernel should consult the SSF.OS API documentation. For efficiency, SSF.OS implements zero-copy message processing by chaining of message processing methods along a path in the protocol graph.

The two main TCP classes extend ProtocolSession:


SSF.OS.TCP classes:

        TCP_Header
        TCP_Message
        tcpSessionMaster
        tcpSession
        SendQueue
        SendItem
        Send_WndManager
        Rcv_WndManager

Related classes:

        simClient
        simServer
        socketSession
        socketMsg
        RandomGen

TCP_Header and TCP_Message

The minimal TCP header has the following fields:

Source Port Number Destination Port Number
Sequence Number
Acknowledgment Number
Advertised Window Size Control Flags(ACK, SYN, FIN)

Class TCP_Message extends TCP_Header, with segment length (in bytes) simulating the payload.


tcpSessionMaster and tcpSession

Class tcpSessionMaster provides interfaces for the upper and lower level protocol to access the TCP service. It receives the messages sent to TCP layer and demultiplexes them to the appropriate tcpSession, which manages one end of a TCP connection.

tcpSessionMaster maintains the default values of all TCP parameters; some of them can be set by a model configuration DML file, either individually for each Host, for a group of Hosts, or uniformly for all hosts.

tcpSessionMaster manages a listening server list (passively opened) and an active connection list. When TCP service is requested by a local application, it uses socketSession to send a socket message with the destination address and port number to tcpSessionMaster.

If the message is to open a connection (active open), tcpSessionMaster creates a new tcpSession for that connection. The new tcpSession initiates a 3-way handshake. The tcpSessionMaster at the destination address will check the existence of the listening server at the destination port number and decide whether to accept the connection or not.

If the socket message is to write or read data, then it's passed to the corresponding tcpSession. The tcpSession will process this message accordingly.

The tcpSession accepts the incoming messages from the IP session. According to control flags (SYN, ACK, FIN or their combinations) of the message and the current state of connection, tcpSession passes the message to the Send_WndManager or Rcv_WndManager.

SSF TCP implements all stantard TCP states and transitions, including active open, passive open and half-close phase of a connection.

tcpSessionMaster mantains TCP fast clock (aka delayed ACK timer) and slow clock (aka 500 ms timer). The slow clock fires every 500 ms, and tcpSessionMaster calls the slowTimeout() method of each active tcpSession in the connection list to update all timers.


SendItem and SendQueue

SendQueue buffers all unsent data and sent-but-unacknowledged data. In the SendQueue each SendItem keeps a reference to a TCP_Message.


Send_WndManager

Send_WndManager object manages data sending and received ACK processing. The Send_WndManager:


Rcv_WndManager

Rcv_WndManager object manages data reception and ACK generation.


simClient and simServer

The simClient models a simple client application which actively opens a TCP connection, and sends a data request (number of bytes to transmit) to a server. The simServer models a simple server listening on a specified port. When a connection is established, and a data request received, simServer transmits requested number of data bytes to the client. Both simClient and simServer can maintain multiple concurrent connections.

simClient and simServer communicate with TCP via a BSD-style socketSession. A socketSession simulates the functions of a socket. It provides an interface for modeling the client/server applications using the TCP and UDP protocols.


socketSession and socketMsg

A socketMsg class implements messages exchanged between a socketSession and a tcpSession. socketSession methods resemble the BSD socket interface, and allow an application-level ProtocolSession to:

open a connection

close a connection

read from a socket a specified number of bytes of pseudo-data and/or a data Object reference

write to a socket a specified number of bytes of pseudo-data and/or a data Object reference.

Since pseudo-data can't represent any actual information exchange, a socketMsg may contain a data Object which after processing by a target tcpSession can be delivered by a TCP_Message to the remote application. On shared-memory machines, for simulation efficiency the data is not serialized for transmission, only an Object reference is sent. In this way user-defined, application-level ProtocolSessions can model transmission of "real data" without incurring the cost of actually sending data in simulated IP packets.

Note: the socketSession interface will be revised in a future release to mimic the BSD-style socket semantics more closely.


RandomGen

A random number generator class, with methods generating pseudo-random numbers from the following distributions:

Note: The future releases of SSF will include a high performance package SSF.Random for generation of high quality independent random number streams, and this class will be obsoleted.


Last updated July 31, 1999.

  Back to SSF.OS.TCP page