diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2015-09-01 19:34:18 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2015-09-07 19:24:33 +0200 |
commit | 96807c4c05e1e76b8bbf00d874a28a279e7d2840 (patch) | |
tree | fc74bc7a9bdc6c3e16524449812bc6cc7f51c5eb /include/libnftnl/gen.h | |
parent | 760768890e60617acfd144dce875a4a3be14513c (diff) |
src: add compat header file definitions
This patch restores the original nft_* definitions from the header files to
avoid sudden compilation breakage of the existing clients of this library.
Then, moving forward the idea is to deprecate the old nft_* symbols anytime
soon using __attribute__((deprecated)) from the header files to warn our users
that they need to update their code.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/libnftnl/gen.h')
-rw-r--r-- | include/libnftnl/gen.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/libnftnl/gen.h b/include/libnftnl/gen.h index eb72d56..1bb2d56 100644 --- a/include/libnftnl/gen.h +++ b/include/libnftnl/gen.h @@ -44,6 +44,42 @@ int nftnl_gen_fprintf(FILE *fp, struct nftnl_gen *gen, uint32_t type, uint32_t f #define nftnl_gen_nlmsg_build_hdr nftnl_nlmsg_build_hdr int nftnl_gen_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_gen *gen); +/* + * Compat + */ + +struct nft_gen; + +struct nft_gen *nft_gen_alloc(void); +void nft_gen_free(struct nft_gen *); + +enum { + NFT_GEN_ID = 0, + __NFT_GEN_MAX +}; +#define NFT_GEN_MAX (__NFT_GEN_MAX - 1) + +bool nft_gen_attr_is_set(const struct nft_gen *gen, uint16_t attr); +void nft_gen_attr_unset(struct nft_gen *gen, uint16_t attr); +void nft_gen_attr_set(struct nft_gen *gen, uint16_t attr, const void *data); +void nft_gen_attr_set_data(struct nft_gen *gen, uint16_t attr, + const void *data, uint32_t data_len); +const void *nft_gen_attr_get(struct nft_gen *gen, uint16_t attr); +const void *nft_gen_attr_get_data(struct nft_gen *gen, uint16_t attr, + uint32_t *data_len); + +void nft_gen_attr_set_u32(struct nft_gen *gen, uint16_t attr, uint32_t data); +uint32_t nft_gen_attr_get_u32(struct nft_gen *gen, uint16_t attr); + +struct nlmsghdr; +int nft_gen_nlmsg_parse(const struct nlmsghdr *nlh, struct nft_gen *gen); + +int nft_gen_snprintf(char *buf, size_t size, struct nft_gen *gen, uint32_t type, uint32_t flags); +int nft_gen_fprintf(FILE *fp, struct nft_gen *gen, uint32_t type, uint32_t flags); + +#define nft_gen_nlmsg_build_hdr nft_nlmsg_build_hdr +int nft_gen_nlmsg_parse(const struct nlmsghdr *nlh, struct nft_gen *gen); + #ifdef __cplusplus } /* extern "C" */ #endif |