linux/include/net/netfilter/nf_tables.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _NET_NF_TABLES_H
#define _NET_NF_TABLES_H

#include <linux/unaligned.h>
#include <linux/list.h>
#include <linux/netfilter.h>
#include <linux/netfilter/nfnetlink.h>
#include <linux/netfilter/x_tables.h>
#include <linux/netfilter/nf_tables.h>
#include <linux/u64_stats_sync.h>
#include <linux/rhashtable.h>
#include <net/netfilter/nf_flow_table.h>
#include <net/netlink.h>
#include <net/flow_offload.h>
#include <net/netns/generic.h>

#define NFT_MAX_HOOKS

struct module;

#define NFT_JUMP_STACK_SIZE

enum {};

struct nft_pktinfo {};

static inline struct sock *nft_sk(const struct nft_pktinfo *pkt)
{}

static inline unsigned int nft_thoff(const struct nft_pktinfo *pkt)
{}

static inline struct net *nft_net(const struct nft_pktinfo *pkt)
{}

static inline unsigned int nft_hook(const struct nft_pktinfo *pkt)
{}

static inline u8 nft_pf(const struct nft_pktinfo *pkt)
{}

static inline const struct net_device *nft_in(const struct nft_pktinfo *pkt)
{}

static inline const struct net_device *nft_out(const struct nft_pktinfo *pkt)
{}

static inline void nft_set_pktinfo(struct nft_pktinfo *pkt,
				   struct sk_buff *skb,
				   const struct nf_hook_state *state)
{}

static inline void nft_set_pktinfo_unspec(struct nft_pktinfo *pkt)
{}

/**
 * 	struct nft_verdict - nf_tables verdict
 *
 * 	@code: nf_tables/netfilter verdict code
 * 	@chain: destination chain for NFT_JUMP/NFT_GOTO
 */
struct nft_verdict {};

struct nft_data {} __attribute__((aligned));

#define NFT_REG32_NUM

/**
 *	struct nft_regs - nf_tables register set
 *
 *	@data: data registers
 *	@verdict: verdict register
 *
 *	The first four data registers alias to the verdict register.
 */
struct nft_regs {};

struct nft_regs_track {};

/* Store/load an u8, u16 or u64 integer to/from the u32 data register.
 *
 * Note, when using concatenations, register allocation happens at 32-bit
 * level. So for store instruction, pad the rest part with zero to avoid
 * garbage values.
 */

static inline void nft_reg_store8(u32 *dreg, u8 val)
{}

static inline u8 nft_reg_load8(const u32 *sreg)
{}

static inline void nft_reg_store16(u32 *dreg, u16 val)
{}

static inline void nft_reg_store_be16(u32 *dreg, __be16 val)
{}

static inline u16 nft_reg_load16(const u32 *sreg)
{}

static inline __be16 nft_reg_load_be16(const u32 *sreg)
{}

static inline __be32 nft_reg_load_be32(const u32 *sreg)
{}

static inline void nft_reg_store64(u64 *dreg, u64 val)
{}

static inline u64 nft_reg_load64(const u32 *sreg)
{}

static inline void nft_data_copy(u32 *dst, const struct nft_data *src,
				 unsigned int len)
{}

/**
 *	struct nft_ctx - nf_tables rule/set context
 *
 *	@net: net namespace
 * 	@table: the table the chain is contained in
 * 	@chain: the chain the rule is contained in
 *	@nla: netlink attributes
 *	@portid: netlink portID of the original message
 *	@seq: netlink sequence number
 *	@flags: modifiers to new request
 *	@family: protocol family
 *	@level: depth of the chains
 *	@report: notify via unicast netlink message
 *	@reg_inited: bitmap of initialised registers
 */
struct nft_ctx {};

enum nft_data_desc_flags {};

struct nft_data_desc {};

int nft_data_init(const struct nft_ctx *ctx, struct nft_data *data,
		  struct nft_data_desc *desc, const struct nlattr *nla);
void nft_data_hold(const struct nft_data *data, enum nft_data_types type);
void nft_data_release(const struct nft_data *data, enum nft_data_types type);
int nft_data_dump(struct sk_buff *skb, int attr, const struct nft_data *data,
		  enum nft_data_types type, unsigned int len);

static inline enum nft_data_types nft_dreg_to_type(enum nft_registers reg)
{}

static inline enum nft_registers nft_type_to_reg(enum nft_data_types type)
{}

int nft_parse_u32_check(const struct nlattr *attr, int max, u32 *dest);
int nft_dump_register(struct sk_buff *skb, unsigned int attr, unsigned int reg);

