GNU Linux-libre 4.9-gnu1
[releases.git] / include / net / netfilter / nf_tables_core.h
1 #ifndef _NET_NF_TABLES_CORE_H
2 #define _NET_NF_TABLES_CORE_H
3
4 int nf_tables_core_module_init(void);
5 void nf_tables_core_module_exit(void);
6
7 int nft_immediate_module_init(void);
8 void nft_immediate_module_exit(void);
9
10 struct nft_cmp_fast_expr {
11         u32                     data;
12         enum nft_registers      sreg:8;
13         u8                      len;
14 };
15
16 /* Calculate the mask for the nft_cmp_fast expression. On big endian the
17  * mask needs to include the *upper* bytes when interpreting that data as
18  * something smaller than the full u32, therefore a cpu_to_le32 is done.
19  */
20 static inline u32 nft_cmp_fast_mask(unsigned int len)
21 {
22         return cpu_to_le32(~0U >> (FIELD_SIZEOF(struct nft_cmp_fast_expr,
23                                                 data) * BITS_PER_BYTE - len));
24 }
25
26 extern const struct nft_expr_ops nft_cmp_fast_ops;
27
28 int nft_cmp_module_init(void);
29 void nft_cmp_module_exit(void);
30
31 int nft_range_module_init(void);
32 void nft_range_module_exit(void);
33
34 int nft_lookup_module_init(void);
35 void nft_lookup_module_exit(void);
36
37 int nft_dynset_module_init(void);
38 void nft_dynset_module_exit(void);
39
40 int nft_bitwise_module_init(void);
41 void nft_bitwise_module_exit(void);
42
43 int nft_byteorder_module_init(void);
44 void nft_byteorder_module_exit(void);
45
46 struct nft_payload {
47         enum nft_payload_bases  base:8;
48         u8                      offset;
49         u8                      len;
50         enum nft_registers      dreg:8;
51 };
52
53 struct nft_payload_set {
54         enum nft_payload_bases  base:8;
55         u8                      offset;
56         u8                      len;
57         enum nft_registers      sreg:8;
58         u8                      csum_type;
59         u8                      csum_offset;
60 };
61
62 extern const struct nft_expr_ops nft_payload_fast_ops;
63 extern struct static_key_false nft_trace_enabled;
64
65 int nft_payload_module_init(void);
66 void nft_payload_module_exit(void);
67
68 #endif /* _NET_NF_TABLES_CORE_H */