| 1 | #ifndef _LIBNFTNL_TRACE_H_ |
| 2 | #define _LIBNFTNL_TRACE_H_ |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | #include <stdbool.h> |
| 6 | #include <sys/types.h> |
| 7 | |
| 8 | #ifdef __cplusplus |
| 9 | extern "C" { |
| 10 | #endif |
| 11 | |
| 12 | enum nftnl_trace_attr { |
| 13 | NFTNL_TRACE_CHAIN = 0, |
| 14 | NFTNL_TRACE_FAMILY, |
| 15 | NFTNL_TRACE_ID, |
| 16 | NFTNL_TRACE_IIF, |
| 17 | NFTNL_TRACE_IIFTYPE, |
| 18 | NFTNL_TRACE_JUMP_TARGET, |
| 19 | NFTNL_TRACE_OIF, |
| 20 | NFTNL_TRACE_OIFTYPE, |
| 21 | NFTNL_TRACE_MARK, |
| 22 | NFTNL_TRACE_LL_HEADER, |
| 23 | NFTNL_TRACE_NETWORK_HEADER, |
| 24 | NFTNL_TRACE_TRANSPORT_HEADER, |
| 25 | NFTNL_TRACE_TABLE, |
| 26 | NFTNL_TRACE_TYPE, |
| 27 | NFTNL_TRACE_RULE_HANDLE, |
| 28 | NFTNL_TRACE_VERDICT, |
| 29 | NFTNL_TRACE_NFPROTO, |
| 30 | NFTNL_TRACE_POLICY, |
| 31 | NFTNL_TRACE_CT_DIRECTION, |
| 32 | NFTNL_TRACE_CT_ID, |
| 33 | NFTNL_TRACE_CT_STATE, |
| 34 | NFTNL_TRACE_CT_STATUS, |
| 35 | __NFTNL_TRACE_MAX, |
| 36 | }; |
| 37 | #define NFTNL_TRACE_MAX (__NFTNL_TRACE_MAX - 1) |
| 38 | |
| 39 | struct nftnl_trace; |
| 40 | |
| 41 | struct nftnl_trace *nftnl_trace_alloc(void); |
| 42 | void nftnl_trace_free(const struct nftnl_trace *trace); |
| 43 | |
| 44 | bool nftnl_trace_is_set(const struct nftnl_trace *trace, uint16_t type); |
| 45 | |
| 46 | const void *nftnl_trace_get_data(const struct nftnl_trace *trace, |
| 47 | uint16_t type, uint32_t *data_len); |
| 48 | |
| 49 | uint16_t nftnl_trace_get_u16(const struct nftnl_trace *trace, uint16_t type); |
| 50 | uint32_t nftnl_trace_get_u32(const struct nftnl_trace *trace, uint16_t type); |
| 51 | uint64_t nftnl_trace_get_u64(const struct nftnl_trace *trace, uint16_t type); |
| 52 | const char *nftnl_trace_get_str(const struct nftnl_trace *trace, uint16_t type); |
| 53 | |
| 54 | int nftnl_trace_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_trace *t); |
| 55 | #ifdef __cplusplus |
| 56 | } /* extern "C" */ |
| 57 | #endif |
| 58 | |
| 59 | #endif /* _LIBNFTNL_TRACE_H_ */ |