Skip to contentSkip to conversation

src: add compat header file definitions

PATCH In review Pablo Neira Ayuso 1 participant 1 message Sep 2, 2015 1 message not in the archive netfilter

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Pablo Neira Ayuso

author maintainer
#1 lore raw

PATCH 3/3 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.

---
 include/libnftnl/batch.h   |   16 +++++
 include/libnftnl/chain.h   |   77 ++++++++++++++++++++
 include/libnftnl/common.h  |   53 ++++++++++++++
 include/libnftnl/expr.h    |  168 ++++++++++++++++++++++++++++++++++++++++++++
 include/libnftnl/gen.h     |   36 ++++++++++
 include/libnftnl/rule.h    |   83 ++++++++++++++++++++++
 include/libnftnl/ruleset.h |   61 ++++++++++++++++
 include/libnftnl/set.h     |  136 +++++++++++++++++++++++++++++++++++
 include/libnftnl/table.h   |   65 +++++++++++++++++
 include/utils.h            |    2 +-
 10 files changed, 696 insertions(+), 1 deletion(-)
include/libnftnl/batch.h +16 -0
index ea1ea66..bd18733 100644
@@ -15,4 +15,20 @@ uint32_t nftnl_batch_buffer_len(struct nftnl_batch *batch);
 int nftnl_batch_iovec_len(struct nftnl_batch *batch);
 void nftnl_batch_iovec(struct nftnl_batch *batch, struct iovec *iov, uint32_t iovlen);
 
+/*
+ * Compat
+ */
+
+struct nft_batch;
+
+struct nft_batch *nft_batch_alloc(uint32_t pg_size, uint32_t pg_overrun_size);
+int nft_batch_update(struct nft_batch *batch);
+void nft_batch_free(struct nft_batch *batch);
+
+void *nft_batch_buffer(struct nft_batch *batch);
+uint32_t nft_batch_buffer_len(struct nft_batch *batch);
+
+int nft_batch_iovec_len(struct nft_batch *batch);
+void nft_batch_iovec(struct nft_batch *batch, struct iovec *iov, uint32_t iovlen);
+
 #endif
include/libnftnl/chain.h +77 -0

83 lines not on this page · raw message

include/libnftnl/common.h +53 -0

57 lines not on this page · raw message

include/libnftnl/expr.h +168 -0

174 lines not on this page · raw message

include/libnftnl/gen.h +36 -0
index eb72d56..1bb2d56 100644
@@ -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
include/libnftnl/rule.h +83 -0

89 lines not on this page · raw message

include/libnftnl/ruleset.h +61 -0

67 lines not on this page · raw message

include/libnftnl/set.h +136 -0

140 lines not on this page · raw message

include/libnftnl/table.h +65 -0

71 lines not on this page · raw message

include/utils.h +1 -1
index 7a46725..f7436fa 100644
@@ -10,7 +10,7 @@
 #include "config.h"
 #ifdef HAVE_VISIBILITY_HIDDEN
 #	define __visible	__attribute__((visibility("default")))
-#	define EXPORT_SYMBOL(x, y)	typeof(x) (x) __visible; __typeof (x) y __attribute ((alias (#x), visibility ("default")))
+#	define EXPORT_SYMBOL(x, y)	typeof(x) (x) __visible; __typeof (y) y __attribute ((alias (#x), visibility ("default")))
 #else
 #	define EXPORT_SYMBOL
 #endif
Signature · 1 line
1.7.10.4