aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders <anders.broman@ericsson.com>2017-06-13 17:31:21 +0200
committerMartin Kaiser <wireshark@kaiser.cx>2017-06-13 20:36:04 +0000
commit927f5cdc7e78db0d143e5d6f9a26d06834396518 (patch)
tree4a1fcdc53c33e2e36bff3a5d2c06e07f42948707
parentd7f2a2b1e0acca5b54219ea52bb5fc9848c3d9c1 (diff)
[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 <a.broman58@gmail.com> Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
-rw-r--r--debian/libwireshark0.symbols1
-rw-r--r--epan/dissectors/packet-megaco.c23
-rw-r--r--epan/unit_strings.c1
-rw-r--r--epan/unit_strings.h1
4 files changed, 21 insertions, 5 deletions
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;