Hi, I've got a bunch of statically entered entries for the "normal" way of 
registering the field array:

I.e.

using static hf_register_info hf[] = {
...}

proto_register_field_array(proto_ublox, hf, array_length(hf));

Now I have chunk of code were I want to do this:

#define    NUM_PORT_VALS    (6)
#define    NUM_PROTO_VALS    (8)

static int hf_mon_msgpp_msg[NUM_PORT_VALS][NUM_PROTO_VALS];

...

    for (i = 0; i < NUM_PORT_VALS; i++)
    {
        subtree =
            proto_tree_add_subtree_format(tree, tvb, curr_offset, 16,
                ett_mon_msgpp_msg[i], NULL,
                "msg%u - Number of successfully parsed messages for each 
protocol on port%u",
                i + 1, i);

        for (j = 0; j < NUM_PROTO_VALS; j++)
        {
            proto_tree_add_item(subtree, hf_mon_msgpp_msg[i][j], tvb, 
curr_offset, 2, ENC_LITTLE_ENDIAN);
            curr_offset += 2;
        }
    }
Is there a way to append or the 48 (6 x 8) hf_register_info elements that I 
will generate at startup?

I would allocate something like this:

static hf_register_info hf2[NUM_PORT_VALS * NUM_PROTO_VALS];

And then programatically build the field name, description, etc.

for port < NUM_PORT_VALS ...
for proto < NUM_PROTO_VALS ...
        { &hf_mon_msgpp_msg[port][proto],
...
           "ublox.mon.msgpp.parsed.port%u.proto%u", port, proto)

Finally appending these field entries?

I looked through proto.h/proto.c but I couldn't find what I was looking for.

Thanks for any help

Cheers


Michael Lum 
(michael....@starsolutions.com<mailto:michael....@starsolutions.com>) | STAR 
SOLUTIONS<http://www.starsolutions.com/> | Principal Software Engineer
4600 Jacombs Road, Richmond BC, Canada V6V 3B1 | +1.604.303.2315

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@wireshark.org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe

Reply via email to