Wireshark-dev: [Wireshark-dev] Arrays of Value String arrays?
From: "Kevin A. Noll" <spamknoll@xxxxxxxxxxxxx>
Date: Wed, 23 May 2007 12:46:00 -0400

I'm dissecting TLVs in the WLCCP protocol. The TLVs are defined in a
hierarchical manner, so the TLV is defined by a group_id and a type_id. 

I'm trying to set up my value_strings for displaying the group and type, but
I'm not quite sure how to do this since the type_id is not unique between
group_ids. 

For example:

Group 0x00 Type 0x03 is an "ipv4 Subnet ID"

Group 0x02 Type 0x03 is an "rmReport"

Another example:

Group 0x00 Type 0x04 is an "Secondary LAN Address List"

Group 0x02 Type 0x04 is an "Aggregate RM Report"


I'm wondering if I can define a 2-dimensional value_string array sort of
like:

static const value_string wlccp_tlv_type_id[0][] = {

/* Group 0 types define in here */

};

static const value_string wlccp_tlv_type_id[1][] = {

/* Group 1 types define in here */

};

etc. etc.

Could I then add items to the tree like this?

group_id=tvb_get_guint16(tvb,offset) && 0x0300;
proto_tree_add_item(wlccp_tlv_tree, hf_wlccp_tlv_type[group_id], tvb,
offset, 1, FALSE);





How would I then define the header fields? I don't think this would work
(esp. the VALS() part):

{ &hf_wlccp_tlv_type, 
  { "TLV Type", "wlccp.wlccp_tlv_type",
    FT_UINT8, BASE_DEC, VALS(wlccp_tlv_type_id), 0,
    "TLV Type", HFILL}
}


I'm not a very good programmer, so I'm grasping for any help I can get.

Thanks!

--kan--
--
Kevin A. Noll, KD4WOZ
CCIE, CCDP
Versatile, Inc.