netfilter: nfnetlink_osf: extract nfnetlink_subsystem code from xt_osf.c
[linux-block.git] / include / uapi / linux / netfilter / nf_osf.h
1 #ifndef _NF_OSF_H
2 #define _NF_OSF_H
3
4 #include <linux/types.h>
5
6 #define MAXGENRELEN     32
7
8 #define NF_OSF_GENRE    (1 << 0)
9 #define NF_OSF_TTL      (1 << 1)
10 #define NF_OSF_LOG      (1 << 2)
11 #define NF_OSF_INVERT   (1 << 3)
12
13 #define NF_OSF_LOGLEVEL_ALL             0       /* log all matched fingerprints */
14 #define NF_OSF_LOGLEVEL_FIRST           1       /* log only the first matced fingerprint */
15 #define NF_OSF_LOGLEVEL_ALL_KNOWN       2       /* do not log unknown packets */
16
17 #define NF_OSF_TTL_TRUE                 0       /* True ip and fingerprint TTL comparison */
18
19 /* Check if ip TTL is less than fingerprint one */
20 #define NF_OSF_TTL_LESS                 1
21
22 /* Do not compare ip and fingerprint TTL at all */
23 #define NF_OSF_TTL_NOCHECK              2
24
25 #define NF_OSF_FLAGMASK         (NF_OSF_GENRE | NF_OSF_TTL | \
26                                  NF_OSF_LOG | NF_OSF_INVERT)
27 /* Wildcard MSS (kind of).
28  * It is used to implement a state machine for the different wildcard values
29  * of the MSS and window sizes.
30  */
31 struct nf_osf_wc {
32         __u32   wc;
33         __u32   val;
34 };
35
36 /* This struct represents IANA options
37  * http://www.iana.org/assignments/tcp-parameters
38  */
39 struct nf_osf_opt {
40         __u16                   kind, length;
41         struct nf_osf_wc        wc;
42 };
43
44 struct nf_osf_info {
45         char    genre[MAXGENRELEN];
46         __u32   len;
47         __u32   flags;
48         __u32   loglevel;
49         __u32   ttl;
50 };
51
52 struct nf_osf_user_finger {
53         struct nf_osf_wc        wss;
54
55         __u8    ttl, df;
56         __u16   ss, mss;
57         __u16   opt_num;
58
59         char    genre[MAXGENRELEN];
60         char    version[MAXGENRELEN];
61         char    subtype[MAXGENRELEN];
62
63         /* MAX_IPOPTLEN is maximum if all options are NOPs or EOLs */
64         struct nf_osf_opt       opt[MAX_IPOPTLEN];
65 };
66
67 struct nf_osf_nlmsg {
68         struct nf_osf_user_finger       f;
69         struct iphdr                    ip;
70         struct tcphdr                   tcp;
71 };
72
73 extern struct list_head nf_osf_fingers[2];
74
75 /* Defines for IANA option kinds */
76 enum iana_options {
77         OSFOPT_EOL = 0,         /* End of options */
78         OSFOPT_NOP,             /* NOP */
79         OSFOPT_MSS,             /* Maximum segment size */
80         OSFOPT_WSO,             /* Window scale option */
81         OSFOPT_SACKP,           /* SACK permitted */
82         OSFOPT_SACK,            /* SACK */
83         OSFOPT_ECHO,
84         OSFOPT_ECHOREPLY,
85         OSFOPT_TS,              /* Timestamp option */
86         OSFOPT_POCP,            /* Partial Order Connection Permitted */
87         OSFOPT_POSP,            /* Partial Order Service Profile */
88
89         /* Others are not used in the current OSF */
90         OSFOPT_EMPTY = 255,
91 };
92
93 enum nf_osf_attr_type {
94         OSF_ATTR_UNSPEC,
95         OSF_ATTR_FINGER,
96         OSF_ATTR_MAX,
97 };
98
99 /*
100  * Add/remove fingerprint from the kernel.
101  */
102 enum nf_osf_msg_types {
103         OSF_MSG_ADD,
104         OSF_MSG_REMOVE,
105         OSF_MSG_MAX,
106 };
107
108 #endif /* _NF_OSF_H */