TCPOpenCommand

Namespace inet

TCPOpenCommand

class

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

Extends

Name Type Description
TCPCommand (unknown -- not in documented files)

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

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
}


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