[Winpcap-users] TCP timestamp option

Ho, Thinh tho at comscore.com
Wed Jul 6 12:40:20 GMT 2005


Hello,
I am trying to extract the options field out of the TCP header.
My struct for tcp_header is below:

typedef struct tcp_header
{
u_short sport; // Source port
u_short dport; // Destination port
u_int seqnum; // Sequence Number
u_int acknum; // Acknowledgement number
u_char hlen; // Header length
u_char flags; // packet flags
u_short win; // Window size
u_short crc; // Header Checksum
u_short urgptr; // Urgent pointer
u_int option; // options field
} tcp_header;

I just want to confirm if this is correct (u_int?) and welcome any
inputs/suggestions.
The reason why I am trying to extract it is to obtain the TCP
timestamp option clock (TSopt), which should be located in the option
field. I am aware of the structure of the options field. However, I do
not know whether the value I am looking for is located in the TSval
field or the TSecr field of option. Would performing this code block
obtain the TSopt value that I am looking for:

Note: tcp is a tcp_header pointer
cout << tcp->option;

I've tried that and it gives me a value different from the timestamp
of the packet (system time). Is this correct?

Any input would be greatly appreciated.

Thanks a whole bunch!



More information about the Winpcap-users mailing list