int nft_parse_register_load(const struct nft_ctx *ctx,
			    const struct nlattr *attr, u8 *sreg, u32 len);
int nft_parse_register_store(const struct nft_ctx *ctx,
			     const struct nlattr *attr, u8 *dreg,
			     const struct nft_data *data,
			     enum nft_data_types type, unsigned int len);

/**
 *	struct nft_userdata - user defined data associated with an object
 *
 *	@len: length of the data
 *	@data: content
 *
 *	The presence of user data is indicated in an object specific fashion,
 *	so a length of zero can't occur and the value "len" indicates data
 *	of length len + 1.
 */
struct nft_userdata {};

/* placeholder structure for opaque set element backend representation. */
struct nft_elem_priv {};

/**
 *	struct nft_set_elem - generic representation of set elements
 *
 *	@key: element key
 *	@key_end: closing element key
 *	@data: element data
 *	@priv: element private data and extensions
 */
struct nft_set_elem {};

static inline void *nft_elem_priv_cast(const struct nft_elem_priv *priv)
{}


/**
 * enum nft_iter_type - nftables set iterator type
 *
 * @NFT_ITER_UNSPEC: unspecified, to catch errors
 * @NFT_ITER_READ: read-only iteration over set elements
 * @NFT_ITER_UPDATE: iteration under mutex to update set element state
 */
enum nft_iter_type {};

struct nft_set;
struct nft_set_iter {};

/**
 *	struct nft_set_desc - description of set elements
 *
 *	@ktype: key type
 *	@klen: key length
 *	@dtype: data type
 *	@dlen: data length
 *	@objtype: object type
 *	@size: number of set elements
 *	@policy: set policy
 *	@gc_int: garbage collector interval
 *	@timeout: element timeout
 *	@field_len: length of each field in concatenation, bytes
 *	@field_count: number of concatenated fields in element
 *	@expr: set must support for expressions
 */
struct nft_set_desc {};

/**
 *	enum nft_set_class - performance class
 *
 *	@NFT_SET_CLASS_O_1: constant, O(1)
 *	@NFT_SET_CLASS_O_LOG_N: logarithmic, O(log N)
 *	@NFT_SET_CLASS_O_N: linear, O(N)
 */
enum nft_set_class {};

/**
 *	struct nft_set_estimate - estimation of memory and performance
 *				  characteristics
 *
 *	@size: required memory
 *	@lookup: lookup performance class
 *	@space: memory class
 */
struct nft_set_estimate {};

#define NFT_EXPR_MAXATTR
#define NFT_EXPR_SIZE(size)

/**
 *	struct nft_expr - nf_tables expression
 *
 *	@ops: expression ops
 *	@data: expression private data
 */
struct nft_expr {};

static inline void *nft_expr_priv(const struct nft_expr *expr)
{}

struct nft_expr_info;

int nft_expr_inner_parse(const struct nft_ctx *ctx, const struct nlattr *nla,
			 struct nft_expr_info *info);
int nft_expr_clone(struct nft_expr *dst, struct nft_expr *src, gfp_t gfp);
void nft_expr_destroy(const struct nft_ctx *ctx, struct nft_expr *expr);
int nft_expr_dump(struct sk_buff *skb, unsigned int attr,
		  const struct nft_expr *expr, bool reset);
bool nft_expr_reduce_bitwise(struct nft_regs_track *track,
			     const struct nft_expr *expr);

struct nft_set_ext;

/**
 *	struct nft_set_ops - nf_tables set operations
 *
 *	@lookup: look up an element within the set
 *	@update: update an element if exists, add it if doesn't exist
 *	@delete: delete an element
 *	@insert: insert new element into set
 *	@activate: activate new element in the next generation
 *	@deactivate: lookup for element and deactivate it in the next generation
 *	@flush: deactivate element in the next generation
 *	@remove: remove element from set
 *	@walk: iterate over all set elements
 *	@get: get set elements
 *	@commit: commit set elements
 *	@abort: abort set elements
 *	@privsize: function to return size of set private data
 *	@estimate: estimate the required memory size and the lookup complexity class
 *	@init: initialize private data of new set instance
 *	@destroy: destroy private data of set instance
 *	@gc_init: initialize garbage collection
 *	@elemsize: element private size
 *
 *	Operations lookup, update and delete have simpler interfaces, are faster
 *	and currently only used in the packet path. All the rest are slower,
 *	control plane functions.
 */
struct nft_set_ops {};

/**
 *      struct nft_set_type - nf_tables set type
 *
 *      @ops: set ops for this type
 *      @features: features supported by the implementation
 */
struct nft_set_type {};
#define to_set_type(o)

