2013/4/2 Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>: > On Tue, Apr 02, 2013 at 07:18:39PM +0200, Arturo Borrero Gonzalez wrote: >> If cmp and bitwise are going to always have DATA_VALUE, and imm >> depending on what was set, I think we could do: >> >> int nft_data_reg_snprintf(char *buf, union data_reg *data, int type, ...) >> switch(type) >> return nft_data_reg_snprintf_'type'(buf, data, ...) > > where 'type' can be: value, verdict or chain. > >> And the same applies when parsing XML. > > Exactly. I propose to use this format: for DATA_VALUE: <expr type=cmp> [...] <cmpdata> <data_reg type=value> <len>N</len> <data0>reg->val[i]</data0> [...] <dataN>reg->val[n]</dataN> </data_reg> </cmpdata> </expr> This way we also export/import the len of reg->val (actually reg->len) For DATA_VERDICT or DATA_CHAIN: <data_reg type=verdict> <verdict>int</verdict> <chain>string</chain> </data_reg> assuming verdict and chain are always used together, despite of node '<verdict>' or '<chain>' being not set (but present with no value) -- Arturo Borrero González -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html