diff options
-rw-r--r-- | doc/README.dissector | 11 | ||||
-rw-r--r-- | epan/dissectors/packet-alcap.c | 25 | ||||
-rw-r--r-- | epan/dissectors/packet-btavrcp.c | 14 | ||||
-rw-r--r-- | epan/dissectors/packet-icmpv6.c | 140 | ||||
-rw-r--r-- | epan/dissectors/packet-ipmi-se.c | 77 | ||||
-rw-r--r-- | epan/dissectors/packet-iso7816.c | 30 | ||||
-rw-r--r-- | epan/dissectors/packet-l2tp.c | 29 | ||||
-rw-r--r-- | epan/dissectors/packet-llrp.c | 133 | ||||
-rw-r--r-- | epan/dissectors/packet-pim.c | 93 | ||||
-rw-r--r-- | epan/dissectors/packet-smb2.c | 15 | ||||
-rw-r--r-- | epan/proto.c | 32 | ||||
-rw-r--r-- | epan/proto.h | 1 | ||||
-rw-r--r-- | plugins/docsis/packet-docsis.c | 16 | ||||
-rw-r--r-- | plugins/docsis/packet-mdd.c | 13 | ||||
-rw-r--r-- | plugins/wimax/msg_reg_req.c | 21 |
15 files changed, 271 insertions, 379 deletions
diff --git a/doc/README.dissector b/doc/README.dissector index ac57159991..adf77ef241 100644 --- a/doc/README.dissector +++ b/doc/README.dissector @@ -117,7 +117,8 @@ FIELDDISPLAY --For FT_UINT{8,16,24,32,40,48,56,64} and BASE_DEC, BASE_HEX, BASE_OCT, BASE_DEC_HEX, BASE_HEX_DEC, BASE_CUSTOM, or BASE_NONE, possibly ORed with BASE_RANGE_STRING, BASE_EXT_STRING, BASE_VAL64_STRING, - BASE_ALLOW_ZERO, BASE_UNIT_STRING or BASE_NO_DISPLAY_VALUE + BASE_ALLOW_ZERO, BASE_UNIT_STRING, BASE_VALS_NO_UNKNOWN or + BASE_NO_DISPLAY_VALUE BASE_NONE may be used with a non-NULL FIELDCONVERT when the numeric value of the field itself is not of significance to @@ -949,6 +950,11 @@ indicate the end of the array). The 'strings' field would be set to If the field has a numeric rather than an enumerated type, the 'strings' field would be set to NULL. +If BASE_VALS_NO_UNKNOWN is also applied to the display bitmask, then if +the numeric value of a field doesn't match any values in the value_string +then just the numeric value is displayed (i.e. no "Unknown"). This is intended +for value_strings that may only have a single value or maybe an enumeration +for mix/max values of a field. -- Extended value strings You can also use an extended version of the value_string for faster lookups. @@ -993,9 +999,10 @@ val64_strings are like value_strings, except that the integer type used is a guint64 (instead of guint32). Instead of using the VALS() macro for the 'strings' field in the header_field_info struct array, 'VALS64()' is used. +BASE_VALS_NO_UNKNOWN can also be used for val64_string. -- Unit string -Some integer fields, of type FT_UINT* and float fiels, of type FT_FLOAT +Some integer fields, of type FT_UINT* and float fields, of type FT_FLOAT or FT_DOUBLE, need units of measurement to help convey the field value. A 'unit_name_string' structure is a way to add a unit suffix to a field. 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 } }, diff --git a/epan/dissectors/packet-btavrcp.c b/epan/dissectors/packet-btavrcp.c index 3203f64449..9ee36c279a 100644 --- a/epan/dissectors/packet-btavrcp.c +++ b/epan/dissectors/packet-btavrcp.c @@ -596,6 +596,11 @@ static const value_string player_subtype_vals[] = { { 0, NULL } }; +static const value_string unique_all_supported_attributes[] = { + { 0x00, "All Supported Attributes" }, + { 0, NULL } +}; + void proto_register_btavrcp(void); void proto_reg_handoff_btavrcp(void); @@ -1477,9 +1482,8 @@ dissect_vendor_dependent(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, col_append_fstr(pinfo->cinfo, COL_INFO, " - 0x%08X%08X", (guint) (identifier >> 32), (guint) (identifier & 0xFFFFFFFF)); if (identifier == 0x00) col_append_str(pinfo->cinfo, COL_INFO, " (PLAYING)"); - pitem = proto_tree_add_item(tree, hf_btavrcp_number_of_attributes, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_btavrcp_number_of_attributes, tvb, offset, 1, ENC_BIG_ENDIAN); number_of_attributes = tvb_get_guint8(tvb, offset); - if (number_of_attributes == 0) proto_item_append_text(pitem, " (All Supported Attributes)"); offset += 1; offset = dissect_attribute_id_list(tvb, tree, offset, number_of_attributes); } else { @@ -2004,7 +2008,6 @@ dissect_browsing(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint64 uid; guint uid_counter; guint scope; - proto_item *pitem = NULL; proto_tree_add_item(tree, hf_btavrcp_scope, tvb, offset, 1, ENC_BIG_ENDIAN); scope = tvb_get_guint8(tvb, offset); @@ -2015,13 +2018,12 @@ dissect_browsing(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_item(tree, hf_btavrcp_uid_counter, tvb, offset, 2, ENC_BIG_ENDIAN); uid_counter = tvb_get_ntohs(tvb, offset); offset += 2; - pitem = proto_tree_add_item(tree, hf_btavrcp_number_of_attributes, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_btavrcp_number_of_attributes, tvb, offset, 1, ENC_BIG_ENDIAN); number_of_attributes = tvb_get_guint8(tvb, offset); col_append_fstr(pinfo->cinfo, COL_INFO, " - Scope: %s, Uid: 0x%016" G_GINT64_MODIFIER "x, UidCounter: 0x%04x", val_to_str_const(scope, scope_vals, "unknown"), uid, uid_counter); - if (number_of_attributes == 0) proto_item_append_text(pitem, " (All Supported Attributes)"); offset += 1; offset = dissect_attribute_id_list(tvb, tree, offset, number_of_attributes); } else { @@ -2482,7 +2484,7 @@ proto_register_btavrcp(void) }, { &hf_btavrcp_number_of_attributes, { "Number of Attributes", "btavrcp.number_of_attributes", - FT_UINT8, BASE_DEC, NULL, 0x00, + FT_UINT8, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_all_supported_attributes), 0x00, NULL, HFILL } }, { &hf_btavrcp_attribute_count, diff --git a/epan/dissectors/packet-icmpv6.c b/epan/dissectors/packet-icmpv6.c index 9bdc2cbda6..b84f67a8a4 100644 --- a/epan/dissectors/packet-icmpv6.c +++ b/epan/dissectors/packet-icmpv6.c @@ -1282,6 +1282,23 @@ static const value_string mpl_seed_id_lengths[] = { }; static const guint8 mpl_seed_id_code_to_length[] = { 0, 2, 8, 16 }; /* bytes */ +static const value_string unique_infinity[] = { + { 0xffffffff, "Infinity" }, + { 0, NULL} +}; + +static const value_string dnssl_infinity[] = { + { 0, "DNSSL domain name MUST no longer be used" }, + { 0xffffffff, "Infinity" }, + { 0, NULL} +}; + +static const value_string rdnss_infinity[] = { + { 0, "RDNSS address MUST no longer be used" }, + { 0xffffffff, "Infinity" }, + { 0, NULL} +}; + static int dissect_contained_icmpv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { @@ -1641,27 +1658,11 @@ dissect_icmpv6_nd_opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree opt_offset += 1; /* Prefix Valid Lifetime */ - ti_opt = proto_tree_add_item(icmp6opt_tree, hf_icmpv6_opt_prefix_valid_lifetime, tvb, opt_offset, 4, ENC_BIG_ENDIAN); - - switch(tvb_get_ntohl(tvb, opt_offset)){ - case 0xffffffff: - proto_item_append_text(ti_opt, " (Infinity)"); - break; - default: - break; - } + proto_tree_add_item(icmp6opt_tree, hf_icmpv6_opt_prefix_valid_lifetime, tvb, opt_offset, 4, ENC_BIG_ENDIAN); opt_offset += 4; /* Prefix Preferred Lifetime */ - ti_opt = proto_tree_add_item(icmp6opt_tree, hf_icmpv6_opt_prefix_preferred_lifetime, tvb, opt_offset, 4, ENC_BIG_ENDIAN); - - switch(tvb_get_ntohl(tvb, opt_offset)){ - case 0xffffffff: - proto_item_append_text(ti_opt, " (Infinity)"); - break; - default: - break; - } + proto_tree_add_item(icmp6opt_tree, hf_icmpv6_opt_prefix_preferred_lifetime, tvb, opt_offset, 4, ENC_BIG_ENDIAN); opt_offset += 4; proto_tree_add_item(icmp6opt_tree, hf_icmpv6_opt_reserved, tvb, opt_offset, 4, ENC_NA); @@ -2059,15 +2060,7 @@ dissect_icmpv6_nd_opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree opt_offset += 1; /* Route Lifetime */ - ti_opt = proto_tree_add_item(icmp6opt_tree, hf_icmpv6_opt_route_lifetime, tvb, opt_offset, 4, ENC_BIG_ENDIAN); - - switch(tvb_get_ntohl(tvb, opt_offset)){ - case 0xffffffff: - proto_item_append_text(ti_opt, " (Infinity)"); - break; - default: - break; - } + proto_tree_add_item(icmp6opt_tree, hf_icmpv6_opt_route_lifetime, tvb, opt_offset, 4, ENC_BIG_ENDIAN); opt_offset += 4; /* Prefix */ @@ -2103,20 +2096,7 @@ dissect_icmpv6_nd_opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree opt_offset += 2; /* RDNSS Lifetime */ - ti_opt = proto_tree_add_item(icmp6opt_tree, hf_icmpv6_opt_rdnss_lifetime, tvb, opt_offset, 4, ENC_BIG_ENDIAN); - /* A value of all one bits (0xffffffff) represents infinity. A value of - * zero means that the RDNSS address MUST no longer be used. - */ - switch(tvb_get_ntohl(tvb, opt_offset)){ - case 0: - proto_item_append_text(ti_opt, " (RDNSS address MUST no longer be used)"); - break; - case 0xffffffff: - proto_item_append_text(ti_opt, " (Infinity)"); - break; - default: - break; - } + proto_tree_add_item(icmp6opt_tree, hf_icmpv6_opt_rdnss_lifetime, tvb, opt_offset, 4, ENC_BIG_ENDIAN); opt_offset += 4; while(opt_offset < (offset + opt_len) ) { @@ -2262,17 +2242,7 @@ dissect_icmpv6_nd_opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree opt_offset += 2; /* DNSSL Lifetime */ - ti_opt = proto_tree_add_item(icmp6opt_tree, hf_icmpv6_opt_dnssl_lifetime, tvb, opt_offset, 4, ENC_BIG_ENDIAN); - switch(tvb_get_ntohl(tvb, opt_offset)){ - case 0: - proto_item_append_text(ti_opt, " (DNSSL domain name MUST no longer be used)"); - break; - case 0xffffffff: - proto_item_append_text(ti_opt, " (Infinity)"); - break; - default: - break; - } + proto_tree_add_item(icmp6opt_tree, hf_icmpv6_opt_dnssl_lifetime, tvb, opt_offset, 4, ENC_BIG_ENDIAN); opt_offset += 4; while(opt_offset < (offset + opt_len) ) { @@ -2681,15 +2651,7 @@ dissect_icmpv6_rpl_opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree opt_offset +=1; /* Prefix lifetime. */ - ti_opt = proto_tree_add_item(icmp6opt_tree, hf_icmpv6_rpl_opt_route_lifetime, tvb, opt_offset, 4, ENC_BIG_ENDIAN); - - switch(tvb_get_ntohl(tvb, opt_offset)){ - case 0xffffffff: - proto_item_append_text(ti_opt, " (Infinity)"); - break; - default: - break; - } + proto_tree_add_item(icmp6opt_tree, hf_icmpv6_rpl_opt_route_lifetime, tvb, opt_offset, 4, ENC_BIG_ENDIAN); opt_offset += 4; switch(opt_len){ @@ -2887,25 +2849,11 @@ dissect_icmpv6_rpl_opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree opt_offset += 1; /* Valid lifetime. */ - ti_opt = proto_tree_add_item(icmp6opt_tree, hf_icmpv6_rpl_opt_prefix_vlifetime, tvb, opt_offset, 4, ENC_BIG_ENDIAN); - switch(tvb_get_ntohl(tvb, opt_offset)){ - case 0xffffffff: - proto_item_append_text(ti_opt, " (Infinity)"); - break; - default: - break; - } + proto_tree_add_item(icmp6opt_tree, hf_icmpv6_rpl_opt_prefix_vlifetime, tvb, opt_offset, 4, ENC_BIG_ENDIAN); opt_offset += 4; /* Preferred Lifetime */ - ti_opt = proto_tree_add_item(icmp6opt_tree, hf_icmpv6_rpl_opt_prefix_plifetime, tvb, opt_offset, 4, ENC_BIG_ENDIAN); - switch(tvb_get_ntohl(tvb, opt_offset)){ - case 0xffffffff: - proto_item_append_text(ti_opt, " (Infinity)"); - break; - default: - break; - } + proto_tree_add_item(icmp6opt_tree, hf_icmpv6_rpl_opt_prefix_plifetime, tvb, opt_offset, 4, ENC_BIG_ENDIAN); opt_offset += 4; /* 4 reserved bytes. */ @@ -3622,25 +3570,11 @@ dissect_rrenum(tvbuff_t *tvb, int rr_offset, packet_info *pinfo _U_, proto_tree rr_offset += 1; /* Valid Lifetime */ - ti = proto_tree_add_item(up_tree, hf_icmpv6_rr_pco_up_validlifetime, tvb, rr_offset, 4, ENC_BIG_ENDIAN); - switch(tvb_get_ntohl(tvb, rr_offset)){ - case 0xffffffff: - proto_item_append_text(ti, " (Infinity)"); - break; - default: - break; - } + proto_tree_add_item(up_tree, hf_icmpv6_rr_pco_up_validlifetime, tvb, rr_offset, 4, ENC_BIG_ENDIAN); rr_offset += 4; /* Preferred Lifetime */ - ti = proto_tree_add_item(up_tree, hf_icmpv6_rr_pco_up_preferredlifetime, tvb, rr_offset, 4, ENC_BIG_ENDIAN); - switch(tvb_get_ntohl(tvb, rr_offset)){ - case 0xffffffff: - proto_item_append_text(ti, " (Infinity)"); - break; - default: - break; - } + proto_tree_add_item(up_tree, hf_icmpv6_rr_pco_up_preferredlifetime, tvb, rr_offset, 4, ENC_BIG_ENDIAN); rr_offset += 4; @@ -4725,10 +4659,10 @@ proto_register_icmpv6(void) { "Reserved", "icmpv6.opt.prefix.flag.reserved", FT_UINT8, BASE_DEC, NULL, 0x1f, NULL, HFILL }}, { &hf_icmpv6_opt_prefix_valid_lifetime, - { "Valid Lifetime", "icmpv6.opt.prefix.valid_lifetime", FT_UINT32, BASE_DEC, NULL, 0x00, + { "Valid Lifetime", "icmpv6.opt.prefix.valid_lifetime", FT_UINT32, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_infinity), 0x00, "The length of time in seconds that the prefix is valid for the purpose of on-link determination", HFILL }}, { &hf_icmpv6_opt_prefix_preferred_lifetime, - { "Preferred Lifetime", "icmpv6.opt.prefix.preferred_lifetime", FT_UINT32, BASE_DEC, NULL, 0x00, + { "Preferred Lifetime", "icmpv6.opt.prefix.preferred_lifetime", FT_UINT32, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_infinity), 0x00, "The length of time in seconds that addresses generated from the prefix via stateless address autoconfiguration remain preferred", HFILL }}, { &hf_icmpv6_opt_prefix, { "Prefix", "icmpv6.opt.prefix", FT_IPv6, BASE_NONE, NULL, 0x00, @@ -4839,7 +4773,7 @@ proto_register_icmpv6(void) { "Reserved", "icmpv6.opt.route_info.flag.reserved", FT_UINT8, BASE_DEC, NULL, ND_RA_FLAG_RESERV_MASK, "Must be 0", HFILL }}, { &hf_icmpv6_opt_route_lifetime, - { "Route Lifetime", "icmpv6.opt.route_lifetime", FT_UINT32, BASE_DEC, NULL, 0x00, + { "Route Lifetime", "icmpv6.opt.route_lifetime", FT_UINT32, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_infinity), 0x00, "The length of time in seconds that the prefix is valid for the purpose of route determination", HFILL }}, { &hf_icmpv6_opt_name_type, { "Name Type", "icmpv6.opt.name_type", FT_UINT8, BASE_DEC, VALS(icmpv6_option_name_type_vals), 0x0, @@ -4892,7 +4826,7 @@ proto_register_icmpv6(void) { "IPv6 Address", "icmpv6.opt.ipv6_address", FT_IPv6, BASE_NONE, NULL, 0x0, "IPv6 addresses of the interface", HFILL }}, { &hf_icmpv6_opt_rdnss_lifetime, - { "Lifetime", "icmpv6.opt.rdnss.lifetime", FT_UINT32, BASE_DEC, NULL, 0x0, + { "Lifetime", "icmpv6.opt.rdnss.lifetime", FT_UINT32, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(rdnss_infinity), 0x0, NULL, HFILL }}, { &hf_icmpv6_opt_rdnss, { "Recursive DNS Servers", "icmpv6.opt.rdnss", FT_IPv6, BASE_NONE, NULL, 0x0, @@ -4958,7 +4892,7 @@ proto_register_icmpv6(void) { "MN-Value", "icmpv6.opt.mn.value", FT_BYTES, BASE_NONE, NULL, 0x0, "The value specified by the Option-Code", HFILL }}, { &hf_icmpv6_opt_dnssl_lifetime, - { "Lifetime", "icmpv6.opt.dnssl.lifetime", FT_UINT32, BASE_DEC, NULL, 0x0, + { "Lifetime", "icmpv6.opt.dnssl.lifetime", FT_UINT32, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(dnssl_infinity), 0x0, NULL, HFILL }}, { &hf_icmpv6_opt_dnssl, { "Domain Names", "icmpv6.opt.dnssl", FT_STRING, BASE_NONE, NULL, 0x0, @@ -5113,10 +5047,10 @@ proto_register_icmpv6(void) { "Reserved", "icmpv6.rr.pco.up.flagmask.reserved", FT_UINT8, BASE_DEC, NULL, 0x3f, NULL, HFILL }}, { &hf_icmpv6_rr_pco_up_validlifetime, - { "Valid Lifetime", "icmpv6.rr.pco.up.validlifetime", FT_UINT32, BASE_DEC, NULL, 0x0, + { "Valid Lifetime", "icmpv6.rr.pco.up.validlifetime", FT_UINT32, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_infinity), 0x0, "The number of seconds for which the New Prefix will be valid", HFILL }}, { &hf_icmpv6_rr_pco_up_preferredlifetime, - { "Preferred Lifetime", "icmpv6.rr.pco.up.preferredlifetime", FT_UINT32, BASE_DEC, NULL, 0x0, + { "Preferred Lifetime", "icmpv6.rr.pco.up.preferredlifetime", FT_UINT32, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_infinity), 0x0, "The number of seconds for which the New Prefix will be preferred", HFILL }}, { &hf_icmpv6_rr_pco_up_flag, { "Flags", "icmpv6.rr.pco.up.flag", FT_UINT32, BASE_HEX, NULL, 0x0, @@ -5580,7 +5514,7 @@ proto_register_icmpv6(void) { "Reserved","icmpv6.rpl.opt.route.reserved", FT_UINT8, BASE_DEC, NULL, RPL_OPT_ROUTE_RESERVED, "Reserved (Must be Zero)", HFILL }}, { &hf_icmpv6_rpl_opt_route_lifetime, - { "Route Lifetime", "icmpv6.rpl.opt.route.lifetime", FT_UINT32, BASE_DEC, NULL, 0x0, + { "Route Lifetime", "icmpv6.rpl.opt.route.lifetime", FT_UINT32, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_infinity), 0x0, "The length of time in seconds (relative to the time the packet is sent) that the prefix is valid for route determination", HFILL }}, { &hf_icmpv6_rpl_opt_route_prefix, { "Prefix", "icmpv6.rpl.opt.route.prefix", FT_IPv6, BASE_NONE, NULL, 0x0, @@ -5698,10 +5632,10 @@ proto_register_icmpv6(void) { "Reserved", "icmpv6.rpl.opt.config.flag.rsv", FT_UINT8, BASE_DEC, NULL, RPL_OPT_PREFIX_FLAG_RSV, "Must Be Zero", HFILL }}, { &hf_icmpv6_rpl_opt_prefix_vlifetime, - { "Valid Lifetime", "icmpv6.rpl.opt.prefix.valid_lifetime", FT_UINT32, BASE_DEC, NULL, 0x0, + { "Valid Lifetime", "icmpv6.rpl.opt.prefix.valid_lifetime", FT_UINT32, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_infinity), 0x0, "The length of time in seconds that the prefix is valid for the purpose of on-link determination", HFILL }}, { &hf_icmpv6_rpl_opt_prefix_plifetime, - { "Preferred Lifetime", "icmpv6.rpl.opt.prefix.preferred_lifetime", FT_UINT32, BASE_DEC, NULL, 0x0, + { "Preferred Lifetime", "icmpv6.rpl.opt.prefix.preferred_lifetime", FT_UINT32, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_infinity), 0x0, "The length of time in seconds that addresses generated from the prefix via stateless address autoconfiguration remain preferred", HFILL }}, { &hf_icmpv6_rpl_opt_prefix, { "Destination Prefix", "icmpv6.rpl.opt.prefix", FT_IPv6, BASE_NONE, NULL, 0x0, diff --git a/epan/dissectors/packet-ipmi-se.c b/epan/dissectors/packet-ipmi-se.c index b980567172..39e013f617 100644 --- a/epan/dissectors/packet-ipmi-se.c +++ b/epan/dissectors/packet-ipmi-se.c @@ -1903,6 +1903,26 @@ static const value_string cp15_op_vals[] = { { 0, NULL } }; +static const value_string unique_selects_volatile_string_parameters[] = { + { 0, "Selects volatile string parameters" }, + { 0, NULL } +}; + +static const value_string unique_disable_message_generation[] = { + { 0xFF, "Disable Message Generation" }, + { 0, NULL } +}; + +static const value_string unique_sel_is_empty[] = { + { 0xFFFF, "SEL is empty" }, + { 0, NULL } +}; + +static const value_string unique_event_processed_not_logged[] = { + { 0, "Event processed but cannot be logged" }, + { 0, NULL } +}; + static void cfgparam_00(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *tree) { @@ -1993,16 +2013,10 @@ cfgparam_12(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *tree) { proto_item *ti; proto_tree *s_tree; - guint8 tmp; ti = proto_tree_add_item(tree, hf_ipmi_se_cp12_byte1, tvb, 0, 1, ENC_LITTLE_ENDIAN); s_tree = proto_item_add_subtree(ti, ett_ipmi_se_cp12_byte1); - tmp = tvb_get_guint8(tvb, 0) & 0x7f; - ti = proto_tree_add_item(s_tree, hf_ipmi_se_cp12_alert_stringsel, tvb, 0, 1, ENC_LITTLE_ENDIAN); - if (tmp == 0) { - proto_item_append_text(ti, " (Selects volatile string parameters)"); - } - + proto_tree_add_item(s_tree, hf_ipmi_se_cp12_alert_stringsel, tvb, 0, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, hf_ipmi_se_cp12_evfilter, tvb, 1, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, hf_ipmi_se_cp12_alert_stringset, tvb, 2, 1, ENC_LITTLE_ENDIAN); } @@ -2145,16 +2159,7 @@ static const struct true_false_string tfs_2b_enabled = { static void rq00(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) { - unsigned int addr; - proto_item *ti; - - addr = tvb_get_guint8(tvb, 0); - ti = proto_tree_add_item(tree, hf_ipmi_se_00_addr, tvb, 0, 1, ENC_LITTLE_ENDIAN); - if (addr == 0xff) - { - proto_item_append_text(ti, " (Disable Message Generation)"); - } - + proto_tree_add_item(tree, hf_ipmi_se_00_addr, tvb, 0, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, hf_ipmi_se_00_lun, tvb, 1, 1, ENC_LITTLE_ENDIAN); } @@ -2163,16 +2168,7 @@ rq00(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) static void rs01(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) { - unsigned int addr; - proto_item *ti; - - addr = tvb_get_guint8(tvb, 0); - ti = proto_tree_add_item(tree, hf_ipmi_se_01_addr, tvb, 0, 1, ENC_LITTLE_ENDIAN); - if (addr == 0xff) - { - proto_item_append_text(ti, " (Disable Message Generation)"); - } - + proto_tree_add_item(tree, hf_ipmi_se_01_addr, tvb, 0, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, hf_ipmi_se_01_lun, tvb, 1, 1, ENC_LITTLE_ENDIAN); } @@ -2374,23 +2370,10 @@ static const value_string cc14[] = { static void rs15(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) { - guint16 tmp; - proto_item *ti; - ipmi_add_timestamp(tree, hf_ipmi_se_15_tstamp, tvb, 0); - tmp = tvb_get_letohs(tvb, 4); - ti = proto_tree_add_item(tree, hf_ipmi_se_15_lastrec, tvb, 4, 2, ENC_LITTLE_ENDIAN); - if (tmp == 0xffff) - { - proto_item_append_text(ti, " (SEL is empty)"); - } + proto_tree_add_item(tree, hf_ipmi_se_15_lastrec, tvb, 4, 2, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, hf_ipmi_se_15_proc_sw, tvb, 6, 2, ENC_LITTLE_ENDIAN); - tmp = tvb_get_letohs(tvb, 8); - ti = proto_tree_add_item(tree, hf_ipmi_se_15_proc_bmc, tvb, 8, 2, ENC_LITTLE_ENDIAN); - if (tmp == 0) - { - proto_item_append_text(ti, " (Event processed but cannot be logged)"); - } + proto_tree_add_item(tree, hf_ipmi_se_15_proc_bmc, tvb, 8, 2, ENC_LITTLE_ENDIAN); } static const value_string cc15[] = { @@ -2989,7 +2972,7 @@ proto_register_ipmi_se(void) "ipmi.cp12.byte1", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_ipmi_se_cp12_alert_stringsel, { "Alert String Selector (set selector)", - "ipmi.cp12.alert_stringsel", FT_UINT8, BASE_HEX, NULL, 0x7f, NULL, HFILL }}, + "ipmi.cp12.alert_stringsel", FT_UINT8, BASE_HEX|BASE_VALS_NO_UNKNOWN, VALS(unique_selects_volatile_string_parameters), 0x7f, NULL, HFILL }}, { &hf_ipmi_se_cp12_evfilter, { "Filter Number", "ipmi.cp12.evfilter", FT_UINT8, BASE_HEX, NULL, 0x7f, NULL, HFILL }}, @@ -3038,14 +3021,14 @@ proto_register_ipmi_se(void) { &hf_ipmi_se_00_addr, { "Event Receiver slave address", - "ipmi.se00.addr", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, + "ipmi.se00.addr", FT_UINT8, BASE_HEX|BASE_VALS_NO_UNKNOWN, VALS(unique_disable_message_generation), 0, NULL, HFILL }}, { &hf_ipmi_se_00_lun, { "Event Receiver LUN", "ipmi.se00.lun", FT_UINT8, BASE_HEX, NULL, 0x3, NULL, HFILL }}, { &hf_ipmi_se_01_addr, { "Event Receiver slave address", - "ipmi.se01.addr", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, + "ipmi.se01.addr", FT_UINT8, BASE_HEX|BASE_VALS_NO_UNKNOWN, VALS(unique_disable_message_generation), 0, NULL, HFILL }}, { &hf_ipmi_se_01_lun, { "Event Receiver LUN", "ipmi.se01.lun", FT_UINT8, BASE_HEX, NULL, 0x3, NULL, HFILL }}, @@ -3135,13 +3118,13 @@ proto_register_ipmi_se(void) "ipmi.se15.tstamp", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_ipmi_se_15_lastrec, { "Record ID for last record in SEL", - "ipmi.se15.lastrec", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }}, + "ipmi.se15.lastrec", FT_UINT16, BASE_HEX|BASE_VALS_NO_UNKNOWN, VALS(unique_sel_is_empty), 0, NULL, HFILL }}, { &hf_ipmi_se_15_proc_sw, { "Last SW Processed Event Record ID", "ipmi.se15.proc_sw", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_ipmi_se_15_proc_bmc, { "Last BMC Processed Event Record ID", - "ipmi.se15.proc_bmc", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }}, + "ipmi.se15.proc_bmc", FT_UINT16, BASE_HEX|BASE_VALS_NO_UNKNOWN, VALS(unique_event_processed_not_logged), 0, NULL, HFILL }}, { &hf_ipmi_se_16_chan, { "Channel", diff --git a/epan/dissectors/packet-iso7816.c b/epan/dissectors/packet-iso7816.c index e3e9ab38ef..6bc2e00d2a 100644 --- a/epan/dissectors/packet-iso7816.c +++ b/epan/dissectors/packet-iso7816.c @@ -217,6 +217,16 @@ static const range_string iso7816_class_rvals[] = { {0, 0, NULL} }; +static const value_string unique_or_unused[] = { + { 0, "or unused" }, + { 0, NULL } +}; + +static const value_string unique_max_num_available_bytes[] = { + { 0, "maximum number of available bytes" }, + { 0, NULL } +}; + static inline guint16 FI_to_Fi(guint8 FI) { @@ -423,8 +433,6 @@ dissect_iso7816_class(tvbuff_t *tvb, gint offset, proto_item *class_item; proto_tree *class_tree; guint8 dev_class; - guint8 channel; - proto_item *ch_item; class_item = proto_tree_add_item(tree, hf_iso7816_cla, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -444,11 +452,8 @@ dissect_iso7816_class(tvbuff_t *tvb, gint offset, proto_tree_add_item(class_tree, hf_iso7816_cla_sm, tvb, offset, 1, ENC_BIG_ENDIAN); - channel = dev_class & 0x03; - ch_item = proto_tree_add_item(class_tree, hf_iso7816_cla_channel, + proto_tree_add_item(class_tree, hf_iso7816_cla_channel, tvb, offset, 1, ENC_BIG_ENDIAN); - if (channel==0) - proto_item_append_text(ch_item, " (or unused)"); } } @@ -546,14 +551,7 @@ static gint dissect_iso7816_le( tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, proto_tree *tree) { - guint8 le; - proto_item *le_item; - - le = tvb_get_guint8(tvb, offset); - le_item = proto_tree_add_item( - tree, hf_iso7816_le, tvb, offset, 1, ENC_BIG_ENDIAN); - if (le==0) - proto_item_append_text(le_item, " (maximum number of available bytes)"); + proto_tree_add_item(tree, hf_iso7816_le, tvb, offset, 1, ENC_BIG_ENDIAN); return 1; } @@ -839,7 +837,7 @@ proto_register_iso7816(void) }, { &hf_iso7816_cla_channel, { "Logical channel number", "iso7816.apdu.cla.channel", - FT_UINT8, BASE_HEX, NULL, 0x03, NULL , HFILL } + FT_UINT8, BASE_HEX|BASE_VALS_NO_UNKNOWN, VALS(unique_or_unused), 0x03, NULL , HFILL } }, { &hf_iso7816_ins, { "Instruction", "iso7816.apdu.ins", @@ -859,7 +857,7 @@ proto_register_iso7816(void) }, { &hf_iso7816_le, { "Expected response length Le", "iso7816.apdu.le", - FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL } + FT_UINT8, BASE_HEX|BASE_VALS_NO_UNKNOWN, VALS(unique_max_num_available_bytes), 0, NULL, HFILL } }, { &hf_iso7816_body, { "APDU Body", "iso7816.apdu.body", diff --git a/epan/dissectors/packet-l2tp.c b/epan/dissectors/packet-l2tp.c index 6ba9c356a6..d200fc9135 100644 --- a/epan/dissectors/packet-l2tp.c +++ b/epan/dissectors/packet-l2tp.c @@ -959,6 +959,11 @@ static const value_string iwf_types_vals[] = { { 0, NULL }, }; +static const val64_string unique_indeterminable_or_no_link[] = { + { 0, "indeterminable or no physical p2p link" }, + { 0, NULL }, +}; + static const true_false_string tfs_up_down = { "Up", "Down" }; static const true_false_string tfs_new_existing = { "New", "Existing" }; @@ -1976,7 +1981,7 @@ static void process_control_avps(tvbuff_t *tvb, l2tpv3_tunnel_t *tunnel) { proto_tree *l2tp_lcp_avp_tree, *l2tp_avp_tree = NULL, *l2tp_avp_tree_sub, *l2tp_avp_csu_tree; - proto_item *tf, *te, *tc; + proto_item *te, *tc; int msg_type = 0; gboolean isStopCcn = FALSE; @@ -2472,31 +2477,17 @@ static void process_control_avps(tvbuff_t *tvb, store_cma_nonce(tunnel, tvb, idx, avp_len, msg_type); break; case TX_CONNECT_SPEED_V3: - { - guint64 speed; if (avp_len < 8) break; - speed = tvb_get_ntoh64(tvb, idx); - tf = proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_tx_connect_speed_v3, tvb, idx, 8, ENC_BIG_ENDIAN); - if (speed == 0) { - proto_item_append_text(tf, " (indeterminable or no physical p2p link)"); - } + proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_tx_connect_speed_v3, tvb, idx, 8, ENC_BIG_ENDIAN); break; - } case RX_CONNECT_SPEED_V3: - { - guint64 speed; if (avp_len < 8) break; - speed = tvb_get_ntoh64(tvb, idx); - tf = proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_rx_connect_speed_v3, tvb, idx, 8, ENC_BIG_ENDIAN); - if (speed == 0) { - proto_item_append_text(tf, " (indeterminable or no physical p2p link)"); - } + proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_rx_connect_speed_v3, tvb, idx, 8, ENC_BIG_ENDIAN); break; - } case CONNECT_SPEED_UPDATE: { tc = proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_csu, tvb, idx, avp_len, ENC_NA); @@ -3720,8 +3711,8 @@ proto_register_l2tp(void) { &hf_l2tp_avp_circuit_type, { "Circuit Type", "l2tp.avp.circuit_type", FT_BOOLEAN, 16, TFS(&tfs_new_existing), 0x0002, NULL, HFILL }}, { &hf_l2tp_avp_preferred_language, { "Preferred Language", "l2tp.avp.preferred_language", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_l2tp_avp_nonce, { "Nonce", "l2tp.avp.nonce", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - { &hf_l2tp_avp_tx_connect_speed_v3, { "Tx Connect Speed v3", "l2tp.avp.tx_connect_speed_v3", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - { &hf_l2tp_avp_rx_connect_speed_v3, { "Rx Connect Speed v3", "l2tp.avp.rx_connect_speed_v3", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_l2tp_avp_tx_connect_speed_v3, { "Tx Connect Speed v3", "l2tp.avp.tx_connect_speed_v3", FT_UINT64, BASE_HEX|BASE_VAL64_STRING|BASE_VALS_NO_UNKNOWN, VALS64(unique_indeterminable_or_no_link), 0x0, NULL, HFILL }}, + { &hf_l2tp_avp_rx_connect_speed_v3, { "Rx Connect Speed v3", "l2tp.avp.rx_connect_speed_v3", FT_UINT64, BASE_HEX|BASE_VAL64_STRING|BASE_VALS_NO_UNKNOWN, VALS64(unique_indeterminable_or_no_link), 0x0, NULL, HFILL }}, { &hf_l2tp_lapd_info, { "LAPD info", "l2tp.lapd_info", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_l2tp_session_id, { "Packet Type", "l2tp.session_id", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_l2tp_zero_length_body_message, { "Zero Length Body message", "l2tp.zero_length_body_message", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-llrp.c b/epan/dissectors/packet-llrp.c index 7c7569fed1..e65bb7d229 100644 --- a/epan/dissectors/packet-llrp.c +++ b/epan/dissectors/packet-llrp.c @@ -1424,6 +1424,37 @@ static value_string_ext impinj_hub_fault_type_ext = VALUE_STRING_EXT_INIT(impinj #define LLRP_HEADER_LENGTH 10 #define LLRP_NO_LIMIT 0 +static const value_string unique_no_limit[] = { + { LLRP_NO_LIMIT, "No Limit" }, + { 0, NULL }, +}; + +static const value_string unique_all_rospecs[] = { + { LLRP_ROSPEC_ALL, "All ROSpecs" }, + { 0, NULL }, +}; + +static const value_string unique_all_access_specs[] = { + { LLRP_ACCESSSPEC_ALL, "All Access Specs" }, + { 0, NULL }, +}; + +static const value_string unique_all_antenna[] = { + { LLRP_ANTENNA_ALL, "All Antenna" }, + { 0, NULL }, +}; + +static const value_string unique_all_gpi_ports[] = { + { LLRP_GPI_PORT_ALL, "All GPI Ports" }, + { 0, NULL }, +}; + +static const value_string unique_all_gpo_ports[] = { + { LLRP_GPO_PORT_ALL, "All GPO Ports" }, + { 0, NULL }, +}; + + static guint dissect_llrp_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, const guint end, const guint depth); @@ -1907,36 +1938,17 @@ dissect_llrp_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, suboffset += 1; proto_tree_add_item(param_tree, hf_llrp_client_opspec_timeout, tvb, suboffset, 2, ENC_BIG_ENDIAN); suboffset += 2; - num = tvb_get_ntohl(tvb, suboffset); - if(num == LLRP_NO_LIMIT) - proto_tree_add_uint_format_value(param_tree, hf_llrp_max_num_rospec, tvb, suboffset, 4, num, "No limit (%u)", num); - else - proto_tree_add_item(param_tree, hf_llrp_max_num_rospec, tvb, suboffset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(param_tree, hf_llrp_max_num_rospec, tvb, suboffset, 4, ENC_BIG_ENDIAN); suboffset += 4; - num = tvb_get_ntohl(tvb, suboffset); - if(num == LLRP_NO_LIMIT) - proto_tree_add_uint_format_value(param_tree, hf_llrp_max_num_spec_per_rospec, tvb, suboffset, 4, num, "No limit (%u)", num); - else - proto_tree_add_item(param_tree, hf_llrp_max_num_spec_per_rospec, tvb, suboffset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(param_tree, hf_llrp_max_num_spec_per_rospec, tvb, suboffset, 4, ENC_BIG_ENDIAN); suboffset += 4; - num = tvb_get_ntohl(tvb, suboffset); - if(num == LLRP_NO_LIMIT) - proto_tree_add_uint_format_value(param_tree, hf_llrp_max_num_inventory_per_aispec, tvb, suboffset, 4, num, "No limit (%u)", num); - else - proto_tree_add_item(param_tree, hf_llrp_max_num_inventory_per_aispec, tvb, suboffset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(param_tree, hf_llrp_max_num_inventory_per_aispec, tvb, suboffset, 4, ENC_BIG_ENDIAN); suboffset += 4; - num = tvb_get_ntohl(tvb, suboffset); - if(num == LLRP_NO_LIMIT) - proto_tree_add_uint_format_value(param_tree, hf_llrp_max_num_accessspec, tvb, suboffset, 4, num, "No limit (%u)", num); - else - proto_tree_add_item(param_tree, hf_llrp_max_num_accessspec, tvb, suboffset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(param_tree, hf_llrp_max_num_accessspec, tvb, suboffset, 4, ENC_BIG_ENDIAN); suboffset += 4; - num = tvb_get_ntohl(tvb, suboffset); - if(num == LLRP_NO_LIMIT) - proto_tree_add_uint_format_value(param_tree, hf_llrp_max_num_opspec_per_accressspec, tvb, suboffset, 4, num, "No limit (%u)", num); - else - proto_tree_add_item(param_tree, hf_llrp_max_num_opspec_per_accressspec, tvb, suboffset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(param_tree, hf_llrp_max_num_opspec_per_accressspec, tvb, suboffset, 4, ENC_BIG_ENDIAN); suboffset += 4; + break; case LLRP_TLV_REGU_CAPABILITIES: proto_tree_add_item(param_tree, hf_llrp_country_code, tvb, suboffset, 2, ENC_BIG_ENDIAN); @@ -2288,11 +2300,7 @@ dissect_llrp_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_item(param_tree, hf_llrp_can_support_UMI_method2, tvb, suboffset, 1, ENC_NA); proto_tree_add_item(param_tree, hf_llrp_can_support_XPC, tvb, suboffset, 1, ENC_NA); suboffset += 1; - num = tvb_get_ntohs(tvb, suboffset); - if(num == LLRP_NO_LIMIT) - proto_tree_add_uint_format_value(param_tree, hf_llrp_max_num_spec_per_rospec, tvb, suboffset, 2, num, "No limit (%u)", num); - else - proto_tree_add_item(param_tree, hf_llrp_max_num_filter_per_query, tvb, suboffset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(param_tree, hf_llrp_max_num_filter_per_query, tvb, suboffset, 2, ENC_BIG_ENDIAN); suboffset += 2; break; case LLRP_TLV_C1G2_UHF_RF_MD_TBL_ENT: @@ -2684,8 +2692,7 @@ dissect_llrp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { gboolean ends_with_parameters; guint8 requested_data; - guint16 antenna_id, gpi_port, gpo_port; - guint32 spec_id, vendor; + guint32 vendor; proto_item *request_item, *antenna_item, *gpi_item, *gpo_item; guint (*dissect_custom_message)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset) = NULL; @@ -2729,26 +2736,14 @@ dissect_llrp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, case LLRP_TYPE_ENABLE_ROSPEC: case LLRP_TYPE_DISABLE_ROSPEC: case LLRP_TYPE_DELETE_ROSPEC: - spec_id = tvb_get_ntohl(tvb, offset); - if (spec_id == LLRP_ROSPEC_ALL) - proto_tree_add_uint_format(tree, hf_llrp_rospec, tvb, - offset, 4, spec_id, "All ROSpecs (%u)", spec_id); - else - proto_tree_add_item(tree, hf_llrp_rospec, tvb, - offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_llrp_rospec, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; break; /* Some just have an AccessSpec ID */ case LLRP_TYPE_ENABLE_ACCESSSPEC: case LLRP_TYPE_DELETE_ACCESSSPEC: case LLRP_TYPE_DISABLE_ACCESSSPEC: - spec_id = tvb_get_ntohl(tvb, offset); - if (spec_id == LLRP_ACCESSSPEC_ALL) - proto_tree_add_uint_format(tree, hf_llrp_accessspec, tvb, - offset, 4, spec_id, "All Access Specs (%u)", spec_id); - else - proto_tree_add_item(tree, hf_llrp_accessspec, tvb, - offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_llrp_accessspec, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; break; case LLRP_TYPE_GET_READER_CAPABILITIES: @@ -2758,13 +2753,7 @@ dissect_llrp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, break; /* GET_READER_CONFIG is more complicated */ case LLRP_TYPE_GET_READER_CONFIG: - antenna_id = tvb_get_ntohs(tvb, offset); - if (antenna_id == LLRP_ANTENNA_ALL) - antenna_item = proto_tree_add_uint_format(tree, hf_llrp_antenna_id, tvb, - offset, 2, antenna_id, "All Antennas (%u)", antenna_id); - else - antenna_item = proto_tree_add_item(tree, hf_llrp_antenna_id, tvb, - offset, 2, ENC_BIG_ENDIAN); + antenna_item = proto_tree_add_item(tree, hf_llrp_antenna_id, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; requested_data = tvb_get_guint8(tvb, offset); @@ -2772,22 +2761,10 @@ dissect_llrp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset, 1, ENC_BIG_ENDIAN); offset++; - gpi_port = tvb_get_ntohs(tvb, offset); - if (gpi_port == LLRP_GPI_PORT_ALL) - gpi_item = proto_tree_add_uint_format(tree, hf_llrp_gpi_port, tvb, - offset, 2, gpi_port, "All GPI Ports (%u)", gpi_port); - else - gpi_item = proto_tree_add_item(tree, hf_llrp_gpi_port, tvb, - offset, 2, ENC_BIG_ENDIAN); + gpi_item = proto_tree_add_item(tree, hf_llrp_gpi_port, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; - gpo_port = tvb_get_ntohs(tvb, offset); - if (gpo_port == LLRP_GPO_PORT_ALL) - gpo_item = proto_tree_add_uint_format(tree, hf_llrp_gpo_port, tvb, - offset, 2, gpo_port, "All GPO Ports (%u)", gpo_port); - else - gpo_item = proto_tree_add_item(tree, hf_llrp_gpo_port, tvb, - offset, 2, ENC_BIG_ENDIAN); + gpo_item = proto_tree_add_item(tree, hf_llrp_gpo_port, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; switch (requested_data) @@ -2996,19 +2973,19 @@ proto_register_llrp(void) NULL, HFILL }}, { &hf_llrp_rospec, - { "ROSpec ID", "llrp.rospec", FT_UINT32, BASE_DEC, NULL, 0, + { "ROSpec ID", "llrp.rospec", FT_UINT32, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_all_rospecs), 0, NULL, HFILL }}, { &hf_llrp_antenna_id, - { "Antenna ID", "llrp.antenna_id", FT_UINT16, BASE_DEC, NULL, 0, + { "Antenna ID", "llrp.antenna_id", FT_UINT16, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_all_antenna), 0, NULL, HFILL }}, { &hf_llrp_gpi_port, - { "GPI Port Number", "llrp.gpi_port", FT_UINT16, BASE_DEC, NULL, 0, + { "GPI Port Number", "llrp.gpi_port", FT_UINT16, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_all_gpi_ports), 0, NULL, HFILL }}, { &hf_llrp_gpo_port, - { "GPO Port Number", "llrp.gpo_port", FT_UINT16, BASE_DEC, NULL, 0, + { "GPO Port Number", "llrp.gpo_port", FT_UINT16, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_all_gpo_ports), 0, NULL, HFILL }}, { &hf_llrp_rest_fact, @@ -3016,7 +2993,7 @@ proto_register_llrp(void) NULL, HFILL }}, { &hf_llrp_accessspec, - { "Access Spec ID", "llrp.accessspec", FT_UINT32, BASE_DEC, NULL, 0, + { "Access Spec ID", "llrp.accessspec", FT_UINT32, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_all_access_specs), 0, NULL, HFILL }}, { &hf_llrp_vendor, @@ -3136,23 +3113,23 @@ proto_register_llrp(void) NULL, HFILL }}, { &hf_llrp_max_num_rospec, - { "Maximum number of ROSpecs", "llrp.param.max_num_rospec", FT_UINT32, BASE_DEC, NULL, 0, + { "Maximum number of ROSpecs", "llrp.param.max_num_rospec", FT_UINT32, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_no_limit), 0, NULL, HFILL }}, { &hf_llrp_max_num_spec_per_rospec, - { "Maximum number of spec per ROSpec", "llrp.param.max_num_spec_per_rospec", FT_UINT32, BASE_DEC, NULL, 0, + { "Maximum number of spec per ROSpec", "llrp.param.max_num_spec_per_rospec", FT_UINT32, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_no_limit), 0, NULL, HFILL }}, { &hf_llrp_max_num_inventory_per_aispec, - { "Maximum number of Inventory Spec per AISpec", "llrp.param.max_num_inventory_per_aispec", FT_UINT32, BASE_DEC, NULL, 0, + { "Maximum number of Inventory Spec per AISpec", "llrp.param.max_num_inventory_per_aispec", FT_UINT32, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_no_limit), 0, NULL, HFILL }}, { &hf_llrp_max_num_accessspec, - { "Maximum number of AccessSpec", "llrp.param.max_num_accessspec", FT_UINT32, BASE_DEC, NULL, 0, + { "Maximum number of AccessSpec", "llrp.param.max_num_accessspec", FT_UINT32, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_no_limit), 0, NULL, HFILL }}, { &hf_llrp_max_num_opspec_per_accressspec, - { "Maximum number of OpSpec per AccessSpec", "llrp.param.max_num_opspec_per_accressspec", FT_UINT32, BASE_DEC, NULL, 0, + { "Maximum number of OpSpec per AccessSpec", "llrp.param.max_num_opspec_per_accressspec", FT_UINT32, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_no_limit), 0, NULL, HFILL }}, /* TODO add translation */ @@ -3537,7 +3514,7 @@ proto_register_llrp(void) NULL, HFILL }}, { &hf_llrp_max_num_filter_per_query, - { "Maximum number of select filters per query", "llrp.param.max_num_filter_per_query", FT_UINT16, BASE_DEC, NULL, 0, + { "Maximum number of select filters per query", "llrp.param.max_num_filter_per_query", FT_UINT16, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_no_limit), 0, NULL, HFILL }}, { &hf_llrp_mode_ident, diff --git a/epan/dissectors/packet-pim.c b/epan/dissectors/packet-pim.c index bc51e92c4c..af34784286 100644 --- a/epan/dissectors/packet-pim.c +++ b/epan/dissectors/packet-pim.c @@ -148,6 +148,7 @@ static int hf_pim_register_flag_border = -1; static int hf_pim_register_flag_null_register = -1; static int hf_pim_mode = -1; static int hf_pim_holdtime = -1; +static int hf_pim_holdtime_t = -1; static int hf_pim_numgroups = -1; static int hf_pim_numjoins = -1; static int hf_pim_numprunes = -1; @@ -326,6 +327,18 @@ static const value_string pim_ip_version_vals[] = { { 6, "IPv6" }, { 0, NULL } }; + +static const value_string unique_infinity[] = { + { 0xffff, "Infinity" }, + { 0, NULL } +}; + +static const value_string unique_infinity_t[] = { + { 0, "goodbye" }, + { 0xffff, "Infinity" }, + { 0, NULL } +}; + /* This function is only called from the IGMP dissector */ static int dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { @@ -432,17 +445,10 @@ dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U switch (pim_type) { case 0: /* query */ { - guint32 holdtime; - proto_item *ti_hold; - proto_tree_add_item(pimopt_tree, hf_pim_mode, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 2; - ti_hold = proto_tree_add_item_ret_uint(pimopt_tree, hf_pim_holdtime, tvb, - offset, 2, ENC_BIG_ENDIAN, &holdtime); - if(holdtime == 0xFFFF){ - proto_item_append_text(ti_hold, " (Infinity)"); - } + proto_tree_add_item(pimopt_tree, hf_pim_holdtime, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; break; } @@ -516,12 +522,10 @@ dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U { int off; int ngroup, i, njoin, nprune, j; - guint32 holdtime; proto_tree *grouptree = NULL; proto_item *tigroup; proto_tree *subtree = NULL; proto_item *tisub; - proto_item *ti_hold; proto_tree_add_item(pimopt_tree, hf_pim_upstream_neighbor_ip4, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; @@ -530,11 +534,7 @@ dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U proto_tree_add_item(pim_tree, hf_pim_res_bytes, tvb, offset, 2, ENC_NA); offset += 2; - ti_hold = proto_tree_add_item_ret_uint(pimopt_tree, hf_pim_holdtime, tvb, - offset, 2, ENC_BIG_ENDIAN, &holdtime); - if(holdtime == 0xFFFF){ - proto_item_append_text(ti_hold, " (Infinity)"); - } + proto_tree_add_item(pimopt_tree, hf_pim_holdtime, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; /* reserved stuff */ @@ -590,9 +590,6 @@ dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U case 4: /* rp-reachability */ { - guint32 holdtime; - proto_item *ti_hold; - proto_tree_add_item(pimopt_tree, hf_pim_group_address_ip4, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; @@ -606,11 +603,7 @@ dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U proto_tree_add_item(pim_tree, hf_pim_res_bytes, tvb, offset, 2, ENC_NA); offset += 2; - ti_hold = proto_tree_add_item_ret_uint(pimopt_tree, hf_pim_holdtime, tvb, - offset, 2, ENC_BIG_ENDIAN, &holdtime); - if(holdtime == 0xFFFF){ - proto_item_append_text(ti_hold, " (Infinity)"); - } + proto_tree_add_item(pimopt_tree, hf_pim_holdtime, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; break; } @@ -932,8 +925,8 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) while (tvb_reported_length_remaining(tvb, offset) >= 2) { guint16 hello_opt, opt_len; guint32 holdtime; + const gchar* hold_str; proto_item *opt_item; - proto_item *ti_hold; proto_tree *opt_tree; opt_count++; @@ -948,21 +941,13 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) switch(hello_opt) { case PIM_HELLO_HOLD_T: /* Hello Hold Time Option */ - ti_hold = proto_tree_add_item_ret_uint(opt_tree, hf_pim_holdtime, tvb, + proto_tree_add_item_ret_uint(opt_tree, hf_pim_holdtime_t, tvb, offset+4, 2, ENC_BIG_ENDIAN, &holdtime); - switch(holdtime){ - case 0: - proto_item_append_text(ti_hold, " (goodbye)"); - proto_item_append_text(opt_item, ": %u (goodbye)", holdtime); - break; - case 0xFFFF: - proto_item_append_text(ti_hold, " (Infinity)"); - proto_item_append_text(opt_item, ": %u (Infinity)", holdtime); - break; - default: - proto_item_append_text(opt_item, ": %u", holdtime); - break; - } + proto_item_append_text(opt_item, ": %u", holdtime); + hold_str = try_val_to_str(holdtime, unique_infinity_t); + if (hold_str != NULL) + proto_item_append_text(opt_item, " (%s)", hold_str); + break; case PIM_HELLO_LAN_PRUNE_DELAY: /* LAN Prune Delay Option */ @@ -1122,12 +1107,10 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) int advance; int off; int ngroup, i, njoin, nprune, j; - guint32 holdtime; proto_tree *grouptree = NULL; proto_item *tigroup; proto_tree *subtree = NULL; proto_item *tisub; - proto_item *ti_hold; if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_unicast, NULL, NULL, hf_pim_upstream_neighbor_ip4, hf_pim_upstream_neighbor_ip6, &advance)) @@ -1143,11 +1126,7 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) proto_tree_add_item(pimopt_tree, hf_pim_numgroups, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - ti_hold = proto_tree_add_item_ret_uint(pimopt_tree, hf_pim_holdtime, tvb, - offset, 2, ENC_BIG_ENDIAN, &holdtime); - if(holdtime == 0xFFFF){ - proto_item_append_text(ti_hold, " (Infinity)"); - } + proto_tree_add_item(pimopt_tree, hf_pim_holdtime, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; for (i = 0; i < ngroup; i++) { @@ -1194,10 +1173,8 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) int advance; int i, j; int frpcnt; - guint32 holdtime; proto_tree *grouptree = NULL; proto_item *tigroup; - proto_item *ti_hold; proto_tree_add_item(pimopt_tree, hf_pim_fragment_tag, tvb, offset, 2, ENC_BIG_ENDIAN); @@ -1236,11 +1213,7 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) goto breakbreak4; offset += advance; - ti_hold = proto_tree_add_item_ret_uint(pimopt_tree, hf_pim_holdtime, tvb, - offset, 2, ENC_BIG_ENDIAN, &holdtime); - if(holdtime == 0xFFFF){ - proto_item_append_text(ti_hold, " (Infinity)"); - } + proto_tree_add_item(pimopt_tree, hf_pim_holdtime, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(grouptree, hf_pim_priority, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; @@ -1285,9 +1258,7 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int advance; int pfxcnt; - guint32 holdtime; int i; - proto_item *ti_hold; pfxcnt = tvb_get_guint8(tvb, offset); proto_tree_add_item(pimopt_tree, hf_pim_prefix_count, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -1295,11 +1266,7 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) proto_tree_add_item(pimopt_tree, hf_pim_priority, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - ti_hold = proto_tree_add_item_ret_uint(pimopt_tree, hf_pim_holdtime, tvb, - offset, 2, ENC_BIG_ENDIAN, &holdtime); - if(holdtime == 0xFFFF){ - proto_item_append_text(ti_hold, " (Infinity)"); - } + proto_tree_add_item(pimopt_tree, hf_pim_holdtime, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_unicast, @@ -1506,7 +1473,13 @@ proto_register_pim(void) }, { &hf_pim_holdtime, { "Holdtime", "pim.holdtime", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_infinity), 0x0, + "The amount of time a receiver must keep the neighbor " + "reachable, in seconds.", HFILL } + }, + { &hf_pim_holdtime_t, + { "Holdtime", "pim.holdtime", + FT_UINT16, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_infinity_t), 0x0, "The amount of time a receiver must keep the neighbor " "reachable, in seconds.", HFILL } }, diff --git a/epan/dissectors/packet-smb2.c b/epan/dissectors/packet-smb2.c index 69cf7b6c10..fa03607a19 100644 --- a/epan/dissectors/packet-smb2.c +++ b/epan/dissectors/packet-smb2.c @@ -789,6 +789,11 @@ static const value_string smb2_cipher_types[] = { { 0, NULL } }; +static const val64_string unique_unsolicited_response[] = { + { 0xffffffffffffffff, "unsolicited response" }, + { 0, NULL } +}; + #define SMB2_NUM_PROCEDURES 256 static void @@ -8914,7 +8919,6 @@ static int dissect_smb2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, gboolean first_in_chain) { gboolean smb2_transform_header = FALSE; - proto_item *msg_id_item; proto_item *item = NULL; proto_tree *tree = NULL; proto_item *header_item = NULL; @@ -9056,10 +9060,7 @@ dissect_smb2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, gboolea /* Message ID */ si->msg_id = tvb_get_letoh64(tvb, offset); ssi_key.msg_id = si->msg_id; - msg_id_item = proto_tree_add_item(header_tree, hf_smb2_msg_id, tvb, offset, 8, ENC_LITTLE_ENDIAN); - if (msg_id_item && (si->msg_id == G_GUINT64_CONSTANT(0xFFFFFFFFFFFFFFFF))) { - proto_item_append_text(msg_id_item, " (unsolicited response)"); - } + proto_tree_add_item(header_tree, hf_smb2_msg_id, tvb, offset, 8, ENC_LITTLE_ENDIAN); offset += 8; /* Tree ID and Session ID */ @@ -9279,8 +9280,8 @@ proto_register_smb2(void) }, { &hf_smb2_msg_id, - { "Message ID", "smb2.msg_id", FT_UINT64, BASE_DEC, - NULL, 0, NULL, HFILL } + { "Message ID", "smb2.msg_id", FT_UINT64, BASE_DEC|BASE_VAL64_STRING|BASE_VALS_NO_UNKNOWN, + VALS64(unique_unsolicited_response), 0, NULL, HFILL } }, { &hf_smb2_tid, diff --git a/epan/proto.c b/epan/proto.c index 17c787a906..330d5a144a 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -7118,6 +7118,13 @@ tmp_fld_check_assert(header_field_info *hfinfo) hfinfo->name, hfinfo->abbrev, ftype_name(hfinfo->type)); } + if (hfinfo->display & BASE_VALS_NO_UNKNOWN) { + g_error("Field '%s' (%s) is an integral value (%s)" + " that is being displayed as BASE_NONE but" + " with BASE_VALS_NO_UNKNOWN", + hfinfo->name, hfinfo->abbrev, + ftype_name(hfinfo->type)); + } break; default: @@ -8269,13 +8276,28 @@ fill_label_number(field_info *fi, gchar *label_str, gboolean is_signed) * frame-number field - they're just integers giving * the ordinal frame number. */ - const char *val_str = hf_try_val_to_str_const(value, hfinfo, "Unknown"); + const char *val_str = hf_try_val_to_str(value, hfinfo); out = hfinfo_number_vals_format(hfinfo, buf, value); - if (out == NULL) /* BASE_NONE so don't put integer in descr */ - label_fill(label_str, 0, hfinfo, val_str); - else - label_fill_descr(label_str, 0, hfinfo, val_str, out); + if (hfinfo->display & BASE_VALS_NO_UNKNOWN) { + /* + * Unique values only display value_string string + * if there is a match. Otherwise it's just a number + */ + if (val_str) { + label_fill_descr(label_str, 0, hfinfo, val_str, out); + } else { + label_fill(label_str, 0, hfinfo, out); + } + } else { + if (val_str == NULL) + val_str = "Unknown"; + + if (out == NULL) /* BASE_NONE so don't put integer in descr */ + label_fill(label_str, 0, hfinfo, val_str); + else + label_fill_descr(label_str, 0, hfinfo, val_str, out); + } } else if (IS_BASE_PORT(hfinfo->display)) { gchar tmp[ITEM_LABEL_LENGTH]; diff --git a/epan/proto.h b/epan/proto.h index fca8b01cb8..c60c36a704 100644 --- a/epan/proto.h +++ b/epan/proto.h @@ -604,6 +604,7 @@ typedef enum { #define BASE_NO_DISPLAY_VALUE 0x2000 /**< Just display the field name with no value. Intended for byte arrays or header fields above a subtree */ #define BASE_PROTOCOL_INFO 0x4000 /**< protocol_t in [FIELDCONVERT]. Internal use only. */ +#define BASE_VALS_NO_UNKNOWN 0x8000 /**< field will not display "Unknown" if value_string match is not found */ /** BASE_ values that cause the field value to be displayed twice */ #define IS_BASE_DUAL(b) ((b)==BASE_DEC_HEX||(b)==BASE_HEX_DEC) diff --git a/plugins/docsis/packet-docsis.c b/plugins/docsis/packet-docsis.c index bc17b6eeb5..39a592b6d8 100644 --- a/plugins/docsis/packet-docsis.c +++ b/plugins/docsis/packet-docsis.c @@ -254,6 +254,11 @@ static const true_false_string odd_even_tfs = { "Even Key", }; +static const value_string unique_no_phs[] = { + { 0, "No PHS on current packet" }, + { 0, NULL } +}; + /* Fragmentation Flags / Sequence */ static guint8 frag_flags; static guint8 frag_seq; @@ -288,13 +293,11 @@ static void dissect_ehdr (tvbuff_t * tvb, proto_tree * tree, packet_info * pinfo) { proto_tree *ehdr_tree; - proto_item *item_pshi; proto_item *eh_length_item; gint ehdrlen; int pos; guint8 type; guint8 len; - guint8 val; ehdrlen = tvb_get_guint8 (tvb, 1); pos = 4; @@ -392,12 +395,7 @@ dissect_ehdr (tvbuff_t * tvb, proto_tree * tree, packet_info * pinfo) /* Deprecated in DOCSIS 3.1, was Downstream Service Flow EH Element in earlier revisions */ case EH_SFLOW_HDR_UP: /* Deprecated in DOCSIS 3.1, was Upstream Service Flow EH Element in earlier revisions */ - val = tvb_get_guint8 (tvb, pos+1); - item_pshi = proto_tree_add_item(ehdr_tree, hf_docsis_ehdr_phsi, tvb, pos+1, 1, ENC_BIG_ENDIAN); - if (val == 0) - { - proto_item_append_text(item_pshi, " (No PHS on current packet)" ); - } + proto_tree_add_item(ehdr_tree, hf_docsis_ehdr_phsi, tvb, pos+1, 1, ENC_BIG_ENDIAN); if (len == 2) { @@ -952,7 +950,7 @@ proto_register_docsis (void) }, {&hf_docsis_ehdr_phsi, {"Payload Header Suppression Index", "docsis.ehdr.phsi", - FT_UINT8, BASE_DEC, NULL, 0x0, + FT_UINT8, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_no_phs), 0x0, NULL, HFILL} }, {&hf_docsis_ehdr_qind, diff --git a/plugins/docsis/packet-mdd.c b/plugins/docsis/packet-mdd.c index 614da44357..71d99568d0 100644 --- a/plugins/docsis/packet-mdd.c +++ b/plugins/docsis/packet-mdd.c @@ -284,6 +284,12 @@ static const value_string upstream_transmit_power_reporting_vals[] = { {0, NULL} }; +static const value_string unique_unlimited[] = { + { 0, "Unlimited" }, + {0, NULL} +}; + + /* Windows does not allow data copy between dlls */ const true_false_string mdd_tfs_on_off = { "On", "Off" }; @@ -546,10 +552,7 @@ dissect_mdd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data proto_item_append_text(text_item, " (%d ms)", (256*tvb_get_guint8 (tvb, subpos) + tvb_get_guint8 (tvb, subpos + 1)) * 20); break; case MAXIMUM_NUMBER_OF_REPORTS_PER_EVENT: - text_item = proto_tree_add_item (tlv_tree, hf_docsis_mdd_maximum_number_of_reports_per_event, tvb, subpos, 1, ENC_BIG_ENDIAN); - if ( tvb_get_guint8 (tvb, subpos) == 0) { - proto_item_append_text(text_item, " (Unlimited)"); - } + proto_tree_add_item (tlv_tree, hf_docsis_mdd_maximum_number_of_reports_per_event, tvb, subpos, 1, ENC_BIG_ENDIAN); break; } subpos += sublength + 2; @@ -770,7 +773,7 @@ void proto_register_docsis_mdd (void) }, {&hf_docsis_mdd_maximum_number_of_reports_per_event, {"Maximum Number of Reports per Event", "docsis_mdd.maximum_number_of_reports_per_event", - FT_UINT8, BASE_DEC, NULL, 0x0, + FT_UINT8, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_unlimited), 0x0, "Mdd Maximum Number of Reports per Event", HFILL} }, {&hf_docsis_mdd_upstream_transmit_power_reporting, diff --git a/plugins/wimax/msg_reg_req.c b/plugins/wimax/msg_reg_req.c index 61d2ad80f5..6cd764aab2 100644 --- a/plugins/wimax/msg_reg_req.c +++ b/plugins/wimax/msg_reg_req.c @@ -217,6 +217,11 @@ static const value_string tfs_support[] = { {0, NULL} }; +static const value_string unique_no_limit[] = { + {0, "no limit"}, + {0, NULL} +}; + /* Decode REG-REQ sub-TLV's. */ void dissect_extended_tlv(proto_tree *reg_req_tree, gint tlv_type, tvbuff_t *tvb, guint tlv_offset, guint tlv_len, packet_info *pinfo, guint offset, gint proto_registry) { @@ -314,10 +319,7 @@ void dissect_extended_tlv(proto_tree *reg_req_tree, gint tlv_type, tvbuff_t *tvb add_tlv_subtree(&tlv_info, reg_req_tree, hf_reg_arq, tvb, offset, ENC_BIG_ENDIAN); break; case REG_DSX_FLOW_CONTROL: - tlv_item = add_tlv_subtree(&tlv_info, reg_req_tree, hf_reg_dsx_flow_control, tvb, offset, ENC_BIG_ENDIAN); - if (tvb_get_guint8(tvb, tlv_offset) == 0) { - proto_item_append_text(tlv_item, " (no limit)"); - } + add_tlv_subtree(&tlv_info, reg_req_tree, hf_reg_dsx_flow_control, tvb, offset, ENC_BIG_ENDIAN); break; case REG_MAC_CRC_SUPPORT: if (!include_cor2_changes) { @@ -328,10 +330,7 @@ void dissect_extended_tlv(proto_tree *reg_req_tree, gint tlv_type, tvbuff_t *tvb } break; case REG_MCA_FLOW_CONTROL: - tlv_item = add_tlv_subtree(&tlv_info, reg_req_tree, hf_reg_mca_flow_control, tvb, offset, ENC_BIG_ENDIAN); - if (tvb_get_guint8(tvb, tlv_offset) == 0) { - proto_item_append_text(tlv_item, " (no limit)"); - } + add_tlv_subtree(&tlv_info, reg_req_tree, hf_reg_mca_flow_control, tvb, offset, ENC_BIG_ENDIAN); break; case REG_MCAST_POLLING_CIDS: add_tlv_subtree(&tlv_info, reg_req_tree, hf_reg_mcast_polling_cids, tvb, offset, ENC_BIG_ENDIAN); @@ -741,7 +740,7 @@ void proto_register_mac_mgmt_msg_reg_req(void) &hf_reg_dsx_flow_control, { "DSx flow control", "wmx.reg.dsx_flow_control", - FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + FT_UINT8, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_no_limit), 0x0, NULL, HFILL } }, /* When REG-REQ TLV 7 is length 2 */ @@ -960,7 +959,7 @@ void proto_register_mac_mgmt_msg_reg_req(void) &hf_reg_tlv_t_43_bandwidth_request_ul_tx_power_report_header_support, { "Bandwidth request and UL Tx Power Report header support", - "wimax.reg.bandwidth_request_ul_tx_pwr_report_header_support", + "wmx.reg.bandwidth_request_ul_tx_pwr_report_header_support", FT_UINT24, BASE_DEC, VALS(tfs_support), 0x1, NULL, HFILL } }, @@ -1073,7 +1072,7 @@ void proto_register_mac_mgmt_msg_reg_req(void) &hf_reg_mca_flow_control, { "MCA flow control", "wmx.reg.mca_flow_control", - FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + FT_UINT8, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_no_limit), 0x0, NULL, HFILL } }, { |