how to define hf_register_info in dissector
I get data in tvbuff_t *tvb, its size is 10 to 50 bit depend on another parameter assume p.
Message structure is as below:
Struct AA
{
Var a : x bit, [0<=range(x)<=32]
Var b : y bit, [0<=range(y)<=16]
};
define static hf_register_info hf[] in dissector, and register it to proto as
proto_register_field_array(proto_xxx, hf, array_length(hf));
Should I define 32+16=48 hf_xxx with different bit_mask and byte_type and select different two hf_xxx for a and b according to p?
Is there any good method to solve this problem?
So by
x bit, [0<=range(x)<=32]
do you mean that the first field in the structure is a variable number of bits, with different instances of the structure possibly having different numbers of bits in that field, with the field being somewhere between 0 bits (i.e., absent) and 32 bits?yes, and y is in the same situation.