[MEGACO] Add tman/sdr as an integer with a unit string.
authorAnders <anders.broman@ericsson.com>
Tue, 13 Jun 2017 15:31:21 +0000 (17:31 +0200)
committerMartin Kaiser <wireshark@kaiser.cx>
Tue, 13 Jun 2017 20:36:04 +0000 (20:36 +0000)
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>
debian/libwireshark0.symbols
epan/dissectors/packet-megaco.c
epan/unit_strings.c
epan/unit_strings.h

index 29fb9eda85cb5a5394171dfeefbdbea1d635a85f..0565232bd53c3a450a12d36acfe0cd8df512ee0c 100644 (file)
@@ -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
index 494adf93d5b6063dfc26c595fc6d4bd22c9a3e3a..147ffee286538484c202951b5f04fa1bbc9837ba 100644 (file)
@@ -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;
index 0372b1e14794d001ecca29b54ff2d6724977a9b0..efa401f6282b5ad58be56ae1fa7c19167803f1c7 100644 (file)
@@ -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" };
index e3ae8f0ceb4873c2befe3da845937d672bc05266..11d092dbf9a4f6d47e8a65f81ba00bac9c6983ac 100644 (file)
@@ -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;