diff options
author | Tom Hughes <tom@compton.nu> | 2018-10-26 01:00:48 +0100 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2018-10-27 14:46:06 +0000 |
commit | 076f941bc9292009dc0c8412e7d0418a3fa049c6 (patch) | |
tree | b903bc8aa2e535a19bd4d166b4c8947052cfc423 /epan | |
parent | 27070dd05964823adefbd159595e61b515c52e49 (diff) |
IAX: Use extended 64 bit value to string matching for codecs
Change-Id: I23fe00594296dd29b456804043b6302bd0219884
Reviewed-on: https://code.wireshark.org/review/30394
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-iax2.c | 11 | ||||
-rw-r--r-- | epan/proto.c | 8 |
2 files changed, 12 insertions, 7 deletions
diff --git a/epan/dissectors/packet-iax2.c b/epan/dissectors/packet-iax2.c index 471d582bdd..aafd9eae3b 100644 --- a/epan/dissectors/packet-iax2.c +++ b/epan/dissectors/packet-iax2.c @@ -514,6 +514,7 @@ static const val64_string codec_types[] = { {CODEC_MASK(AST_FORMAT_TESTLAW), "Raw testing-law data (G.711)"}, {0, NULL} }; +static val64_string_ext codec_types_ext = VAL64_STRING_EXT_INIT(codec_types); static const value_string iax_dataformats[] = { {AST_DATAFORMAT_NULL, "N/A (analogue call?)"}, @@ -2535,7 +2536,7 @@ static void dissect_payload(tvbuff_t *tvb, guint32 offset, #endif } else { col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", - val64_to_str(CODEC_MASK(codec), codec_types, "unknown (0x%04x)")); + val64_to_str_ext(CODEC_MASK(codec), &codec_types_ext, "unknown (0x%04x)")); } nbytes = tvb_reported_length(sub_tvb); @@ -2706,7 +2707,7 @@ proto_register_iax2(void) {&hf_iax2_voice_codec, {"CODEC", "iax2.voice.codec", - FT_UINT64, BASE_HEX | BASE_VAL64_STRING, VALS64(codec_types), 0x0, + FT_UINT64, BASE_HEX | BASE_EXT_STRING | BASE_VAL64_STRING, &codec_types_ext, 0x0, "CODEC gives the codec used to encode audio data", HFILL}}, @@ -2723,7 +2724,7 @@ proto_register_iax2(void) {&hf_iax2_video_codec, {"CODEC", "iax2.video.codec", - FT_UINT64, BASE_HEX | BASE_VAL64_STRING, VALS64(codec_types), 0, + FT_UINT64, BASE_HEX | BASE_EXT_STRING | BASE_VAL64_STRING, &codec_types_ext, 0, "The codec used to encode video data", HFILL}}, @@ -2874,7 +2875,7 @@ proto_register_iax2(void) {&hf_iax2_ies[IAX_IE_FORMAT], {"Desired codec format", "iax2.iax.format", - FT_UINT64, BASE_HEX | BASE_VAL64_STRING, VALS64(codec_types), 0x0, + FT_UINT64, BASE_HEX | BASE_EXT_STRING | BASE_VAL64_STRING, &codec_types_ext, 0x0, NULL, HFILL}}, {&hf_iax2_ies[IAX_IE_LANGUAGE], @@ -3094,7 +3095,7 @@ proto_register_iax2(void) {&hf_iax2_ies[IAX_IE_FORMAT2], {"64-bit codec format", "iax2.iax.format2", - FT_UINT64, BASE_HEX | BASE_VAL64_STRING, VALS64(codec_types), 0x0, + FT_UINT64, BASE_HEX | BASE_EXT_STRING | BASE_VAL64_STRING, &codec_types_ext, 0x0, NULL, HFILL}}, {&hf_iax2_ies[IAX_IE_DATAFORMAT], diff --git a/epan/proto.c b/epan/proto.c index 027044e59f..650318a55a 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -8750,8 +8750,12 @@ hf_try_val_to_str(guint32 value, const header_field_info *hfinfo) static const char * hf_try_val64_to_str(guint64 value, const header_field_info *hfinfo) { - if (hfinfo->display & BASE_VAL64_STRING) - return try_val64_to_str(value, (const val64_string *) hfinfo->strings); + if (hfinfo->display & BASE_VAL64_STRING) { + if (hfinfo->display & BASE_EXT_STRING) + return try_val64_to_str_ext(value, (val64_string_ext *) hfinfo->strings); + else + return try_val64_to_str(value, (const val64_string *) hfinfo->strings); + } if (hfinfo->display & BASE_RANGE_STRING) return try_rval64_to_str(value, (const range_string *) hfinfo->strings); |