License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[linux-2.6-block.git] / include / net / netfilter / nf_nat_l3proto.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _NF_NAT_L3PROTO_H
3 #define _NF_NAT_L3PROTO_H
4
5 struct nf_nat_l4proto;
6 struct nf_nat_l3proto {
7         u8      l3proto;
8
9         bool    (*in_range)(const struct nf_conntrack_tuple *t,
10                             const struct nf_nat_range *range);
11
12         u32     (*secure_port)(const struct nf_conntrack_tuple *t, __be16);
13
14         bool    (*manip_pkt)(struct sk_buff *skb,
15                              unsigned int iphdroff,
16                              const struct nf_nat_l4proto *l4proto,
17                              const struct nf_conntrack_tuple *target,
18                              enum nf_nat_manip_type maniptype);
19
20         void    (*csum_update)(struct sk_buff *skb, unsigned int iphdroff,
21                                __sum16 *check,
22                                const struct nf_conntrack_tuple *t,
23                                enum nf_nat_manip_type maniptype);
24
25         void    (*csum_recalc)(struct sk_buff *skb, u8 proto,
26                                void *data, __sum16 *check,
27                                int datalen, int oldlen);
28
29         void    (*decode_session)(struct sk_buff *skb,
30                                   const struct nf_conn *ct,
31                                   enum ip_conntrack_dir dir,
32                                   unsigned long statusbit,
33                                   struct flowi *fl);
34
35         int     (*nlattr_to_range)(struct nlattr *tb[],
36                                    struct nf_nat_range *range);
37 };
38
39 int nf_nat_l3proto_register(const struct nf_nat_l3proto *);
40 void nf_nat_l3proto_unregister(const struct nf_nat_l3proto *);
41 const struct nf_nat_l3proto *__nf_nat_l3proto_find(u8 l3proto);
42
43 int nf_nat_icmp_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
44                                   enum ip_conntrack_info ctinfo,
45                                   unsigned int hooknum);
46
47 unsigned int nf_nat_ipv4_in(void *priv, struct sk_buff *skb,
48                             const struct nf_hook_state *state,
49                             unsigned int (*do_chain)(void *priv,
50                                                      struct sk_buff *skb,
51                                                      const struct nf_hook_state *state,
52                                                      struct nf_conn *ct));
53
54 unsigned int nf_nat_ipv4_out(void *priv, struct sk_buff *skb,
55                              const struct nf_hook_state *state,
56                              unsigned int (*do_chain)(void *priv,
57                                                       struct sk_buff *skb,
58                                                       const struct nf_hook_state *state,
59                                                       struct nf_conn *ct));
60
61 unsigned int nf_nat_ipv4_local_fn(void *priv,
62                                   struct sk_buff *skb,
63                                   const struct nf_hook_state *state,
64                                   unsigned int (*do_chain)(void *priv,
65                                                            struct sk_buff *skb,
66                                                            const struct nf_hook_state *state,
67                                                            struct nf_conn *ct));
68
69 unsigned int nf_nat_ipv4_fn(void *priv, struct sk_buff *skb,
70                             const struct nf_hook_state *state,
71                             unsigned int (*do_chain)(void *priv,
72                                                      struct sk_buff *skb,
73                                                      const struct nf_hook_state *state,
74                                                      struct nf_conn *ct));
75
76 int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
77                                     enum ip_conntrack_info ctinfo,
78                                     unsigned int hooknum, unsigned int hdrlen);
79
80 unsigned int nf_nat_ipv6_in(void *priv, struct sk_buff *skb,
81                             const struct nf_hook_state *state,
82                             unsigned int (*do_chain)(void *priv,
83                                                      struct sk_buff *skb,
84                                                      const struct nf_hook_state *state,
85                                                      struct nf_conn *ct));
86
87 unsigned int nf_nat_ipv6_out(void *priv, struct sk_buff *skb,
88                              const struct nf_hook_state *state,
89                              unsigned int (*do_chain)(void *priv,
90                                                       struct sk_buff *skb,
91                                                       const struct nf_hook_state *state,
92                                                       struct nf_conn *ct));
93
94 unsigned int nf_nat_ipv6_local_fn(void *priv,
95                                   struct sk_buff *skb,
96                                   const struct nf_hook_state *state,
97                                   unsigned int (*do_chain)(void *priv,
98                                                            struct sk_buff *skb,
99                                                            const struct nf_hook_state *state,
100                                                            struct nf_conn *ct));
101
102 unsigned int nf_nat_ipv6_fn(void *priv, struct sk_buff *skb,
103                             const struct nf_hook_state *state,
104                             unsigned int (*do_chain)(void *priv,
105                                                      struct sk_buff *skb,
106                                                      const struct nf_hook_state *state,
107                                                      struct nf_conn *ct));
108
109 #endif /* _NF_NAT_L3PROTO_H */