diff options
author | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2017-03-27 06:42:03 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-04-10 20:31:37 +0000 |
commit | 043df01c5645378bd61318c20cfdbf86c8f73288 (patch) | |
tree | 83cc90c67b765746aed3394ba1d1154e9a433155 /epan/dissectors/packet-alcap.c | |
parent | ded9ad7017a9b04a9f63c9ea91961d19ff6b395e (diff) |
Add support for BASE_VALS_NO_UNKNOWN
BASE_VALS_NO_UNKNOWN is a special value_string value for only a single
(maybe 2) numerical value(s). If a field has the numerical value
that doesn't match anything in the value_string, just the number
is supplied for the field (no "Unknown")
Dissectors that had this use case have been converted in the patch.
Change-Id: Ie63a36cceec2fe4436938ec7e3d7f9e690d2b8d9
Reviewed-on: https://code.wireshark.org/review/20736
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-alcap.c')
-rw-r--r-- | epan/dissectors/packet-alcap.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/epan/dissectors/packet-alcap.c b/epan/dissectors/packet-alcap.c index a0661f25a3..1704166fbb 100644 --- a/epan/dissectors/packet-alcap.c +++ b/epan/dissectors/packet-alcap.c @@ -188,11 +188,19 @@ static const value_string connection_priority[] = { { 0, NULL } }; - - static const char *alcap_proto_name = "AAL type 2 signalling protocol (Q.2630)"; static const char *alcap_proto_name_short = "ALCAP"; +static const value_string all_paths_vals[] = { + { 0, "All Paths in association" }, + { 0, NULL } +}; + +static const value_string all_cids_vals[] = { + { 0, "All CIDs in the Path" }, + { 0, NULL } +}; + /* Initialize the subtree pointers */ static gint ett_alcap = -1; static gint ett_leg = -1; @@ -496,27 +504,22 @@ static const gchar* dissect_fields_ceid(packet_info* pinfo, tvbuff_t *tvb, proto * 7.4.3 Path Identifier * 7.4.4 Channel Identifier */ - proto_item* pi; - if (len != 5) { proto_tree_add_expert(tree, pinfo, &ei_alcap_parameter_field_bad_length, tvb, offset, len); return NULL; } - pi = proto_tree_add_item(tree,hf_alcap_ceid_pathid,tvb,offset,4,ENC_BIG_ENDIAN); + proto_tree_add_item_ret_uint(tree, hf_alcap_ceid_pathid, tvb, offset, 4, ENC_BIG_ENDIAN, &msg_info->pathid); - msg_info->pathid = tvb_get_ntohl(tvb,offset); msg_info->cid = tvb_get_guint8(tvb,offset+4); if (msg_info->pathid == 0) { - proto_item_append_text(pi," (All Paths in association)"); return "Path: 0 (All Paths)"; } - pi = proto_tree_add_item(tree,hf_alcap_ceid_cid,tvb,offset+4,1,ENC_BIG_ENDIAN); + proto_tree_add_item(tree,hf_alcap_ceid_cid,tvb,offset+4,1,ENC_BIG_ENDIAN); if (msg_info->cid == 0) { - proto_item_append_text(pi," (All CIDs in the Path)"); return wmem_strdup_printf(wmem_packet_scope(), "Path: %u CID: 0 (Every CID)",msg_info->pathid); } else { return wmem_strdup_printf(wmem_packet_scope(), "Path: %u CID: %u",msg_info->pathid,msg_info->cid); @@ -1583,12 +1586,12 @@ proto_register_alcap(void) { &hf_alcap_ceid_pathid, { "Path ID", "alcap.ceid.pathid", - FT_UINT32, BASE_DEC, NULL, 0, + FT_UINT32, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(all_paths_vals), 0, NULL, HFILL } }, { &hf_alcap_ceid_cid, { "CID", "alcap.ceid.cid", - FT_UINT8, BASE_DEC, NULL, 0, + FT_UINT8, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(all_cids_vals), 0, NULL, HFILL } }, |