summaryrefslogtreecommitdiffstats
path: root/include/libnftnl/trace.h
blob: 18ab0c3baef757887af421f7a80ab8f77d522acf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef _LIBNFTNL_TRACE_H_
#define _LIBNFTNL_TRACE_H_

#include <stdint.h>
#include <stdbool.h>
#include <sys/types.h>

#ifdef __cplusplus
extern "C" {
#endif

enum nftnl_trace_attr {
	NFTNL_TRACE_CHAIN = 0,
	NFTNL_TRACE_FAMILY,
	NFTNL_TRACE_ID,
	NFTNL_TRACE_IIF,
	NFTNL_TRACE_IIFTYPE,
	NFTNL_TRACE_JUMP_TARGET,
	NFTNL_TRACE_OIF,
	NFTNL_TRACE_OIFTYPE,
	NFTNL_TRACE_MARK,
	NFTNL_TRACE_LL_HEADER,
	NFTNL_TRACE_NETWORK_HEADER,
	NFTNL_TRACE_TRANSPORT_HEADER,
	NFTNL_TRACE_TABLE,
	NFTNL_TRACE_TYPE,
	NFTNL_TRACE_RULE_HANDLE,
	NFTNL_TRACE_VERDICT,
	NFTNL_TRACE_NFPROTO,
	NFTNL_TRACE_POLICY,
	__NFTNL_TRACE_MAX,
};
#define NFTNL_TRACE_MAX (__NFTNL_TRACE_MAX - 1)

struct nftnl_trace;

struct nftnl_trace *nftnl_trace_alloc(void);
void nftnl_trace_free(const struct nftnl_trace *trace);

bool nftnl_trace_is_set(const struct nftnl_trace *trace, uint16_t type);

const void *nftnl_trace_get_data(const struct nftnl_trace *trace,
				 uint16_t type, uint32_t *data_len);

uint16_t nftnl_trace_get_u16(const struct nftnl_trace *trace, uint16_t type);
uint32_t nftnl_trace_get_u32(const struct nftnl_trace *trace, uint16_t type);
uint64_t nftnl_trace_get_u64(const struct nftnl_trace *trace, uint16_t type);
const char *nftnl_trace_get_str(const struct nftnl_trace *trace, uint16_t type);

int nftnl_trace_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_trace *t);
#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* _LIBNFTNL_TRACE_H_ */