linux/include/net/netfilter/nf_conntrack_timeout.h

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

#include <net/net_namespace.h>
#include <linux/netfilter/nf_conntrack_common.h>
#include <linux/netfilter/nf_conntrack_tuple_common.h>
#include <linux/refcount.h>
#include <net/netfilter/nf_conntrack.h>
#include <net/netfilter/nf_conntrack_extend.h>

#define CTNL_TIMEOUT_NAME_MAX

struct nf_ct_timeout {};

struct nf_conn_timeout {};

static inline unsigned int *
nf_ct_timeout_data(const struct nf_conn_timeout *t)
{}

static inline
struct nf_conn_timeout *nf_ct_timeout_find(const struct nf_conn *ct)
{}

static inline
struct nf_conn_timeout *nf_ct_timeout_ext_add(struct nf_conn *ct,
					      struct nf_ct_timeout *timeout,
					      gfp_t gfp)
{
#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
	struct nf_conn_timeout *timeout_ext;

	timeout_ext = nf_ct_ext_add(ct, NF_CT_EXT_TIMEOUT, gfp);
	if (timeout_ext == NULL)
		return NULL;

	rcu_assign_pointer(timeout_ext->timeout, timeout);

	return timeout_ext;
#else
	return NULL;
#endif
};

static inline unsigned int *nf_ct_timeout_lookup(const struct nf_conn *ct)
{}

#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
void nf_ct_untimeout(struct net *net, struct nf_ct_timeout *timeout);
int nf_ct_set_timeout(struct net *net, struct nf_conn *ct, u8 l3num, u8 l4num,
		      const char *timeout_name);
void nf_ct_destroy_timeout(struct nf_conn *ct);
#else
static inline int nf_ct_set_timeout(struct net *net, struct nf_conn *ct,
				    u8 l3num, u8 l4num,
				    const char *timeout_name)
{
	return -EOPNOTSUPP;
}

static inline void nf_ct_destroy_timeout(struct nf_conn *ct)
{
	return;
}
#endif /* CONFIG_NF_CONNTRACK_TIMEOUT */

#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
struct nf_ct_timeout_hooks {};

extern const struct nf_ct_timeout_hooks __rcu *nf_ct_timeout_hook;
#endif

#endif /* _NF_CONNTRACK_TIMEOUT_H */