Namespace inet::tcp
TcpHeader
classRepresents a TCP segment, to be used with the Tcp module.
TCP header fields not explicitly modelled: work on going
- Data Offset (number of 32 bit words in the header): represented by cMessage::length().
- Reserved (reserved for future use)
- Checksum (header checksum): modelled by cMessage::hasBitError()
- Header Options: Currently only EOL, NOP, MSS, WS, SACK_PERMITTED, SACK and TS are implemented
- Padding
cMessage::getKind() may be set to an arbitrary value: TCP entities will ignore it and use only the header fields (synBit, ackBit, rstBit).
Extends
Name | Type | Description |
---|---|---|
TransportHeaderBase | (unknown -- not in documented files) |
Fields
Name | Type | Description |
---|---|---|
chunkLength | ||
srcPort | uint16_t |
Source Port |
destPort | uint16_t |
Destination Port |
sequenceNo | uint32_t |
Sequence Number: first sequence number of the first data octet in the respective segment (except if SYN is set; then the the seq. number is the initial seq. number (ISS) and the first data octet is ISS + 1) |
ackNo | uint32_t |
Acknowledgement Number: if ACK flag is set, this field contains the next sequence number the sender of this segment is expecting to receive |
headerLength | B |
TCP Header Length including options |
cwrBit | bool |
CWR: congestion window reduced bit (RFC 3168) |
eceBit | bool |
ECE: ECN-echo bit (RFC 3168) |
urgBit | bool |
URG: urgent pointer field significant if set |
ackBit | bool |
ACK: ackNo significant if set |
pshBit | bool |
PSH: push function |
rstBit | bool |
RST: reset the connection |
synBit | bool |
SYN: synchronize seq. numbers |
finBit | bool |
FIN: finish - no more data from sender |
window | uint16_t |
Window Size: the number of data octets beginning with the one indicated in the acknowledgement field which the sender of this segment is willing to accept |
urgentPointer | uint16_t |
Urgent Pointer: communicates the current value of the urgent pointer as a positive offset from the sequence number in this segment. The urgent pointer points to the sequence number of the octet following the urgent data. This field is only be interpreted in segments with the URG control bit set. |
crc | uint16_t | |
crcMode | CrcMode | |
headerOption | TcpOption[] |
Header options (optional) Currently only EOL, NOP, MSS, WS, SACK_PERMITTED, SACK and TS are implemented |
Packet operations (observed)
action | module |
---|---|
insertAtFront | Tcp, TcpConnection, TcpCrcInsertionHook, TcpLwip |
peekAtFront | Tcp, TcpLwip |
popAtFront | PcapRecorder |
removeAtFront | TcpCrcInsertionHook, TcpLwip |
Source code
// // Represents a TCP segment, to be used with the ~Tcp module. // // TCP header fields not explicitly modelled: work on going // - Data Offset (number of 32 bit words in the header): represented // by cMessage::length(). // - Reserved (reserved for future use) // - Checksum (header checksum): modelled by cMessage::hasBitError() // - Header Options: Currently only EOL, NOP, MSS, WS, SACK_PERMITTED, SACK and TS are implemented // - Padding // // cMessage::getKind() may be set to an arbitrary value: TCP entities will // ignore it and use only the header fields (synBit, ackBit, rstBit). // class TcpHeader extends TransportHeaderBase { chunkLength = TCP_MIN_HEADER_LENGTH; // Source Port uint16_t srcPort; // Destination Port uint16_t destPort; // Sequence Number: first sequence number of the first data octet // in the respective segment (except if SYN is set; then the the // seq. number is the initial seq. number (ISS) and the first data // octet is ISS + 1) uint32_t sequenceNo; // Acknowledgement Number: if ACK flag is set, this field contains // the next sequence number the sender of this segment is expecting // to receive uint32_t ackNo; // TCP Header Length including options B headerLength = TCP_MIN_HEADER_LENGTH; bool cwrBit; // CWR: congestion window reduced bit (RFC 3168) bool eceBit; // ECE: ECN-echo bit (RFC 3168) bool urgBit; // URG: urgent pointer field significant if set bool ackBit; // ACK: ackNo significant if set bool pshBit; // PSH: push function bool rstBit; // RST: reset the connection bool synBit; // SYN: synchronize seq. numbers bool finBit; // FIN: finish - no more data from sender // Window Size: the number of data octets beginning with the one indicated // in the acknowledgement field which the sender of this segment is // willing to accept uint16_t window; // Urgent Pointer: communicates the current value of the urgent pointer // as a positive offset from the sequence number in this segment. The // urgent pointer points to the sequence number of the octet following // the urgent data. This field is only be interpreted in segments with // the URG control bit set. uint16_t urgentPointer; uint16_t crc = 0; CrcMode crcMode = CRC_MODE_UNDEFINED; // Header options (optional) // Currently only EOL, NOP, MSS, WS, SACK_PERMITTED, SACK and TS are implemented TcpOption *headerOption[] @owned; }File: src/inet/transportlayer/tcp_common/TcpHeader.msg