struct nft_set_elem_expr {};

#define nft_setelem_expr_at(__elem_expr, __offset)

#define nft_setelem_expr_foreach(__expr, __elem_expr, __size)

#define NFT_SET_EXPR_MAX

/**
 * 	struct nft_set - nf_tables set instance
 *
 *	@list: table set list node
 *	@bindings: list of set bindings
 *	@refs: internal refcounting for async set destruction
 *	@table: table this set belongs to
 *	@net: netnamespace this set belongs to
 * 	@name: name of the set
 *	@handle: unique handle of the set
 * 	@ktype: key type (numeric type defined by userspace, not used in the kernel)
 * 	@dtype: data type (verdict or numeric type defined by userspace)
 * 	@objtype: object type (see NFT_OBJECT_* definitions)
 * 	@size: maximum set size
 *	@field_len: length of each field in concatenation, bytes
 *	@field_count: number of concatenated fields in element
 *	@use: number of rules references to this set
 * 	@nelems: number of elements
 * 	@ndeact: number of deactivated elements queued for removal
 *	@timeout: default timeout value in jiffies
 * 	@gc_int: garbage collection interval in msecs
 *	@policy: set parameterization (see enum nft_set_policies)
 *	@udlen: user data length
 *	@udata: user data
 *	@pending_update: list of pending update set element
 * 	@ops: set ops
 * 	@flags: set flags
 *	@dead: set will be freed, never cleared
 *	@genmask: generation mask
 * 	@klen: key length
 * 	@dlen: data length
 *	@num_exprs: numbers of exprs
 *	@exprs: stateful expression
 *	@catchall_list: list of catch-all set element
 * 	@data: private set data
 */
struct nft_set {};

static inline bool nft_set_is_anonymous(const struct nft_set *set)
{}

static inline void *nft_set_priv(const struct nft_set *set)
{}

static inline enum nft_data_types nft_set_datatype(const struct nft_set *set)
{}

static inline bool nft_set_gc_is_pending(const struct nft_set *s)
{}

static inline struct nft_set *nft_set_container_of(const void *priv)
{}

struct nft_set *nft_set_lookup_global(const struct net *net,
				      const struct nft_table *table,
				      const struct nlattr *nla_set_name,
				      const struct nlattr *nla_set_id,
				      u8 genmask);

struct nft_set_ext *nft_set_catchall_lookup(const struct net *net,
					    const struct nft_set *set);

static inline unsigned long nft_set_gc_interval(const struct nft_set *set)
{}

/**
 *	struct nft_set_binding - nf_tables set binding
 *
 *	@list: set bindings list node
 *	@chain: chain containing the rule bound to the set
 *	@flags: set action flags
 *
 *	A set binding contains all information necessary for validation
 *	of new elements added to a bound set.
 */
struct nft_set_binding {};

enum nft_trans_phase;
void nf_tables_activate_set(const struct nft_ctx *ctx, struct nft_set *set);
void nf_tables_deactivate_set(const struct nft_ctx *ctx, struct nft_set *set,
			      struct nft_set_binding *binding,
			      enum nft_trans_phase phase);
int nf_tables_bind_set(const struct nft_ctx *ctx, struct nft_set *set,
		       struct nft_set_binding *binding);
void nf_tables_destroy_set(const struct nft_ctx *ctx, struct nft_set *set);

/**
 *	enum nft_set_extensions - set extension type IDs
 *
 *	@NFT_SET_EXT_KEY: element key
 *	@NFT_SET_EXT_KEY_END: upper bound element key, for ranges
 *	@NFT_SET_EXT_DATA: mapping data
 *	@NFT_SET_EXT_FLAGS: element flags
 *	@NFT_SET_EXT_TIMEOUT: element timeout
 *	@NFT_SET_EXT_USERDATA: user data associated with the element
 *	@NFT_SET_EXT_EXPRESSIONS: expressions associated with the element
 *	@NFT_SET_EXT_OBJREF: stateful object reference associated with element
 *	@NFT_SET_EXT_NUM: number of extension types
 */
enum nft_set_extensions {};

/**
 *	struct nft_set_ext_type - set extension type
 *
 * 	@len: fixed part length of the extension
 * 	@align: alignment requirements of the extension
 */
struct nft_set_ext_type {};

extern const struct nft_set_ext_type nft_set_ext_types[];

/**
 *	struct nft_set_ext_tmpl - set extension template
 *
 *	@len: length of extension area
 *	@offset: offsets of individual extension types
 *	@ext_len: length of the expected extension(used to sanity check)
 */
struct nft_set_ext_tmpl {};

