TcpOpenCommand¶
Namespace: inet
class TcpOpenCommand
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
Usage diagram¶
Inheritance diagram¶
Extends¶
Name |
Type |
Description |
|---|---|---|
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 |
|---|---|---|
userId |
int |
id than can be freely used by the app |
localAddr |
may be left empty |
|
remoteAddr |
required for active open |
|
localPort |
int |
required for passive open |
remotePort |
int |
required for active open |
fork |
bool |
used only for passive open |
autoRead |
bool |
true: TCPs sends up arrived data automatically. false: should use read command |
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
bool autoRead = true; // true: TCPs sends up arrived data automatically. false: should use read command
string tcpAlgorithmClass; // TCP congestion control algorithm; leave empty for default
}