From 600890067c40e1846398db373b9c38b6fe9a16a6 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 26 Apr 2016 14:16:58 +0100 Subject: 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 --- include/libnftnl/table.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'include/libnftnl/table.h') diff --git a/include/libnftnl/table.h b/include/libnftnl/table.h index c52d579..8972d09 100644 --- a/include/libnftnl/table.h +++ b/include/libnftnl/table.h @@ -15,7 +15,7 @@ extern "C" { struct nftnl_table; struct nftnl_table *nftnl_table_alloc(void); -void nftnl_table_free(struct nftnl_table *); +void nftnl_table_free(const struct nftnl_table *); enum nftnl_table_attr { NFTNL_TABLE_NAME = 0, @@ -31,16 +31,16 @@ void nftnl_table_unset(struct nftnl_table *t, uint16_t attr); void nftnl_table_set(struct nftnl_table *t, uint16_t attr, const void *data); void nftnl_table_set_data(struct nftnl_table *t, uint16_t attr, const void *data, uint32_t data_len); -const void *nftnl_table_get(struct nftnl_table *t, uint16_t attr); -const void *nftnl_table_get_data(struct nftnl_table *t, uint16_t attr, - uint32_t *data_len); +const void *nftnl_table_get(const struct nftnl_table *t, uint16_t attr); +const void *nftnl_table_get_data(const struct nftnl_table *t, uint16_t attr, + uint32_t *data_len); void nftnl_table_set_u8(struct nftnl_table *t, uint16_t attr, uint8_t data); void nftnl_table_set_u32(struct nftnl_table *t, uint16_t attr, uint32_t data); void nftnl_table_set_str(struct nftnl_table *t, uint16_t attr, const char *str); -uint8_t nftnl_table_get_u8(struct nftnl_table *t, uint16_t attr); -uint32_t nftnl_table_get_u32(struct nftnl_table *t, uint16_t attr); -const char *nftnl_table_get_str(struct nftnl_table *t, uint16_t attr); +uint8_t nftnl_table_get_u8(const struct nftnl_table *t, uint16_t attr); +uint32_t nftnl_table_get_u32(const struct nftnl_table *t, uint16_t attr); +const char *nftnl_table_get_str(const struct nftnl_table *t, uint16_t attr); struct nlmsghdr; @@ -50,8 +50,8 @@ int nftnl_table_parse(struct nftnl_table *t, enum nftnl_parse_type type, const char *data, struct nftnl_parse_err *err); int nftnl_table_parse_file(struct nftnl_table *t, enum nftnl_parse_type type, FILE *fp, struct nftnl_parse_err *err); -int nftnl_table_snprintf(char *buf, size_t size, struct nftnl_table *t, uint32_t type, uint32_t flags); -int nftnl_table_fprintf(FILE *fp, struct nftnl_table *t, uint32_t type, uint32_t flags); +int nftnl_table_snprintf(char *buf, size_t size, const struct nftnl_table *t, uint32_t type, uint32_t flags); +int nftnl_table_fprintf(FILE *fp, const struct nftnl_table *t, uint32_t type, uint32_t flags); #define nftnl_table_nlmsg_build_hdr nftnl_nlmsg_build_hdr int nftnl_table_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_table *t); @@ -60,7 +60,7 @@ struct nftnl_table_list; struct nftnl_table_list *nftnl_table_list_alloc(void); void nftnl_table_list_free(struct nftnl_table_list *list); -int nftnl_table_list_is_empty(struct nftnl_table_list *list); +int nftnl_table_list_is_empty(const struct nftnl_table_list *list); int nftnl_table_list_foreach(struct nftnl_table_list *table_list, int (*cb)(struct nftnl_table *t, void *data), void *data); void nftnl_table_list_add(struct nftnl_table *r, struct nftnl_table_list *list); @@ -71,7 +71,7 @@ struct nftnl_table_list_iter; struct nftnl_table_list_iter *nftnl_table_list_iter_create(struct nftnl_table_list *l); struct nftnl_table *nftnl_table_list_iter_next(struct nftnl_table_list_iter *iter); -void nftnl_table_list_iter_destroy(struct nftnl_table_list_iter *iter); +void nftnl_table_list_iter_destroy(const struct nftnl_table_list_iter *iter); /* * Compat -- cgit v1.2.3