/**
 *	struct nft_set_ext - set extensions
 *
 *	@genmask: generation mask
 *	@offset: offsets of individual extension types
 *	@data: beginning of extension data
 */
struct nft_set_ext {};

static inline void nft_set_ext_prepare(struct nft_set_ext_tmpl *tmpl)
{}

static inline int nft_set_ext_add_length(struct nft_set_ext_tmpl *tmpl, u8 id,
					 unsigned int len)
{}

static inline int nft_set_ext_add(struct nft_set_ext_tmpl *tmpl, u8 id)
{}

static inline void nft_set_ext_init(struct nft_set_ext *ext,
				    const struct nft_set_ext_tmpl *tmpl)
{}

static inline bool __nft_set_ext_exists(const struct nft_set_ext *ext, u8 id)
{}

static inline bool nft_set_ext_exists(const struct nft_set_ext *ext, u8 id)
{}

static inline void *nft_set_ext(const struct nft_set_ext *ext, u8 id)
{}

static inline struct nft_data *nft_set_ext_key(const struct nft_set_ext *ext)
{}

static inline struct nft_data *nft_set_ext_key_end(const struct nft_set_ext *ext)
{}

static inline struct nft_data *nft_set_ext_data(const struct nft_set_ext *ext)
{}

static inline u8 *nft_set_ext_flags(const struct nft_set_ext *ext)
{}

struct nft_timeout {};

static inline struct nft_timeout *nft_set_ext_timeout(const struct nft_set_ext *ext)
{}

static inline struct nft_userdata *nft_set_ext_userdata(const struct nft_set_ext *ext)
{}

static inline struct nft_set_elem_expr *nft_set_ext_expr(const struct nft_set_ext *ext)
{}

static inline bool __nft_set_elem_expired(const struct nft_set_ext *ext,
					  u64 tstamp)
{}

static inline bool nft_set_elem_expired(const struct nft_set_ext *ext)
{}

static inline struct nft_set_ext *nft_set_elem_ext(const struct nft_set *set,
						   const struct nft_elem_priv *elem_priv)
{}

static inline struct nft_object **nft_set_ext_obj(const struct nft_set_ext *ext)
{}

struct nft_expr *nft_set_elem_expr_alloc(const struct nft_ctx *ctx,
					 const struct nft_set *set,
					 const struct nlattr *attr);

struct nft_elem_priv *nft_set_elem_init(const struct nft_set *set,
					const struct nft_set_ext_tmpl *tmpl,
					const u32 *key, const u32 *key_end,
					const u32 *data,
					u64 timeout, u64 expiration, gfp_t gfp);
int nft_set_elem_expr_clone(const struct nft_ctx *ctx, struct nft_set *set,
			    struct nft_expr *expr_array[]);
void nft_set_elem_destroy(const struct nft_set *set,
			  const struct nft_elem_priv *elem_priv,
			  bool destroy_expr);
void nf_tables_set_elem_destroy(const struct nft_ctx *ctx,
				const struct nft_set *set,
				const struct nft_elem_priv *elem_priv);

struct nft_expr_ops;
/**
 *	struct nft_expr_type - nf_tables expression type
 *
 *	@select_ops: function to select nft_expr_ops
 *	@release_ops: release nft_expr_ops
 *	@ops: default ops, used when no select_ops functions is present
 *	@inner_ops: inner ops, used for inner packet operation
 *	@list: used internally
 *	@name: Identifier
 *	@owner: module reference
 *	@policy: netlink attribute policy
 *	@maxattr: highest netlink attribute number
 *	@family: address family for AF-specific types
 *	@flags: expression type flags
 */
struct nft_expr_type {};

#define NFT_EXPR_STATEFUL
#define NFT_EXPR_GC

enum nft_trans_phase {};

struct nft_flow_rule;
struct nft_offload_ctx;

/**
 *	struct nft_expr_ops - nf_tables expression operations
 *
 *	@eval: Expression evaluation function
 *	@clone: Expression clone function
 *	@size: full expression size, including private data size
 *	@init: initialization function
 *	@activate: activate expression in the next generation
 *	@deactivate: deactivate expression in next generation
 *	@destroy: destruction function, called after synchronize_rcu
 *	@destroy_clone: destruction clone function
 *	@dump: function to dump parameters
 *	@validate: validate expression, called during loop detection
 *	@reduce: reduce expression
 *	@gc: garbage collection expression
 *	@offload: hardware offload expression
 *	@offload_action: function to report true/false to allocate one slot or not in the flow
 *			 offload array
 *	@offload_stats: function to synchronize hardware stats via updating the counter expression
 *	@type: expression type
 *	@data: extra data to attach to this expression operation
 */
