From 206d98a54305a1178c7d9c5e234699813f8c6f5a Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Mon, 7 Sep 2015 17:56:47 +0200 Subject: src: rename nftnl_rule_expr to nftnl_expr Use a shorter name for this, morever this can be used from sets so the _rule_ is misleading. Signed-off-by: Pablo Neira Ayuso --- include/expr.h | 6 +++--- include/expr_ops.h | 18 +++++++++--------- include/json.h | 2 +- include/libnftnl/expr.h | 38 +++++++++++++++++++------------------- include/libnftnl/rule.h | 16 ++++++++-------- include/set.h | 4 ++-- include/set_elem.h | 2 +- include/xml.h | 2 +- 8 files changed, 44 insertions(+), 44 deletions(-) (limited to 'include') diff --git a/include/expr.h b/include/expr.h index 26b4a95..be45e95 100644 --- a/include/expr.h +++ b/include/expr.h @@ -3,7 +3,7 @@ struct expr_ops; -struct nftnl_rule_expr { +struct nftnl_expr { struct list_head head; uint32_t flags; struct expr_ops *ops; @@ -12,8 +12,8 @@ struct nftnl_rule_expr { struct nlmsghdr; -void nftnl_rule_expr_build_payload(struct nlmsghdr *nlh, struct nftnl_rule_expr *expr); -struct nftnl_rule_expr *nftnl_rule_expr_parse(struct nlattr *attr); +void nftnl_expr_build_payload(struct nlmsghdr *nlh, struct nftnl_expr *expr); +struct nftnl_expr *nftnl_expr_parse(struct nlattr *attr); #endif diff --git a/include/expr_ops.h b/include/expr_ops.h index caf9218..cecad95 100644 --- a/include/expr_ops.h +++ b/include/expr_ops.h @@ -6,21 +6,21 @@ struct nlattr; struct nlmsghdr; -struct nftnl_rule_expr; +struct nftnl_expr; struct expr_ops { const char *name; uint32_t alloc_len; int max_attr; - void (*free)(struct nftnl_rule_expr *e); - int (*set)(struct nftnl_rule_expr *e, uint16_t type, const void *data, uint32_t data_len); - const void *(*get)(const struct nftnl_rule_expr *e, uint16_t type, uint32_t *data_len); - int (*parse)(struct nftnl_rule_expr *e, struct nlattr *attr); - void (*build)(struct nlmsghdr *nlh, struct nftnl_rule_expr *e); - int (*snprintf)(char *buf, size_t len, uint32_t type, uint32_t flags, struct nftnl_rule_expr *e); - int (*xml_parse)(struct nftnl_rule_expr *e, mxml_node_t *tree, + void (*free)(struct nftnl_expr *e); + int (*set)(struct nftnl_expr *e, uint16_t type, const void *data, uint32_t data_len); + const void *(*get)(const struct nftnl_expr *e, uint16_t type, uint32_t *data_len); + int (*parse)(struct nftnl_expr *e, struct nlattr *attr); + void (*build)(struct nlmsghdr *nlh, struct nftnl_expr *e); + int (*snprintf)(char *buf, size_t len, uint32_t type, uint32_t flags, struct nftnl_expr *e); + int (*xml_parse)(struct nftnl_expr *e, mxml_node_t *tree, struct nftnl_parse_err *err); - int (*json_parse)(struct nftnl_rule_expr *e, json_t *data, + int (*json_parse)(struct nftnl_expr *e, json_t *data, struct nftnl_parse_err *err); }; diff --git a/include/json.h b/include/json.h index a15a65b..bd70cec 100644 --- a/include/json.h +++ b/include/json.h @@ -29,7 +29,7 @@ int nftnl_jansson_str2num(json_t *root, const char *node_name, int base, void *o enum nftnl_type type, struct nftnl_parse_err *err); int nftnl_jansson_parse_reg(json_t *root, const char *node_name, int type, void *out, struct nftnl_parse_err *err); -struct nftnl_rule_expr *nftnl_jansson_expr_parse(json_t *root, +struct nftnl_expr *nftnl_jansson_expr_parse(json_t *root, struct nftnl_parse_err *err, struct nftnl_set_list *set_list); int nftnl_jansson_data_reg_parse(json_t *root, const char *node_name, diff --git a/include/libnftnl/expr.h b/include/libnftnl/expr.h index c0c8259..0600860 100644 --- a/include/libnftnl/expr.h +++ b/include/libnftnl/expr.h @@ -9,34 +9,34 @@ extern "C" { #endif -struct nftnl_rule_expr; +struct nftnl_expr; enum { NFTNL_RULE_EXPR_ATTR_NAME = 0, NFTNL_RULE_EXPR_ATTR_BASE, }; -struct nftnl_rule_expr *nftnl_rule_expr_alloc(const char *name); -void nftnl_rule_expr_free(struct nftnl_rule_expr *expr); +struct nftnl_expr *nftnl_expr_alloc(const char *name); +void nftnl_expr_free(struct nftnl_expr *expr); -bool nftnl_rule_expr_is_set(const struct nftnl_rule_expr *expr, uint16_t type); -void nftnl_rule_expr_set(struct nftnl_rule_expr *expr, uint16_t type, const void *data, uint32_t data_len); -#define nftnl_rule_expr_set_data nftnl_rule_expr_set -void nftnl_rule_expr_set_u8(struct nftnl_rule_expr *expr, uint16_t type, uint8_t data); -void nftnl_rule_expr_set_u16(struct nftnl_rule_expr *expr, uint16_t type, uint16_t data); -void nftnl_rule_expr_set_u32(struct nftnl_rule_expr *expr, uint16_t type, uint32_t data); -void nftnl_rule_expr_set_u64(struct nftnl_rule_expr *expr, uint16_t type, uint64_t data); -void nftnl_rule_expr_set_str(struct nftnl_rule_expr *expr, uint16_t type, const char *str); +bool nftnl_expr_is_set(const struct nftnl_expr *expr, uint16_t type); +void nftnl_expr_set(struct nftnl_expr *expr, uint16_t type, const void *data, uint32_t data_len); +#define nftnl_expr_set_data nftnl_expr_set +void nftnl_expr_set_u8(struct nftnl_expr *expr, uint16_t type, uint8_t data); +void nftnl_expr_set_u16(struct nftnl_expr *expr, uint16_t type, uint16_t data); +void nftnl_expr_set_u32(struct nftnl_expr *expr, uint16_t type, uint32_t data); +void nftnl_expr_set_u64(struct nftnl_expr *expr, uint16_t type, uint64_t data); +void nftnl_expr_set_str(struct nftnl_expr *expr, uint16_t type, const char *str); -const void *nftnl_rule_expr_get(const struct nftnl_rule_expr *expr, uint16_t type, uint32_t *data_len); -#define nftnl_rule_expr_get_data nftnl_rule_expr_get -uint8_t nftnl_rule_expr_get_u8(const struct nftnl_rule_expr *expr, uint16_t type); -uint16_t nftnl_rule_expr_get_u16(const struct nftnl_rule_expr *expr, uint16_t type); -uint32_t nftnl_rule_expr_get_u32(const struct nftnl_rule_expr *expr, uint16_t type); -uint64_t nftnl_rule_expr_get_u64(const struct nftnl_rule_expr *expr, uint16_t type); -const char *nftnl_rule_expr_get_str(const struct nftnl_rule_expr *expr, uint16_t type); +const void *nftnl_expr_get(const struct nftnl_expr *expr, uint16_t type, uint32_t *data_len); +#define nftnl_expr_get_data nftnl_expr_get +uint8_t nftnl_expr_get_u8(const struct nftnl_expr *expr, uint16_t type); +uint16_t nftnl_expr_get_u16(const struct nftnl_expr *expr, uint16_t type); +uint32_t nftnl_expr_get_u32(const struct nftnl_expr *expr, uint16_t type); +uint64_t nftnl_expr_get_u64(const struct nftnl_expr *expr, uint16_t type); +const char *nftnl_expr_get_str(const struct nftnl_expr *expr, uint16_t type); -int nftnl_rule_expr_snprintf(char *buf, size_t buflen, struct nftnl_rule_expr *expr, uint32_t type, uint32_t flags); +int nftnl_expr_snprintf(char *buf, size_t buflen, struct nftnl_expr *expr, uint32_t type, uint32_t flags); enum { NFTNL_EXPR_PAYLOAD_DREG = NFTNL_RULE_EXPR_ATTR_BASE, diff --git a/include/libnftnl/rule.h b/include/libnftnl/rule.h index c1bfcb6..f5f8555 100644 --- a/include/libnftnl/rule.h +++ b/include/libnftnl/rule.h @@ -13,7 +13,7 @@ extern "C" { #endif struct nftnl_rule; -struct nftnl_rule_expr; +struct nftnl_expr; struct nftnl_rule *nftnl_rule_alloc(void); void nftnl_rule_free(struct nftnl_rule *); @@ -48,7 +48,7 @@ uint8_t nftnl_rule_attr_get_u8(const struct nftnl_rule *r, uint16_t attr); uint32_t nftnl_rule_attr_get_u32(const struct nftnl_rule *r, uint16_t attr); uint64_t nftnl_rule_attr_get_u64(const struct nftnl_rule *r, uint16_t attr); -void nftnl_rule_add_expr(struct nftnl_rule *r, struct nftnl_rule_expr *expr); +void nftnl_rule_add_expr(struct nftnl_rule *r, struct nftnl_expr *expr); struct nlmsghdr; @@ -64,15 +64,15 @@ int nftnl_rule_fprintf(FILE *fp, struct nftnl_rule *r, uint32_t type, uint32_t f #define nftnl_rule_nlmsg_build_hdr nftnl_nlmsg_build_hdr int nftnl_rule_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_rule *t); -int nftnl_rule_expr_foreach(struct nftnl_rule *r, - int (*cb)(struct nftnl_rule_expr *e, void *data), +int nftnl_expr_foreach(struct nftnl_rule *r, + int (*cb)(struct nftnl_expr *e, void *data), void *data); -struct nftnl_rule_expr_iter; +struct nftnl_expr_iter; -struct nftnl_rule_expr_iter *nftnl_rule_expr_iter_create(struct nftnl_rule *r); -struct nftnl_rule_expr *nftnl_rule_expr_iter_next(struct nftnl_rule_expr_iter *iter); -void nftnl_rule_expr_iter_destroy(struct nftnl_rule_expr_iter *iter); +struct nftnl_expr_iter *nftnl_expr_iter_create(struct nftnl_rule *r); +struct nftnl_expr *nftnl_expr_iter_next(struct nftnl_expr_iter *iter); +void nftnl_expr_iter_destroy(struct nftnl_expr_iter *iter); struct nftnl_rule_list; diff --git a/include/set.h b/include/set.h index 1addd0f..c3b96f2 100644 --- a/include/set.h +++ b/include/set.h @@ -27,8 +27,8 @@ struct nftnl_set { }; struct nftnl_set_list; -struct nftnl_rule_expr; -int nftnl_set_lookup_id(struct nftnl_rule_expr *e, struct nftnl_set_list *set_list, +struct nftnl_expr; +int nftnl_set_lookup_id(struct nftnl_expr *e, struct nftnl_set_list *set_list, uint32_t *set_id); #endif diff --git a/include/set_elem.h b/include/set_elem.h index 13e096c..60cecc9 100644 --- a/include/set_elem.h +++ b/include/set_elem.h @@ -8,7 +8,7 @@ struct nftnl_set_elem { uint32_t set_elem_flags; union nftnl_data_reg key; union nftnl_data_reg data; - struct nftnl_rule_expr *expr; + struct nftnl_expr *expr; uint32_t flags; uint64_t timeout; uint64_t expiration; diff --git a/include/xml.h b/include/xml.h index 454de44..7b33a83 100644 --- a/include/xml.h +++ b/include/xml.h @@ -18,7 +18,7 @@ union nftnl_data_reg; mxml_node_t *nftnl_mxml_build_tree(const void *data, const char *treename, struct nftnl_parse_err *err, enum nftnl_parse_input input); -struct nftnl_rule_expr *nftnl_mxml_expr_parse(mxml_node_t *node, +struct nftnl_expr *nftnl_mxml_expr_parse(mxml_node_t *node, struct nftnl_parse_err *err, struct nftnl_set_list *set_list); int nftnl_mxml_reg_parse(mxml_node_t *tree, const char *reg_name, uint32_t *reg, -- cgit v1.2.3