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 --- src/expr/ct.c | 56 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'src/expr/ct.c') diff --git a/src/expr/ct.c b/src/expr/ct.c index 73ae33a..584dffe 100644 --- a/src/expr/ct.c +++ b/src/expr/ct.c @@ -36,7 +36,7 @@ struct nftnl_expr_ct { #endif static int -nftnl_rule_expr_ct_set(struct nftnl_rule_expr *e, uint16_t type, +nftnl_expr_ct_set(struct nftnl_expr *e, uint16_t type, const void *data, uint32_t data_len) { struct nftnl_expr_ct *ct = nftnl_expr_data(e); @@ -61,7 +61,7 @@ nftnl_rule_expr_ct_set(struct nftnl_rule_expr *e, uint16_t type, } static const void * -nftnl_rule_expr_ct_get(const struct nftnl_rule_expr *e, uint16_t type, +nftnl_expr_ct_get(const struct nftnl_expr *e, uint16_t type, uint32_t *data_len) { struct nftnl_expr_ct *ct = nftnl_expr_data(e); @@ -83,7 +83,7 @@ nftnl_rule_expr_ct_get(const struct nftnl_rule_expr *e, uint16_t type, return NULL; } -static int nftnl_rule_expr_ct_cb(const struct nlattr *attr, void *data) +static int nftnl_expr_ct_cb(const struct nlattr *attr, void *data) { const struct nlattr **tb = data; int type = mnl_attr_get_type(attr); @@ -109,7 +109,7 @@ static int nftnl_rule_expr_ct_cb(const struct nlattr *attr, void *data) } static void -nftnl_rule_expr_ct_build(struct nlmsghdr *nlh, struct nftnl_rule_expr *e) +nftnl_expr_ct_build(struct nlmsghdr *nlh, struct nftnl_expr *e) { struct nftnl_expr_ct *ct = nftnl_expr_data(e); @@ -124,12 +124,12 @@ nftnl_rule_expr_ct_build(struct nlmsghdr *nlh, struct nftnl_rule_expr *e) } static int -nftnl_rule_expr_ct_parse(struct nftnl_rule_expr *e, struct nlattr *attr) +nftnl_expr_ct_parse(struct nftnl_expr *e, struct nlattr *attr) { struct nftnl_expr_ct *ct = nftnl_expr_data(e); struct nlattr *tb[NFTA_CT_MAX+1] = {}; - if (mnl_attr_parse_nested(attr, nftnl_rule_expr_ct_cb, tb) < 0) + if (mnl_attr_parse_nested(attr, nftnl_expr_ct_cb, tb) < 0) return -1; if (tb[NFTA_CT_KEY]) { @@ -216,7 +216,7 @@ static inline int str2ctdir(const char *str, uint8_t *ctdir) return -1; } -static int nftnl_rule_expr_ct_json_parse(struct nftnl_rule_expr *e, json_t *root, +static int nftnl_expr_ct_json_parse(struct nftnl_expr *e, json_t *root, struct nftnl_parse_err *err) { #ifdef JSON_PARSING @@ -226,10 +226,10 @@ static int nftnl_rule_expr_ct_json_parse(struct nftnl_rule_expr *e, json_t *root int key; if (nftnl_jansson_parse_reg(root, "dreg", NFTNL_TYPE_U32, ®, err) == 0) - nftnl_rule_expr_set_u32(e, NFTNL_EXPR_CT_DREG, reg); + nftnl_expr_set_u32(e, NFTNL_EXPR_CT_DREG, reg); if (nftnl_jansson_parse_reg(root, "sreg", NFTNL_TYPE_U32, ®, err) == 0) - nftnl_rule_expr_set_u32(e, NFTNL_EXPR_CT_SREG, reg); + nftnl_expr_set_u32(e, NFTNL_EXPR_CT_SREG, reg); key_str = nftnl_jansson_parse_str(root, "key", err); if (key_str != NULL) { @@ -237,7 +237,7 @@ static int nftnl_rule_expr_ct_json_parse(struct nftnl_rule_expr *e, json_t *root if (key < 0) return -1; - nftnl_rule_expr_set_u32(e, NFTNL_EXPR_CT_KEY, key); + nftnl_expr_set_u32(e, NFTNL_EXPR_CT_KEY, key); } dir_str = nftnl_jansson_parse_str(root, "dir", err); @@ -247,7 +247,7 @@ static int nftnl_rule_expr_ct_json_parse(struct nftnl_rule_expr *e, json_t *root err->error = NFTNL_PARSE_EBADTYPE; goto err; } - nftnl_rule_expr_set_u8(e, NFTNL_EXPR_CT_DIR, dir); + nftnl_expr_set_u8(e, NFTNL_EXPR_CT_DIR, dir); } return 0; @@ -261,7 +261,7 @@ err: } -static int nftnl_rule_expr_ct_xml_parse(struct nftnl_rule_expr *e, mxml_node_t *tree, +static int nftnl_expr_ct_xml_parse(struct nftnl_expr *e, mxml_node_t *tree, struct nftnl_parse_err *err) { #ifdef XML_PARSING @@ -272,11 +272,11 @@ static int nftnl_rule_expr_ct_xml_parse(struct nftnl_rule_expr *e, mxml_node_t * if (nftnl_mxml_reg_parse(tree, "dreg", &dreg, MXML_DESCEND_FIRST, NFTNL_XML_OPT, err) == 0) - nftnl_rule_expr_set_u32(e, NFTNL_EXPR_CT_DREG, dreg); + nftnl_expr_set_u32(e, NFTNL_EXPR_CT_DREG, dreg); if (nftnl_mxml_reg_parse(tree, "sreg", &sreg, MXML_DESCEND_FIRST, NFTNL_XML_OPT, err) == 0) - nftnl_rule_expr_set_u32(e, NFTNL_EXPR_CT_SREG, sreg); + nftnl_expr_set_u32(e, NFTNL_EXPR_CT_SREG, sreg); key_str = nftnl_mxml_str_parse(tree, "key", MXML_DESCEND_FIRST, NFTNL_XML_MAND, err); @@ -285,7 +285,7 @@ static int nftnl_rule_expr_ct_xml_parse(struct nftnl_rule_expr *e, mxml_node_t * if (key < 0) return -1; - nftnl_rule_expr_set_u32(e, NFTNL_EXPR_CT_KEY, key); + nftnl_expr_set_u32(e, NFTNL_EXPR_CT_KEY, key); } dir_str = nftnl_mxml_str_parse(tree, "dir", MXML_DESCEND_FIRST, NFTNL_XML_OPT, err); @@ -295,7 +295,7 @@ static int nftnl_rule_expr_ct_xml_parse(struct nftnl_rule_expr *e, mxml_node_t * err->error = NFTNL_PARSE_EBADTYPE; goto err; } - nftnl_rule_expr_set_u8(e, NFTNL_EXPR_CT_DIR, dir); + nftnl_expr_set_u8(e, NFTNL_EXPR_CT_DIR, dir); } return 0; @@ -309,7 +309,7 @@ err: } static int -nftnl_expr_ct_export(char *buf, size_t size, struct nftnl_rule_expr *e, int type) +nftnl_expr_ct_export(char *buf, size_t size, struct nftnl_expr *e, int type) { struct nftnl_expr_ct *ct = nftnl_expr_data(e); NFTNL_BUF_INIT(b, buf, size); @@ -327,7 +327,7 @@ nftnl_expr_ct_export(char *buf, size_t size, struct nftnl_rule_expr *e, int type } static int -nftnl_expr_ct_snprintf_default(char *buf, size_t size, struct nftnl_rule_expr *e) +nftnl_expr_ct_snprintf_default(char *buf, size_t size, struct nftnl_expr *e) { int ret, len = size, offset = 0; struct nftnl_expr_ct *ct = nftnl_expr_data(e); @@ -344,7 +344,7 @@ nftnl_expr_ct_snprintf_default(char *buf, size_t size, struct nftnl_rule_expr *e SNPRINTF_BUFFER_SIZE(ret, size, len, offset); } - if (nftnl_rule_expr_is_set(e, NFTNL_EXPR_CT_DIR)) { + if (nftnl_expr_is_set(e, NFTNL_EXPR_CT_DIR)) { ret = snprintf(buf+offset, len, ", dir %s ", ctdir2str(ct->dir)); SNPRINTF_BUFFER_SIZE(ret, size, len, offset); @@ -354,8 +354,8 @@ nftnl_expr_ct_snprintf_default(char *buf, size_t size, struct nftnl_rule_expr *e } static int -nftnl_rule_expr_ct_snprintf(char *buf, size_t len, uint32_t type, - uint32_t flags, struct nftnl_rule_expr *e) +nftnl_expr_ct_snprintf(char *buf, size_t len, uint32_t type, + uint32_t flags, struct nftnl_expr *e) { switch (type) { case NFTNL_OUTPUT_DEFAULT: @@ -373,11 +373,11 @@ struct expr_ops expr_ops_ct = { .name = "ct", .alloc_len = sizeof(struct nftnl_expr_ct), .max_attr = NFTA_CT_MAX, - .set = nftnl_rule_expr_ct_set, - .get = nftnl_rule_expr_ct_get, - .parse = nftnl_rule_expr_ct_parse, - .build = nftnl_rule_expr_ct_build, - .snprintf = nftnl_rule_expr_ct_snprintf, - .xml_parse = nftnl_rule_expr_ct_xml_parse, - .json_parse = nftnl_rule_expr_ct_json_parse, + .set = nftnl_expr_ct_set, + .get = nftnl_expr_ct_get, + .parse = nftnl_expr_ct_parse, + .build = nftnl_expr_ct_build, + .snprintf = nftnl_expr_ct_snprintf, + .xml_parse = nftnl_expr_ct_xml_parse, + .json_parse = nftnl_expr_ct_json_parse, }; -- cgit v1.2.3