From: Anders Date: Tue, 13 Jun 2017 15:31:21 +0000 (+0200) Subject: [MEGACO] Add tman/sdr as an integer with a unit string. X-Git-Url: http://git.samba.org/?p=metze%2Fwireshark%2Fwip.git;a=commitdiff_plain;h=927f5cdc7e78db0d143e5d6f9a26d06834396518 [MEGACO] Add tman/sdr as an integer with a unit string. Change-Id: I987b4a9a86b0000b726f7e514be741e713b6ec5a Reviewed-on: https://code.wireshark.org/review/22112 Reviewed-by: Anders Broman Petri-Dish: Anders Broman Tested-by: Petri Dish Buildbot Reviewed-by: Martin Kaiser --- diff --git a/debian/libwireshark0.symbols b/debian/libwireshark0.symbols index 29fb9eda85..0565232bd5 100644 --- a/debian/libwireshark0.symbols +++ b/debian/libwireshark0.symbols @@ -1714,6 +1714,7 @@ libwireshark.so.0 libwireshark0 #MINVER# units_bit_bits@Base 2.3.0 units_bit_sec@Base 2.3.0 units_byte_bytes@Base 2.3.0 + units_byte_bytespseconds@Base 2.5.0 units_day_days@Base 2.3.0 units_dbi@Base 2.3.0 units_dbm@Base 2.3.0 diff --git a/epan/dissectors/packet-megaco.c b/epan/dissectors/packet-megaco.c index 494adf93d5..147ffee286 100644 --- a/epan/dissectors/packet-megaco.c +++ b/epan/dissectors/packet-megaco.c @@ -166,6 +166,7 @@ static expert_field ei_megaco_audit_descriptor = EI_INIT; static expert_field ei_megaco_signal_descriptor = EI_INIT; static expert_field ei_megaco_reason_invalid = EI_INIT; static expert_field ei_megaco_error_code_invalid = EI_INIT; +static expert_field ei_megaco_invalid_sdr = EI_INIT; static dissector_handle_t megaco_text_handle; @@ -3289,9 +3290,20 @@ dissect_megaco_LocalControldescriptor(tvbuff_t *tvb, proto_tree *megaco_mediades tvb_current_offset = megaco_tvb_skip_wsp(tvb, tvb_offset +1); break; case MEGACO_TMAN_SDR: - proto_tree_add_string(megaco_LocalControl_tree, hf_megaco_tman_sdr, tvb, - tvb_help_offset, tvb_offset-tvb_help_offset, tvb_format_text(tvb, tvb_current_offset, tokenlen)); - tvb_current_offset = megaco_tvb_skip_wsp(tvb, tvb_offset +1); + { + gint32 sdr; + gboolean sdr_valid; + proto_item* pi; + + sdr_valid = ws_strtoi32(tvb_format_text(tvb, tvb_current_offset, tokenlen), NULL, &sdr); + pi =proto_tree_add_int(megaco_LocalControl_tree, hf_megaco_tman_sdr, tvb, tvb_help_offset, + tvb_offset - tvb_help_offset, sdr); + proto_item_append_text(pi, " [%i b/s]", sdr*8); + if (!sdr_valid) { + expert_add_info(pinfo, pi, &ei_megaco_invalid_sdr); + } + tvb_current_offset = megaco_tvb_skip_wsp(tvb, tvb_offset + 1); + } break; case MEGACO_TMAN_MBS: proto_tree_add_string(megaco_LocalControl_tree, hf_megaco_tman_mbs, tvb, @@ -3668,7 +3680,7 @@ proto_register_megaco(void) { "RTCP Allocation Specific Behaviour", "megaco.gm_rsb", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_megaco_tman_sdr, - { "Sustainable Data Rate", "megaco.tman_sdr", FT_STRING, BASE_NONE, NULL, 0x0, + { "Sustainable Data Rate", "megaco.tman_sdr", FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytespsecond, 0x0, NULL, HFILL }}, { &hf_megaco_tman_mbs, { "Maximum Burst Rate", "megaco.tman_mbs", FT_STRING, BASE_NONE, NULL, 0x0, @@ -3779,7 +3791,8 @@ proto_register_megaco(void) { &ei_megaco_no_command, { "megaco.no_command", PI_PROTOCOL, PI_WARN, "No Command detectable", EXPFILL }}, { &ei_megaco_no_descriptor, { "megaco.no_descriptor", PI_PROTOCOL, PI_WARN, "No Descriptor detectable", EXPFILL }}, { &ei_megaco_reason_invalid, { "megaco.change_reason.invalid", PI_MALFORMED, PI_ERROR, "Invalid Service Change Reason", EXPFILL }}, - { &ei_megaco_error_code_invalid, { "megaco.error_code.invalid", PI_MALFORMED, PI_ERROR, "Invalid error code", EXPFILL }} + { &ei_megaco_error_code_invalid,{ "megaco.error_code.invalid", PI_MALFORMED, PI_ERROR, "Invalid error code", EXPFILL } }, + { &ei_megaco_invalid_sdr, { "megaco.sdr.invalid", PI_MALFORMED, PI_ERROR, "Invalid Sustainable Data Rate", EXPFILL }} }; module_t *megaco_module; diff --git a/epan/unit_strings.c b/epan/unit_strings.c index 0372b1e147..efa401f628 100644 --- a/epan/unit_strings.c +++ b/epan/unit_strings.c @@ -58,6 +58,7 @@ char* unit_name_string_get_double(double value, unit_name_string* units) const unit_name_string units_foot_feet = { " foot", " feet" }; const unit_name_string units_bit_bits = { " bit", " bits" }; const unit_name_string units_byte_bytes = { " byte", " bytes" }; +const unit_name_string units_byte_bytespsecond = { " byte/s", " bytes/s" }; const unit_name_string units_octet_octets = { " octet", " octets" }; const unit_name_string units_word_words = { " word", " words" }; const unit_name_string units_tick_ticks = { " tick", " ticks" }; diff --git a/epan/unit_strings.h b/epan/unit_strings.h index e3ae8f0ceb..11d092dbf9 100644 --- a/epan/unit_strings.h +++ b/epan/unit_strings.h @@ -50,6 +50,7 @@ WS_DLL_PUBLIC char* unit_name_string_get_double(double value, unit_name_string* WS_DLL_PUBLIC const unit_name_string units_foot_feet; WS_DLL_PUBLIC const unit_name_string units_bit_bits; WS_DLL_PUBLIC const unit_name_string units_byte_bytes; +WS_DLL_PUBLIC const unit_name_string units_byte_bytespsecond; WS_DLL_PUBLIC const unit_name_string units_octet_octets; WS_DLL_PUBLIC const unit_name_string units_word_words; WS_DLL_PUBLIC const unit_name_string units_tick_ticks;