summaryrefslogtreecommitdiffstats
path: root/include/libnftnl/set.h
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2016-04-26 14:16:58 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2016-05-09 22:57:10 +0200
commit600890067c40e1846398db373b9c38b6fe9a16a6 (patch)
treea2419ba0f0a817937bce9ca0f048ec43d24e5b42 /include/libnftnl/set.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 <kaber@trash.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/libnftnl/set.h')
-rw-r--r--include/libnftnl/set.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/include/libnftnl/set.h b/include/libnftnl/set.h
index 11243f5..c9a879a 100644
--- a/include/libnftnl/set.h
+++ b/include/libnftnl/set.h
@@ -29,7 +29,7 @@ enum nftnl_set_attr {
struct nftnl_set;
struct nftnl_set *nftnl_set_alloc(void);
-void nftnl_set_free(struct nftnl_set *s);
+void nftnl_set_free(const struct nftnl_set *s);
struct nftnl_set *nftnl_set_clone(const struct nftnl_set *set);
@@ -42,12 +42,12 @@ void nftnl_set_set_u32(struct nftnl_set *s, uint16_t attr, uint32_t val);
void nftnl_set_set_u64(struct nftnl_set *s, uint16_t attr, uint64_t val);
void nftnl_set_set_str(struct nftnl_set *s, uint16_t attr, const char *str);
-const void *nftnl_set_get(struct nftnl_set *s, uint16_t attr);
-const void *nftnl_set_get_data(struct nftnl_set *s, uint16_t attr,
- uint32_t *data_len);
-const char *nftnl_set_get_str(struct nftnl_set *s, uint16_t attr);
-uint32_t nftnl_set_get_u32(struct nftnl_set *s, uint16_t attr);
-uint64_t nftnl_set_get_u64(struct nftnl_set *s, uint16_t attr);
+const void *nftnl_set_get(const struct nftnl_set *s, uint16_t attr);
+const void *nftnl_set_get_data(const struct nftnl_set *s, uint16_t attr,
+ uint32_t *data_len);
+const char *nftnl_set_get_str(const struct nftnl_set *s, uint16_t attr);
+uint32_t nftnl_set_get_u32(const struct nftnl_set *s, uint16_t attr);
+uint64_t nftnl_set_get_u64(const struct nftnl_set *s, uint16_t attr);
struct nlmsghdr;
@@ -56,14 +56,14 @@ void nftnl_set_nlmsg_build_payload(struct nlmsghdr *nlh, struct nftnl_set *s);
int nftnl_set_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s);
int nftnl_set_elems_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s);
-int nftnl_set_snprintf(char *buf, size_t size, struct nftnl_set *s, uint32_t type, uint32_t flags);
-int nftnl_set_fprintf(FILE *fp, struct nftnl_set *s, uint32_t type, uint32_t flags);
+int nftnl_set_snprintf(char *buf, size_t size, const struct nftnl_set *s, uint32_t type, uint32_t flags);
+int nftnl_set_fprintf(FILE *fp, const struct nftnl_set *s, uint32_t type, uint32_t flags);
struct nftnl_set_list;
struct nftnl_set_list *nftnl_set_list_alloc(void);
void nftnl_set_list_free(struct nftnl_set_list *list);
-int nftnl_set_list_is_empty(struct nftnl_set_list *list);
+int nftnl_set_list_is_empty(const struct nftnl_set_list *list);
void nftnl_set_list_add(struct nftnl_set *s, struct nftnl_set_list *list);
void nftnl_set_list_add_tail(struct nftnl_set *s, struct nftnl_set_list *list);
void nftnl_set_list_del(struct nftnl_set *s);
@@ -73,7 +73,7 @@ struct nftnl_set_list_iter;
struct nftnl_set_list_iter *nftnl_set_list_iter_create(struct nftnl_set_list *l);
struct nftnl_set *nftnl_set_list_iter_cur(struct nftnl_set_list_iter *iter);
struct nftnl_set *nftnl_set_list_iter_next(struct nftnl_set_list_iter *iter);
-void nftnl_set_list_iter_destroy(struct nftnl_set_list_iter *iter);
+void nftnl_set_list_iter_destroy(const struct nftnl_set_list_iter *iter);
int nftnl_set_parse(struct nftnl_set *s, enum nftnl_parse_type type,
const char *data, struct nftnl_parse_err *err);
@@ -126,7 +126,7 @@ int nftnl_set_elem_parse(struct nftnl_set_elem *e, enum nftnl_parse_type type,
const char *data, struct nftnl_parse_err *err);
int nftnl_set_elem_parse_file(struct nftnl_set_elem *e, enum nftnl_parse_type type,
FILE *fp, struct nftnl_parse_err *err);
-int nftnl_set_elem_snprintf(char *buf, size_t size, struct nftnl_set_elem *s, uint32_t type, uint32_t flags);
+int nftnl_set_elem_snprintf(char *buf, size_t size, const struct nftnl_set_elem *s, uint32_t type, uint32_t flags);
int nftnl_set_elem_fprintf(FILE *fp, struct nftnl_set_elem *se, uint32_t type, uint32_t flags);
int nftnl_set_elem_foreach(struct nftnl_set *s, int (*cb)(struct nftnl_set_elem *e, void *data), void *data);