| 1 | #ifndef _LIBNFTNL_UDATA_INTERNAL_H_ |
| 2 | #define _LIBNFTNL_UDATA_INTERNAL_H_ |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | #include <stddef.h> |
| 6 | |
| 7 | /* |
| 8 | * TLV structures: |
| 9 | * nftnl_udata |
| 10 | * <-------- HEADER --------> <------ PAYLOAD ------> |
| 11 | * +------------+-------------+- - - - - - - - - - - -+ |
| 12 | * | type | len | value | |
| 13 | * | (1 byte) | (1 byte) | | |
| 14 | * +--------------------------+- - - - - - - - - - - -+ |
| 15 | * <-- sizeof(nftnl_udata) -> <-- nftnl_udata->len --> |
| 16 | */ |
| 17 | struct nftnl_udata { |
| 18 | uint8_t type; |
| 19 | uint8_t len; |
| 20 | unsigned char value[]; |
| 21 | } __attribute__((__packed__)); |
| 22 | |
| 23 | /* |
| 24 | * +---------------------------------++ |
| 25 | * | data[] || |
| 26 | * | || || |
| 27 | * | \/ \/ |
| 28 | * +-------+-------+-------+-------+ ... +-------+- - - - - - -+ |
| 29 | * | size | end | TLV | TLV | | TLV | Empty | |
| 30 | * +-------+-------+-------+-------+ ... +-------+- - - - - - -+ |
| 31 | * |<---- nftnl_udata_len() ---->| |
| 32 | * |<----------- nftnl_udata_size() ---------->| |
| 33 | */ |
| 34 | struct nftnl_udata_buf { |
| 35 | uint32_t size; |
| 36 | char *end; |
| 37 | char data[]; |
| 38 | }; |
| 39 | |
| 40 | #endif /* _LIBNFTNL_UDATA_INTERNAL_H_ */ |