1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #ifndef _LINUX_TCP_H
18 #define _LINUX_TCP_H
19
20
21 #define HEADER_SIZE 64
22
23
24 struct tcphdr {
25 __u16 source;
26 __u16 dest;
27 __u32 seq;
28 __u32 ack_seq;
29 #if defined(__i386__)
30 __u16 res1:4,
31 doff:4,
32 fin:1,
33 syn:1,
34 rst:1,
35 psh:1,
36 ack:1,
37 urg:1,
38 res2:2;
39 #elif defined(__mc68000__)
40 __u16 res2:2,
41 urg:1,
42 ack:1,
43 psh:1,
44 rst:1,
45 syn:1,
46 fin:1,
47 doff:4,
48 res1:4;
49 #elif defined(__MIPSEL__)
50 __u16 res1:4,
51 doff:4,
52 fin:1,
53 syn:1,
54 rst:1,
55 psh:1,
56 ack:1,
57 urg:1,
58 res2:2;
59 #elif defined(__MIPSEB__)
60 __u16 res2:2,
61 urg:1,
62 ack:1,
63 psh:1,
64 rst:1,
65 syn:1,
66 fin:1,
67 doff:4,
68 res1:4;
69 #elif defined(__alpha__)
70 __u16 res1:4,
71 doff:4,
72 fin:1,
73 syn:1,
74 rst:1,
75 psh:1,
76 ack:1,
77 urg:1,
78 res2:2;
79 #elif defined(__sparc__)
80 __u16 res2:2,
81 urg:1,
82 ack:1,
83 psh:1,
84 rst:1,
85 syn:1,
86 fin:1,
87 doff:4,
88 res1:4;
89 #else
90 #error "Adjust this structure for your cpu alignment rules"
91 #endif
92 __u16 window;
93 __u16 check;
94 __u16 urg_ptr;
95 };
96
97
98 enum {
99 TCP_ESTABLISHED = 1,
100 TCP_SYN_SENT,
101 TCP_SYN_RECV,
102 TCP_FIN_WAIT1,
103 TCP_FIN_WAIT2,
104 TCP_TIME_WAIT,
105 TCP_CLOSE,
106 TCP_CLOSE_WAIT,
107 TCP_LAST_ACK,
108 TCP_LISTEN,
109 TCP_CLOSING
110 };
111
112 #endif