1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| struct _tcphdr
{
unsigned short source; // [00][01] source port
unsigned short dest; // [02][03] target port
unsigned int seq; // [04][05][06][07] send sequence
unsigned int ack_seq; // [08][09][10][11] ack sequence
#if defined(__LITTLE_ENDIAN_BITFIELD)
unsigned short res1:4,doff:4,fin:1,syn:1,rst:1,psh:1,ack:1,urg:1,ece:1,cwr:1;
#elif defined(__BIG_ENDIAN_BITFIELD)
unsigned short doff:4,res1:4,cwr:1,ece:1,urg:1,ack:1,psh:1,rst:1,syn:1,fin:1;
#else
#error "check __LITTLE_ENDIAN_BITFIELD / __BIG_ENDIAN_BITFIELD"
#endif // [12][13] doff tcp hdr len
unsigned short window; // [14][15]
unsigned short check; // [16][17]
unsigned short urg_ptr; // [18][19]
// The options start here. [20]~[59] mss,wsopt,sack-premitted,sack,tspot ...
// payload...
};
|