path: root/include/libnftnl/chain.h
diff options
authorPatrick McHardy <>2016-04-26 14:16:58 +0100
committerPablo Neira Ayuso <>2016-05-09 22:57:10 +0200
commit600890067c40e1846398db373b9c38b6fe9a16a6 (patch)
treea2419ba0f0a817937bce9ca0f048ec43d24e5b42 /include/libnftnl/chain.h
parent813da08a8bd9d320d6a6a52b3cacc87b8d0ed1f9 (diff)
libnftnl: constify object arguments to various functions
flow table support needs constant object arguments to printing functions to avoid ugly casts. While at it, also constify object arguments to message construction, destructor and a few helper functions. Signed-off-by: Patrick McHardy <> Signed-off-by: Pablo Neira Ayuso <>
Diffstat (limited to 'include/libnftnl/chain.h')
1 files changed, 4 insertions, 4 deletions
diff --git a/include/libnftnl/chain.h b/include/libnftnl/chain.h
index 9ac8830..4c0d071 100644
--- a/include/libnftnl/chain.h
+++ b/include/libnftnl/chain.h
@@ -15,7 +15,7 @@ extern "C" {
struct nftnl_chain;
struct nftnl_chain *nftnl_chain_alloc(void);
-void nftnl_chain_free(struct nftnl_chain *);
+void nftnl_chain_free(const struct nftnl_chain *);
enum nftnl_chain_attr {
@@ -62,8 +62,8 @@ int nftnl_chain_parse(struct nftnl_chain *c, enum nftnl_parse_type type,
const char *data, struct nftnl_parse_err *err);
int nftnl_chain_parse_file(struct nftnl_chain *c, enum nftnl_parse_type type,
FILE *fp, struct nftnl_parse_err *err);
-int nftnl_chain_snprintf(char *buf, size_t size, struct nftnl_chain *t, uint32_t type, uint32_t flags);
-int nftnl_chain_fprintf(FILE *fp, struct nftnl_chain *c, uint32_t type, uint32_t flags);
+int nftnl_chain_snprintf(char *buf, size_t size, const struct nftnl_chain *t, uint32_t type, uint32_t flags);
+int nftnl_chain_fprintf(FILE *fp, const struct nftnl_chain *c, uint32_t type, uint32_t flags);
#define nftnl_chain_nlmsg_build_hdr nftnl_nlmsg_build_hdr
int nftnl_chain_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_chain *t);
@@ -72,7 +72,7 @@ struct nftnl_chain_list;
struct nftnl_chain_list *nftnl_chain_list_alloc(void);
void nftnl_chain_list_free(struct nftnl_chain_list *list);
-int nftnl_chain_list_is_empty(struct nftnl_chain_list *list);
+int nftnl_chain_list_is_empty(const struct nftnl_chain_list *list);
int nftnl_chain_list_foreach(struct nftnl_chain_list *chain_list, int (*cb)(struct nftnl_chain *t, void *data), void *data);
void nftnl_chain_list_add(struct nftnl_chain *r, struct nftnl_chain_list *list);