struct nft_expr_ops {};

/**
 *	struct nft_rule - nf_tables rule
 *
 *	@list: used internally
 *	@handle: rule handle
 *	@genmask: generation mask
 *	@dlen: length of expression data
 *	@udata: user data is appended to the rule
 *	@data: expression data
 */
struct nft_rule {};

static inline struct nft_expr *nft_expr_first(const struct nft_rule *rule)
{}

static inline struct nft_expr *nft_expr_next(const struct nft_expr *expr)
{}

static inline struct nft_expr *nft_expr_last(const struct nft_rule *rule)
{}

static inline bool nft_expr_more(const struct nft_rule *rule,
				 const struct nft_expr *expr)
{}

static inline struct nft_userdata *nft_userdata(const struct nft_rule *rule)
{}

void nft_rule_expr_activate(const struct nft_ctx *ctx, struct nft_rule *rule);
void nft_rule_expr_deactivate(const struct nft_ctx *ctx, struct nft_rule *rule,
			      enum nft_trans_phase phase);
void nf_tables_rule_destroy(const struct nft_ctx *ctx, struct nft_rule *rule);

static inline void nft_set_elem_update_expr(const struct nft_set_ext *ext,
					    struct nft_regs *regs,
					    const struct nft_pktinfo *pkt)
{}

/*
 * The last pointer isn't really necessary, but the compiler isn't able to
 * determine that the result of nft_expr_last() is always the same since it
 * can't assume that the dlen value wasn't changed within calls in the loop.
 */
#define nft_rule_for_each_expr(expr, last, rule)

#define NFT_CHAIN_POLICY_UNSET

struct nft_rule_dp {};

struct nft_rule_dp_last {};

static inline const struct nft_rule_dp *nft_rule_next(const struct nft_rule_dp *rule)
{}

struct nft_rule_blob {};

/**
 *	struct nft_chain - nf_tables chain
 *
 *	@blob_gen_0: rule blob pointer to the current generation
 *	@blob_gen_1: rule blob pointer to the future generation
 *	@rules: list of rules in the chain
 *	@list: used internally
 *	@rhlhead: used internally
 *	@table: table that this chain belongs to
 *	@handle: chain handle
 *	@use: number of jump references to this chain
 *	@flags: bitmask of enum NFTA_CHAIN_FLAGS
 *	@bound: bind or not
 *	@genmask: generation mask
 *	@name: name of the chain
 *	@udlen: user data length
 *	@udata: user data in the chain
 *	@blob_next: rule blob pointer to the next in the chain
 */
struct nft_chain {};

int nft_chain_validate(const struct nft_ctx *ctx, const struct nft_chain *chain);
int nft_setelem_validate(const struct nft_ctx *ctx, struct nft_set *set,
			 const struct nft_set_iter *iter,
			 struct nft_elem_priv *elem_priv);
int nft_set_catchall_validate(const struct nft_ctx *ctx, struct nft_set *set);
int nf_tables_bind_chain(const struct nft_ctx *ctx, struct nft_chain *chain);
void nf_tables_unbind_chain(const struct nft_ctx *ctx, struct nft_chain *chain);

enum nft_chain_types {};

/**
 * 	struct nft_chain_type - nf_tables chain type info
 *
 * 	@name: name of the type
 * 	@type: numeric identifier
 * 	@family: address family
 * 	@owner: module owner
 * 	@hook_mask: mask of valid hooks
 * 	@hooks: array of hook functions
 *	@ops_register: base chain register function
 *	@ops_unregister: base chain unregister function
 */
struct nft_chain_type {};

int nft_chain_validate_dependency(const struct nft_chain *chain,
				  enum nft_chain_types type);
int nft_chain_validate_hooks(const struct nft_chain *chain,
                             unsigned int hook_flags);

static inline bool nft_chain_binding(const struct nft_chain *chain)
{}

static inline bool nft_chain_is_bound(struct nft_chain *chain)
{}

int nft_chain_add(struct nft_table *table, struct nft_chain *chain);
void nft_chain_del(struct nft_chain *chain);
void nf_tables_chain_destroy(struct nft_chain *chain);

struct nft_stats {};

struct nft_hook {};

/**
 *	struct nft_base_chain - nf_tables base chain
 *
 *	@ops: netfilter hook ops
 *	@hook_list: list of netfilter hooks (for NFPROTO_NETDEV family)
 *	@type: chain type
 *	@policy: default policy
 *	@flags: indicate the base chain disabled or not
 *	@stats: per-cpu chain stats
 *	@chain: the chain
 *	@flow_block: flow block (for hardware offload)
 */
struct nft_base_chain {};

