path: root/include/libnftnl/rule.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/rule.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/rule.h')
1 files changed, 5 insertions, 5 deletions
diff --git a/include/libnftnl/rule.h b/include/libnftnl/rule.h
index d5b50ad..6f9d8c1 100644
--- a/include/libnftnl/rule.h
+++ b/include/libnftnl/rule.h
@@ -16,7 +16,7 @@ struct nftnl_rule;
struct nftnl_expr;
struct nftnl_rule *nftnl_rule_alloc(void);
-void nftnl_rule_free(struct nftnl_rule *);
+void nftnl_rule_free(const struct nftnl_rule *);
enum nftnl_rule_attr {
@@ -58,8 +58,8 @@ int nftnl_rule_parse(struct nftnl_rule *r, enum nftnl_parse_type type,
const char *data, struct nftnl_parse_err *err);
int nftnl_rule_parse_file(struct nftnl_rule *r, enum nftnl_parse_type type,
FILE *fp, struct nftnl_parse_err *err);
-int nftnl_rule_snprintf(char *buf, size_t size, struct nftnl_rule *t, uint32_t type, uint32_t flags);
-int nftnl_rule_fprintf(FILE *fp, struct nftnl_rule *r, uint32_t type, uint32_t flags);
+int nftnl_rule_snprintf(char *buf, size_t size, const struct nftnl_rule *t, uint32_t type, uint32_t flags);
+int nftnl_rule_fprintf(FILE *fp, const struct nftnl_rule *r, uint32_t type, uint32_t flags);
#define nftnl_rule_nlmsg_build_hdr nftnl_nlmsg_build_hdr
int nftnl_rule_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_rule *t);
@@ -78,7 +78,7 @@ struct nftnl_rule_list;
struct nftnl_rule_list *nftnl_rule_list_alloc(void);
void nftnl_rule_list_free(struct nftnl_rule_list *list);
-int nftnl_rule_list_is_empty(struct nftnl_rule_list *list);
+int nftnl_rule_list_is_empty(const struct nftnl_rule_list *list);
void nftnl_rule_list_add(struct nftnl_rule *r, struct nftnl_rule_list *list);
void nftnl_rule_list_add_tail(struct nftnl_rule *r, struct nftnl_rule_list *list);
void nftnl_rule_list_del(struct nftnl_rule *r);
@@ -89,7 +89,7 @@ struct nftnl_rule_list_iter;
struct nftnl_rule_list_iter *nftnl_rule_list_iter_create(struct nftnl_rule_list *l);
struct nftnl_rule *nftnl_rule_list_iter_cur(struct nftnl_rule_list_iter *iter);
struct nftnl_rule *nftnl_rule_list_iter_next(struct nftnl_rule_list_iter *iter);
-void nftnl_rule_list_iter_destroy(struct nftnl_rule_list_iter *iter);
+void nftnl_rule_list_iter_destroy(const struct nftnl_rule_list_iter *iter);
* Compat