path: root/include
diff options
authorPablo Neira Ayuso <>2015-09-07 17:56:47 +0200
committerPablo Neira Ayuso <>2015-09-07 20:00:57 +0200
commit206d98a54305a1178c7d9c5e234699813f8c6f5a (patch)
treecf4a1335eb6724cfbdb3a8caa5346a78758d9506 /include
parent96807c4c05e1e76b8bbf00d874a28a279e7d2840 (diff)
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 <>
Diffstat (limited to 'include')
8 files changed, 44 insertions, 44 deletions
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);
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" {
-struct nftnl_rule_expr;
+struct nftnl_expr;
enum {
-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 {
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" {
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);
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,