static inline struct nft_base_chain *nft_base_chain(const struct nft_chain *chain)
{}

static inline bool nft_is_base_chain(const struct nft_chain *chain)
{}

int __nft_release_basechain(struct nft_ctx *ctx);

unsigned int nft_do_chain(struct nft_pktinfo *pkt, void *priv);

static inline bool nft_use_inc(u32 *use)
{}

static inline void nft_use_dec(u32 *use)
{}

/* For error and abort path: restore use counter to previous state. */
static inline void nft_use_inc_restore(u32 *use)
{}

#define nft_use_dec_restore

/**
 *	struct nft_table - nf_tables table
 *
 *	@list: used internally
 *	@chains_ht: chains in the table
 *	@chains: same, for stable walks
 *	@sets: sets in the table
 *	@objects: stateful objects in the table
 *	@flowtables: flow tables in the table
 *	@hgenerator: handle generator state
 *	@handle: table handle
 *	@use: number of chain references to this table
 *	@family:address family
 *	@flags: table flag (see enum nft_table_flags)
 *	@genmask: generation mask
 *	@nlpid: netlink port ID
 *	@name: name of the table
 *	@udlen: length of the user data
 *	@udata: user data
 *	@validate_state: internal, set when transaction adds jumps
 */
struct nft_table {};

static inline bool nft_table_has_owner(const struct nft_table *table)
{}

static inline bool nft_table_is_orphan(const struct nft_table *table)
{}

static inline bool nft_base_chain_netdev(int family, u32 hooknum)
{}

void nft_register_chain_type(const struct nft_chain_type *);
void nft_unregister_chain_type(const struct nft_chain_type *);

int nft_register_expr(struct nft_expr_type *);
void nft_unregister_expr(struct nft_expr_type *);

int nft_verdict_dump(struct sk_buff *skb, int type,
		     const struct nft_verdict *v);

/**
 *	struct nft_object_hash_key - key to lookup nft_object
 *
 *	@name: name of the stateful object to look up
 *	@table: table the object belongs to
 */
struct nft_object_hash_key {};

/**
 *	struct nft_object - nf_tables stateful object
 *
 *	@list: table stateful object list node
 *	@rhlhead: nft_objname_ht node
 *	@key: keys that identify this object
 *	@genmask: generation mask
 *	@use: number of references to this stateful object
 *	@handle: unique object handle
 *	@udlen: length of user data
 *	@udata: user data
 *	@ops: object operations
 *	@data: object data, layout depends on type
 */
struct nft_object {};

static inline void *nft_obj_data(const struct nft_object *obj)
{}

#define nft_expr_obj(expr)

struct nft_object *nft_obj_lookup(const struct net *net,
				  const struct nft_table *table,
				  const struct nlattr *nla, u32 objtype,
				  u8 genmask);

void nft_obj_notify(struct net *net, const struct nft_table *table,
		    struct nft_object *obj, u32 portid, u32 seq,
		    int event, u16 flags, int family, int report, gfp_t gfp);

/**
 *	struct nft_object_type - stateful object type
 *
 *	@select_ops: function to select nft_object_ops
 *	@ops: default ops, used when no select_ops functions is present
 *	@list: list node in list of object types
 *	@type: stateful object numeric type
 *	@owner: module owner
 *	@maxattr: maximum netlink attribute
 *	@family: address family for AF-specific object types
 *	@policy: netlink attribute policy
 */
struct nft_object_type {};

/**
 *	struct nft_object_ops - stateful object operations
 *
 *	@eval: stateful object evaluation function
 *	@size: stateful object size
 *	@init: initialize object from netlink attributes
 *	@destroy: release existing stateful object
 *	@dump: netlink dump stateful object
 *	@update: update stateful object
 *	@type: pointer to object type
 */
struct nft_object_ops {};

int nft_register_obj(struct nft_object_type *obj_type);
void nft_unregister_obj(struct nft_object_type *obj_type);

#define NFT_NETDEVICE_MAX

/**
 *	struct nft_flowtable - nf_tables flow table
 *
 *	@list: flow table list node in table list
 * 	@table: the table the flow table is contained in
 *	@name: name of this flow table
 *	@hooknum: hook number
 *	@ops_len: number of hooks in array
 *	@genmask: generation mask
 *	@use: number of references to this flow table
 * 	@handle: unique object handle
 *	@hook_list: hook list for hooks per net_device in flowtables
 *	@data: rhashtable and garbage collector
 */
struct nft_flowtable {};

struct nft_flowtable *nft_flowtable_lookup(const struct nft_table *table,
					   const struct nlattr *nla,
					   u8 genmask);

