Class TCPOpenCommand

File: src/inet/transportlayer/contract/tcp/TCPCommand.msg

C++ definition

Control info to be used for active or passive TCP open.

localAddr, remoteAddr, localPort, remotePort should be self-explanatory. localAddr is optional because TCP can learn it from IP when a packet is received from the peer; localPort is optional because TCP supports ephemeral ports.

The fork parameter is used with passive open, and controls what happens when an incoming connection is received. With fork=true, it emulates the Unix accept(2) syscall semantics: a new connection structure is created for the connection (with a new connId, see in TCPCommand), and the connection structure with the old connId remains listening. With fork=false, all the above does not happen: the first connection is accepted (with the original connId), and further incoming connections will be refused by TCP by sending an RST segment.

The dataTransferMode and tcpAlgorithmClass fields allow per-connection TCP configuration. The dataTransferMode field set the The tcpAlgorithmClass field may contain name of class subclassed from TCPAlgorithm, respectively. If not set, module parameters with similar names are used.

See also: TcpCommandCode, ITCP

Usage diagram:

The following diagram shows usage relationships between types. Unresolved types are missing from the diagram.

Inheritance diagram:

The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.

Extends:

Name Type Description
TCPCommand class

Control info for TCP connections. This class is to be set as control info (see cMessage::setControlInfo()) on all messages exchanged between TCP and application, in both directions. Some commands and indications (TCP_C_OPEN_xxx, TCP_I_STATUS) use subclasses.

Fields:

Name Type Description
localAddr L3Address

may be left empty

remoteAddr L3Address

required for active open

localPort int

required for passive open

remotePort int

required for active open

fork bool

used only for passive open

dataTransferMode int

whether to transmit C++ objects, real bytes or just byte counts. See TCPDataTransferMode.

tcpAlgorithmClass string

TCP congestion control algorithm; leave empty for default

connId int

identifies the socket within the application

userId int

id than can be freely used by the app

Source code:

//
// Control info to be used for active or passive TCP open.
//
// localAddr, remoteAddr, localPort, remotePort should be self-explanatory.
// localAddr is optional because TCP can learn it from IP when a packet
// is received from the peer; localPort is optional because TCP supports
// ephemeral ports.
//
// The fork parameter is used with passive open, and controls what happens
// when an incoming connection is received. With fork=true, it emulates
// the Unix accept(2) syscall semantics: a new connection structure
// is created for the connection (with a new connId, see in ~TCPCommand),
// and the connection structure with the old connId remains listening.
// With fork=false, all the above does not happen: the first connection
// is accepted (with the original connId), and further incoming connections
// will be refused by TCP by sending an RST segment.
//
// The dataTransferMode and tcpAlgorithmClass fields
// allow per-connection TCP configuration.
// The dataTransferMode field set the
// The tcpAlgorithmClass field may contain name of class subclassed from
// TCPAlgorithm, respectively.
// If not set, module parameters with similar names are used.
//
// @see ~TcpCommandCode, ~ITCP
//
class TCPOpenCommand extends TCPCommand
{
    L3Address localAddr; // may be left empty
    L3Address remoteAddr;// required for active open
    int localPort = -1;       // required for passive open
    int remotePort = -1;      // required for active open
    bool fork = false;        // used only for passive open
    int dataTransferMode @enum(TCPDataTransferMode); // whether to transmit C++ objects, real bytes or just byte counts. See ~TCPDataTransferMode.
    string tcpAlgorithmClass; // TCP congestion control algorithm; leave empty for default
}