1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _NFT_META_H_
3#define _NFT_META_H_
4
5#include <net/netfilter/nf_tables.h>
6
7struct nft_meta {
8	enum nft_meta_keys	key:8;
9	u8			len;
10	union {
11		u8		dreg;
12		u8		sreg;
13	};
14};
15
16extern const struct nla_policy nft_meta_policy[];
17
18int nft_meta_get_init(const struct nft_ctx *ctx,
19		      const struct nft_expr *expr,
20		      const struct nlattr * const tb[]);
21
22int nft_meta_set_init(const struct nft_ctx *ctx,
23		      const struct nft_expr *expr,
24		      const struct nlattr * const tb[]);
25
26int nft_meta_get_dump(struct sk_buff *skb,
27		      const struct nft_expr *expr, bool reset);
28
29int nft_meta_set_dump(struct sk_buff *skb,
30		      const struct nft_expr *expr, bool reset);
31
32void nft_meta_get_eval(const struct nft_expr *expr,
33		       struct nft_regs *regs,
34		       const struct nft_pktinfo *pkt);
35
36void nft_meta_set_eval(const struct nft_expr *expr,
37		       struct nft_regs *regs,
38		       const struct nft_pktinfo *pkt);
39
40void nft_meta_set_destroy(const struct nft_ctx *ctx,
41			  const struct nft_expr *expr);
42
43int nft_meta_set_validate(const struct nft_ctx *ctx,
44			  const struct nft_expr *expr,
45			  const struct nft_data **data);
46
47bool nft_meta_get_reduce(struct nft_regs_track *track,
48			 const struct nft_expr *expr);
49
50struct nft_inner_tun_ctx;
51void nft_meta_inner_eval(const struct nft_expr *expr,
52			 struct nft_regs *regs, const struct nft_pktinfo *pkt,
53			 struct nft_inner_tun_ctx *tun_ctx);
54
55#endif
56