Transmission Control Protocol - TCP Header (RFC 793)
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Byte Offset 0
Byte Offset 1
Byte Offset 2
Byte Offset 3
20 Bytes
Source Port Number (16-bit)
Destination Port Number (16-bit)
Byte Offset 4
Byte Offset 5
Byte Offset 6
Byte Offset 7
Sequence Number (32-bit)
Byte Offset 8
Byte Offset 9
Byte Offset 10
Byte Offset 11
Acknowledgement Number (32-bit)
Byte Offset 12
Byte Offset 13
Byte Offset 14
Byte Offset 15
Hdr Length
(4-bit)
Reserved
(4-bit)
CWR
ECN
URG
ACK
PSH
RST
SYN
FIN
Window Size (16-bit)
Byte Offset 16
Byte Offset 17
Byte Offset 18
Byte Offset 19
Checksum (16-bit)
Urgent Pointer (16-bit)
Byte Offset 20
Byte Offset 21
Byte Offset 22
Byte Offset 23
TCP Opitions (variable length…) (if any)
TCP Options Length = TCP Header Length in the current packet - 20 bytes (Minimum TCP Header Length)
data (variable length…)
Length of Packet Payload = IP Total Length - (IP Header Length + TCP Header Length)
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Common Port Numbers
echo
chargen
domain
netbios-ns
https (ssl)
ftp-data
netbios-ssn
ftp-control
Sequence Number
32-bit number uniquely identifies initial byte of segment data.
Acknowledgement Number
Represents next byte of data receiving host expects: (last received sequence number + 1)
Header Length
(4 byte multiplier)
Number of 32-bit words in TCP header
minimum value 5 (5x4=20bytes)
maximum value 15 (5x15=60bytes)
Reserved
4 bits set to 0
Congestion Window Reduced (CWR)
Set to 0 unless ECN is used.
(1 = sender cuts congestion window in half)
Explicit Congestion Notification Echo (ECN)
Set to 0 unless ECN is used.
(1 = receiver cuts congestion window in half)
URG = Urgent
ACK = Acknowledgment
PSH = Push
RST = Reset
SYN = Syncronize
FIN = Finish
(Note: Push means don't buffer data but push it to be processes as soon as it comes in.)
Window Size
Acts as flow control. Window size dynamically changes as data is received. A 0 window size tells src host to wait.
Checksum
Covers psedo header (IP Header source and destinstation addresses, the protocol and the computed TCP length (the
TCP header length the and data length in octets)) and the TCP header
Urgent Pointer
Points to the sequence number of the octet following the urgent data.
Options
0
End of Options List
1
No Operation (pad)
2
Maximum segment size
3
Window scale
4
Selective ACK ok
8
Timestamp