TCP Header Options:
Header options (as the name clearly implies) are the options of the header and (obviously) are optional. They add some specifics to the packet.
Notice that they are not specific to the TCP header. Actually they are common between other protocols like IP, DHCP and with a little bit of change in UDP.
Options anatomy:
In general (and despite the protocol), any header option has three different parts which are:
kind, length and data.
Each of the kind and length, has the size of one byte while the size of data, is not set and it alters from one type of option to another.
In general (and despite the protocol), any header option has three different parts which are:
kind, length and data.
Each of the kind and length, has the size of one byte while the size of data, is not set and it alters from one type of option to another.
- kind: 'kind' or type is a number between 0 and 255. It is actually an identifier which indicates the type of current option. The fact that option-kind is one byte of length, implies that there are 256 possible options for any specific protocol that implements header options.
- length: This part is also a number indicating the size of current option in bytes. Size of this portion is also one byte which suggests that the maximum length of an option is 256 bytes.
- data: This part is the actual data of the (current) option. Size of this part (obviously) alters from one type of option to another.
Options may appear as a single byte which holds only the object-kind number. In this case although the actual length of the option is one byte, the length portion of the option is undefined because the option does not have such a portion, It only has one byte which is occupied by the option-kind.
The first two options ( 0 and 1 ) fall in this category (as you can see in the following image).
The other format of header option is the complete form with all the three different parts in it.
Different types of TCP header Options:
Most widely used options in TCP header are as follows:
No-Operation (NOP): The No-Operation option simply means “no option”. This option is used between other kinds of options to align the beginning of the next option on a word boundary. In other words it is used to fill the empty spaces between other valid options on a 16-bit (2 bytes) boundary. It is 16-bit boundary because when RFC793 was published (september 1981) the 16-bit computers were top line computers.
As you can see in this picture the first option of our header is MSS which has the length of 4 bytes so it satisfies the boundary. After MSS we have a NOP option (with one byte) which is placed exactly before WS option which has the length of 3 bytes. Obviously this is because the length of the WS option is not aligned to the word boundary which is 2 bytes. The missing byte is filled with NOP option to help the NEXT option meet the criteria. Same thing happens with the other options in the header.