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 tcpAlgorithmClass field allows per-connection TCP configuration. 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

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 tcpAlgorithmClass field allows per-connection TCP configuration.
// 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
    string tcpAlgorithmClass; // TCP congestion control algorithm; leave empty for default
}

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