TCP Segment Header
Like IP, the TCP segment header typically consists of five 32-bit words, with the potential for optional words containing additional options and the relevant padding to make 32 bits of data. Figure 3-9 depicts the TCP segment header.
Figure 3-9. TCP Segment Header Structure
[View full size image]
SOURCE PORT
DESTINATION PÛR1
SEQUENCE NUMBER
ACKNOWLEDGED ENl NUMBfjR
DATA OFFSET
RESERVED
|
u |
A |
P |
R |
S |
|
R |
c |
S |
S |
V |
|
G |
K |
H |
T |
WiNDOW URGENT POINTER PAQpING (Of11ICNAL) The fields of the TCP segment header and their meanings are as follows: • Source Port (16 bits) This field represents the source protocol or application. This allows the source to know which application the data belongs to so that responses can be delivered to the appropriate source application. In most cases, the source port is a random high-level port number (>1024) generated by the application. • Destination Port (16 bits) This field represents the destination protocol or application on the target host. This allows the destination to properly route the data to the appropriate higher-layer application or protocol. In most cases, the destination port is a defined (and in some cases well known) port number that is associated with the protocol or application in question. • Sequence Number (32 bits) This field contains the information necessary for the hosts to know what data has been transmitted. If the SYN control bit is enabled, this value is the initial sequence number (ISN) and the first data octet is the ISN + 1. • Acknowledgement Number (32 bits) This field contains the value of the next sequence number the sender is expecting to receive. This field relies on the ACK control bit to be set and is always sent after a session has been established • Data Offset (4 bits) This field indicates where the actual data begins by specifying how many 32-bit words exist in the TCP header. It is also referred to as the Header Length (HLEN) field. • Reserved (4 bits) This field is reserved for future use and must have a value of 0. • Explicit Congestion Notification (ECN, 2 bits) This field is used, like in IP, for ECN information. The first bit is used to set the Congestion Window Reduced (CWR) flag; the second bit sets the ECN-echo (ECE) flag. • Control bits (6 bits from left to right) The control bits tell the hosts what they should be doing with the session. There are 6 bits that can be either on (1) or off (0) and from left to right they are as follows: - URG This indicates that the Urgent Pointer field is significant. - ACK This indicates that the Acknowledgment field is significant. - PSH This indicates that the push function is requested. - RST This indicates that the connection should be reset. - SYN This indicates that the sequence numbers should be synchronized. - FIN This indicates that there is no more data from the sender and the session can be terminated. • Window (16 bits) This field represents the number of data octets that will be transmitted before an ACK is expected. • Checksum (16 bits) This field verifies that the data received is the proper size as what was transmitted. • Urgent Pointer (16 bits) This field is only processed in segments where the URG control bit is set and communicates the value of the urgent pointer as a positive offset from the sequence number of the current segment. • Options (variable) The Options field contains any number of variable option values that must be understood by all TCP hosts, but in practice are rarely used. • Padding (variable) This field provides the necessary padding to the Options field to ensure that the data length is 32 bits. |
Continue reading here: Bad TCP
Was this article helpful?
Readers' Questions
-
donnamira7 months ago
- Reply
-
tom8 months ago
- Reply