void nf_tables_deactivate_flowtable(const struct nft_ctx *ctx,
				    struct nft_flowtable *flowtable,
				    enum nft_trans_phase phase);

void nft_register_flowtable_type(struct nf_flowtable_type *type);
void nft_unregister_flowtable_type(struct nf_flowtable_type *type);

/**
 *	struct nft_traceinfo - nft tracing information and state
 *
 *	@trace: other struct members are initialised
 *	@nf_trace: copy of skb->nf_trace before rule evaluation
 *	@type: event type (enum nft_trace_types)
 *	@skbid: hash of skb to be used as trace id
 *	@packet_dumped: packet headers sent in a previous traceinfo message
 *	@basechain: base chain currently processed
 */
struct nft_traceinfo {};

void nft_trace_init(struct nft_traceinfo *info, const struct nft_pktinfo *pkt,
		    const struct nft_chain *basechain);

void nft_trace_notify(const struct nft_pktinfo *pkt,
		      const struct nft_verdict *verdict,
		      const struct nft_rule_dp *rule,
		      struct nft_traceinfo *info);

#define MODULE_ALIAS_NFT_CHAIN(family, name)

#define MODULE_ALIAS_NFT_AF_EXPR(family, name)

#define MODULE_ALIAS_NFT_EXPR(name)

#define MODULE_ALIAS_NFT_OBJ(type)

#if IS_ENABLED(CONFIG_NF_TABLES)

/*
 * The gencursor defines two generations, the currently active and the
 * next one. Objects contain a bitmask of 2 bits specifying the generations
 * they're active in. A set bit means they're inactive in the generation
 * represented by that bit.
 *
 * New objects start out as inactive in the current and active in the
 * next generation. When committing the ruleset the bitmask is cleared,
 * meaning they're active in all generations. When removing an object,
 * it is set inactive in the next generation. After committing the ruleset,
 * the objects are removed.
 */
static inline unsigned int nft_gencursor_next(const struct net *net)
{}

static inline u8 nft_genmask_next(const struct net *net)
{}

static inline u8 nft_genmask_cur(const struct net *net)
{}

#define NFT_GENMASK_ANY

/*
 * Generic transaction helpers
 */

/* Check if this object is currently active. */
#define nft_is_active(__net, __obj)

/* Check if this object is active in the next generation. */
#define nft_is_active_next(__net, __obj)

/* This object becomes active in the next generation. */
#define nft_activate_next(__net, __obj)

/* This object becomes inactive in the next generation. */
#define nft_deactivate_next(__net, __obj)

/* After committing the ruleset, clear the stale generation bit. */
#define nft_clear(__net, __obj)
#define nft_active_genmask(__obj, __genmask)

/*
 * Set element transaction helpers
 */

static inline bool nft_set_elem_active(const struct nft_set_ext *ext,
				       u8 genmask)
{}

static inline void nft_set_elem_change_active(const struct net *net,
					      const struct nft_set *set,
					      struct nft_set_ext *ext)
{}

#endif /* IS_ENABLED(CONFIG_NF_TABLES) */

#define NFT_SET_ELEM_DEAD_MASK

#if defined(__LITTLE_ENDIAN_BITFIELD)
#define NFT_SET_ELEM_DEAD_BIT
#elif defined(__BIG_ENDIAN_BITFIELD)
#define NFT_SET_ELEM_DEAD_BIT
#else
#error
#endif

static inline void nft_set_elem_dead(struct nft_set_ext *ext)
{}

static inline int nft_set_elem_is_dead(const struct nft_set_ext *ext)
{}

/**
 * struct nft_trans - nf_tables object update in transaction
 *
 * @list: used internally
 * @net: struct net
 * @table: struct nft_table the object resides in
 * @msg_type: message type
 * @seq: netlink sequence number
 * @flags: modifiers to new request
 * @report: notify via unicast netlink message
 * @put_net: net needs to be put
 *
 * This is the information common to all objects in the transaction,
 * this must always be the first member of derived sub-types.
 */
struct nft_trans {};

/**
 * struct nft_trans_binding - nf_tables object with binding support in transaction
 * @nft_trans:    base structure, MUST be first member
 * @binding_list: list of objects with possible bindings
 *
 * This is the base type used by objects that can be bound to a chain.
 */
struct nft_trans_binding {};

struct nft_trans_rule {};

#define nft_trans_container_rule(trans)
#define nft_trans_rule(trans)
#define nft_trans_flow_rule(trans)
#define nft_trans_rule_id(trans)
#define nft_trans_rule_bound(trans)
#define nft_trans_rule_chain(trans)

struct nft_trans_set {};

