Linux-2.6.12-rc2
[linux-flexiantxendom0-natty.git] / include / linux / netfilter_ipv4 / ip_conntrack_tcp.h
1 #ifndef _IP_CONNTRACK_TCP_H
2 #define _IP_CONNTRACK_TCP_H
3 /* TCP tracking. */
4
5 enum tcp_conntrack {
6         TCP_CONNTRACK_NONE,
7         TCP_CONNTRACK_SYN_SENT,
8         TCP_CONNTRACK_SYN_RECV,
9         TCP_CONNTRACK_ESTABLISHED,
10         TCP_CONNTRACK_FIN_WAIT,
11         TCP_CONNTRACK_CLOSE_WAIT,
12         TCP_CONNTRACK_LAST_ACK,
13         TCP_CONNTRACK_TIME_WAIT,
14         TCP_CONNTRACK_CLOSE,
15         TCP_CONNTRACK_LISTEN,
16         TCP_CONNTRACK_MAX,
17         TCP_CONNTRACK_IGNORE
18 };
19
20 /* Window scaling is advertised by the sender */
21 #define IP_CT_TCP_FLAG_WINDOW_SCALE             0x01
22
23 /* SACK is permitted by the sender */
24 #define IP_CT_TCP_FLAG_SACK_PERM                0x02
25
26 /* This sender sent FIN first */
27 #define IP_CT_TCP_FLAG_CLOSE_INIT               0x03
28
29 struct ip_ct_tcp_state {
30         u_int32_t       td_end;         /* max of seq + len */
31         u_int32_t       td_maxend;      /* max of ack + max(win, 1) */
32         u_int32_t       td_maxwin;      /* max(win) */
33         u_int8_t        td_scale;       /* window scale factor */
34         u_int8_t        loose;          /* used when connection picked up from the middle */
35         u_int8_t        flags;          /* per direction options */
36 };
37
38 struct ip_ct_tcp
39 {
40         struct ip_ct_tcp_state seen[2]; /* connection parameters per direction */
41         u_int8_t        state;          /* state of the connection (enum tcp_conntrack) */
42         /* For detecting stale connections */
43         u_int8_t        last_dir;       /* Direction of the last packet (enum ip_conntrack_dir) */
44         u_int8_t        retrans;        /* Number of retransmitted packets */
45         u_int8_t        last_index;     /* Index of the last packet */
46         u_int32_t       last_seq;       /* Last sequence number seen in dir */
47         u_int32_t       last_ack;       /* Last sequence number seen in opposite dir */
48         u_int32_t       last_end;       /* Last seq + len */
49 };
50
51 #endif /* _IP_CONNTRACK_TCP_H */