From f4befc129827632209779c71d804f6139ac03541 Mon Sep 17 00:00:00 2001 From: Arturo Borrero Gonzalez Date: Fri, 13 Sep 2013 14:05:51 +0200 Subject: src: xml: add parsing optional/mandatory flag Add an optional/mandatory flag to XML parsing. In some elements (ie regs), no flag is used because is always mandatory. DATA_NONE is created to indicate a non-parsed data_reg. Signed-off-by: Arturo Borrero Gonzalez Signed-off-by: Pablo Neira Ayuso --- src/table.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/table.c') diff --git a/src/table.c b/src/table.c index 838c5ee..0b51d15 100644 --- a/src/table.c +++ b/src/table.c @@ -232,7 +232,8 @@ static int nft_table_xml_parse(struct nft_table *t, const char *xml) if (strcmp(tree->value.opaque, "table") != 0) goto err; - name = nft_mxml_str_parse(tree, "name", MXML_DESCEND_FIRST); + name = nft_mxml_str_parse(tree, "name", MXML_DESCEND_FIRST, + NFT_XML_MAND); if (name == NULL) goto err; @@ -242,7 +243,8 @@ static int nft_table_xml_parse(struct nft_table *t, const char *xml) t->name = strdup(name); t->flags |= (1 << NFT_TABLE_ATTR_NAME); - family = nft_mxml_family_parse(tree, "family", MXML_DESCEND_FIRST); + family = nft_mxml_family_parse(tree, "family", MXML_DESCEND_FIRST, + NFT_XML_MAND); if (family < 0) goto err; @@ -250,7 +252,8 @@ static int nft_table_xml_parse(struct nft_table *t, const char *xml) t->flags |= (1 << NFT_TABLE_ATTR_FAMILY); if (nft_mxml_num_parse(tree, "flags", MXML_DESCEND, BASE_DEC, - &t->table_flags, NFT_TYPE_U32) != 0) + &t->table_flags, NFT_TYPE_U32, + NFT_XML_MAND) != 0) goto err; t->flags |= (1 << NFT_TABLE_ATTR_FLAGS); -- cgit v1.2.3