#define nft_trans_container_set(t)
#define nft_trans_set(trans)
#define nft_trans_set_id(trans)
#define nft_trans_set_bound(trans)
#define nft_trans_set_update(trans)
#define nft_trans_set_timeout(trans)
#define nft_trans_set_gc_int(trans)
#define nft_trans_set_size(trans)

struct nft_trans_chain {};

#define nft_trans_container_chain(t)
#define nft_trans_chain(trans)
#define nft_trans_chain_update(trans)
#define nft_trans_chain_name(trans)
#define nft_trans_chain_stats(trans)
#define nft_trans_chain_policy(trans)
#define nft_trans_chain_bound(trans)
#define nft_trans_chain_id(trans)
#define nft_trans_basechain(trans)
#define nft_trans_chain_hooks(trans)

struct nft_trans_table {};

#define nft_trans_container_table(trans)
#define nft_trans_table_update(trans)

enum nft_trans_elem_flags {};

struct nft_trans_elem {};

#define nft_trans_container_elem(t)
#define nft_trans_elem_set(trans)
#define nft_trans_elem_priv(trans)
#define nft_trans_elem_update_flags(trans)
#define nft_trans_elem_timeout(trans)
#define nft_trans_elem_expiration(trans)
#define nft_trans_elem_set_bound(trans)

struct nft_trans_obj {};

#define nft_trans_container_obj(t)
#define nft_trans_obj(trans)
#define nft_trans_obj_newobj(trans)
#define nft_trans_obj_update(trans)

struct nft_trans_flowtable {};

#define nft_trans_container_flowtable(t)
#define nft_trans_flowtable(trans)
#define nft_trans_flowtable_update(trans)
#define nft_trans_flowtable_hooks(trans)
#define nft_trans_flowtable_flags(trans)

#define NFT_TRANS_GC_BATCHCOUNT

struct nft_trans_gc {};

static inline void nft_ctx_update(struct nft_ctx *ctx,
				  const struct nft_trans *trans)
{}

struct nft_trans_gc *nft_trans_gc_alloc(struct nft_set *set,
					unsigned int gc_seq, gfp_t gfp);
void nft_trans_gc_destroy(struct nft_trans_gc *trans);

struct nft_trans_gc *nft_trans_gc_queue_async(struct nft_trans_gc *gc,
					      unsigned int gc_seq, gfp_t gfp);
void nft_trans_gc_queue_async_done(struct nft_trans_gc *gc);

struct nft_trans_gc *nft_trans_gc_queue_sync(struct nft_trans_gc *gc, gfp_t gfp);
void nft_trans_gc_queue_sync_done(struct nft_trans_gc *trans);

void nft_trans_gc_elem_add(struct nft_trans_gc *gc, void *priv);

struct nft_trans_gc *nft_trans_gc_catchall_async(struct nft_trans_gc *gc,
						 unsigned int gc_seq);
struct nft_trans_gc *nft_trans_gc_catchall_sync(struct nft_trans_gc *gc);

void nft_setelem_data_deactivate(const struct net *net,
				 const struct nft_set *set,
				 struct nft_elem_priv *elem_priv);

int __init nft_chain_filter_init(void);
void nft_chain_filter_fini(void);

void __init nft_chain_route_init(void);
void nft_chain_route_fini(void);

void nf_tables_trans_destroy_flush_work(void);

int nf_msecs_to_jiffies64(const struct nlattr *nla, u64 *result);
__be64 nf_jiffies64_to_msecs(u64 input);

#ifdef CONFIG_MODULES
__printf(2, 3) int nft_request_module(struct net *net, const char *fmt, ...);
#else
static inline int nft_request_module(struct net *net, const char *fmt, ...) { return -ENOENT; }
#endif

struct nftables_pernet {};

extern unsigned int nf_tables_net_id;

static inline struct nftables_pernet *nft_pernet(const struct net *net)
{}

static inline u64 nft_net_tstamp(const struct net *net)
{}

#define __NFT_REDUCE_READONLY
#define NFT_REDUCE_READONLY

static inline bool nft_reduce_is_readonly(const struct nft_expr *expr)
{}

void nft_reg_track_update(struct nft_regs_track *track,
			  const struct nft_expr *expr, u8 dreg, u8 len);
void nft_reg_track_cancel(struct nft_regs_track *track, u8 dreg, u8 len);
void __nft_reg_track_cancel(struct nft_regs_track *track, u8 dreg);

static inline bool nft_reg_track_cmp(struct nft_regs_track *track,
				     const struct nft_expr *expr, u8 dreg)
{}

#endif /* _NET_NF_TABLES_H */