| 1 | #ifndef _DATA_H_ |
| 2 | #define _DATA_H_ |
| 3 | |
| 4 | #include <linux/netfilter/nf_tables.h> |
| 5 | #include <stdint.h> |
| 6 | #include <stdbool.h> |
| 7 | #include <unistd.h> |
| 8 | |
| 9 | enum { |
| 10 | DATA_NONE, |
| 11 | DATA_VALUE, |
| 12 | DATA_VERDICT, |
| 13 | DATA_CHAIN, |
| 14 | }; |
| 15 | |
| 16 | enum { |
| 17 | DATA_F_NOPFX = 1 << 0, |
| 18 | }; |
| 19 | |
| 20 | union nftnl_data_reg { |
| 21 | struct { |
| 22 | uint32_t val[NFT_DATA_VALUE_MAXLEN / sizeof(uint32_t)]; |
| 23 | uint32_t len; |
| 24 | uint32_t byteorder; |
| 25 | uint8_t sizes[NFT_REG32_COUNT]; |
| 26 | }; |
| 27 | struct { |
| 28 | uint32_t verdict; |
| 29 | const char *chain; |
| 30 | uint32_t chain_id; |
| 31 | }; |
| 32 | }; |
| 33 | |
| 34 | int nftnl_data_reg_snprintf(char *buf, size_t size, |
| 35 | const union nftnl_data_reg *reg, |
| 36 | uint32_t flags, int reg_type); |
| 37 | struct nlattr; |
| 38 | |
| 39 | int nftnl_parse_data(union nftnl_data_reg *data, struct nlattr *attr, int *type); |
| 40 | int nftnl_data_cpy(union nftnl_data_reg *dreg, const void *src, |
| 41 | uint32_t len, uint32_t byteorder, uint8_t *sizes); |
| 42 | |
| 43 | #endif |