Merge branch 'linus' into core/iommu
[sfrench/cifs-2.6.git] / include / linux / netfilter / nf_conntrack_tcp.h
1 #ifndef _NF_CONNTRACK_TCP_H
2 #define _NF_CONNTRACK_TCP_H
3 /* TCP tracking. */
4
5 #include <linux/types.h>
6
7 /* This is exposed to userspace (ctnetlink) */
8 enum tcp_conntrack {
9         TCP_CONNTRACK_NONE,
10         TCP_CONNTRACK_SYN_SENT,
11         TCP_CONNTRACK_SYN_RECV,
12         TCP_CONNTRACK_ESTABLISHED,
13         TCP_CONNTRACK_FIN_WAIT,
14         TCP_CONNTRACK_CLOSE_WAIT,
15         TCP_CONNTRACK_LAST_ACK,
16         TCP_CONNTRACK_TIME_WAIT,
17         TCP_CONNTRACK_CLOSE,
18         TCP_CONNTRACK_LISTEN,
19         TCP_CONNTRACK_MAX,
20         TCP_CONNTRACK_IGNORE
21 };
22
23 /* Window scaling is advertised by the sender */
24 #define IP_CT_TCP_FLAG_WINDOW_SCALE             0x01
25
26 /* SACK is permitted by the sender */
27 #define IP_CT_TCP_FLAG_SACK_PERM                0x02
28
29 /* This sender sent FIN first */
30 #define IP_CT_TCP_FLAG_CLOSE_INIT               0x04
31
32 /* Be liberal in window checking */
33 #define IP_CT_TCP_FLAG_BE_LIBERAL               0x08
34
35 /* Has unacknowledged data */
36 #define IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED      0x10
37
38 struct nf_ct_tcp_flags {
39         __u8 flags;
40         __u8 mask;
41 };
42
43 #ifdef __KERNEL__
44
45 struct ip_ct_tcp_state {
46         u_int32_t       td_end;         /* max of seq + len */
47         u_int32_t       td_maxend;      /* max of ack + max(win, 1) */
48         u_int32_t       td_maxwin;      /* max(win) */
49         u_int8_t        td_scale;       /* window scale factor */
50         u_int8_t        flags;          /* per direction options */
51 };
52
53 struct ip_ct_tcp
54 {
55         struct ip_ct_tcp_state seen[2]; /* connection parameters per direction */
56         u_int8_t        state;          /* state of the connection (enum tcp_conntrack) */
57         /* For detecting stale connections */
58         u_int8_t        last_dir;       /* Direction of the last packet (enum ip_conntrack_dir) */
59         u_int8_t        retrans;        /* Number of retransmitted packets */
60         u_int8_t        last_index;     /* Index of the last packet */
61         u_int32_t       last_seq;       /* Last sequence number seen in dir */
62         u_int32_t       last_ack;       /* Last sequence number seen in opposite dir */
63         u_int32_t       last_end;       /* Last seq + len */
64         u_int16_t       last_win;       /* Last window advertisement seen in dir */
65 };
66
67 #endif /* __KERNEL__ */
68
69 #endif /* _NF_CONNTRACK_TCP_H */