Skip to contentSkip to conversation

xml: expr: fix public interface for parsing XML

PATCH In review Arturo Borrero Gonzalez 2 participants 4 messages Jul 26, 2013 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xml: expr: fix public interface for parsing XML

This patch adds a public interface for parsing expr XML. Before this patch, that operation was not possible.

---
 include/libnftables/expr.h |    3 +++
 src/expr.c                 |   41 +++++++++++++++++++++++++++++++++++++++++
 src/libnftables.map        |    1 +
 3 files changed, 45 insertions(+)
include/libnftables/expr.h +3 -0
index 02f38d0..31946b3 100644
@@ -8,6 +8,8 @@
 extern "C" {
 #endif
 
+#include <libnftables/rule.h>
+
 struct nft_rule_expr;
 
 enum {
@@ -35,6 +37,7 @@ struct nlmsghdr;
 
 void nft_rule_expr_build_payload(struct nlmsghdr *nlh, struct nft_rule_expr *expr);
 
+int nft_rule_expr_parse(struct nft_rule_expr *expr, enum nft_rule_parse_type type, const char *data);
 int nft_rule_expr_snprintf(char *buf, size_t buflen, struct nft_rule_expr *expr, uint32_t type, uint32_t flags);
 
 enum {
src/expr.c +41 -0

47 lines not on this page · raw message

src/libnftables.map +1 -0
index 614c705..16d8c05 100644
@@ -93,6 +93,7 @@ global:
   nft_rule_expr_get_u64;
   nft_rule_expr_get_str;
   nft_rule_expr_build_payload;
+  nft_rule_expr_parse;
   nft_rule_expr_snprintf;
   nft_rule_expr_free;
 
#1 lore raw

Hi Arturo,

Quoted 2 lines · Arturo Borrero Gonzalez

This patch adds a public interface for parsing expr XML. Before this patch, that operation was not possible.

rule parse already parses expressions.

Do you need this? If so, please specify the usage. Thanks.

#2 lore raw
Quoted 9 lines · Pablo Neira Ayuso

Hi Arturo,

Quoted 2 lines · Arturo Borrero Gonzalez

This patch adds a public interface for parsing expr XML. Before this patch, that operation was not possible.

rule parse already parses expressions.

Do you need this? If so, please specify the usage. Thanks.

I don't need this.

The only motivation was all object having a way of going from str to nft_* but expr.
As you stated, currently the only way of parsing a XML expr is if the expr itself is nested inside a rule.

but i'm fine without it ATM.

Regards.

Signature · 5 lines
Arturo Borrero González
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
Quoted 11 lines · Arturo Borrero Gonzalez
Quoted 9 lines · Pablo Neira Ayuso

Hi Arturo,

Quoted 2 lines · Arturo Borrero Gonzalez

This patch adds a public interface for parsing expr XML. Before this patch, that operation was not possible.

rule parse already parses expressions.

Do you need this? If so, please specify the usage. Thanks.

Quoted 8 lines

I don't need this.

The only motivation was all object having a way of going from str to nft_* but expr.
As you stated, currently the only way of parsing a XML expr is if the expr itself is nested inside a rule.

but i'm fine without it ATM.

Let keep this back. I prefer not to add yet another interface for something we don't need at this moment.