diff options
author | Michael Mann <mmann78@netscape.net> | 2016-12-15 13:01:27 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-12-16 03:04:11 +0000 |
commit | 232cb9a2dd87ea9cc9c88d4c32bfb7b452705130 (patch) | |
tree | ff1b2039727322c1f8e332f2040f0ba5d83c4f43 | |
parent | 8efb7fece1ffefd26dacd79f5ec8722c4e01e827 (diff) |
Remove proto_item_append_text calls in favor of BASE_UNIT_STRING.
Many proto_item_append_text calls were just adding a unit string to a field.
There's a better way to do that now.
Change-Id: Id18d5ac1ea4d8ecdc4cbe7ebaec07fbd2eab6e78
Reviewed-on: https://code.wireshark.org/review/19289
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
40 files changed, 418 insertions, 614 deletions
diff --git a/debian/libwireshark0.symbols b/debian/libwireshark0.symbols index 1a2641f84b..0bc0ca8ddc 100644 --- a/debian/libwireshark0.symbols +++ b/debian/libwireshark0.symbols @@ -1653,7 +1653,14 @@ libwireshark.so.0 libwireshark0 #MINVER# units_hz_s@Base 2.3.0 units_kbit@Base 2.3.0 units_kbps@Base 2.3.0 + units_khz@Base 2.3.0 + units_kibps@Base 2.3.0 + units_kmh@Base 2.3.0 + units_m_per_s@Base 2.3.0 + units_m_per_s_per_s@Base 2.3.0 + units_meter_meters@Base 2.3.0 units_mhz@Base 2.3.0 + units_microsecond_microseconds@Base 2.3.0 units_microseconds@Base 2.3.0 units_millisecond_milliseconds@Base 2.3.0 units_milliseconds@Base 2.3.0 @@ -1665,6 +1672,7 @@ libwireshark.so.0 libwireshark0 #MINVER# units_seconds@Base 2.3.0 units_segment_remaining@Base 2.3.0 units_tick_ticks@Base 2.3.0 + units_uW@Base 2.3.0 units_word_words@Base 2.3.0 unsigned_time_secs_to_str@Base 2.1.0 update_crc10_by_bytes_tvb@Base 1.99.0 diff --git a/epan/dissectors/packet-asap.c b/epan/dissectors/packet-asap.c index 4079ef5d2b..ee294fdf58 100644 --- a/epan/dissectors/packet-asap.c +++ b/epan/dissectors/packet-asap.c @@ -507,12 +507,10 @@ static void dissect_pool_element_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree) { tvbuff_t* parameters_tvb; - proto_item* pi; proto_tree_add_item(parameter_tree, hf_pe_pe_identifier, parameter_tvb, PE_PE_IDENTIFIER_OFFSET, PE_PE_IDENTIFIER_LENGTH, ENC_BIG_ENDIAN); proto_tree_add_item(parameter_tree, hf_home_enrp_id, parameter_tvb, HOME_ENRP_INDENTIFIER_OFFSET, HOME_ENRP_INDENTIFIER_LENGTH, ENC_BIG_ENDIAN); - pi = proto_tree_add_item(parameter_tree, hf_reg_life, parameter_tvb, REGISTRATION_LIFE_OFFSET, REGISTRATION_LIFE_LENGTH, ENC_BIG_ENDIAN); - proto_item_append_text(pi, "ms"); + proto_tree_add_item(parameter_tree, hf_reg_life, parameter_tvb, REGISTRATION_LIFE_OFFSET, REGISTRATION_LIFE_LENGTH, ENC_BIG_ENDIAN); parameters_tvb = tvb_new_subset_remaining(parameter_tvb, USER_TRANSPORT_PARAMETER_OFFSET); dissect_parameters(parameters_tvb, parameter_tree); @@ -889,7 +887,7 @@ proto_register_asap(void) { &hf_pool_handle, { "Pool Handle", "asap.pool_handle_pool_handle", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pe_pe_identifier, { "PE Identifier", "asap.pool_element_pe_identifier", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_home_enrp_id, { "Home ENRP Server Identifier", "asap.pool_element_home_enrp_server_identifier", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, - { &hf_reg_life, { "Registration Life", "asap.pool_element_registration_life", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_reg_life, { "Registration Life", "asap.pool_element_registration_life", FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL } }, { &hf_cookie, { "Cookie", "asap.cookie", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pe_identifier, { "PE Identifier", "asap.pe_identifier", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pe_checksum, { "PE Checksum", "asap.pe_checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, diff --git a/epan/dissectors/packet-btavdtp.c b/epan/dissectors/packet-btavdtp.c index 5b5c0bb0dc..12cac4337c 100644 --- a/epan/dissectors/packet-btavdtp.c +++ b/epan/dissectors/packet-btavdtp.c @@ -2848,7 +2848,6 @@ dissect_aptx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) cumulative_frame_duration = (tvb_reported_length(tvb) / 4.0) * frame_duration; pitem = proto_tree_add_double(aptx_tree, hf_aptx_cumulative_frame_duration, tvb, 0, 0, cumulative_frame_duration); - proto_item_append_text(pitem, " ms"); PROTO_ITEM_SET_GENERATED(pitem); if (info && info->previous_media_packet_info && info->current_media_packet_info) { @@ -2856,27 +2855,22 @@ dissect_aptx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) nstime_delta(&delta, &pinfo->abs_ts, &info->previous_media_packet_info->abs_ts); pitem = proto_tree_add_double(aptx_tree, hf_aptx_delta_time, tvb, 0, 0, nstime_to_msec(&delta)); - proto_item_append_text(pitem, " ms"); PROTO_ITEM_SET_GENERATED(pitem); pitem = proto_tree_add_double(aptx_tree, hf_aptx_avrcp_song_position, tvb, 0, 0, info->previous_media_packet_info->avrcp_song_position); - proto_item_append_text(pitem, " ms"); PROTO_ITEM_SET_GENERATED(pitem); nstime_delta(&delta, &pinfo->abs_ts, &info->previous_media_packet_info->first_abs_ts); pitem = proto_tree_add_double(aptx_tree, hf_aptx_delta_time_from_the_beginning, tvb, 0, 0, nstime_to_msec(&delta)); - proto_item_append_text(pitem, " ms"); PROTO_ITEM_SET_GENERATED(pitem); if (!pinfo->fd->flags.visited) info->current_media_packet_info->cumulative_frame_duration += cumulative_frame_duration; pitem = proto_tree_add_double(aptx_tree, hf_aptx_cumulative_duration, tvb, 0, 0, info->previous_media_packet_info->cumulative_frame_duration); - proto_item_append_text(pitem, " ms"); PROTO_ITEM_SET_GENERATED(pitem); pitem = proto_tree_add_double(aptx_tree, hf_aptx_diff, tvb, 0, 0, info->previous_media_packet_info->cumulative_frame_duration - nstime_to_msec(&delta)); - proto_item_append_text(pitem, " ms"); PROTO_ITEM_SET_GENERATED(pitem); } } @@ -2895,32 +2889,32 @@ proto_register_aptx(void) }, { &hf_aptx_cumulative_frame_duration, { "Cumulative Frame Duration", "aptx.cumulative_frame_duration", - FT_DOUBLE, BASE_NONE, NULL, 0x00, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_milliseconds, 0x00, NULL, HFILL } }, { &hf_aptx_delta_time, { "Delta time", "aptx.delta_time", - FT_DOUBLE, BASE_NONE, NULL, 0x00, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_milliseconds, 0x00, NULL, HFILL } }, { &hf_aptx_avrcp_song_position, { "AVRCP Song Position", "aptx.avrcp_song_position", - FT_DOUBLE, BASE_NONE, NULL, 0x00, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_milliseconds, 0x00, NULL, HFILL } }, { &hf_aptx_delta_time_from_the_beginning, { "Delta time from the beginning", "aptx.delta_time_from_the_beginning", - FT_DOUBLE, BASE_NONE, NULL, 0x00, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_milliseconds, 0x00, NULL, HFILL } }, { &hf_aptx_cumulative_duration, { "Cumulative Music Duration", "aptx.cumulative_music_duration", - FT_DOUBLE, BASE_NONE, NULL, 0x00, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_milliseconds, 0x00, NULL, HFILL } }, { &hf_aptx_diff, { "Diff", "aptx.diff", - FT_DOUBLE, BASE_NONE, NULL, 0x00, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_milliseconds, 0x00, NULL, HFILL } }, }; diff --git a/epan/dissectors/packet-bthci_cmd.c b/epan/dissectors/packet-bthci_cmd.c index 89cf129b49..d3dc8aa797 100644 --- a/epan/dissectors/packet-bthci_cmd.c +++ b/epan/dissectors/packet-bthci_cmd.c @@ -3727,7 +3727,6 @@ dissect_bthci_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat nstime_delta(&delta, &bthci_cmd_data->pending_abs_ts, &bthci_cmd_data->command_abs_ts); sub_item = proto_tree_add_double(bthci_cmd_tree, hf_command_pending_time_delta, tvb, 0, 0, nstime_to_msec(&delta)); - proto_item_append_text(sub_item, " ms"); PROTO_ITEM_SET_GENERATED(sub_item); } if (bthci_cmd_data && bthci_cmd_data->response_in_frame < max_disconnect_in_frame) { @@ -3738,7 +3737,6 @@ dissect_bthci_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat nstime_delta(&delta, &bthci_cmd_data->response_abs_ts, &bthci_cmd_data->command_abs_ts); sub_item = proto_tree_add_double(bthci_cmd_tree, hf_command_response_time_delta, tvb, 0, 0, nstime_to_msec(&delta)); - proto_item_append_text(sub_item, " ms"); PROTO_ITEM_SET_GENERATED(sub_item); } @@ -5213,7 +5211,7 @@ proto_register_bthci_cmd(void) }, { &hf_command_response_time_delta, { "Command-Response Delta", "bthci_cmd.command_response_delta", - FT_DOUBLE, BASE_NONE, NULL, 0x00, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_milliseconds, 0x00, NULL, HFILL } }, { &hf_pending_in_frame, @@ -5223,7 +5221,7 @@ proto_register_bthci_cmd(void) }, { &hf_command_pending_time_delta, { "Command-Pending Delta", "bthci_cmd.command_pending_delta", - FT_DOUBLE, BASE_NONE, NULL, 0x00, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_milliseconds, 0x00, NULL, HFILL } }, { &hf_bthci_cmd_le_tx_octets, diff --git a/epan/dissectors/packet-bthci_evt.c b/epan/dissectors/packet-bthci_evt.c index da92fc4118..b61ec4d6f8 100644 --- a/epan/dissectors/packet-bthci_evt.c +++ b/epan/dissectors/packet-bthci_evt.c @@ -788,6 +788,8 @@ static const value_string mws_transport_layer_vals[] = { { 0, NULL } }; +static const unit_name_string units_number_events = { " (number events)", NULL }; + void proto_register_bthci_evt(void); void proto_reg_handoff_bthci_evt(void); @@ -2054,7 +2056,6 @@ dissect_bthci_evt_le_meta(tvbuff_t *tvb, int offset, packet_info *pinfo, offset += 2; item = proto_tree_add_item(tree, hf_bthci_evt_le_con_latency, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_item_append_text(item, " (number events)"); offset += 2; item = proto_tree_add_item(tree, hf_bthci_evt_le_supervision_timeout, tvb, offset, 2, ENC_LITTLE_ENDIAN); @@ -2152,7 +2153,6 @@ dissect_bthci_evt_le_meta(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_item_append_text(item, " (%g msec)", tvb_get_letohs(tvb, offset)*1.25); offset += 2; item = proto_tree_add_item(tree, hf_bthci_evt_le_con_latency, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_item_append_text(item, " (number events)"); offset += 2; item = proto_tree_add_item(tree, hf_bthci_evt_le_supervision_timeout, tvb, offset, 2, ENC_LITTLE_ENDIAN); proto_item_append_text(item, " (%g sec)", tvb_get_letohs(tvb, offset)*0.01); @@ -2194,7 +2194,6 @@ dissect_bthci_evt_le_meta(tvbuff_t *tvb, int offset, packet_info *pinfo, offset += 2; item = proto_tree_add_item(tree, hf_bthci_evt_le_con_latency, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_item_append_text(item, " (number events)"); offset += 2; item = proto_tree_add_item(tree, hf_bthci_evt_le_supervision_timeout, tvb, offset, 2, ENC_LITTLE_ENDIAN); @@ -2266,7 +2265,6 @@ dissect_bthci_evt_le_meta(tvbuff_t *tvb, int offset, packet_info *pinfo, offset += 2; item = proto_tree_add_item(tree, hf_bthci_evt_le_con_latency, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_item_append_text(item, " (number events)"); offset += 2; item = proto_tree_add_item(tree, hf_bthci_evt_le_supervision_timeout, tvb, offset, 2, ENC_LITTLE_ENDIAN); @@ -5291,13 +5289,11 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat nstime_delta(&delta, &lastest_bthci_cmd_data->pending_abs_ts, &lastest_bthci_cmd_data->command_abs_ts); sub_item = proto_tree_add_double(bthci_evt_tree, hf_command_pending_time_delta, tvb, 0, 0, nstime_to_msec(&delta)); - proto_item_append_text(sub_item, " ms"); PROTO_ITEM_SET_GENERATED(sub_item); if (lastest_bthci_cmd_data->response_in_frame < max_disconnect_in_frame) { nstime_delta(&delta, &lastest_bthci_cmd_data->response_abs_ts, &lastest_bthci_cmd_data->pending_abs_ts); sub_item = proto_tree_add_double(bthci_evt_tree, hf_pending_response_time_delta, tvb, 0, 0, nstime_to_msec(&delta)); - proto_item_append_text(sub_item, " ms"); PROTO_ITEM_SET_GENERATED(sub_item); } } @@ -5312,13 +5308,11 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat nstime_delta(&delta, &lastest_bthci_cmd_data->response_abs_ts, &lastest_bthci_cmd_data->pending_abs_ts); sub_item = proto_tree_add_double(bthci_evt_tree, hf_pending_response_time_delta, tvb, 0, 0, nstime_to_msec(&delta)); - proto_item_append_text(sub_item, " ms"); PROTO_ITEM_SET_GENERATED(sub_item); } nstime_delta(&delta, &lastest_bthci_cmd_data->response_abs_ts, &lastest_bthci_cmd_data->command_abs_ts); sub_item = proto_tree_add_double(bthci_evt_tree, hf_command_response_time_delta, tvb, 0, 0, nstime_to_msec(&delta)); - proto_item_append_text(sub_item, " ms"); PROTO_ITEM_SET_GENERATED(sub_item); } } @@ -6661,7 +6655,7 @@ proto_register_bthci_evt(void) }, { &hf_bthci_evt_le_con_latency, { "Connection Latency", "bthci_evt.le_con_latency", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_number_events, 0x0, NULL, HFILL } }, { &hf_bthci_evt_le_supervision_timeout, @@ -6891,12 +6885,12 @@ proto_register_bthci_evt(void) }, { &hf_command_pending_time_delta, { "Command-Pending Delta", "bthci_evt.command_pending_delta", - FT_DOUBLE, BASE_NONE, NULL, 0x00, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_milliseconds, 0x00, NULL, HFILL } }, { &hf_pending_response_time_delta, { "Pending-Response Delta", "bthci_evt.pending_response_delta", - FT_DOUBLE, BASE_NONE, NULL, 0x00, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_milliseconds, 0x00, NULL, HFILL } }, { &hf_bthci_evt_le_features, diff --git a/epan/dissectors/packet-bthfp.c b/epan/dissectors/packet-bthfp.c index 7b8b1b5479..ea267792af 100644 --- a/epan/dissectors/packet-bthfp.c +++ b/epan/dissectors/packet-bthfp.c @@ -474,6 +474,8 @@ static const value_string biev_assigned_number_vals[] = { { 0, NULL } }; +static const unit_name_string units_slash15 = { "/15", NULL }; + extern value_string_ext csd_data_rate_vals_ext; void proto_register_bthfp(void); @@ -772,7 +774,6 @@ dissect_vgs_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, value = get_uint_parameter(parameter_stream, parameter_length); pitem = proto_tree_add_uint(tree, hf_vgs, tvb, offset, parameter_length, value); - proto_item_append_text(pitem, "/15"); if (value > 15) { expert_add_info(pinfo, pitem, &ei_vgs_gain); @@ -799,7 +800,6 @@ dissect_vgm_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, value = get_uint_parameter(parameter_stream, parameter_length); pitem = proto_tree_add_uint(tree, hf_vgm, tvb, offset, parameter_length, value); - proto_item_append_text(pitem, "/15"); if (value > 15) { expert_add_info(pinfo, pitem, &ei_vgm_gain); @@ -2441,12 +2441,12 @@ proto_register_bthfp(void) }, { &hf_vgs, { "Gain", "bthfp.vgs", - FT_UINT8, BASE_DEC, NULL, 0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_slash15, 0, NULL, HFILL} }, { &hf_vgm, { "Gain", "bthfp.vgm", - FT_UINT8, BASE_DEC, NULL, 0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_slash15, 0, NULL, HFILL} }, { &hf_nrec, diff --git a/epan/dissectors/packet-bthsp.c b/epan/dissectors/packet-bthsp.c index 4e531f6900..19e8484a6f 100644 --- a/epan/dissectors/packet-bthsp.c +++ b/epan/dissectors/packet-bthsp.c @@ -137,6 +137,8 @@ static const enum_val_t pref_hsp_role[] = { { NULL, NULL, 0 } }; +static const unit_name_string units_slash15 = { "/15", NULL }; + void proto_register_bthsp(void); void proto_reg_handoff_bthsp(void); @@ -194,7 +196,6 @@ dissect_vgs_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, value = get_uint_parameter(parameter_stream, parameter_length); pitem = proto_tree_add_uint(tree, hf_vgs, tvb, offset, parameter_length, value); - proto_item_append_text(pitem, "/15"); if (value > 15) { expert_add_info(pinfo, pitem, &ei_vgs_gain); @@ -218,7 +219,6 @@ dissect_vgm_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, value = get_uint_parameter(parameter_stream, parameter_length); pitem = proto_tree_add_uint(tree, hf_vgm, tvb, offset, parameter_length, value); - proto_item_append_text(pitem, "/15"); if (value > 15) { expert_add_info(pinfo, pitem, &ei_vgm_gain); @@ -1089,12 +1089,12 @@ proto_register_bthsp(void) }, { &hf_vgs, { "Gain", "bthsp.vgs", - FT_UINT8, BASE_DEC, NULL, 0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_slash15, 0, NULL, HFILL} }, { &hf_vgm, { "Gain", "bthsp.vgm", - FT_UINT8, BASE_DEC, NULL, 0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_slash15, 0, NULL, HFILL} }, { &hf_ckpd, diff --git a/epan/dissectors/packet-btl2cap.c b/epan/dissectors/packet-btl2cap.c index 40476bff5c..1a7f8db062 100644 --- a/epan/dissectors/packet-btl2cap.c +++ b/epan/dissectors/packet-btl2cap.c @@ -447,6 +447,8 @@ static const range_string le_psm_rvals[] = { { 0, 0, NULL } }; +static const unit_name_string units_ll_connection_event = { " LL Connection Event", " LL Connection Events" }; + #define PROTO_DATA_BTL2CAP_CID 0 #define PROTO_DATA_BTL2CAP_PSM 1 @@ -1680,7 +1682,6 @@ dissect_connparamrequest(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr max_interval = tvb_get_letohs(tvb, offset); offset += 2; item = proto_tree_add_item(tree, hf_btl2cap_slave_latency, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_item_append_text(item, " LL Connection Events"); slave_latency = tvb_get_letohs(tvb, offset); if(slave_latency >= 500 || slave_latency > 10.0 * tvb_get_letohs(tvb, offset + 2) / (max_interval *1.25)) @@ -3206,7 +3207,7 @@ proto_register_btl2cap(void) }, { &hf_btl2cap_slave_latency, { "Slave Latency", "btl2cap.slave_latency", - FT_UINT16, BASE_DEC, NULL, 0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_ll_connection_event, 0, NULL, HFILL } }, { &hf_btl2cap_timeout_multiplier, diff --git a/epan/dissectors/packet-btle.c b/epan/dissectors/packet-btle.c index 427f57ca42..cda6b8880f 100644 --- a/epan/dissectors/packet-btle.c +++ b/epan/dissectors/packet-btle.c @@ -1146,15 +1146,13 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) proto_tree_add_item(btle_tree, hf_control_max_rx_octets, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - sub_item = proto_tree_add_item(btle_tree, hf_control_max_rx_time, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_item_append_text (sub_item, " microseconds"); + proto_tree_add_item(btle_tree, hf_control_max_rx_time, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; proto_tree_add_item(btle_tree, hf_control_max_tx_octets, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - sub_item = proto_tree_add_item(btle_tree, hf_control_max_tx_time, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_item_append_text (sub_item, " microseconds"); + proto_tree_add_item(btle_tree, hf_control_max_tx_time, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; break; @@ -1596,7 +1594,7 @@ proto_register_btle(void) }, { &hf_control_max_rx_time, { "Max RX time", "btle.control.max_rx_time", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_microsecond_microseconds, 0x0, NULL, HFILL } }, { &hf_control_max_tx_octets, @@ -1606,7 +1604,7 @@ proto_register_btle(void) }, { &hf_control_max_tx_time, { "Max TX time", "btle.control.max_tx_time", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_microsecond_microseconds, 0x0, NULL, HFILL } }, { &hf_l2cap_fragment, diff --git a/epan/dissectors/packet-btmcap.c b/epan/dissectors/packet-btmcap.c index 3243c39b1d..232cde609f 100644 --- a/epan/dissectors/packet-btmcap.c +++ b/epan/dissectors/packet-btmcap.c @@ -93,6 +93,8 @@ static const value_string response_code_vals[] = { { 0, NULL } }; +static const unit_name_string units_ppm = { " ppm", NULL }; + void proto_register_btmcap(void); void proto_reg_handoff_btmcap(void); @@ -184,8 +186,7 @@ dissect_btmcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ } break; case 0x11: /* MD_SYNC_CAP_REQ */ - pitem = proto_tree_add_item(main_tree, hf_btmcap_timestamp_required_accuracy, tvb, offset, 2, ENC_BIG_ENDIAN); - proto_item_append_text(pitem, " ppm"); + proto_tree_add_item(main_tree, hf_btmcap_timestamp_required_accuracy, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; break; case 0x13: /* MD_SYNC_SET_REQ */ @@ -217,8 +218,7 @@ dissect_btmcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ proto_item_append_text(pitem, " (Time-Stamp Clock Instant)"); offset += 8; - pitem = proto_tree_add_item(main_tree, hf_btmcap_timestamp_sample_accuracy, tvb, offset, 2, ENC_BIG_ENDIAN); - proto_item_append_text(pitem, " us"); + proto_tree_add_item(main_tree, hf_btmcap_timestamp_sample_accuracy, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; break; } @@ -239,16 +239,13 @@ dissect_btmcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ proto_item_append_text(pitem, " (Baseband half-slots)"); offset += 1; - pitem = proto_tree_add_item(main_tree, hf_btmcap_sync_lead_time, tvb, offset, 2, ENC_BIG_ENDIAN); - proto_item_append_text(pitem, " ms"); + proto_tree_add_item(main_tree, hf_btmcap_sync_lead_time, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; - pitem = proto_tree_add_item(main_tree, hf_btmcap_timestamp_native_resolution, tvb, offset, 2, ENC_BIG_ENDIAN); - proto_item_append_text(pitem, " us"); + proto_tree_add_item(main_tree, hf_btmcap_timestamp_native_resolution, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; - pitem = proto_tree_add_item(main_tree, hf_btmcap_timestamp_native_accuracy, tvb, offset, 2, ENC_BIG_ENDIAN); - proto_item_append_text(pitem, " ppm"); + proto_tree_add_item(main_tree, hf_btmcap_timestamp_native_accuracy, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; break; case 0x14: /* MD_SYNC_SET_RSP */ @@ -268,8 +265,7 @@ dissect_btmcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ proto_item_append_text(pitem, " (Time-Stamp Clock Instant)"); offset += 8; - pitem = proto_tree_add_item(main_tree, hf_btmcap_timestamp_sample_accuracy, tvb, offset, 2, ENC_BIG_ENDIAN); - proto_item_append_text(pitem, " us"); + proto_tree_add_item(main_tree, hf_btmcap_timestamp_sample_accuracy, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; break; } @@ -349,7 +345,7 @@ proto_register_btmcap(void) }, { &hf_btmcap_timestamp_required_accuracy, { "Timestamp Required Accuracy", "btmcap.timestamp_required_accuracy", - FT_UINT16, BASE_DEC, NULL, 0x00, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_ppm, 0x00, NULL, HFILL } }, { &hf_btmcap_timestamp_update_information, @@ -369,7 +365,7 @@ proto_register_btmcap(void) }, { &hf_btmcap_timestamp_sample_accuracy, { "Timestamp Sample Accuracy", "btmcap.timestamp_sample_accuracy", - FT_UINT16, BASE_DEC, NULL, 0x00, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0x00, NULL, HFILL } }, { &hf_btmcap_bluetooth_clock_access_resolution, @@ -379,17 +375,17 @@ proto_register_btmcap(void) }, { &hf_btmcap_sync_lead_time, { "Sync Lead Time", "btmcap.sync_lead_time", - FT_UINT16, BASE_DEC, NULL, 0x00, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x00, NULL, HFILL } }, { &hf_btmcap_timestamp_native_resolution, { "Timestamp Native Resolution", "btmcap.timestamp_native_resolution", - FT_UINT16, BASE_DEC, NULL, 0x00, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0x00, NULL, HFILL } }, { &hf_btmcap_timestamp_native_accuracy, { "Timestamp Native Accuracy", "btmcap.timestamp_native_accuracy", - FT_UINT16, BASE_DEC, NULL, 0x00, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_ppm, 0x00, NULL, HFILL } }, { &hf_btmcap_response_parameters, diff --git a/epan/dissectors/packet-enrp.c b/epan/dissectors/packet-enrp.c index 96cec01364..d0828c7a4f 100644 --- a/epan/dissectors/packet-enrp.c +++ b/epan/dissectors/packet-enrp.c @@ -513,12 +513,10 @@ static void dissect_pool_element_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree) { tvbuff_t* parameters_tvb; - proto_item* pi; proto_tree_add_item(parameter_tree, hf_pe_pe_identifier, parameter_tvb, PE_PE_IDENTIFIER_OFFSET, PE_PE_IDENTIFIER_LENGTH, ENC_BIG_ENDIAN); proto_tree_add_item(parameter_tree, hf_home_enrp_id, parameter_tvb, HOME_ENRP_INDENTIFIER_OFFSET, HOME_ENRP_INDENTIFIER_LENGTH, ENC_BIG_ENDIAN); - pi = proto_tree_add_item(parameter_tree, hf_reg_life, parameter_tvb, REGISTRATION_LIFE_OFFSET, REGISTRATION_LIFE_LENGTH, ENC_BIG_ENDIAN); - proto_item_append_text(pi, "ms"); + proto_tree_add_item(parameter_tree, hf_reg_life, parameter_tvb, REGISTRATION_LIFE_OFFSET, REGISTRATION_LIFE_LENGTH, ENC_BIG_ENDIAN); parameters_tvb = tvb_new_subset_remaining(parameter_tvb, USER_TRANSPORT_PARAMETER_OFFSET); dissect_parameters(parameters_tvb, parameter_tree); @@ -1050,7 +1048,7 @@ proto_register_enrp(void) { &hf_pool_handle, { "Pool Handle", "enrp.pool_handle_pool_handle", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pe_pe_identifier, { "PE Identifier", "enrp.pool_element_pe_identifier", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_home_enrp_id, { "Home ENRP Server Identifier", "enrp.pool_element_home_enrp_server_identifier", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, - { &hf_reg_life, { "Registration Life", "enrp.pool_element_registration_life", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_reg_life, { "Registration Life", "enrp.pool_element_registration_life", FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL } }, { &hf_server_identifier, { "Server Identifier", "enrp.server_information_server_identifier", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_cookie, { "Cookie", "enrp.cookie", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pe_identifier, { "PE Identifier", "enrp.pe_identifier", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, diff --git a/epan/dissectors/packet-gsm_a_common.c b/epan/dissectors/packet-gsm_a_common.c index 7d1b7cb13f..686b8ea81b 100644 --- a/epan/dissectors/packet-gsm_a_common.c +++ b/epan/dissectors/packet-gsm_a_common.c @@ -1047,8 +1047,7 @@ dissect_description_of_velocity(tvbuff_t *tvb, proto_tree *tree, packet_info *pi proto_tree_add_bits_item(tree, hf_gsm_a_bearing, tvb, (curr_offset<<3)+7, 9, ENC_BIG_ENDIAN); curr_offset += 2; /* Horizontal speed is encoded in increments of 1 kilometre per hour using a 16 bit binary coded number N. */ - velocity_item = proto_tree_add_item(tree, hf_gsm_a_horizontal_speed, tvb, offset, 2, ENC_BIG_ENDIAN); - proto_item_append_text(velocity_item, " km/h"); + proto_tree_add_item(tree, hf_gsm_a_horizontal_speed, tvb, offset, 2, ENC_BIG_ENDIAN); curr_offset += 2; break; case 1: @@ -1061,14 +1060,12 @@ dissect_description_of_velocity(tvbuff_t *tvb, proto_tree *tree, packet_info *pi proto_tree_add_bits_item(tree, hf_gsm_a_bearing, tvb, (curr_offset<<3)+7, 9, ENC_BIG_ENDIAN); curr_offset += 2; /* Horizontal speed is encoded in increments of 1 kilometre per hour using a 16 bit binary coded number N. */ - velocity_item = proto_tree_add_item(tree, hf_gsm_a_horizontal_speed, tvb, offset, 2, ENC_BIG_ENDIAN); - proto_item_append_text(velocity_item, " km/h"); + proto_tree_add_item(tree, hf_gsm_a_horizontal_speed, tvb, offset, 2, ENC_BIG_ENDIAN); curr_offset += 2; /* Vertical Speed Octet 5 * Vertical speed is encoded in increments of 1 kilometre per hour using 8 bits giving a number N between 0 and 28-1. */ - velocity_item = proto_tree_add_item(tree, hf_gsm_a_vertical_speed, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(velocity_item, " km/h"); + proto_tree_add_item(tree, hf_gsm_a_vertical_speed, tvb, offset, 1, ENC_BIG_ENDIAN); curr_offset++; break; case 2: @@ -1079,8 +1076,7 @@ dissect_description_of_velocity(tvbuff_t *tvb, proto_tree *tree, packet_info *pi proto_tree_add_bits_item(tree, hf_gsm_a_bearing, tvb, (curr_offset<<3)+7, 9, ENC_BIG_ENDIAN); curr_offset += 2; /* Horizontal speed is encoded in increments of 1 kilometre per hour using a 16 bit binary coded number N. */ - velocity_item = proto_tree_add_item(tree, hf_gsm_a_horizontal_speed, tvb, offset, 2, ENC_BIG_ENDIAN); - proto_item_append_text(velocity_item, " km/h"); + proto_tree_add_item(tree, hf_gsm_a_horizontal_speed, tvb, offset, 2, ENC_BIG_ENDIAN); curr_offset += 2; /* Uncertainty Speed Octet 5 * Uncertainty speed is encoded in increments of 1 kilometre per hour using an 8 bit binary coded number N. The value of @@ -1105,14 +1101,12 @@ dissect_description_of_velocity(tvbuff_t *tvb, proto_tree *tree, packet_info *pi proto_tree_add_bits_item(tree, hf_gsm_a_bearing, tvb, (curr_offset<<3)+7, 9, ENC_BIG_ENDIAN); curr_offset += 2; /* Horizontal speed is encoded in increments of 1 kilometre per hour using a 16 bit binary coded number N. */ - velocity_item = proto_tree_add_item(tree, hf_gsm_a_horizontal_speed, tvb, offset, 2, ENC_BIG_ENDIAN); - proto_item_append_text(velocity_item, " km/h"); + proto_tree_add_item(tree, hf_gsm_a_horizontal_speed, tvb, offset, 2, ENC_BIG_ENDIAN); curr_offset += 2; /* Vertical Speed Octet 5 * Vertical speed is encoded in increments of 1 kilometre per hour using 8 bits giving a number N between 0 and 28-1. */ - velocity_item = proto_tree_add_item(tree, hf_gsm_a_vertical_speed, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(velocity_item, " km/h"); + proto_tree_add_item(tree, hf_gsm_a_vertical_speed, tvb, offset, 1, ENC_BIG_ENDIAN); curr_offset++; /* Horizontal Uncertainty Speed Octet 6 */ @@ -4581,12 +4575,12 @@ proto_register_gsm_a_common(void) }, { &hf_gsm_a_horizontal_speed, { "Horizontal Speed", "gsm_a.gad.horizontal_velocity", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_kmh, 0x0, NULL, HFILL } }, { &hf_gsm_a_vertical_speed, { "Vertical Speed", "gsm_a.gad.vertical_speed", - FT_UINT8, BASE_DEC, NULL, 0x0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_kmh, 0x0, NULL, HFILL } }, { &hf_gsm_a_uncertainty_speed, diff --git a/epan/dissectors/packet-gsm_a_gm.c b/epan/dissectors/packet-gsm_a_gm.c index 1dfa26044d..30565bb400 100644 --- a/epan/dissectors/packet-gsm_a_gm.c +++ b/epan/dissectors/packet-gsm_a_gm.c @@ -559,6 +559,8 @@ static dissector_handle_t nbifom_handle; static dissector_table_t gprs_sm_pco_subdissector_table; /* GPRS SM PCO PPP Protocols */ +static const unit_name_string units_message_messages = { " message", " messages" }; + #define NUM_GSM_GM_ELEM (sizeof(gsm_gm_elem_strings)/sizeof(value_string)) gint ett_gsm_gm_elem[NUM_GSM_GM_ELEM]; @@ -4442,8 +4444,7 @@ de_sm_pco(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, g break; case 0x0010: if ((link_dir == P2P_DIR_DL) && (e_len == 2)) { - pco_item = proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_ipv4_link_mtu_size, tvb, curr_offset, 2, ENC_BIG_ENDIAN); - proto_item_append_text(pco_item, " octets"); + proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_ipv4_link_mtu_size, tvb, curr_offset, 2, ENC_BIG_ENDIAN); } break; case 0x0014: @@ -4453,8 +4454,7 @@ de_sm_pco(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, g break; case 0x0015: if ((link_dir == P2P_DIR_DL) && (e_len == 2)) { - pco_item = proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_non_ip_link_mtu_size, tvb, curr_offset, 2, ENC_BIG_ENDIAN); - proto_item_append_text(pco_item, " octets"); + proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_non_ip_link_mtu_size, tvb, curr_offset, 2, ENC_BIG_ENDIAN); } break; case 0x0016: @@ -4463,8 +4463,7 @@ de_sm_pco(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, g proto_tree_add_item(tree, hf_gsm_a_gm_sm_pco_apn_rate_ctrl_params_aer, tvb, curr_offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_gsm_a_gm_sm_pco_apn_rate_ctrl_params_ul_time_unit, tvb, curr_offset, 1, ENC_BIG_ENDIAN); if (e_len >= 4) { - pco_item = proto_tree_add_item(tree, hf_gsm_a_gm_sm_pco_apn_rate_ctrl_params_max_ul_rate, tvb, curr_offset+1, 3, ENC_BIG_ENDIAN); - proto_item_append_text(pco_item, " messages"); + proto_tree_add_item(tree, hf_gsm_a_gm_sm_pco_apn_rate_ctrl_params_max_ul_rate, tvb, curr_offset+1, 3, ENC_BIG_ENDIAN); } } break; @@ -8851,7 +8850,7 @@ proto_register_gsm_a_gm(void) }, { &hf_gsm_a_gm_sm_pco_apn_rate_ctrl_params_max_ul_rate, { "Maximum uplink rate", "gsm_a.gm.sm.pco.apn_rate_ctrl_params.max_ul_rate", - FT_UINT24, BASE_DEC, NULL, 0x0, + FT_UINT24, BASE_DEC|BASE_UNIT_STRING, &units_message_messages, 0x0, NULL, HFILL } }, /* Generated from convert_proto_tree_add_text.pl */ @@ -8879,9 +8878,9 @@ proto_register_gsm_a_gm(void) { &hf_gsm_a_gm_sm_pco_dsmipv6_home_agent_ipv4, { "IPv4", "gsm_a.gm.sm.pco.dsmipv6_home_agent.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gsm_a_gm_sm_pco_pcscf_ipv4, { "IPv4", "gsm_a.gm.sm.pco.pcscf.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gsm_a_gm_sm_pco_dns_ipv4, { "IPv4", "gsm_a.gm.sm.pco.dns.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - { &hf_gsm_a_gm_sm_pco_ipv4_link_mtu_size, { "IPv4 link MTU size", "gsm_a.gm.sm.pco.ipv4_link_mtu_size", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_gsm_a_gm_sm_pco_ipv4_link_mtu_size, { "IPv4 link MTU size", "gsm_a.gm.sm.pco.ipv4_link_mtu_size", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0, NULL, HFILL }}, { &hf_gsm_a_gm_sm_pco_nbifom_mode, { "NBIFOM mode", "gsm_a.gm.sm.pco.nbifom_mode", FT_UINT8, BASE_HEX, VALS(gsm_a_gm_nbifom_mode_vals), 0x0, NULL, HFILL }}, - { &hf_gsm_a_gm_sm_pco_non_ip_link_mtu_size, { "Non-IP link MTU size", "gsm_a.gm.sm.pco.non_ip_link_mtu_size", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_gsm_a_gm_sm_pco_non_ip_link_mtu_size, { "Non-IP link MTU size", "gsm_a.gm.sm.pco.non_ip_link_mtu_size", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0, NULL, HFILL }}, { &hf_gsm_a_gm_sm_pco_sel_bearer_ctrl_mode, { "Selected Bearer Control Mode", "gsm_a.gm.sm.pco.sel_bearer_ctrl_mode", FT_UINT8, BASE_DEC, VALS(gsm_a_gm_sel_bearer_ctrl_mode_vals), 0x0, NULL, HFILL }}, { &hf_gsm_a_sm_pdp_type_number, { "PDP type number", "gsm_a.gm.sm.pdp_type_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gsm_a_sm_pdp_address, { "PDP address", "gsm_a.gm.sm.pdp_address", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-gtp.c b/epan/dissectors/packet-gtp.c index 6e5d62cb84..5c72f6d114 100644 --- a/epan/dissectors/packet-gtp.c +++ b/epan/dissectors/packet-gtp.c @@ -7526,7 +7526,6 @@ decode_gtp_apn_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_t { guint16 length; proto_tree *ext_tree; - proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RELIABLE_IRAT_HO_INF], NULL, @@ -7541,12 +7540,10 @@ decode_gtp_apn_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_t * formatted as shown in Figure 7.7.98-1 as Unsigned32 binary integer values in kbps (1000 bits per second). */ /* 4 to 7 APN-AMBR for Uplink */ - te = proto_tree_add_item(ext_tree, hf_gtp_ext_apn_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(te, " kbps"); + proto_tree_add_item(ext_tree, hf_gtp_ext_apn_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4; /* 8 to 11 APN-AMBR for Downlink */ - te = proto_tree_add_item(ext_tree, hf_gtp_ext_apn_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(te, " kbps"); + proto_tree_add_item(ext_tree, hf_gtp_ext_apn_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN); return 3 + length; } @@ -7580,7 +7577,6 @@ decode_gtp_ue_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tr { guint16 length; proto_tree *ext_tree; - proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_APN_AMBR_WITH_NSAPI], NULL, @@ -7592,12 +7588,10 @@ decode_gtp_ue_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tr offset = offset + 2; /* 4 to 7 Subscribed UE-AMBR for Uplink */ - te = proto_tree_add_item(ext_tree, hf_gtp_ext_sub_ue_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(te, " kbps"); + proto_tree_add_item(ext_tree, hf_gtp_ext_sub_ue_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4; /* 8 to 11 Subscribed UE-AMBR for Downlink */ - te = proto_tree_add_item(ext_tree, hf_gtp_ext_sub_ue_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(te, " kbps"); + proto_tree_add_item(ext_tree, hf_gtp_ext_sub_ue_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4; /* Authorized UE-AMBR for Uplink and Downlink fields are present in the IE only if the sender has their valid values @@ -7607,13 +7601,11 @@ decode_gtp_ue_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tr return 3 + length; /* m to (m+3) Authorized UE-AMBR for Uplink */ - te = proto_tree_add_item(ext_tree, hf_gtp_ext_auth_ue_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(te, " kbps"); + proto_tree_add_item(ext_tree, hf_gtp_ext_auth_ue_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4; /* (m+4) to (n+3) Authorized UE-AMBR for Downlink */ - te = proto_tree_add_item(ext_tree, hf_gtp_ext_auth_ue_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(te, " kbps"); + proto_tree_add_item(ext_tree, hf_gtp_ext_auth_ue_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN); proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length); @@ -7628,7 +7620,6 @@ decode_gtp_apn_ambr_with_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _ { guint16 length; proto_tree *ext_tree; - proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_UE_AMBR], NULL, @@ -7643,13 +7634,11 @@ decode_gtp_apn_ambr_with_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _ offset++; /* 5 to 8 Authorized APN-AMBR for Uplink */ - te = proto_tree_add_item(ext_tree, hf_gtp_ext_auth_apn_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(te, " kbps"); + proto_tree_add_item(ext_tree, hf_gtp_ext_auth_apn_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4; /* 9 to12 Authorized APN-AMBR for Downlink */ - te = proto_tree_add_item(ext_tree, hf_gtp_ext_auth_apn_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(te, " kbps"); + proto_tree_add_item(ext_tree, hf_gtp_ext_auth_apn_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN); return 3 + length; } @@ -9908,42 +9897,42 @@ proto_register_gtp(void) }, { &hf_gtp_ext_apn_ambr_ul, { "APN-AMBR for Uplink", "gtp.apn_ambr_ul", - FT_INT32, BASE_DEC, NULL, 0x0, + FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_kbps, 0x0, NULL, HFILL} }, { &hf_gtp_ext_apn_ambr_dl, { "APN-AMBR for Downlink", "gtp.apn_ambr_dl", - FT_INT32, BASE_DEC, NULL, 0x0, + FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_kbps, 0x0, NULL, HFILL} }, { &hf_gtp_ext_sub_ue_ambr_ul, { "Subscribed UE-AMBR for Uplink", "gtp.sub_ue_ambr_ul", - FT_INT32, BASE_DEC, NULL, 0x0, + FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_kbps, 0x0, NULL, HFILL} }, { &hf_gtp_ext_sub_ue_ambr_dl, { "Subscribed UE-AMBR for Downlink", "gtp.sub_ue_ambr_dl", - FT_INT32, BASE_DEC, NULL, 0x0, + FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_kbps, 0x0, NULL, HFILL} }, { &hf_gtp_ext_auth_ue_ambr_ul, { "Authorized UE-AMBR for Uplink", "gtp.auth_ue_ambr_ul", - FT_INT32, BASE_DEC, NULL, 0x0, + FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_kbps, 0x0, NULL, HFILL} }, { &hf_gtp_ext_auth_ue_ambr_dl, { "Authorized UE-AMBR for Downlink", "gtp.auth_ue_ambr_dl", - FT_INT32, BASE_DEC, NULL, 0x0, + FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_kbps, 0x0, NULL, HFILL} }, { &hf_gtp_ext_auth_apn_ambr_ul, { "Authorized APN-AMBR for Uplink", "gtp.auth_apn_ambr_ul", - FT_INT32, BASE_DEC, NULL, 0x0, + FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_kbps, 0x0, NULL, HFILL} }, { &hf_gtp_ext_auth_apn_ambr_dl, { "Authorized APN-AMBR for Downlink", "gtp.auth_apn_ambr_dl", - FT_INT32, BASE_DEC, NULL, 0x0, + FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_kbps, 0x0, NULL, HFILL} }, { &hf_gtp_ext_ggsn_back_off_time_units, diff --git a/epan/dissectors/packet-gvcp.c b/epan/dissectors/packet-gvcp.c index e6b93fb362..376614e502 100644 --- a/epan/dissectors/packet-gvcp.c +++ b/epan/dissectors/packet-gvcp.c @@ -1458,10 +1458,9 @@ static void dissect_readreg_cmd(proto_tree *gvcp_telegram_tree, tvbuff_t *tvb, p { /* Insert data as generic register */ item = proto_tree_add_item(gvcp_telegram_tree, hf_gvcp_custom_register_addr, tvb, offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(item, " "); /* Use generic register name */ - proto_item_append_text(item, "[Unknown Register]"); + proto_item_append_text(item, " [Unknown Register]"); } } offset +=4; @@ -1596,8 +1595,7 @@ static void dissect_readmem_cmd(proto_tree *gvcp_telegram_tree, tvbuff_t *tvb, p else { item = proto_tree_add_item(gvcp_telegram_tree, hf_gvcp_custom_memory_addr, tvb, offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(item, " "); - proto_item_append_text(item, "[Unknown Register]"); + proto_item_append_text(item, " [Unknown Register]"); } proto_tree_add_item(gvcp_telegram_tree, hf_gvcp_readmemcmd_count, tvb, (offset + 6), 2, ENC_BIG_ENDIAN); } diff --git a/epan/dissectors/packet-ieee1722.c b/epan/dissectors/packet-ieee1722.c index eda70313b7..360d99a575 100644 --- a/epan/dissectors/packet-ieee1722.c +++ b/epan/dissectors/packet-ieee1722.c @@ -1077,8 +1077,7 @@ static int dissect_1722_aaf (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree expert_add_info(pinfo, ti, &ei_aaf_incorrect_bit_depth); } offset += 1; - ti = proto_tree_add_item_ret_uint(ti_aaf_tree, hf_1722_aaf_stream_data_length, tvb, offset, 2, ENC_BIG_ENDIAN, &datalen); - proto_item_append_text(ti, " bytes"); + proto_tree_add_item_ret_uint(ti_aaf_tree, hf_1722_aaf_stream_data_length, tvb, offset, 2, ENC_BIG_ENDIAN, &datalen); offset += 2; proto_tree_add_bitmask_list(ti_aaf_tree, tvb, offset, 1, fields_pcm, ENC_BIG_ENDIAN); @@ -1166,7 +1165,7 @@ void proto_register_1722_aaf (void) }, { &hf_1722_aaf_stream_data_length, { "Stream Data Length", "aaf.stream_data_len", - FT_UINT16, BASE_DEC, NULL, IEEE_1722_STREAM_DATA_LENGTH_MASK, NULL, HFILL } + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, IEEE_1722_STREAM_DATA_LENGTH_MASK, NULL, HFILL } }, { &hf_1722_aaf_sparse_timestamp, { "Sparse Timestamp Mode", "aaf.sparse_timestamp", @@ -1259,8 +1258,7 @@ static int dissect_1722_crf (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree offset += 8; proto_tree_add_bitmask_list(ti_crf_tree, tvb, offset, 4, pull_frequency, ENC_NA); offset += 4; - ti = proto_tree_add_item_ret_uint(ti_crf_tree, hf_1722_crf_data_length, tvb, offset, 2, ENC_BIG_ENDIAN, &datalen); - proto_item_append_text(ti, " bytes"); + proto_tree_add_item_ret_uint(ti_crf_tree, hf_1722_crf_data_length, tvb, offset, 2, ENC_BIG_ENDIAN, &datalen); offset += 2; proto_tree_add_item(ti_crf_tree, hf_1722_crf_timestamp_interval, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; @@ -1325,7 +1323,7 @@ void proto_register_1722_crf(void) }, { &hf_1722_crf_data_length, { "Data Length", "crf.data_len", - FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL } + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x00, NULL, HFILL } }, { &hf_1722_crf_timestamp_interval, { "Timestamp Interval", "crf.timestamp_interval", diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c index bb2a832175..8f4126716c 100644 --- a/epan/dissectors/packet-ieee802154.c +++ b/epan/dissectors/packet-ieee802154.c @@ -1691,8 +1691,7 @@ dissect_ieee802154_fcs: field_tree = proto_tree_add_subtree_format(ieee802154_tree, tvb, offset, 2, ett_ieee802154_fcs, NULL, "Frame Check Sequence (TI CC24xx format): FCS %s", (fcs_ok) ? "OK" : "Bad"); /* Display FCS contents. */ - ti = proto_tree_add_int(field_tree, hf_ieee802154_rssi, tvb, offset++, 1, (gint8) (fcs & IEEE802154_CC24xx_RSSI)); - proto_item_append_text(ti, " dB"); /* Displaying Units */ + proto_tree_add_int(field_tree, hf_ieee802154_rssi, tvb, offset++, 1, (gint8) (fcs & IEEE802154_CC24xx_RSSI)); proto_tree_add_boolean(field_tree, hf_ieee802154_fcs_ok, tvb, offset, 1, (gboolean) (fcs & IEEE802154_CC24xx_CRC_OK)); proto_tree_add_uint(field_tree, hf_ieee802154_correlation, tvb, offset, 1, (guint8) ((fcs & IEEE802154_CC24xx_CORRELATION) >> 8)); } @@ -3624,7 +3623,7 @@ void proto_register_ieee802154(void) NULL, HFILL }}, { &hf_ieee802154_rssi, - { "RSSI", "wpan.rssi", FT_INT8, BASE_DEC, NULL, 0x0, + { "RSSI", "wpan.rssi", FT_INT8, BASE_DEC|BASE_UNIT_STRING, &units_decibals, 0x0, "Received Signal Strength", HFILL }}, { &hf_ieee802154_fcs_ok, diff --git a/epan/dissectors/packet-ipsec.c b/epan/dissectors/packet-ipsec.c index 0d13dc9476..571c15a8f0 100644 --- a/epan/dissectors/packet-ipsec.c +++ b/epan/dissectors/packet-ipsec.c @@ -1120,7 +1120,7 @@ static int dissect_ah(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { proto_tree *ah_tree, *root_tree; - proto_item *pi, *ti; + proto_item *pi; guint ah_nxt; /* Next header */ guint8 ah_len; /* Length of header in 32bit words minus 2 */ guint ah_hdr_len; /* Length of header in octets */ @@ -1153,8 +1153,7 @@ dissect_ah(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) ah_tree = proto_item_add_subtree(pi, ett_ah); proto_tree_add_item(ah_tree, hf_ah_next_header, tvb, 0, 1, ENC_BIG_ENDIAN); - ti = proto_tree_add_item(ah_tree, hf_ah_length, tvb, 1, 1, ENC_BIG_ENDIAN); - proto_item_append_text(ti, " (%u bytes)", ah_hdr_len); + proto_tree_add_item(ah_tree, hf_ah_length, tvb, 1, 1, ENC_BIG_ENDIAN); proto_tree_add_item(ah_tree, hf_ah_reserved, tvb, 2, 2, ENC_NA); proto_tree_add_item_ret_uint(ah_tree, hf_ah_spi, tvb, 4, 4, ENC_BIG_ENDIAN, &ah_spi); @@ -2268,7 +2267,7 @@ proto_register_ipsec(void) { "Next header", "ah.next_header", FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ipproto_val_ext, 0x0, NULL, HFILL }}, { &hf_ah_length, - { "Length", "ah.length", FT_UINT8, BASE_DEC, NULL, 0x0, + { "Length", "ah.length", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL }}, { &hf_ah_reserved, { "Reserved", "ah.reserved", FT_BYTES, BASE_NONE, NULL, 0x0, diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c index c5f603bb3e..fa9fbc6b55 100644 --- a/epan/dissectors/packet-ipv6.c +++ b/epan/dissectors/packet-ipv6.c @@ -1199,7 +1199,6 @@ dissect_routing6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data rthdr_ti.len = proto_tree_add_item(rthdr_tree, hf_ipv6_routing_len, tvb, offset, 1, ENC_BIG_ENDIAN); ti = proto_tree_add_uint(rthdr_tree, hf_ipv6_routing_len_oct, tvb, offset, 1, len); - proto_item_append_text(ti, " bytes"); PROTO_ITEM_SET_GENERATED(ti); if (ipv6_exthdr_hide_len_oct_field) { PROTO_ITEM_SET_HIDDEN(ti); @@ -1245,7 +1244,7 @@ dissect_routing6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data static int dissect_fraghdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { - proto_item *pi, *ti; + proto_item *pi; proto_tree *frag_tree, *root_tree; guint8 nxt; guint16 offlg; @@ -1289,8 +1288,7 @@ dissect_fraghdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) proto_tree_add_item(frag_tree, hf_ipv6_fraghdr_reserved_octet, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - ti = proto_tree_add_item(frag_tree, hf_ipv6_fraghdr_offset, tvb, offset, 2, ENC_BIG_ENDIAN); - proto_item_append_text(ti, " (%d bytes)", frag_off); + proto_tree_add_item(frag_tree, hf_ipv6_fraghdr_offset, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item(frag_tree, hf_ipv6_fraghdr_reserved_bits, tvb, offset, 2, ENC_BIG_ENDIAN); @@ -1861,7 +1859,6 @@ dissect_opts(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info *pinfo, ws ti_len = proto_tree_add_item(exthdr_tree, hf_exthdr_item_len, tvb, offset, 1, ENC_BIG_ENDIAN); ti = proto_tree_add_uint(exthdr_tree, hf_exthdr_item_len_oct, tvb, offset, 1, len); - proto_item_append_text(ti, " bytes"); PROTO_ITEM_SET_GENERATED(ti); if (ipv6_exthdr_hide_len_oct_field) { PROTO_ITEM_SET_HIDDEN(ti); @@ -3091,7 +3088,7 @@ proto_register_ipv6(void) }, { &hf_ipv6_hopopts_len_oct, { "Length", "ipv6.hopopts.len_oct", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, "Extension header length in octets", HFILL } } }; @@ -3109,7 +3106,7 @@ proto_register_ipv6(void) }, { &hf_ipv6_dstopts_len_oct, { "Length", "ipv6.dstopts.len_oct", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, "Extension header length in octets", HFILL } } }; @@ -3129,7 +3126,7 @@ proto_register_ipv6(void) }, { &hf_ipv6_routing_len_oct, { "Length", "ipv6.routing.len_oct", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, "Extension header length in octets", HFILL } }, { &hf_ipv6_routing_type, @@ -3274,7 +3271,7 @@ proto_register_ipv6(void) }, { &hf_ipv6_fraghdr_offset, { "Offset", "ipv6.fraghdr.offset", - FT_UINT16, BASE_DEC, NULL, IP6F_OFF_MASK, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, IP6F_OFF_MASK, "Fragment Offset", HFILL } }, { &hf_ipv6_fraghdr_reserved_bits, diff --git a/epan/dissectors/packet-ismacryp.c b/epan/dissectors/packet-ismacryp.c index 2e0fd2d6e7..5a847473ee 100644 --- a/epan/dissectors/packet-ismacryp.c +++ b/epan/dissectors/packet-ismacryp.c @@ -338,9 +338,8 @@ static void dissect_ismacryp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tre /* ismacryp_tree analysis */ /* get total length of AU headers (first 2 bytes) */ - ismacryp_item = proto_tree_add_item(ismacryp_tree, hf_ismacryp_au_headers_length, + proto_tree_add_item(ismacryp_tree, hf_ismacryp_au_headers_length, tvb, poffset->offset_bytes, AU_HEADERS_LENGTH_SIZE, ENC_BIG_ENDIAN ); - proto_item_append_text(ismacryp_item, " (bits)"); /* add text to AU Header tree indicating length */ au_headers_length = tvb_get_ntohs(tvb, poffset->offset_bytes); /* 2 byte au headers length */ poffset->offset_bytes += AU_HEADERS_LENGTH_SIZE; /* ADD HEADER(S) BRANCH */ @@ -715,7 +714,7 @@ void proto_register_ismacryp (void) #endif { &hf_ismacryp_au_headers_length, - { "AU Headers Length", "ismacryp.au_headers.length", FT_UINT16, BASE_DEC, NULL, 0x0, + { "AU Headers Length", "ismacryp.au_headers.length", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_bit_bits, 0x0, NULL, HFILL }}, { &hf_ismacryp_header_byte, diff --git a/epan/dissectors/packet-knxnetip.c b/epan/dissectors/packet-knxnetip.c index 79ffa91958..04e5ef23c9 100644 --- a/epan/dissectors/packet-knxnetip.c +++ b/epan/dissectors/packet-knxnetip.c @@ -683,16 +683,13 @@ static expert_field ei_knxnetip_length = EI_INIT; static void dissect_hpai(tvbuff_t *tvb, guint32 *offset, proto_tree *insert_tree, const char *append_text) { - proto_item *hpai_item = NULL; - proto_item *slength = NULL; - - proto_tree *hpai_tree = NULL; + proto_item *hpai_item; + proto_tree *hpai_tree; hpai_item = proto_tree_add_item( insert_tree, hf_knxnetip_hpai, tvb, *offset, 8, ENC_NA ); hpai_tree = proto_item_add_subtree(hpai_item, ett_knxnetip_hpai); proto_item_append_text(hpai_item, "%s", append_text); - slength= proto_tree_add_item(hpai_tree, hf_knxnetip_hpai_structure_length, tvb, *offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(slength, " octets"); + proto_tree_add_item(hpai_tree, hf_knxnetip_hpai_structure_length, tvb, *offset, 1, ENC_BIG_ENDIAN); *offset+=1; proto_tree_add_item(hpai_tree, hf_knxnetip_hpai_host_protocol, tvb, *offset, 1, ENC_BIG_ENDIAN); *offset+=1; @@ -706,7 +703,6 @@ static void dissect_hpai(tvbuff_t *tvb, guint32 *offset, proto_tree *insert_tree static gboolean dissect_dib(tvbuff_t *tvb, guint32 *offset, proto_tree *insert_tree) { proto_item *dib_item = NULL; - proto_item *struct_length = NULL; proto_item *projectid_item = NULL; proto_item *service_item = NULL; @@ -723,8 +719,7 @@ static gboolean dissect_dib(tvbuff_t *tvb, guint32 *offset, proto_tree *insert_t length = tvb_get_guint8(tvb, *offset); dib_item = proto_tree_add_item(insert_tree, hf_knxnetip_dib, tvb, *offset, length, ENC_NA); dib_tree = proto_item_add_subtree(dib_item, ett_knxnetip_dib); - struct_length= proto_tree_add_item(dib_tree, hf_knxnetip_structure_length, tvb, *offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(struct_length, " octets"); + proto_tree_add_item(dib_tree, hf_knxnetip_structure_length, tvb, *offset, 1, ENC_BIG_ENDIAN); *offset+=1; proto_tree_add_item(dib_tree, hf_knxnetip_dib_type, tvb, *offset, 1, ENC_BIG_ENDIAN); dib_type = tvb_get_guint8(tvb, *offset); @@ -834,7 +829,6 @@ static gboolean dissect_dib(tvbuff_t *tvb, guint32 *offset, proto_tree *insert_t static guint dissect_cri(tvbuff_t *tvb, guint32 offset, proto_tree *insert_tree) { proto_item *cri_item = NULL; - proto_item *cri_length = NULL; proto_tree *cri_tree = NULL; guint8 length; @@ -843,8 +837,7 @@ static guint dissect_cri(tvbuff_t *tvb, guint32 offset, proto_tree *insert_tree) cri_item = proto_tree_add_item(insert_tree, hf_knxnetip_cri, tvb, offset, length, ENC_NA); cri_tree = proto_item_add_subtree(cri_item, ett_knxnetip_cri); - cri_length= proto_tree_add_item(cri_tree, hf_knxnetip_structure_length, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(cri_length, " octets"); + proto_tree_add_item(cri_tree, hf_knxnetip_structure_length, tvb, offset, 1, ENC_BIG_ENDIAN); offset+=1; proto_tree_add_item(cri_tree, hf_knxnetip_connection_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset+=1; @@ -864,7 +857,6 @@ static guint dissect_cri(tvbuff_t *tvb, guint32 offset, proto_tree *insert_tree) static void dissect_crd(tvbuff_t *tvb, guint32 *offset, proto_tree *insert_tree) { proto_item *crd_item = NULL; - proto_item *crd_length = NULL; proto_tree *crd_tree = NULL; guint8 length; @@ -874,8 +866,7 @@ static void dissect_crd(tvbuff_t *tvb, guint32 *offset, proto_tree *insert_tree) crd_item = proto_tree_add_item(insert_tree, hf_knxnetip_crd, tvb, *offset, length, ENC_NA); crd_tree = proto_item_add_subtree(crd_item, ett_knxnetip_crd); - crd_length= proto_tree_add_item(crd_tree, hf_knxnetip_structure_length, tvb, *offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(crd_length, " octets"); + proto_tree_add_item(crd_tree, hf_knxnetip_structure_length, tvb, *offset, 1, ENC_BIG_ENDIAN); *offset+=1; proto_tree_add_item(crd_tree, hf_knxnetip_connection_type, tvb, *offset, 1, ENC_BIG_ENDIAN); *offset+=1; @@ -892,10 +883,7 @@ static void dissect_crd(tvbuff_t *tvb, guint32 *offset, proto_tree *insert_tree) static guint dissect_connection_header(tvbuff_t *tvb, guint32 offset, proto_tree *insert_tree, gboolean have_status) { - proto_item *struct_length = NULL; - - struct_length= proto_tree_add_item(insert_tree, hf_knxnetip_structure_length, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(struct_length, " octets"); + proto_tree_add_item(insert_tree, hf_knxnetip_structure_length, tvb, offset, 1, ENC_BIG_ENDIAN); offset+=1; proto_tree_add_item(insert_tree, hf_knxnetip_communication_channel_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset+=1; @@ -911,10 +899,7 @@ static guint dissect_connection_header(tvbuff_t *tvb, guint32 offset, proto_tree static guint dissect_selector(tvbuff_t *tvb, guint32 offset, proto_tree *insert_tree){ - proto_item *struct_length = NULL; - - struct_length= proto_tree_add_item(insert_tree, hf_knxnetip_structure_length, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(struct_length, " octets"); + proto_tree_add_item(insert_tree, hf_knxnetip_structure_length, tvb, offset, 1, ENC_BIG_ENDIAN); offset+=1; proto_tree_add_item(insert_tree, hf_knxnetip_selector_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset+=1; @@ -1028,11 +1013,8 @@ static void dissect_apci(tvbuff_t *tvb, guint32 *offset, proto_tree *insert_tree static gboolean dissect_cemi(tvbuff_t *tvb, guint32 *offset, proto_tree *insert_tree, packet_info *pinfo){ proto_item *cemi_item = NULL; - proto_item *additional_info_totallength = NULL; proto_item *additional_item = NULL; proto_item *additional_info = NULL; - proto_item *tpdu_length = NULL; - proto_item *npdu_length = NULL; proto_tree *cemi_tree = NULL; proto_tree *additional_tree = NULL; @@ -1056,8 +1038,7 @@ static gboolean dissect_cemi(tvbuff_t *tvb, guint32 *offset, proto_tree *insert_ /*check if M_ Message*/ if ((messagecode & 0xF0) < 0xF0){ length = tvb_get_guint8(tvb, *offset); - additional_info_totallength= proto_tree_add_item(cemi_tree, hf_knxnetip_cemi_addlength, tvb, *offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(additional_info_totallength, " octets"); + proto_tree_add_item(cemi_tree, hf_knxnetip_cemi_addlength, tvb, *offset, 1, ENC_BIG_ENDIAN); *offset+=1; if (length != 0){ @@ -1069,8 +1050,7 @@ static gboolean dissect_cemi(tvbuff_t *tvb, guint32 *offset, proto_tree *insert_ additional_item = proto_tree_add_item(additional_tree, hf_knxnetip_cemi_typid, tvb, *offset, 1, ENC_BIG_ENDIAN); additional_subtree = proto_item_add_subtree(additional_item, ett_knxnetip_cemi_additional_item); *offset+=1; - additional_info_totallength= proto_tree_add_item(additional_item, hf_knxnetip_cemi_additemlength, tvb, *offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(additional_info_totallength, " octets"); + proto_tree_add_item(additional_item, hf_knxnetip_cemi_additemlength, tvb, *offset, 1, ENC_BIG_ENDIAN); *offset+=1; if (length >= 2){ length-=2; @@ -1250,8 +1230,7 @@ static gboolean dissect_cemi(tvbuff_t *tvb, guint32 *offset, proto_tree *insert_ proto_tree_add_item(cemi_tree, hf_knxnetip_polldata, tvb, *offset, -1, ENC_NA); } else { - npdu_length = proto_tree_add_item(cemi_tree, hf_knxnetip_cemi_npdu_length, tvb, *offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(npdu_length, " octets"); + proto_tree_add_item(cemi_tree, hf_knxnetip_cemi_npdu_length, tvb, *offset, 1, ENC_BIG_ENDIAN); *offset+=1; dissect_apci(tvb, offset, cemi_tree, FALSE); } @@ -1268,8 +1247,7 @@ static gboolean dissect_cemi(tvbuff_t *tvb, guint32 *offset, proto_tree *insert_ case(DATA_CONNEC_REQ): proto_tree_add_item(cemi_tree, hf_knxnetip_reserved, tvb, *offset, 6, ENC_NA); *offset+=6; - tpdu_length = proto_tree_add_item(cemi_tree, hf_knxnetip_cemi_tpdu_length, tvb, *offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(tpdu_length, " octets"); + proto_tree_add_item(cemi_tree, hf_knxnetip_cemi_tpdu_length, tvb, *offset, 1, ENC_BIG_ENDIAN); *offset+=1; dissect_apci(tvb, offset, cemi_tree, TRUE); break; @@ -1332,9 +1310,6 @@ static gboolean dissect_cemi(tvbuff_t *tvb, guint32 *offset, proto_tree *insert_ static void dissect_knxnetip (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_item *knx_item = NULL; - proto_item *total_length = NULL; - proto_item *struct_length = NULL; - proto_item *busy_item = NULL; proto_tree *knx_tree = NULL; proto_tree *header_tree = NULL; @@ -1360,8 +1335,7 @@ static void dissect_knxnetip (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre proto_tree_add_item(header_tree, hf_knxnetip_servicetype, tvb, offset, 2, ENC_BIG_ENDIAN); col_add_fstr(pinfo->cinfo, COL_INFO, "%s %d > %d", val_to_str(service_type, knxnetip_service_identifier, "Unknown Identifier:0x%02x"), pinfo->srcport, pinfo->destport); offset+=2; - total_length = proto_tree_add_item(header_tree, hf_knxnetip_totallength, tvb, offset, 2, ENC_BIG_ENDIAN); - proto_item_append_text(total_length, " octets"); + proto_tree_add_item(header_tree, hf_knxnetip_totallength, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2; /* BODY */ body_tree = proto_tree_add_subtree(knx_tree, tvb, offset, -1, ett_knxnetip_body, NULL, "Body"); @@ -1457,8 +1431,7 @@ static void dissect_knxnetip (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre } break; case(ROUTING_LOST): - struct_length= proto_tree_add_item(body_tree, hf_knxnetip_structure_length, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(struct_length, " octets"); + proto_tree_add_item(body_tree, hf_knxnetip_structure_length, tvb, offset, 1, ENC_BIG_ENDIAN); offset+=1; proto_tree_add_bitmask(body_tree, tvb, offset, hf_knxnetip_devicestate, ett_knxnetip_devicestate, devicestate_flags, ENC_BIG_ENDIAN); offset+=1; @@ -1466,13 +1439,11 @@ static void dissect_knxnetip (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre offset+=2; break; case(ROUTING_BUSY): - struct_length= proto_tree_add_item(body_tree, hf_knxnetip_structure_length, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(struct_length, " octets"); + proto_tree_add_item(body_tree, hf_knxnetip_structure_length, tvb, offset, 1, ENC_BIG_ENDIAN); offset+=1; proto_tree_add_bitmask(body_tree, tvb, offset, hf_knxnetip_devicestate, ett_knxnetip_devicestate, devicestate_flags, ENC_BIG_ENDIAN); offset+=1; - busy_item = proto_tree_add_item(body_tree, hf_knxnetip_busywaittime, tvb, offset, 2, ENC_BIG_ENDIAN); - proto_item_append_text(busy_item, " ms"); + proto_tree_add_item(body_tree, hf_knxnetip_busywaittime, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2; proto_tree_add_item(body_tree, hf_knxnetip_busycontrol, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2; @@ -1553,13 +1524,13 @@ void proto_register_knxnetip (void) { { &hf_knxnetip_servicetype, { "Service Type Identifier", "knxnetip.service_type_identifier", FT_UINT16, BASE_HEX, VALS(knxnetip_service_identifier), 0x0, NULL, HFILL }}, { &hf_knxnetip_totallength, - { "Total Length", "knxnetip.total_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { "Total Length", "knxnetip.total_length", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0, NULL, HFILL }}, { &hf_knxnetip_hpai, { "HPAI", "knxnetip.hpai", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_knxnetip_hpai_structure_length, - { "Structure Length", "knxnetip.hpai_structure_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { "Structure Length", "knxnetip.hpai_structure_length", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0, NULL, HFILL }}, { &hf_knxnetip_structure_length, - { "Structure Length", "knxnetip.struct_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { "Structure Length", "knxnetip.struct_length", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0, NULL, HFILL }}, { &hf_knxnetip_hpai_host_protocol, { "Host Protocol Code", "knxnetip.hpai_host_protocol", FT_UINT8, BASE_HEX, VALS(knxnetip_host_protocol_codes), 0x0, NULL, HFILL }}, { &hf_knxnetip_hpai_ip_address, @@ -1649,7 +1620,7 @@ void proto_register_knxnetip (void) { { &hf_knxnetip_numberoflost, { "NumberofLostMessages", "knxnetip.number_of_lost_msg", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_knxnetip_busywaittime, - { "Busy Wait Time", "knxnetip.busy_time", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { "Busy Wait Time", "knxnetip.busy_time", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, { &hf_knxnetip_busycontrol, { "Busy Control Field", "knxnetip.busy_control", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_knxnetip_knxlayer, @@ -1663,9 +1634,9 @@ void proto_register_knxnetip (void) { { &hf_knxnetip_cemi_mc, { "messagecode", "knxnetip.cemi_messagecode", FT_UINT8, BASE_HEX, VALS(cemi_messagecodes), 0x0, NULL, HFILL }}, { &hf_knxnetip_cemi_addlength, - { "add information length", "knxnetip.additional_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { "add information length", "knxnetip.additional_length", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0, NULL, HFILL }}, { &hf_knxnetip_cemi_additemlength, - { "Length", "knxnetip.additional_item_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { "Length", "knxnetip.additional_item_length", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0, NULL, HFILL }}, { &hf_knxnetip_cemi_typid, { "Type id", "knxnetip.cemi_type_id", FT_UINT8, BASE_HEX, VALS(cemi_add_type_id), 0x0, NULL, HFILL }}, { &hf_knxnetip_cemi_type_pl, @@ -1709,9 +1680,9 @@ void proto_register_knxnetip (void) { { &hf_knxnetip_cemi_tpci, { "TPCI", "knxnetip.cemitpci", FT_UINT8, BASE_HEX, VALS(cemi_tpci_vals), 0xC0, NULL, HFILL }}, { &hf_knxnetip_cemi_npdu_length, - { "NPDU length", "knxnetip.npdulength", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { "NPDU length", "knxnetip.npdulength", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0, NULL, HFILL }}, { &hf_knxnetip_cemi_tpdu_length, - { "TPDU length", "knxnetip.tpdulength", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { "TPDU length", "knxnetip.tpdulength", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0, NULL, HFILL }}, { &hf_knxnetip_cemi_counter, { "sequence NCD/NDT", "knxnetip.npduseq", FT_UINT8, BASE_DEC, NULL, 0x3C, NULL, HFILL }}, { &hf_knxnetip_cemi_apci, diff --git a/epan/dissectors/packet-lldp.c b/epan/dissectors/packet-lldp.c index d4d3508df1..c843e6fbf3 100644 --- a/epan/dissectors/packet-lldp.c +++ b/epan/dissectors/packet-lldp.c @@ -1084,6 +1084,8 @@ static const value_string ieee_802_1qbg_subtypes[] = { { 0, NULL } }; +static const unit_name_string units_m = { " m", NULL }; + static void mdi_power_base(gchar *buf, guint32 value) { g_snprintf(buf, ITEM_LABEL_LENGTH, "%u.%u. Watt", value/10, value%10); @@ -3245,7 +3247,7 @@ dissect_hytec_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint gint32 bit_offset, msg_len, expected_data_length, maximum_data_length, temp_gint32; proto_tree *hytec_data = NULL; proto_item *tf = NULL; - proto_item *tlm, *group_proto_item, *identifier_proto_item; + proto_item *group_proto_item, *identifier_proto_item; float float_value = 0.0f; subtype = tvb_get_guint8(tvb, offset); @@ -3299,8 +3301,7 @@ dissect_hytec_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint case HYTEC_TBD__SINGLE_MODE: if(msg_len == expected_data_length) { - tlm = proto_tree_add_item(tree, hf_hytec_single_mode, tvb, offset, msg_len, ENC_BIG_ENDIAN); - proto_item_append_text(tlm, " m"); + proto_tree_add_item(tree, hf_hytec_single_mode, tvb, offset, msg_len, ENC_BIG_ENDIAN); } else { /* unexpected length */ @@ -3311,8 +3312,7 @@ dissect_hytec_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint case HYTEC_TBD__MULTI_MODE_50: if(msg_len == expected_data_length) { - tlm = proto_tree_add_item(tree, hf_hytec_multi_mode_50, tvb, offset, msg_len, ENC_BIG_ENDIAN); - proto_item_append_text(tlm, " m"); + proto_tree_add_item(tree, hf_hytec_multi_mode_50, tvb, offset, msg_len, ENC_BIG_ENDIAN); } else { /* unexpected length */ @@ -3323,8 +3323,7 @@ dissect_hytec_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint case HYTEC_TBD__MULTI_MODE_62_5: if(msg_len == expected_data_length) { - tlm = proto_tree_add_item(tree, hf_hytec_multi_mode_62_5, tvb, offset, msg_len, ENC_BIG_ENDIAN); - proto_item_append_text(tlm, " m"); + proto_tree_add_item(tree, hf_hytec_multi_mode_62_5, tvb, offset, msg_len, ENC_BIG_ENDIAN); } else { /* unexpected length */ @@ -3346,8 +3345,7 @@ dissect_hytec_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint { temp_gint32 = (gint32) tvb_get_ntohl(tvb, offset); float_value = (float) 0.1 * (float) temp_gint32; - tlm = proto_tree_add_float(tree, hf_hytec_tx_current_output_power, tvb, offset, msg_len, float_value); - proto_item_append_text(tlm, " uW"); + proto_tree_add_float(tree, hf_hytec_tx_current_output_power, tvb, offset, msg_len, float_value); } else { /* unexpected length */ @@ -3360,8 +3358,7 @@ dissect_hytec_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint { temp_gint32 = (gint32) tvb_get_ntohl(tvb, offset); float_value = (float) 0.1 * (float) temp_gint32; - tlm = proto_tree_add_float(tree, hf_hytec_rx_current_input_power, tvb, offset, msg_len, float_value); - proto_item_append_text(tlm, " uW"); + proto_tree_add_float(tree, hf_hytec_rx_current_input_power, tvb, offset, msg_len, float_value); } else { /* unexpected length */ @@ -3376,8 +3373,7 @@ dissect_hytec_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint if(temp_gint32 < 0) float_value = (float)-1.0 * (float)((~temp_gint32) >> 8); else float_value = (float) (temp_gint32 >> 8); float_value += (float)(temp_gint32 & 0xFF) * (float)0.00390625; /* 0.00390625 == 0.5 ^ 8 */ - tlm = proto_tree_add_float(tree, hf_hytec_rx_input_snr, tvb, offset, msg_len, float_value); - proto_item_append_text(tlm, " dB"); + proto_tree_add_float(tree, hf_hytec_rx_input_snr, tvb, offset, msg_len, float_value); } else { /* unexpected length */ @@ -3392,8 +3388,7 @@ dissect_hytec_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint if(temp_gint32 < 0) float_value = (float)-1.0 * (float)((~temp_gint32) >> 8); else float_value = (float) (temp_gint32 >> 8); float_value += (float)(temp_gint32 & 0xFF) * (float)0.00390625; /* 0.5 ^ 8 */ - tlm = proto_tree_add_float(tree, hf_hytec_lineloss, tvb, offset, msg_len, float_value); - proto_item_append_text(tlm, " dB"); + proto_tree_add_float(tree, hf_hytec_lineloss, tvb, offset, msg_len, float_value); } else { /* unexpected length */ @@ -5111,32 +5106,32 @@ proto_register_lldp(void) NULL, 0x0, NULL, HFILL } }, { &hf_hytec_single_mode, - { HYTEC_TBD__SINGLE_MODE_STR, "lldp.hytec.single_mode", FT_UINT32, BASE_DEC, - NULL, 0x0, NULL, HFILL} + { HYTEC_TBD__SINGLE_MODE_STR, "lldp.hytec.single_mode", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, + &units_m, 0x0, NULL, HFILL} }, { &hf_hytec_multi_mode_50, - { HYTEC_TBD__MULTI_MODE_50_STR, "lldp.hytec.multi_mode_50", FT_UINT32, BASE_DEC, - NULL, 0x0, NULL, HFILL} + { HYTEC_TBD__MULTI_MODE_50_STR, "lldp.hytec.multi_mode_50", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, + &units_m, 0x0, NULL, HFILL} }, { &hf_hytec_multi_mode_62_5, - { HYTEC_TBD__MULTI_MODE_62_5_STR, "lldp.hytec.multi_mode_62_5", FT_UINT32, BASE_DEC, - NULL, 0x0, NULL, HFILL} + { HYTEC_TBD__MULTI_MODE_62_5_STR, "lldp.hytec.multi_mode_62_5", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, + &units_m, 0x0, NULL, HFILL} }, { &hf_hytec_tx_current_output_power, - { HYTEC_MD__TX_CURRENT_OUTPUT_POWER_STR, "lldp.hytec.tx_current_output_power", FT_FLOAT, BASE_NONE, - NULL, 0x0, NULL, HFILL} + { HYTEC_MD__TX_CURRENT_OUTPUT_POWER_STR, "lldp.hytec.tx_current_output_power", FT_FLOAT, BASE_NONE|BASE_UNIT_STRING, + &units_uW, 0x0, NULL, HFILL} }, { &hf_hytec_rx_current_input_power, - { HYTEC_MD__RX_CURRENT_INPUT_POWER_STR, "lldp.hytec.rx_current_input_power", FT_FLOAT, BASE_NONE, - NULL, 0x0, NULL, HFILL} + { HYTEC_MD__RX_CURRENT_INPUT_POWER_STR, "lldp.hytec.rx_current_input_power", FT_FLOAT, BASE_NONE|BASE_UNIT_STRING, + &units_uW, 0x0, NULL, HFILL} }, { &hf_hytec_rx_input_snr, - { HYTEC_MD__RX_INPUT_SNR_STR, "lldp.hytec.rx_input_snr", FT_FLOAT, BASE_NONE, - NULL, 0x0, NULL, HFILL} + { HYTEC_MD__RX_INPUT_SNR_STR, "lldp.hytec.rx_input_snr", FT_FLOAT, BASE_NONE|BASE_UNIT_STRING, + &units_decibals, 0x0, NULL, HFILL} }, { &hf_hytec_lineloss, - { HYTEC_MD__LINELOSS_STR, "lldp.hytec.lineloss", FT_FLOAT, BASE_NONE, - NULL, 0x0, NULL, HFILL} + { HYTEC_MD__LINELOSS_STR, "lldp.hytec.lineloss", FT_FLOAT, BASE_NONE|BASE_UNIT_STRING, + &units_decibals, 0x0, NULL, HFILL} }, { &hf_hytec_mac_trace_request, { HYTEC_MC__MAC_TRACE_REQUEST_STR, "lldp.hytec.mac_trace_request", FT_NONE, BASE_NONE, diff --git a/epan/dissectors/packet-mbim.c b/epan/dissectors/packet-mbim.c index b50712d7b0..b481c1ff2c 100644 --- a/epan/dissectors/packet-mbim.c +++ b/epan/dissectors/packet-mbim.c @@ -2604,7 +2604,6 @@ mbim_dissect_registration_state_info(tvbuff_t *tvb, packet_info *pinfo _U_, prot static void mbim_dissect_packet_service_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset) { - proto_item *ti; guint32 nw_error; nw_error = tvb_get_letohl(tvb, offset); @@ -2619,22 +2618,18 @@ mbim_dissect_packet_service_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr proto_tree_add_bitmask(tree, tvb, offset, hf_mbim_packet_service_info_highest_available_data_class, ett_mbim_bitmap, mbim_data_class_fields, ENC_LITTLE_ENDIAN); offset += 4; - ti = proto_tree_add_item(tree, hf_mbim_packet_service_info_uplink_speed, tvb, offset, 8, ENC_LITTLE_ENDIAN); - proto_item_append_text(ti, " b/s"); + proto_tree_add_item(tree, hf_mbim_packet_service_info_uplink_speed, tvb, offset, 8, ENC_LITTLE_ENDIAN); offset += 8; - ti = proto_tree_add_item(tree, hf_mbim_packet_service_info_downlink_speed, tvb, offset, 8, ENC_LITTLE_ENDIAN); - proto_item_append_text(ti, " b/s"); + proto_tree_add_item(tree, hf_mbim_packet_service_info_downlink_speed, tvb, offset, 8, ENC_LITTLE_ENDIAN); /*offset += 8;*/ } static void mbim_dissect_set_signal_state(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset) { - proto_item *ti; guint32 error_rate_threshold; - ti = proto_tree_add_item(tree, hf_mbim_set_signal_state_signal_strength_interval, tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_item_append_text(ti, " s"); + proto_tree_add_item(tree, hf_mbim_set_signal_state_signal_strength_interval, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_tree_add_item(tree, hf_mbim_set_signal_state_rssi_threshold, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; @@ -2650,15 +2645,13 @@ mbim_dissect_set_signal_state(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree static void mbim_dissect_signal_state_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset) { - proto_item *ti; guint32 error_rate_threshold; proto_tree_add_item(tree, hf_mbim_signal_state_info_rssi, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_tree_add_item(tree, hf_mbim_signal_state_info_error_rate, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - ti = proto_tree_add_item(tree, hf_mbim_signal_state_info_signal_strength_interval, tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_item_append_text(ti, " s"); + proto_tree_add_item(tree, hf_mbim_signal_state_info_signal_strength_interval, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_tree_add_item(tree, hf_mbim_signal_state_info_rssi_threshold, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; @@ -4120,21 +4113,15 @@ mbim_dissect_sar_config(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, static void mbim_dissect_adpclk_freq_value(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset, guint32 buffer_len) { - proto_item *pi; - - pi = proto_tree_add_item(tree, hf_mbim_adpclk_freq_info_adpclk_freq_value_center_freq, tvb, offset, 8, ENC_LITTLE_ENDIAN); - proto_item_append_text(pi, " Hz"); + proto_tree_add_item(tree, hf_mbim_adpclk_freq_info_adpclk_freq_value_center_freq, tvb, offset, 8, ENC_LITTLE_ENDIAN); offset += 4; - pi = proto_tree_add_item(tree, hf_mbim_adpclk_freq_info_adpclk_freq_value_freq_spread, tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_item_append_text(pi, " Hz"); + proto_tree_add_item(tree, hf_mbim_adpclk_freq_info_adpclk_freq_value_freq_spread, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; if (buffer_len > 8) { - pi = proto_tree_add_item(tree, hf_mbim_adpclk_freq_info_adpclk_freq_value_noise_power, tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_item_append_text(pi, " dBm"); + proto_tree_add_item(tree, hf_mbim_adpclk_freq_info_adpclk_freq_value_noise_power, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; if (buffer_len > 12) { - pi = proto_tree_add_item(tree, hf_mbim_adpclk_freq_info_adpclk_freq_value_rssi, tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_item_append_text(pi, " dBm"); + proto_tree_add_item(tree, hf_mbim_adpclk_freq_info_adpclk_freq_value_rssi, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; if (buffer_len > 16) { proto_tree_add_item(tree, hf_mbim_adpclk_freq_info_adpclk_freq_value_connect_status, tvb, offset, 4, ENC_LITTLE_ENDIAN); @@ -4197,21 +4184,15 @@ mbim_dissect_nrtcws_config(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr static void mbim_dissect_nrtcws_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset) { - proto_item *pi; - proto_tree_add_item(tree, hf_mbim_nrtcws_info_lte_active, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - pi = proto_tree_add_item(tree, hf_mbim_nrtcws_info_wlan_safe_rx_min, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_item_append_text(pi, " MHz"); + proto_tree_add_item(tree, hf_mbim_nrtcws_info_wlan_safe_rx_min, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - pi = proto_tree_add_item(tree, hf_mbim_nrtcws_info_wlan_safe_rx_max, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_item_append_text(pi, " MHz"); + proto_tree_add_item(tree, hf_mbim_nrtcws_info_wlan_safe_rx_max, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - pi = proto_tree_add_item(tree, hf_mbim_nrtcws_info_bt_safe_rx_min, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_item_append_text(pi, " MHz"); + proto_tree_add_item(tree, hf_mbim_nrtcws_info_bt_safe_rx_min, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - pi = proto_tree_add_item(tree, hf_mbim_nrtcws_info_bt_safe_rx_max, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_item_append_text(pi, " MHz"); + proto_tree_add_item(tree, hf_mbim_nrtcws_info_bt_safe_rx_max, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; proto_tree_add_item(tree, hf_mbim_nrtcws_info_lte_sps_period, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; @@ -4314,47 +4295,39 @@ mbim_dissect_atds_operators(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, static void mbim_dissect_atds_projection_table(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset) { - proto_item *pi; - proto_tree_add_item(tree, hf_mbim_atds_projection_table_type, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - pi = proto_tree_add_item(tree, hf_mbim_atds_projection_table_bar5min, tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_item_append_text(pi, " dBm"); + proto_tree_add_item(tree, hf_mbim_atds_projection_table_bar5min, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_tree_add_item(tree, hf_mbim_atds_projection_table_a5, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_tree_add_item(tree, hf_mbim_atds_projection_table_b5, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - pi = proto_tree_add_item(tree, hf_mbim_atds_projection_table_bar4min, tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_item_append_text(pi, " dBm"); + proto_tree_add_item(tree, hf_mbim_atds_projection_table_bar4min, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_tree_add_item(tree, hf_mbim_atds_projection_table_a4, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_tree_add_item(tree, hf_mbim_atds_projection_table_b4, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - pi = proto_tree_add_item(tree, hf_mbim_atds_projection_table_bar3min, tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_item_append_text(pi, " dBm"); + proto_tree_add_item(tree, hf_mbim_atds_projection_table_bar3min, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_tree_add_item(tree, hf_mbim_atds_projection_table_a3, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_tree_add_item(tree, hf_mbim_atds_projection_table_b3, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - pi = proto_tree_add_item(tree, hf_mbim_atds_projection_table_bar2min, tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_item_append_text(pi, " dBm"); + proto_tree_add_item(tree, hf_mbim_atds_projection_table_bar2min, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_tree_add_item(tree, hf_mbim_atds_projection_table_a2, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_tree_add_item(tree, hf_mbim_atds_projection_table_b2, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - pi = proto_tree_add_item(tree, hf_mbim_atds_projection_table_bar1min, tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_item_append_text(pi, " dBm"); + proto_tree_add_item(tree, hf_mbim_atds_projection_table_bar1min, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_tree_add_item(tree, hf_mbim_atds_projection_table_a1, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_tree_add_item(tree, hf_mbim_atds_projection_table_b1, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - pi = proto_tree_add_item(tree, hf_mbim_atds_projection_table_bar0min, tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_item_append_text(pi, " dBm"); + proto_tree_add_item(tree, hf_mbim_atds_projection_table_bar0min, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_tree_add_item(tree, hf_mbim_atds_projection_table_a0, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; @@ -5031,13 +5004,9 @@ dissect_mbim_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * switch (cid) { case MBIM_CID_INTC_NRTAPP: if (cmd_type == MBIM_COMMAND_SET) { - proto_item *pi; - - pi = proto_tree_add_item(subtree, hf_mbim_nrtc_app_info_period, frag_tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_item_append_text(pi, " ms"); + proto_tree_add_item(subtree, hf_mbim_nrtc_app_info_period, frag_tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - pi = proto_tree_add_item(subtree, hf_mbim_nrtc_app_info_duration, frag_tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_item_append_text(pi, " ms"); + proto_tree_add_item(subtree, hf_mbim_nrtc_app_info_duration, frag_tvb, offset, 2, ENC_LITTLE_ENDIAN); } else if (info_buff_len) { proto_tree_add_expert(subtree, pinfo, &ei_mbim_unexpected_info_buffer, frag_tvb, offset, info_buff_len); } @@ -5711,13 +5680,9 @@ dissect_mbim_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * if (mbim_info && (mbim_info->cmd_type == MBIM_COMMAND_SET) && info_buff_len) { proto_tree_add_expert(subtree, pinfo, &ei_mbim_unexpected_info_buffer, frag_tvb, offset, info_buff_len); } else if ((mbim_info && (mbim_info->cmd_type == MBIM_COMMAND_QUERY)) || info_buff_len) { - proto_item *pi; - - pi = proto_tree_add_item(subtree, hf_mbim_nrtc_app_info_period, frag_tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_item_append_text(pi, " ms"); + proto_tree_add_item(subtree, hf_mbim_nrtc_app_info_period, frag_tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - pi = proto_tree_add_item(subtree, hf_mbim_nrtc_app_info_duration, frag_tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_item_append_text(pi, " ms"); + proto_tree_add_item(subtree, hf_mbim_nrtc_app_info_duration, frag_tvb, offset, 2, ENC_LITTLE_ENDIAN); } } else { proto_tree_add_expert(subtree, pinfo, &ei_mbim_unexpected_msg, frag_tvb, offset, -1); @@ -7006,17 +6971,17 @@ proto_register_mbim(void) }, { &hf_mbim_packet_service_info_uplink_speed, { "Uplink Speed", "mbim.control.packet_service_info.uplink_speed", - FT_UINT64, BASE_DEC, NULL, 0, + FT_UINT64, BASE_DEC|BASE_UNIT_STRING, &units_bit_sec, 0, NULL, HFILL } }, { &hf_mbim_packet_service_info_downlink_speed, { "Downlink Speed", "mbim.control.packet_service_info.downlink_speed", - FT_UINT64, BASE_DEC, NULL, 0, + FT_UINT64, BASE_DEC|BASE_UNIT_STRING, &units_bit_sec, 0, NULL, HFILL } }, { &hf_mbim_set_signal_state_signal_strength_interval, { "Signal Strength Interval", "mbim.control.set_signal_state.signal_strength_interval", - FT_UINT32, BASE_DEC, NULL, 0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_seconds, 0, NULL, HFILL } }, { &hf_mbim_set_signal_state_rssi_threshold, @@ -7041,7 +7006,7 @@ proto_register_mbim(void) }, { &hf_mbim_signal_state_info_signal_strength_interval, { "Signal Strength Interval", "mbim.control.signal_state_info.signal_strength_interval", - FT_UINT32, BASE_DEC, NULL, 0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_seconds, 0, NULL, HFILL } }, { &hf_mbim_signal_state_info_rssi_threshold, @@ -8911,22 +8876,22 @@ proto_register_mbim(void) }, { &hf_mbim_adpclk_freq_info_adpclk_freq_value_center_freq, { "Center Frequency", "mbim.control.adpclk_freq_info.adpclk_freq_value.center_freq", - FT_UINT64, BASE_DEC, NULL, 0, + FT_UINT64, BASE_DEC|BASE_UNIT_STRING, &units_hz, 0, NULL, HFILL } }, { &hf_mbim_adpclk_freq_info_adpclk_freq_value_freq_spread, { "Frequency Spread", "mbim.control.adpclk_freq_info.adpclk_freq_value.freq_spread", - FT_UINT32, BASE_DEC, NULL, 0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_hz, 0, NULL, HFILL } }, { &hf_mbim_adpclk_freq_info_adpclk_freq_value_noise_power, { "Noise Power", "mbim.control.adpclk_freq_info.adpclk_freq_value.noise_power", - FT_UINT32, BASE_DEC, NULL, 0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_dbm, 0, NULL, HFILL } }, { &hf_mbim_adpclk_freq_info_adpclk_freq_value_rssi, { "Relative Signal Strength Indication", "mbim.control.adpclk_freq_info.adpclk_freq_value.rssi", - FT_UINT32, BASE_DEC, NULL, 0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_dbm, 0, NULL, HFILL } }, { &hf_mbim_adpclk_freq_info_adpclk_freq_value_connect_status, @@ -8941,12 +8906,12 @@ proto_register_mbim(void) }, { &hf_mbim_nrtc_app_info_period, { "Period", "mbim.control.nrtc_app_info.period", - FT_UINT16, BASE_DEC, NULL, 0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0, NULL, HFILL } }, { &hf_mbim_nrtc_app_info_duration, { "Duration", "mbim.control.nrtc_app_info.duration", - FT_UINT16, BASE_DEC, NULL, 0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0, NULL, HFILL } }, { &hf_mbim_nrtcws_config_mode, @@ -8986,22 +8951,22 @@ proto_register_mbim(void) }, { &hf_mbim_nrtcws_info_wlan_safe_rx_min, { "WLAN Safe Rx Min", "mbim.control.nrtcws_info.wlan_safe_rx_min", - FT_UINT16, BASE_DEC, NULL, 0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_mhz, 0, NULL, HFILL } }, { &hf_mbim_nrtcws_info_wlan_safe_rx_max, { "WLAN Safe Rx Max", "mbim.control.nrtcws_info.wlan_safe_rx_max", - FT_UINT16, BASE_DEC, NULL, 0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_mhz, 0, NULL, HFILL } }, { &hf_mbim_nrtcws_info_bt_safe_rx_min, { "BT Safe Rx Min", "mbim.control.nrtcws_info.bt_safe_rx_min", - FT_UINT16, BASE_DEC, NULL, 0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_mhz, 0, NULL, HFILL } }, { &hf_mbim_nrtcws_info_bt_safe_rx_max, { "BT Safe Rx Max", "mbim.control.nrtcws_info.bt_safe_rx_max", - FT_UINT16, BASE_DEC, NULL, 0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_mhz, 0, NULL, HFILL } }, { &hf_mbim_nrtcws_info_lte_sps_period, @@ -9186,7 +9151,7 @@ proto_register_mbim(void) }, { &hf_mbim_atds_projection_table_bar5min, { "Bar5 Min", "mbim.control.atds_projection_table.bar5min", - FT_INT32, BASE_DEC, NULL, 0, + FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_dbm, 0, NULL, HFILL } }, { &hf_mbim_atds_projection_table_a5, @@ -9201,7 +9166,7 @@ proto_register_mbim(void) }, { &hf_mbim_atds_projection_table_bar4min, { "Bar4 Min", "mbim.control.atds_projection_table.bar4min", - FT_INT32, BASE_DEC, NULL, 0, + FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_dbm, 0, NULL, HFILL } }, { &hf_mbim_atds_projection_table_a4, @@ -9216,7 +9181,7 @@ proto_register_mbim(void) }, { &hf_mbim_atds_projection_table_bar3min, { "Bar3 Min", "mbim.control.atds_projection_table.bar3min", - FT_INT32, BASE_DEC, NULL, 0, + FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_dbm, 0, NULL, HFILL } }, { &hf_mbim_atds_projection_table_a3, @@ -9231,7 +9196,7 @@ proto_register_mbim(void) }, { &hf_mbim_atds_projection_table_bar2min, { "Bar2 Min", "mbim.control.atds_projection_table.bar2min", - FT_INT32, BASE_DEC, NULL, 0, + FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_dbm, 0, NULL, HFILL } }, { &hf_mbim_atds_projection_table_a2, @@ -9246,7 +9211,7 @@ proto_register_mbim(void) }, { &hf_mbim_atds_projection_table_bar1min, { "Bar1 Min", "mbim.control.atds_projection_table.bar1min", - FT_INT32, BASE_DEC, NULL, 0, + FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_dbm, 0, NULL, HFILL } }, { &hf_mbim_atds_projection_table_a1, @@ -9261,7 +9226,7 @@ proto_register_mbim(void) }, { &hf_mbim_atds_projection_table_bar0min, { "Bar0 Min", "mbim.control.atds_projection_table.bar0min", - FT_INT32, BASE_DEC, NULL, 0, + FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_dbm, 0, NULL, HFILL } }, { &hf_mbim_atds_projection_table_a0, diff --git a/epan/dissectors/packet-oampdu.c b/epan/dissectors/packet-oampdu.c index b088e9adc0..d68e9fe4cc 100644 --- a/epan/dissectors/packet-oampdu.c +++ b/epan/dissectors/packet-oampdu.c @@ -802,6 +802,9 @@ static const value_string user_port_object_result_rr_vals[] = { { 0, NULL } }; +static const unit_name_string units_pdus_100ms = { " (PDUs/100ms)", NULL }; +static const unit_name_string units_num_100ms = { " (Number of 100ms)", NULL }; + /* Initialise the protocol and registered fields */ static int proto_oampdu = -1; @@ -1099,7 +1102,6 @@ dissect_oampdu_information(tvbuff_t *tvb, proto_tree *tree) proto_tree *info_tree; proto_item *info_item; proto_item *oui_item; - proto_item *item; offset = OAMPDU_HEADER_SIZE; @@ -1183,11 +1185,9 @@ dissect_oampdu_information(tvbuff_t *tvb, proto_tree *tree) offset += OAMPDU_INFO_OAM_CONFIG_SZ; - item = proto_tree_add_item(info_tree, hf_oampdu_info_oampduConfig, + proto_tree_add_item(info_tree, hf_oampdu_info_oampduConfig, tvb, offset, 2, ENC_BIG_ENDIAN); - proto_item_append_text(item, " (bytes)"); - offset += OAMPDU_INFO_OAMPDU_CONFIG_SZ; oui_item = proto_tree_add_item(info_tree, hf_oampdu_info_oui, @@ -1760,10 +1760,8 @@ dissect_oampdu_vendor_specific(tvbuff_t *tvb, proto_tree *tree) } else if (leaf_branch == DPOE_LB_NUM_S1_INT) { proto_tree_add_item(dpoe_opcode_response_tree, hf_oam_dpoe_response_int, tvb, offset, variable_length, ENC_BIG_ENDIAN); } else if (leaf_branch == DPOE_LB_OAM_FR) { - dpoe_opcode_response = proto_tree_add_item(dpoe_opcode_response_tree, hf_oam_dpoe_frame_rate_minimum, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(dpoe_opcode_response, " (PDUs/100ms)"); - dpoe_opcode_response = proto_tree_add_item(dpoe_opcode_response_tree, hf_oam_dpoe_frame_rate_maximum, tvb, offset+1, 1, ENC_BIG_ENDIAN); - proto_item_append_text(dpoe_opcode_response, " (Number of 100ms)"); + proto_tree_add_item(dpoe_opcode_response_tree, hf_oam_dpoe_frame_rate_minimum, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(dpoe_opcode_response_tree, hf_oam_dpoe_frame_rate_maximum, tvb, offset+1, 1, ENC_BIG_ENDIAN); } else if (leaf_branch == DPOE_LB_REP_THRESH) { guint8 nqs; guint8 rvpqs; @@ -2059,7 +2057,7 @@ proto_register_oampdu(void) { &hf_oampdu_info_oampduConfig, { "Max OAMPDU Size", "oampdu.info.oampduConfig", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, "OAMPDU Configuration", HFILL }}, { &hf_oampdu_info_oui, @@ -2302,12 +2300,12 @@ proto_register_oampdu(void) { &hf_oam_dpoe_frame_rate_maximum, { "Maximum OAM Rate", "oampdu.frame.rate.min", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_num_100ms, 0x0, NULL, HFILL } }, { &hf_oam_dpoe_frame_rate_minimum, { "Minimum OAM Rate", "oampdu.frame.rate.max", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_pdus_100ms, 0x0, NULL, HFILL } }, { &hf_oam_dpoe_repthr_nqs, diff --git a/epan/dissectors/packet-ppi-vector.c b/epan/dissectors/packet-ppi-vector.c index 6fcf481307..9ee8836969 100644 --- a/epan/dissectors/packet-ppi-vector.c +++ b/epan/dissectors/packet-ppi-vector.c @@ -481,10 +481,7 @@ dissect_ppi_vector_v1(tvbuff_t *tvb, packet_info *pinfo, int offset, gint length break; t_val = tvb_get_letohl(tvb, offset); vel_r = ppi_fixed6_4_to_gdouble(t_val); - if (ppi_vector_tree) { - ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_vel_r, tvb, offset, 4, vel_r); - proto_item_append_text(ti, " m/s"); - } + proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_vel_r, tvb, offset, 4, vel_r); offset+=4; length_remaining-=4; break; @@ -493,10 +490,7 @@ dissect_ppi_vector_v1(tvbuff_t *tvb, packet_info *pinfo, int offset, gint length break; t_val = tvb_get_letohl(tvb, offset); vel_f = ppi_fixed6_4_to_gdouble(t_val); - if (ppi_vector_tree) { - ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_vel_f, tvb, offset, 4, vel_f); - proto_item_append_text(ti, " m/s"); - } + proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_vel_f, tvb, offset, 4, vel_f); offset+=4; length_remaining-=4; break; @@ -505,10 +499,7 @@ dissect_ppi_vector_v1(tvbuff_t *tvb, packet_info *pinfo, int offset, gint length break; t_val = tvb_get_letohl(tvb, offset); vel_u = ppi_fixed6_4_to_gdouble(t_val); - if (ppi_vector_tree) { - ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_vel_u, tvb, offset, 4, vel_u); - proto_item_append_text(ti, " m/s"); - } + proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_vel_u, tvb, offset, 4, vel_u); offset+=4; length_remaining-=4; break; @@ -517,10 +508,7 @@ dissect_ppi_vector_v1(tvbuff_t *tvb, packet_info *pinfo, int offset, gint length break; t_val = tvb_get_letohl(tvb, offset); vel_t = ppi_fixed6_4_to_gdouble(t_val); - if (ppi_vector_tree) { - ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_vel_t, tvb, offset, 4, vel_t); - proto_item_append_text(ti, " m/s"); - } + proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_vel_t, tvb, offset, 4, vel_t); offset+=4; length_remaining-=4; break; @@ -529,10 +517,7 @@ dissect_ppi_vector_v1(tvbuff_t *tvb, packet_info *pinfo, int offset, gint length break; t_val = tvb_get_letohl(tvb, offset); acc_r = ppi_fixed6_4_to_gdouble(t_val); - if (ppi_vector_tree) { - ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_acc_r, tvb, offset, 4, acc_r); - proto_item_append_text(ti, " (m/s)/s"); - } + proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_acc_r, tvb, offset, 4, acc_r); offset+=4; length_remaining-=4; break; @@ -541,10 +526,7 @@ dissect_ppi_vector_v1(tvbuff_t *tvb, packet_info *pinfo, int offset, gint length break; t_val = tvb_get_letohl(tvb, offset); acc_f = ppi_fixed6_4_to_gdouble(t_val); - if (ppi_vector_tree) { - ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_acc_f, tvb, offset, 4, acc_f); - proto_item_append_text(ti, " (m/s)/s"); - } + ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_acc_f, tvb, offset, 4, acc_f); offset+=4; length_remaining-=4; break; @@ -553,10 +535,7 @@ dissect_ppi_vector_v1(tvbuff_t *tvb, packet_info *pinfo, int offset, gint length break; t_val = tvb_get_letohl(tvb, offset); acc_u = ppi_fixed6_4_to_gdouble(t_val); - if (ppi_vector_tree) { - ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_acc_u, tvb, offset, 4, acc_u); - proto_item_append_text(ti, " (m/s)/s"); - } + proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_acc_u, tvb, offset, 4, acc_u); offset+=4; length_remaining-=4; break; @@ -565,10 +544,7 @@ dissect_ppi_vector_v1(tvbuff_t *tvb, packet_info *pinfo, int offset, gint length break; t_val = tvb_get_letohl(tvb, offset); acc_t = ppi_fixed6_4_to_gdouble(t_val); - if (ppi_vector_tree) { - ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_acc_t, tvb, offset, 4, acc_t); - proto_item_append_text(ti, " (m/s)/s"); - } + proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_acc_t, tvb, offset, 4, acc_t); offset+=4; length_remaining-=4; break; @@ -577,10 +553,7 @@ dissect_ppi_vector_v1(tvbuff_t *tvb, packet_info *pinfo, int offset, gint length break; t_val = tvb_get_letohl(tvb, offset); err_rot = ppi_fixed3_6_to_gdouble(t_val); - if (ppi_vector_tree) { - ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_err_rot, tvb, offset, 4, err_rot); - proto_item_append_text(ti, " degrees"); - } + proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_err_rot, tvb, offset, 4, err_rot); offset+=4; length_remaining-=4; break; @@ -589,10 +562,7 @@ dissect_ppi_vector_v1(tvbuff_t *tvb, packet_info *pinfo, int offset, gint length break; t_val = tvb_get_letohl(tvb, offset); err_off = ppi_fixed6_4_to_gdouble(t_val); - if (ppi_vector_tree) { - ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_err_off, tvb, offset, 4, err_off); - proto_item_append_text(ti, " meters"); - } + proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_err_off, tvb, offset, 4, err_off); offset+=4; length_remaining-=4; break; @@ -601,10 +571,7 @@ dissect_ppi_vector_v1(tvbuff_t *tvb, packet_info *pinfo, int offset, gint length break; t_val = tvb_get_letohl(tvb, offset); err_vel = ppi_fixed6_4_to_gdouble(t_val); - if (ppi_vector_tree) { - ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_err_vel, tvb, offset, 4, err_vel); - proto_item_append_text(ti, "m/s"); - } + proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_err_vel, tvb, offset, 4, err_vel); offset+=4; length_remaining-=4; break; @@ -882,10 +849,7 @@ dissect_ppi_vector_v2(tvbuff_t *tvb, packet_info *pinfo, int offset, gint length break; t_val = tvb_get_letohl(tvb, offset); err_rot = ppi_fixed3_6_to_gdouble(t_val); - if (ppi_vector_tree) { - ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_err_rot, tvb, offset, 4, err_rot); - proto_item_append_text(ti, " Degrees"); - } + proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_err_rot, tvb, offset, 4, err_rot); offset+=4; length_remaining-=4; break; @@ -894,10 +858,7 @@ dissect_ppi_vector_v2(tvbuff_t *tvb, packet_info *pinfo, int offset, gint length break; t_val = tvb_get_letohl(tvb, offset); err_off = ppi_fixed6_4_to_gdouble(t_val); - if (ppi_vector_tree) { - ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_err_off, tvb, offset, 4, err_off); - proto_item_append_text(ti, " Meters"); - } + proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_err_off, tvb, offset, 4, err_off); offset+=4; length_remaining-=4; break; @@ -1217,36 +1178,36 @@ proto_register_ppi_vector(void) "Offset up", HFILL } }, { &hf_ppi_vector_vel_r, { "Vel-r", "ppi_vector.vel_r", - FT_DOUBLE, BASE_NONE, NULL, 0x0, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_m_per_s, 0x0, "Velocity-right", HFILL } }, { &hf_ppi_vector_vel_f, { "Vel-f", "ppi_vector.vel_f", - FT_DOUBLE, BASE_NONE, NULL, 0x0, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_m_per_s, 0x0, "Velocity-forward", HFILL } }, { &hf_ppi_vector_vel_u, { "Vel-u", "ppi_vector.vel_u", - FT_DOUBLE, BASE_NONE, NULL, 0x0, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_m_per_s, 0x0, "Velocity-up", HFILL } }, { &hf_ppi_vector_vel_t, { "Vel-t", "ppi_vector.vel_t", - FT_DOUBLE, BASE_NONE, NULL, 0x0, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_m_per_s, 0x0, "Velocity-Total", HFILL } }, { &hf_ppi_vector_acc_r, { "Accel-r", "ppi_vector.acc_r", - FT_DOUBLE, BASE_NONE, NULL, 0x0, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_m_per_s_per_s, 0x0, "Acceleration-right", HFILL } }, { &hf_ppi_vector_acc_f, { "Accel-f", "ppi_vector.acc_f", - FT_DOUBLE, BASE_NONE, NULL, 0x0, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_m_per_s_per_s, 0x0, "Acceleration-forward", HFILL } }, { &hf_ppi_vector_acc_u, { "Accel-u", "ppi_vector.acc_u", - FT_DOUBLE, BASE_NONE, NULL, 0x0, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_m_per_s_per_s, 0x0, "Acceleration-up", HFILL } }, { &hf_ppi_vector_acc_t, { "Accel-t", "ppi_vector.acc_t", - FT_DOUBLE, BASE_NONE, NULL, 0x0, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_m_per_s_per_s, 0x0, "Acceleration-Total", HFILL } }, /* V2 */ @@ -1265,21 +1226,21 @@ proto_register_ppi_vector(void) { &hf_ppi_vector_err_rot, { "Err-Rot", "ppi_vector.err_rot", - FT_DOUBLE, BASE_NONE, NULL, 0x0, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_degree_degrees, 0x0, "Rotation margin of error", HFILL } }, { &hf_ppi_vector_err_off, { "Err-Off", "ppi_vector.err_off", - FT_DOUBLE, BASE_NONE, NULL, 0x0, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_meter_meters, 0x0, "Offset margin of error", HFILL } }, /* V1 only */ { &hf_ppi_vector_err_vel, { "Err-Vel", "ppi_vector.err_vel", - FT_DOUBLE, BASE_NONE, NULL, 0x0, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_m_per_s, 0x0, "Velocity margin of error", HFILL } }, { &hf_ppi_vector_err_acc, { "Err-Accel", "ppi_vector.err_acc", - FT_DOUBLE, BASE_NONE, NULL, 0x0, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_m_per_s_per_s, 0x0, "Acceleration margin of error", HFILL } }, { &hf_ppi_vector_descstr, diff --git a/epan/dissectors/packet-rftap.c b/epan/dissectors/packet-rftap.c index 148d6a470f..901c24f672 100644 --- a/epan/dissectors/packet-rftap.c +++ b/epan/dissectors/packet-rftap.c @@ -136,7 +136,6 @@ struct rftap_hdr { static void dissect_rftap_header(tvbuff_t *tvb, proto_tree *tree, guint32 *dlt, const guint8 **subdissector_name) { - proto_item *ti; proto_item *ti_header; proto_tree *header_tree; gint32 offset; @@ -201,18 +200,15 @@ dissect_rftap_header(tvbuff_t *tvb, proto_tree *tree, guint32 *dlt, const guint8 offset += 4; break; case RFTAP_TAG_FREQ: - ti = proto_tree_add_item(tree, hf_rftap_freq, tvb, offset, 8, ENC_LITTLE_ENDIAN); - proto_item_append_text(ti, " Hz"); + proto_tree_add_item(tree, hf_rftap_freq, tvb, offset, 8, ENC_LITTLE_ENDIAN); offset += 8; break; case RFTAP_TAG_NOM_FREQ: - ti = proto_tree_add_item(tree, hf_rftap_nomfreq, tvb, offset, 8, ENC_LITTLE_ENDIAN); - proto_item_append_text(ti, " Hz"); + proto_tree_add_item(tree, hf_rftap_nomfreq, tvb, offset, 8, ENC_LITTLE_ENDIAN); offset += 8; break; case RFTAP_TAG_FREQ_OFS: - ti = proto_tree_add_item(tree, hf_rftap_freqofs, tvb, offset, 8, ENC_LITTLE_ENDIAN); - proto_item_append_text(ti, " Hz"); + proto_tree_add_item(tree, hf_rftap_freqofs, tvb, offset, 8, ENC_LITTLE_ENDIAN); offset += 8; break; case RFTAP_TAG_POWER_IS_IN_DBM: @@ -251,17 +247,13 @@ dissect_rftap_header(tvbuff_t *tvb, proto_tree *tree, guint32 *dlt, const guint8 offset += 16; break; case RFTAP_TAG_DURATION: - ti = proto_tree_add_item(tree, hf_rftap_duration, tvb, offset, 8, ENC_LITTLE_ENDIAN); - proto_item_append_text(ti, " seconds"); + proto_tree_add_item(tree, hf_rftap_duration, tvb, offset, 8, ENC_LITTLE_ENDIAN); offset += 8; break; case RFTAP_TAG_LOCATION: - ti = proto_tree_add_item(tree, hf_rftap_latitude, tvb, offset, 8, ENC_LITTLE_ENDIAN); - proto_item_append_text(ti, " degrees"); - ti = proto_tree_add_item(tree, hf_rftap_longitude, tvb, offset+8, 8, ENC_LITTLE_ENDIAN); - proto_item_append_text(ti, " degrees"); - ti = proto_tree_add_item(tree, hf_rftap_altitude, tvb, offset+16, 8, ENC_LITTLE_ENDIAN); - proto_item_append_text(ti, " meters"); + proto_tree_add_item(tree, hf_rftap_latitude, tvb, offset, 8, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_rftap_longitude, tvb, offset+8, 8, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_rftap_altitude, tvb, offset+16, 8, ENC_LITTLE_ENDIAN); offset += 24; break; default: @@ -493,17 +485,17 @@ proto_register_rftap(void) { &hf_rftap_freq, { "Frequency", "rftap.freq", - FT_DOUBLE, BASE_NONE, NULL, 0, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_hz, 0, "Actual (measured) carrier frequency, in Hertz (not necessarily center frequency)", HFILL }}, { &hf_rftap_nomfreq, { "Nominal Frequency", "rftap.nomfreq", - FT_DOUBLE, BASE_NONE, NULL, 0, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_hz, 0, "Nominal carrier frequency, in Hertz (the ideal frequency, ignoring freq errors)", HFILL }}, { &hf_rftap_freqofs, { "Frequency Offset", "rftap.freqofs", - FT_DOUBLE, BASE_NONE, NULL, 0, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_hz, 0, "Carrier frequency offset, in Hertz: wikipedia.org/wiki/Carrier_frequency_offset", HFILL }}, { &hf_rftap_signal_power, { "Signal Power", @@ -543,22 +535,22 @@ proto_register_rftap(void) { &hf_rftap_duration, { "Duration", "rftap.duration", - FT_DOUBLE, BASE_NONE, NULL, 0, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_second_seconds, 0, "The duration of the event (packet), in seconds", HFILL }}, { &hf_rftap_latitude, { "Latitude", "rftap.lat", - FT_DOUBLE, BASE_NONE, NULL, 0, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_degree_degrees, 0, "Latitude of receiver (-90..90 degrees), using WGS 84 datum: wikipedia.org/wiki/World_Geodetic_System", HFILL }}, { &hf_rftap_longitude, { "Longitude", "rftap.lon", - FT_DOUBLE, BASE_NONE, NULL, 0, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_degree_degrees, 0, "Longitude of receiver (-180..180 degrees), using WGS 84 datum: wikipedia.org/wiki/World_Geodetic_System", HFILL }}, { &hf_rftap_altitude, { "Altitude", "rftap.alt", - FT_DOUBLE, BASE_NONE, NULL, 0, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_meter_meters, 0, "Altitude of receiver, in meters, using WGS 84 datum: wikipedia.org/wiki/World_Geodetic_System", HFILL }}, /* rftap tagged parameters */ diff --git a/epan/dissectors/packet-sbc.c b/epan/dissectors/packet-sbc.c index 607157914e..e10519c264 100644 --- a/epan/dissectors/packet-sbc.c +++ b/epan/dissectors/packet-sbc.c @@ -228,21 +228,18 @@ dissect_sbc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) /* TODO: expert_info for invalid CRC */ pitem = proto_tree_add_uint(rtree, hf_sbc_expected_data_speed, tvb, offset, 0, expected_speed_data / 1024); - proto_item_append_text(pitem, " KiB/s"); PROTO_ITEM_SET_GENERATED(pitem); frame_duration = (((double) frame_length / (double) expected_speed_data) * 1000.0); cumulative_frame_duration += frame_duration; pitem = proto_tree_add_double(rtree, hf_sbc_frame_duration, tvb, offset, 0, frame_duration); - proto_item_append_text(pitem, " ms"); PROTO_ITEM_SET_GENERATED(pitem); counter += 1; } pitem = proto_tree_add_double(sbc_tree, hf_sbc_cumulative_frame_duration, tvb, offset, 0, cumulative_frame_duration); - proto_item_append_text(pitem, " ms"); PROTO_ITEM_SET_GENERATED(pitem); if (info && info->configuration && info->configuration_length > 0) { @@ -254,16 +251,13 @@ dissect_sbc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) nstime_delta(&delta, &pinfo->abs_ts, &info->previous_media_packet_info->abs_ts); pitem = proto_tree_add_double(sbc_tree, hf_sbc_delta_time, tvb, offset, 0, nstime_to_msec(&delta)); - proto_item_append_text(pitem, " ms"); PROTO_ITEM_SET_GENERATED(pitem); pitem = proto_tree_add_double(sbc_tree, hf_sbc_avrcp_song_position, tvb, offset, 0, info->previous_media_packet_info->avrcp_song_position); - proto_item_append_text(pitem, " ms"); PROTO_ITEM_SET_GENERATED(pitem); nstime_delta(&delta, &pinfo->abs_ts, &info->previous_media_packet_info->first_abs_ts); pitem = proto_tree_add_double(sbc_tree, hf_sbc_delta_time_from_the_beginning, tvb, offset, 0, nstime_to_msec(&delta)); - proto_item_append_text(pitem, " ms"); PROTO_ITEM_SET_GENERATED(pitem); if (!pinfo->fd->flags.visited) { @@ -272,11 +266,9 @@ dissect_sbc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) } pitem = proto_tree_add_double(sbc_tree, hf_sbc_cumulative_duration, tvb, offset, 0, info->previous_media_packet_info->cumulative_frame_duration); - proto_item_append_text(pitem, " ms"); PROTO_ITEM_SET_GENERATED(pitem); pitem = proto_tree_add_double(sbc_tree, hf_sbc_diff, tvb, offset, 0, info->previous_media_packet_info->cumulative_frame_duration - nstime_to_msec(&delta)); - proto_item_append_text(pitem, " ms"); PROTO_ITEM_SET_GENERATED(pitem); } @@ -361,42 +353,42 @@ proto_register_sbc(void) }, { &hf_sbc_expected_data_speed, { "Expected data speed", "sbc.expected_speed_data", - FT_UINT32, BASE_DEC, NULL, 0x00, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_kibps, 0x00, NULL, HFILL } }, { &hf_sbc_frame_duration, { "Frame Duration", "sbc.frame_duration", - FT_DOUBLE, BASE_NONE, NULL, 0x00, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_milliseconds, 0x00, NULL, HFILL } }, { &hf_sbc_cumulative_frame_duration, { "Cumulative Frame Duration", "sbc.cumulative_frame_duration", - FT_DOUBLE, BASE_NONE, NULL, 0x00, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_milliseconds, 0x00, NULL, HFILL } }, { &hf_sbc_delta_time, { "Delta time", "sbc.delta_time", - FT_DOUBLE, BASE_NONE, NULL, 0x00, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_milliseconds, 0x00, NULL, HFILL } }, { &hf_sbc_delta_time_from_the_beginning, { "Delta time from the beginning", "sbc.delta_time_from_the_beginning", - FT_DOUBLE, BASE_NONE, NULL, 0x00, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_milliseconds, 0x00, NULL, HFILL } }, { &hf_sbc_cumulative_duration, { "Cumulative Music Duration", "sbc.cumulative_music_duration", - FT_DOUBLE, BASE_NONE, NULL, 0x00, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_milliseconds, 0x00, NULL, HFILL } }, { &hf_sbc_avrcp_song_position, { "AVRCP Song Position", "sbc.avrcp_song_position", - FT_DOUBLE, BASE_NONE, NULL, 0x00, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_milliseconds, 0x00, NULL, HFILL } }, { &hf_sbc_diff, { "Diff", "sbc.diff", - FT_DOUBLE, BASE_NONE, NULL, 0x00, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_milliseconds, 0x00, NULL, HFILL } }, { &hf_sbc_data, diff --git a/epan/dissectors/packet-simulcrypt.c b/epan/dissectors/packet-simulcrypt.c index 65218c621b..77bdce7de7 100644 --- a/epan/dissectors/packet-simulcrypt.c +++ b/epan/dissectors/packet-simulcrypt.c @@ -804,32 +804,25 @@ dissect_ecmg_parameter_value (proto_tree *tree, tvbuff_t *tvb, packet_info *pinf proto_tree_add_item(tree, hf_simulcrypt_ecm_channel_id, tvb, offset, plen, ENC_BIG_ENDIAN); break; case SIMULCRYPT_ECMG_DELAY_START: - simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_delay_start, tvb, offset, plen, ENC_BIG_ENDIAN); - proto_item_append_text(simulcrypt_item, " ms"); + proto_tree_add_item(tree, hf_simulcrypt_delay_start, tvb, offset, plen, ENC_BIG_ENDIAN); break; case SIMULCRYPT_ECMG_DELAY_STOP: - simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_delay_stop, tvb, offset, plen, ENC_BIG_ENDIAN); - proto_item_append_text(simulcrypt_item, " ms"); + proto_tree_add_item(tree, hf_simulcrypt_delay_stop, tvb, offset, plen, ENC_BIG_ENDIAN); break; case SIMULCRYPT_ECMG_TRANSITION_DELAY_START: - simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_transition_delay_start, tvb, offset, plen, ENC_BIG_ENDIAN); - proto_item_append_text(simulcrypt_item, " ms"); + proto_tree_add_item(tree, hf_simulcrypt_transition_delay_start, tvb, offset, plen, ENC_BIG_ENDIAN); break; case SIMULCRYPT_ECMG_TRANSITION_DELAY_STOP: - simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_transition_delay_stop, tvb, offset, plen, ENC_BIG_ENDIAN); - proto_item_append_text(simulcrypt_item, " ms"); + proto_tree_add_item(tree, hf_simulcrypt_transition_delay_stop, tvb, offset, plen, ENC_BIG_ENDIAN); break; case SIMULCRYPT_ECMG_AC_DELAY_START: - simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_ac_delay_start, tvb, offset, plen, ENC_BIG_ENDIAN); - proto_item_append_text(simulcrypt_item, " ms"); + proto_tree_add_item(tree, hf_simulcrypt_ac_delay_start, tvb, offset, plen, ENC_BIG_ENDIAN); break; case SIMULCRYPT_ECMG_AC_DELAY_STOP: - simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_ac_delay_stop, tvb, offset, plen, ENC_BIG_ENDIAN); - proto_item_append_text(simulcrypt_item, " ms"); + proto_tree_add_item(tree, hf_simulcrypt_ac_delay_stop, tvb, offset, plen, ENC_BIG_ENDIAN); break; case SIMULCRYPT_ECMG_ECM_REP_PERIOD: - simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_ecm_rep_period, tvb, offset, plen, ENC_BIG_ENDIAN); - proto_item_append_text(simulcrypt_item, " ms"); + proto_tree_add_item(tree, hf_simulcrypt_ecm_rep_period, tvb, offset, plen, ENC_BIG_ENDIAN); break; case SIMULCRYPT_ECMG_MAX_STREAMS: proto_tree_add_item(tree, hf_simulcrypt_max_streams, tvb, offset, plen, ENC_BIG_ENDIAN); @@ -848,8 +841,7 @@ dissect_ecmg_parameter_value (proto_tree *tree, tvbuff_t *tvb, packet_info *pinf proto_tree_add_item(tree, hf_simulcrypt_cw_per_msg, tvb, offset, plen, ENC_BIG_ENDIAN); break; case SIMULCRYPT_ECMG_MAX_COMP_TIME: - simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_max_comp_time, tvb, offset, plen, ENC_BIG_ENDIAN); - proto_item_append_text(simulcrypt_item, " ms"); + proto_tree_add_item(tree, hf_simulcrypt_max_comp_time, tvb, offset, plen, ENC_BIG_ENDIAN); break; case SIMULCRYPT_ECMG_ACCESS_CRITERIA: proto_tree_add_item(tree, hf_simulcrypt_access_criteria, tvb, offset, plen, ENC_NA); @@ -919,8 +911,6 @@ static void dissect_emmg_parameter_value (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, guint32 offset, guint16 plen, guint16 ptype, gchar *pvalue_char) { - proto_item *simulcrypt_item; - switch (ptype) { case SIMULCRYPT_EMMG_CLIENT_ID: proto_tree_add_item(tree, hf_simulcrypt_client_id, tvb, offset, plen, ENC_BIG_ENDIAN); @@ -938,8 +928,7 @@ dissect_emmg_parameter_value (proto_tree *tree, tvbuff_t *tvb, packet_info *pinf proto_tree_add_item(tree, hf_simulcrypt_datagram, tvb, offset, plen, ENC_NA); break; case SIMULCRYPT_EMMG_BANDWIDTH: - simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_bandwidth, tvb, offset, plen, ENC_BIG_ENDIAN); - proto_item_append_text(simulcrypt_item, " kbit/s"); + proto_tree_add_item(tree, hf_simulcrypt_bandwidth, tvb, offset, plen, ENC_BIG_ENDIAN); break; case SIMULCRYPT_EMMG_DATA_TYPE: proto_tree_add_item(tree, hf_simulcrypt_data_type, tvb, offset, plen, ENC_BIG_ENDIAN); @@ -1183,16 +1172,13 @@ dissect_psig_parameter_value (proto_tree *tree, tvbuff_t *tvb, packet_info *pinf proto_tree_add_item(tree, hf_simulcrypt_datagram, tvb, offset, plen, ENC_NA); break; case SIMULCRYPT_PSIG_BANDWIDTH: - simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_bandwidth, tvb, offset, plen, ENC_BIG_ENDIAN); - proto_item_append_text(simulcrypt_item, " kbit/s"); + proto_tree_add_item(tree, hf_simulcrypt_bandwidth, tvb, offset, plen, ENC_BIG_ENDIAN); break; case SIMULCRYPT_PSIG_INITIAL_BANDWIDTH: - simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_initial_bandwidth, tvb, offset, plen, ENC_BIG_ENDIAN); - proto_item_append_text(simulcrypt_item, " kbit/s"); + proto_tree_add_item(tree, hf_simulcrypt_initial_bandwidth, tvb, offset, plen, ENC_BIG_ENDIAN); break; case SIMULCRYPT_PSIG_MAX_COMP_TIME: - simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_max_comp_time, tvb, offset, plen, ENC_BIG_ENDIAN); - proto_item_append_text(simulcrypt_item, " ms"); + proto_tree_add_item(tree, hf_simulcrypt_max_comp_time, tvb, offset, plen, ENC_BIG_ENDIAN); break; case SIMULCRYPT_PSIG_ASI_INPUT_PACKET_ID: proto_tree_add_item(tree, hf_simulcrypt_asi_input_packet_id, tvb, offset, plen, ENC_BIG_ENDIAN); @@ -1261,8 +1247,7 @@ dissect_simulcrypt_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset+=2; /* Message Length 2 Bytes */ - simulcrypt_item = proto_tree_add_item(simulcrypt_header_tree, hf_simulcrypt_message_length, tvb, offset, 2, ENC_BIG_ENDIAN); - proto_item_append_text(simulcrypt_item, " (bytes)"); + proto_tree_add_item(simulcrypt_header_tree, hf_simulcrypt_message_length, tvb, offset, 2, ENC_BIG_ENDIAN); msg_length = tvb_get_ntohs(tvb, offset); /* read 2 byte message length value */ offset+=2; @@ -1363,8 +1348,7 @@ dissect_simulcrypt_data(proto_tree *simulcrypt_tree, proto_item *simulcrypt_item proto_tree_add_item(simulcrypt_parameter_tree, hf_simulcrypt_parameter_type, tvb, offset, 2, ENC_BIG_ENDIAN); break; } - simulcrypt_item = proto_tree_add_item(simulcrypt_parameter_tree, hf_simulcrypt_parameter_length, tvb, offset+2, 2, ENC_BIG_ENDIAN); /* length item */ - proto_item_append_text(simulcrypt_item, " (bytes)"); + proto_tree_add_item(simulcrypt_parameter_tree, hf_simulcrypt_parameter_length, tvb, offset+2, 2, ENC_BIG_ENDIAN); /* length item */ offset += 2+2; /* offset --> parameter value */ switch (iftype) { @@ -1460,7 +1444,7 @@ proto_register_simulcrypt (void) NULL, HFILL }}, { &hf_simulcrypt_message_length, - { "Message Length", "simulcrypt.message.len", FT_UINT16, BASE_DEC, NULL, 0x0, /* length 2 bytes, print as decimal value */ + { "Message Length", "simulcrypt.message.len", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, /* length 2 bytes, print as decimal value */ NULL, HFILL }}, { &hf_simulcrypt_message, @@ -1484,7 +1468,7 @@ proto_register_simulcrypt (void) NULL, HFILL }}, { &hf_simulcrypt_parameter_length, - { "Parameter Length", "simulcrypt.parameter.len", FT_UINT16, BASE_DEC, NULL, 0x0, /* length 2 bytes, print as decimal value */ + { "Parameter Length", "simulcrypt.parameter.len", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, /* length 2 bytes, print as decimal value */ NULL, HFILL }}, { &hf_simulcrypt_ca_system_id, @@ -1508,31 +1492,31 @@ proto_register_simulcrypt (void) NULL, HFILL }}, { &hf_simulcrypt_delay_start, - { "Delay start", "simulcrypt.delay_start", FT_INT16, BASE_DEC, NULL, 0x0, + { "Delay start", "simulcrypt.delay_start", FT_INT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, { &hf_simulcrypt_delay_stop, - { "Delay stop", "simulcrypt.delay_stop", FT_INT16, BASE_DEC, NULL, 0x0, + { "Delay stop", "simulcrypt.delay_stop", FT_INT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, { &hf_simulcrypt_ac_delay_start, - { "AC delay start", "simulcrypt.ac_delay_start", FT_INT16, BASE_DEC, NULL, 0x0, + { "AC delay start", "simulcrypt.ac_delay_start", FT_INT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, { &hf_simulcrypt_ac_delay_stop, - { "AC delay stop", "simulcrypt.ac_delay_stop", FT_INT16, BASE_DEC, NULL, 0x0, + { "AC delay stop", "simulcrypt.ac_delay_stop", FT_INT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, { &hf_simulcrypt_transition_delay_start, - { "Transition delay start", "simulcrypt.transition_delay_start", FT_INT16, BASE_DEC, NULL, 0x0, + { "Transition delay start", "simulcrypt.transition_delay_start", FT_INT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, { &hf_simulcrypt_transition_delay_stop, - { "Transition delay stop", "simulcrypt.transition_delay_stop", FT_INT16, BASE_DEC, NULL, 0x0, + { "Transition delay stop", "simulcrypt.transition_delay_stop", FT_INT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, { &hf_simulcrypt_ecm_rep_period, - { "ECM repetition period", "simulcrypt.ecm_rep_period", FT_UINT16, BASE_DEC, NULL, 0x0, + { "ECM repetition period", "simulcrypt.ecm_rep_period", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, { &hf_simulcrypt_max_streams, @@ -1552,7 +1536,7 @@ proto_register_simulcrypt (void) NULL, HFILL }}, { &hf_simulcrypt_max_comp_time, - { "Max comp time", "simulcrypt.max_comp_time", FT_UINT16, BASE_DEC, NULL, 0x0, + { "Max comp time", "simulcrypt.max_comp_time", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, { &hf_simulcrypt_access_criteria, @@ -1612,7 +1596,7 @@ proto_register_simulcrypt (void) NULL, HFILL }}, { &hf_simulcrypt_bandwidth, - { "Bandwidth", "simulcrypt.bandwidth", FT_UINT16, BASE_DEC, NULL, 0x0, + { "Bandwidth", "simulcrypt.bandwidth", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_kbps, 0x0, NULL, HFILL }}, { &hf_simulcrypt_data_type, @@ -1792,7 +1776,7 @@ proto_register_simulcrypt (void) NULL, HFILL }}, { &hf_simulcrypt_initial_bandwidth, - { "Initial bandwidth", "simulcrypt.parameter.initial_bandwidth", FT_UINT16, BASE_DEC, NULL, 0x0, + { "Initial bandwidth", "simulcrypt.parameter.initial_bandwidth", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_kbps, 0x0, NULL, HFILL }}, { &hf_simulcrypt_asi_input_packet_id, diff --git a/epan/dissectors/packet-spice.c b/epan/dissectors/packet-spice.c index 7aaf66065f..ba87f8ed55 100644 --- a/epan/dissectors/packet-spice.c +++ b/epan/dissectors/packet-spice.c @@ -1226,7 +1226,6 @@ dissect_ImageZLIB_GLZ_stream(tvbuff_t *tvb, proto_tree *ZLIB_GLZ_tree, packet_in static guint32 dissect_ImageZLIB_GLZ(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset) { - proto_item *ti; proto_tree *ZLIB_GLZ_tree; guint32 ZLIB_GLZSize, ZLIB_uncompSize; @@ -1235,11 +1234,9 @@ dissect_ImageZLIB_GLZ(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint if (tree) { ZLIB_GLZ_tree = proto_tree_add_subtree(tree, tvb, offset, ZLIB_GLZSize + 8, ett_ZLIB_GLZ, NULL, "ZLIB over GLZ Image"); - ti = proto_tree_add_item(ZLIB_GLZ_tree, hf_zlib_uncompress_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_item_append_text(ti, " bytes"); + proto_tree_add_item(ZLIB_GLZ_tree, hf_zlib_uncompress_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - ti = proto_tree_add_item(ZLIB_GLZ_tree, hf_zlib_compress_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_item_append_text(ti, " bytes"); + proto_tree_add_item(ZLIB_GLZ_tree, hf_zlib_compress_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; dissect_ImageZLIB_GLZ_stream(tvb, ZLIB_GLZ_tree, pinfo, offset, ZLIB_GLZSize, ZLIB_uncompSize); } @@ -4211,12 +4208,12 @@ proto_register_spice(void) }, { &hf_zlib_uncompress_size, { "ZLIB stream uncompressed size", "spice.zlib_uncompress_size", - FT_UINT32, BASE_DEC, NULL, 0x0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL } }, { &hf_zlib_compress_size, { "ZLIB stream compressed size", "spice.zlib_compress_size", - FT_UINT32, BASE_DEC, NULL, 0x0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL } }, { &hf_rect_left, diff --git a/epan/dissectors/packet-sync.c b/epan/dissectors/packet-sync.c index 786bc6b24c..db16fd9e51 100644 --- a/epan/dissectors/packet-sync.c +++ b/epan/dissectors/packet-sync.c @@ -136,8 +136,7 @@ dissect_sync(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ /* Octet 2 - Time Stamp */ timestamp = tvb_get_ntohs(tvb, offset) * 10; - item = proto_tree_add_uint(sync_tree, hf_sync_timestamp, tvb, offset, 2, timestamp); - proto_item_append_text(item, " ms"); + proto_tree_add_uint(sync_tree, hf_sync_timestamp, tvb, offset, 2, timestamp); offset += 2; /* Octet 4 - Packet Number */ @@ -239,7 +238,7 @@ proto_register_sync(void) }, { &hf_sync_timestamp, { "Timestamp", "sync.timestamp", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, "Relative time value for the starting time of a synchronisation sequence within the synchronisation period.", HFILL } }, { &hf_sync_packet_nr, diff --git a/epan/dissectors/packet-usb-ccid.c b/epan/dissectors/packet-usb-ccid.c index 2352ac6cb7..596991de1b 100644 --- a/epan/dissectors/packet-usb-ccid.c +++ b/epan/dissectors/packet-usb-ccid.c @@ -345,13 +345,11 @@ dissect_usb_ccid_descriptor(tvbuff_t *tvb, packet_info *pinfo _U_, ENC_LITTLE_ENDIAN); offset += 4; - freq_item = proto_tree_add_item(desc_tree, hf_ccid_dwDefaultClock, tvb, + proto_tree_add_item(desc_tree, hf_ccid_dwDefaultClock, tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_item_append_text(freq_item, " kHz"); offset += 4; - freq_item = proto_tree_add_item(desc_tree, hf_ccid_dwMaximumClock, tvb, + proto_tree_add_item(desc_tree, hf_ccid_dwMaximumClock, tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_item_append_text(freq_item, " kHz"); offset += 4; num_clock_supp = tvb_get_guint8(tvb, offset); freq_item = proto_tree_add_item(desc_tree, hf_ccid_bNumClockSupported, tvb, @@ -693,10 +691,10 @@ proto_register_ccid(void) TFS(&tfs_supported_not_supported), 0x02, NULL, HFILL }}, {&hf_ccid_dwDefaultClock, { "default clock frequency", "usbccid.dwDefaultClock", - FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_khz, 0x0, NULL, HFILL }}, {&hf_ccid_dwMaximumClock, { "maximum clock frequency", "usbccid.dwMaximumClock", - FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_khz, 0x0, NULL, HFILL }}, {&hf_ccid_bNumClockSupported, { "number of supported clock frequencies", "usbccid.bNumClockSupported", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-usb-com.c b/epan/dissectors/packet-usb-com.c index dd03aa5ac6..f34bdefe2a 100644 --- a/epan/dissectors/packet-usb-com.c +++ b/epan/dissectors/packet-usb-com.c @@ -747,11 +747,9 @@ dissect_usb_com_interrupt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v offset += 2; proto_tree_add_item(subtree, hf_usb_com_interrupt_length, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - it = proto_tree_add_item(subtree, hf_usb_com_interrupt_dl_bitrate, tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_item_append_text(it, " b/s"); + proto_tree_add_item(subtree, hf_usb_com_interrupt_dl_bitrate, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - it = proto_tree_add_item(subtree, hf_usb_com_interrupt_ul_bitrate, tvb, offset, 4, ENC_LITTLE_ENDIAN); - proto_item_append_text(it, " b/s"); + proto_tree_add_item(subtree, hf_usb_com_interrupt_ul_bitrate, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; break; default: @@ -1048,11 +1046,11 @@ proto_register_usb_com(void) { "Length", "usbcom.interrupt.length", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_usb_com_interrupt_dl_bitrate, - { "DL Bitrate", "usbcom.interrupt.conn_speed_change.dl_bitrate", FT_UINT32, BASE_DEC, - NULL, 0, NULL, HFILL }}, + { "DL Bitrate", "usbcom.interrupt.conn_speed_change.dl_bitrate", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, + &units_bit_sec, 0, NULL, HFILL }}, { &hf_usb_com_interrupt_ul_bitrate, - { "UL Bitrate", "usbcom.interrupt.conn_speed_change.ul_bitrate", FT_UINT32, BASE_DEC, - NULL, 0, NULL, HFILL }}, + { "UL Bitrate", "usbcom.interrupt.conn_speed_change.ul_bitrate", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, + &units_bit_sec, 0, NULL, HFILL }}, { &hf_usb_com_interrupt_payload, { "Payload", "usbcom.interrupt.payload", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }} diff --git a/epan/dissectors/packet-xip-serval.c b/epan/dissectors/packet-xip-serval.c index b8f458dd6c..5a75939e1d 100644 --- a/epan/dissectors/packet-xip-serval.c +++ b/epan/dissectors/packet-xip-serval.c @@ -120,9 +120,8 @@ display_xip_serval_control_ext(tvbuff_t *tvb, proto_tree *xip_serval_tree, offset++; /* Add XIP Serval extension length. */ - ti = proto_tree_add_item(cext_tree, hf_xip_serval_ext_length, tvb, + proto_tree_add_item(cext_tree, hf_xip_serval_ext_length, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(ti, " bytes"); offset++; /* Create XIP Serval Control Extension flags tree. */ @@ -198,7 +197,6 @@ display_xip_serval(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Add XIP Serval header length. */ hl_ti = proto_tree_add_item(xip_serval_tree, hf_xip_serval_hl, tvb, XSRVL_LEN, 1, ENC_BIG_ENDIAN); - proto_item_append_text(hl_ti, " bytes"); if (tvb_captured_length(tvb) < xsh_len) expert_add_info_format(pinfo, hl_ti, &ei_xip_serval_bad_len, "Header Length field (%d bytes) cannot be greater than actual number of bytes left in packet (%d bytes)", @@ -284,7 +282,7 @@ proto_register_xip_serval(void) { &hf_xip_serval_hl, { "Header Length", "xip_serval.hl", FT_UINT8, - BASE_DEC, NULL, 0x0, NULL, HFILL }}, + BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL }}, { &hf_xip_serval_proto, { "Protocol", "xip_serval.proto", FT_UINT8, @@ -306,7 +304,7 @@ proto_register_xip_serval(void) { &hf_xip_serval_ext_length, { "Extension Length", "xip_serval.ext_length", FT_UINT8, - BASE_DEC, NULL, 0x0, NULL, HFILL }}, + BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL }}, /* Serval Control Extension Header. */ diff --git a/epan/unit_strings.c b/epan/unit_strings.c index 4614eb2ce5..a927a0fb07 100644 --- a/epan/unit_strings.c +++ b/epan/unit_strings.c @@ -53,10 +53,12 @@ const unit_name_string units_byte_bytes = { " byte", " bytes" }; 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" }; +const unit_name_string units_meter_meters = { " meter", " meters" }; const unit_name_string units_second_seconds = { " second", " seconds" }; const unit_name_string units_seconds = { "s", NULL }; const unit_name_string units_millisecond_milliseconds = { " millisecond", " milliseconds" }; const unit_name_string units_milliseconds = { "ms", NULL }; +const unit_name_string units_microsecond_microseconds = { " microsecond", " microseconds" }; const unit_name_string units_microseconds = { UTF8_MICRO_SIGN "s", NULL }; const unit_name_string units_nanosecond_nanoseconds = { " nanosecond", " nanoseconds" }; const unit_name_string units_nanometers = { "nm", NULL }; @@ -64,13 +66,19 @@ const unit_name_string units_degree_degrees = { " degree", " degrees" }; const unit_name_string units_decibals = { "dB", NULL }; const unit_name_string units_dbm = { "dBm", NULL }; const unit_name_string units_percent = { "%", NULL }; +const unit_name_string units_khz = { "kHz", NULL }; const unit_name_string units_mhz = { "MHz", NULL }; const unit_name_string units_ghz = { "GHz", NULL }; const unit_name_string units_hz = { "Hz", NULL }; const unit_name_string units_hz_s = { "Hz/s", NULL }; const unit_name_string units_kbit = { "kbit", NULL }; const unit_name_string units_kbps = { "Kbps", NULL }; +const unit_name_string units_kibps = { "KiB/s", NULL }; +const unit_name_string units_kmh = { "km/h", NULL }; const unit_name_string units_bit_sec = { "bits/s", NULL }; +const unit_name_string units_uW = { "uW", NULL }; +const unit_name_string units_m_per_s = { "m/s", NULL }; +const unit_name_string units_m_per_s_per_s = { " (m/s)/s", NULL }; const unit_name_string units_segment_remaining = { " segment remaining", " segments remaining" }; diff --git a/epan/unit_strings.h b/epan/unit_strings.h index 5c4997ff71..cbe94f8076 100644 --- a/epan/unit_strings.h +++ b/epan/unit_strings.h @@ -52,10 +52,12 @@ WS_DLL_PUBLIC const unit_name_string units_byte_bytes; 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; +WS_DLL_PUBLIC const unit_name_string units_meter_meters; WS_DLL_PUBLIC const unit_name_string units_second_seconds; // full unit name "second[s?]" WS_DLL_PUBLIC const unit_name_string units_seconds; //only seconds abbreviation "s" WS_DLL_PUBLIC const unit_name_string units_millisecond_milliseconds; // full unit name "millisecond[s?]" WS_DLL_PUBLIC const unit_name_string units_milliseconds; //only seconds abbreviation "ms" +WS_DLL_PUBLIC const unit_name_string units_microsecond_microseconds; // full unit name "microsecond[s?]" WS_DLL_PUBLIC const unit_name_string units_microseconds; //only seconds abbreviation "us" WS_DLL_PUBLIC const unit_name_string units_nanosecond_nanoseconds; // full unit name "nanosecond[s?]" WS_DLL_PUBLIC const unit_name_string units_nanometers; @@ -63,12 +65,18 @@ WS_DLL_PUBLIC const unit_name_string units_degree_degrees; WS_DLL_PUBLIC const unit_name_string units_decibals; WS_DLL_PUBLIC const unit_name_string units_dbm; WS_DLL_PUBLIC const unit_name_string units_percent; +WS_DLL_PUBLIC const unit_name_string units_khz; WS_DLL_PUBLIC const unit_name_string units_ghz; WS_DLL_PUBLIC const unit_name_string units_mhz; WS_DLL_PUBLIC const unit_name_string units_hz; WS_DLL_PUBLIC const unit_name_string units_hz_s; WS_DLL_PUBLIC const unit_name_string units_kbit; WS_DLL_PUBLIC const unit_name_string units_kbps; +WS_DLL_PUBLIC const unit_name_string units_kibps; +WS_DLL_PUBLIC const unit_name_string units_kmh; +WS_DLL_PUBLIC const unit_name_string units_uW; +WS_DLL_PUBLIC const unit_name_string units_m_per_s; +WS_DLL_PUBLIC const unit_name_string units_m_per_s_per_s; WS_DLL_PUBLIC const unit_name_string units_bit_sec; WS_DLL_PUBLIC const unit_name_string units_segment_remaining; diff --git a/plugins/wimax/msg_dcd.c b/plugins/wimax/msg_dcd.c index 75742f7032..e0e6fcb6c9 100644 --- a/plugins/wimax/msg_dcd.c +++ b/plugins/wimax/msg_dcd.c @@ -35,6 +35,7 @@ #include <epan/packet.h> #include "wimax_tlv.h" #include "wimax_mac.h" +#include "wimax_utils.h" /* Delete the following variable as soon as possible */ extern gboolean include_cor2_changes; @@ -419,8 +420,7 @@ static int dissect_mac_mgmt_msg_dcd_decoder(tvbuff_t *tvb, packet_info *pinfo, p { case DCD_BURST_FREQUENCY: { - tlv_item = add_tlv_subtree(&tlv_info, tlv_tree, hf_dcd_burst_freq, tvb, (offset+tlv_offset), ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " kHz"); + add_tlv_subtree(&tlv_info, tlv_tree, hf_dcd_burst_freq, tvb, (offset+tlv_offset), ENC_BIG_ENDIAN); break; } case DCD_BURST_FEC_CODE_TYPE: @@ -453,8 +453,7 @@ static int dissect_mac_mgmt_msg_dcd_decoder(tvbuff_t *tvb, packet_info *pinfo, p } case DCD_BS_EIRP: { - tlv_item = add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_bs_eirp, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " dBm"); + add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_bs_eirp, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } case DCD_FRAME_DURATION: @@ -479,28 +478,24 @@ static int dissect_mac_mgmt_msg_dcd_decoder(tvbuff_t *tvb, packet_info *pinfo, p } case DCD_TTG: { - tlv_item = add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_ttg, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " PS"); + add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_ttg, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } case DCD_RTG: { - tlv_item = add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_rtg, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " PS"); + add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_rtg, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } #ifdef WIMAX_16D_2004 case DCD_RSS: { - tlv_item = add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_rss, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " dBm"); + add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_rss, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } #else case DCD_EIRXP: { - tlv_item = add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_eirxp, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " dBm"); + add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_eirxp, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } #endif @@ -511,8 +506,7 @@ static int dissect_mac_mgmt_msg_dcd_decoder(tvbuff_t *tvb, packet_info *pinfo, p } case DCD_FREQUENCY: { - tlv_item = add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_frequency, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " kHz"); + add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_frequency, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } case DCD_BS_ID: @@ -539,8 +533,7 @@ static int dissect_mac_mgmt_msg_dcd_decoder(tvbuff_t *tvb, packet_info *pinfo, p #endif case DCD_H_ARQ_ACK_DELAY: { - tlv_item = add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_h_arq_ack_delay, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " frame offset"); + add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_h_arq_ack_delay, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } case DCD_MAC_VERSION: @@ -601,24 +594,20 @@ static int dissect_mac_mgmt_msg_dcd_decoder(tvbuff_t *tvb, packet_info *pinfo, p } case DCD_TLV_T_31_H_ADD_THRESHOLD: { - tlv_item = add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_31_h_add_threshold, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " dB"); + add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_31_h_add_threshold, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } case DCD_TLV_T_32_H_DELETE_THRESHOLD: { - tlv_item = add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_32_h_delete_threshold, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " dB"); + add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_32_h_delete_threshold, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } case DCD_TLV_T_33_ASR: { tlv_item = add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_33_asr, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); tlv_tree = proto_item_add_subtree(tlv_item, ett_mac_mgmt_msg_dcd_decoder); - tlv_item = proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_33_asr_m, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " frames"); - tlv_item = proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_33_asr_l, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " frames"); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_33_asr_m, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_33_asr_l, tvb, offset, 1, ENC_BIG_ENDIAN); break; } case DCD_TLV_T_35_PAGING_GROUP_ID: @@ -638,14 +627,12 @@ static int dissect_mac_mgmt_msg_dcd_decoder(tvbuff_t *tvb, packet_info *pinfo, p } case DCD_TLV_T_51_HYSTERSIS_MARGIN: { - tlv_item = add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_51_hysteresis_margin, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " dB"); + add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_51_hysteresis_margin, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } case DCD_TLV_T_52_TIME_TO_TRIGGER_DURATION: { - tlv_item = add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_52_time_to_trigger_duration, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " ms"); + add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_52_time_to_trigger_duration, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } case DCD_TLV_T_54_TRIGGER: @@ -744,21 +731,21 @@ void proto_register_mac_mgmt_msg_dcd(void) &hf_dcd_tlv_t_33_asr_l, { "ASR Switching Period (L)", "wmx.dcd.asr.l", - FT_UINT8, BASE_DEC, NULL, 0x0f, NULL, HFILL + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_frame_frames, 0x0f, NULL, HFILL } }, { &hf_dcd_tlv_t_33_asr_m, { "ASR Slot Length (M)", "wmx.dcd.asr.m", - FT_UINT8, BASE_DEC, NULL, 0xf0, NULL, HFILL + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_frame_frames, 0xf0, NULL, HFILL } }, { &hf_dcd_bs_eirp, { "BS EIRP", "wmx.dcd.bs_eirp", - FT_INT16, BASE_DEC, NULL, 0x00, NULL, HFILL + FT_INT16, BASE_DEC|BASE_UNIT_STRING, &wimax_units_dbm, 0x00, NULL, HFILL } }, { @@ -809,7 +796,7 @@ void proto_register_mac_mgmt_msg_dcd(void) &hf_dcd_burst_freq, { "Frequency", "wmx.dcd.burst.freq", - FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_khz, 0x00, NULL, HFILL } }, #if 0 @@ -952,7 +939,7 @@ void proto_register_mac_mgmt_msg_dcd(void) &hf_dcd_eirxp, { "EIRXP (IR, max)", "wmx.dcd.eirxp", - FT_INT16, BASE_DEC, NULL, 0x00, NULL, HFILL + FT_INT16, BASE_DEC|BASE_UNIT_STRING, &wimax_units_dbm, 0x00, NULL, HFILL } }, #endif @@ -981,14 +968,14 @@ void proto_register_mac_mgmt_msg_dcd(void) &hf_dcd_frequency, { "Downlink Center Frequency", "wmx.dcd.frequency", - FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &wimax_units_khz, 0x00, NULL, HFILL } }, { &hf_dcd_tlv_t_31_h_add_threshold, { "H_add Threshold", "wmx.dcd.h_add_threshold", - FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_db, 0x0, NULL, HFILL } }, #ifdef WIMAX_16D_2004 @@ -996,7 +983,7 @@ void proto_register_mac_mgmt_msg_dcd(void) &hf_dcd_h_arq_ack_delay, { "H-ARQ ACK Delay for DL Burst", "wmx.dcd.h_arq_ack_delay_dl_burst", - FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_frame_offset, 0x00, "", HFILL } }, #else @@ -1004,7 +991,7 @@ void proto_register_mac_mgmt_msg_dcd(void) &hf_dcd_h_arq_ack_delay, { "H-ARQ ACK Delay for UL Burst", "wmx.dcd.h_arq_ack_delay_ul_burst", - FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_frame_offset, 0x00, NULL, HFILL } }, #endif @@ -1012,7 +999,7 @@ void proto_register_mac_mgmt_msg_dcd(void) &hf_dcd_tlv_t_32_h_delete_threshold, { "H_delete Threshold", "wmx.dcd.h_delete_threshold", - FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_db, 0x0, NULL, HFILL } }, { @@ -1054,7 +1041,7 @@ void proto_register_mac_mgmt_msg_dcd(void) &hf_dcd_tlv_t_51_hysteresis_margin, { "Hysteresis Margin", "wmx.dcd.hysteresis_margin", - FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_db, 0x0, NULL, HFILL } }, { @@ -1146,7 +1133,7 @@ void proto_register_mac_mgmt_msg_dcd(void) &hf_dcd_rss, { "RSS (IR, max)", "wmx.dcd.rss", - FT_INT16, BASE_DEC, NULL, 0x00, "", HFILL + FT_INT16, BASE_DEC|BASE_UNIT_STRING, &wimax_units_dbm, 0x00, "", HFILL } }, #endif @@ -1154,7 +1141,7 @@ void proto_register_mac_mgmt_msg_dcd(void) &hf_dcd_rtg, { "RTG", "wmx.dcd.rtg", - FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL + FT_UINT8, BASE_HEX|BASE_UNIT_STRING, &wimax_units_ps, 0x00, NULL, HFILL } }, #ifdef WIMAX_16D_2004 @@ -1177,7 +1164,7 @@ void proto_register_mac_mgmt_msg_dcd(void) &hf_dcd_tlv_t_52_time_to_trigger_duration, { "Time to Trigger Duration", "wmx.dcd.time_trigger_duration", - FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_ms, 0x0, NULL, HFILL } }, { @@ -1198,7 +1185,7 @@ void proto_register_mac_mgmt_msg_dcd(void) &hf_dcd_ttg, { "TTG", "wmx.dcd.ttg", - FT_UINT16, BASE_HEX, NULL, 0x00, NULL, HFILL + FT_UINT16, BASE_HEX|BASE_UNIT_STRING, &wimax_units_ps, 0x00, NULL, HFILL } }, { diff --git a/plugins/wimax/msg_rng_rsp.c b/plugins/wimax/msg_rng_rsp.c index 8842061f2d..35ed143e2b 100644 --- a/plugins/wimax/msg_rng_rsp.c +++ b/plugins/wimax/msg_rng_rsp.c @@ -335,16 +335,14 @@ static int dissect_mac_mgmt_msg_rng_rsp_decoder(tvbuff_t *tvb, packet_info *pinf break; } case RNG_RSP_OFFSET_FREQ_ADJUST: { - tlv_item = add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_offset_freq_adjust, tvb, offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " Hz"); + add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_offset_freq_adjust, tvb, offset, ENC_BIG_ENDIAN); break; } case RNG_RSP_RANGING_STATUS: ranging_status_item = add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_ranging_status, tvb, offset, ENC_BIG_ENDIAN); break; case RNG_RSP_DL_FREQ_OVERRIDE: { - dl_freq_override_item = add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_dl_freq_override, tvb, offset, ENC_BIG_ENDIAN); - proto_item_append_text(dl_freq_override_item, " kHz"); + add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_dl_freq_override, tvb, offset, ENC_BIG_ENDIAN); break; } case RNG_RSP_UL_CHANNEL_ID_OVERRIDE: @@ -577,7 +575,7 @@ void proto_register_mac_mgmt_msg_rng_rsp(void) &hf_rng_rsp_dl_freq_override, { "Downlink Frequency Override", "wmx.rng_rsp.dl_freq_override", - FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &wimax_units_hz, 0x00, NULL, HFILL } }, { @@ -768,7 +766,7 @@ void proto_register_mac_mgmt_msg_rng_rsp(void) &hf_rng_rsp_offset_freq_adjust, { "Offset Frequency Adjust", "wmx.rng_rsp.offset_freq_adjust", - FT_INT32, BASE_DEC, NULL, 0x00, NULL, HFILL + FT_INT32, BASE_DEC|BASE_UNIT_STRING, &wimax_units_hz, 0x00, NULL, HFILL } }, { diff --git a/plugins/wimax/msg_ucd.c b/plugins/wimax/msg_ucd.c index 27e86e37ce..985450e90e 100644 --- a/plugins/wimax/msg_ucd.c +++ b/plugins/wimax/msg_ucd.c @@ -35,6 +35,7 @@ #include <epan/packet.h> #include "wimax_tlv.h" #include "wimax_mac.h" +#include "wimax_utils.h" void proto_register_mac_mgmt_msg_ucd(void); void proto_reg_handoff_mac_mgmt_msg_ucd(void); @@ -68,7 +69,7 @@ static gint hf_ucd_tlv_t_159_band_amc_allocation_threshold = -1; static gint hf_ucd_tlv_t_158_optional_permutation_ul_allocated_subchannels_bitmap = -1; static gint hf_ucd_tlv_t_160_band_amc_release_threshold = -1; static gint hf_ucd_tlv_t_161_band_amc_allocation_timer = -1; -/* static gint hf_ucd_tlv_t_162_band_amc_release_timer = -1; */ +static gint hf_ucd_tlv_t_162_band_amc_release_timer = -1; static gint hf_ucd_tlv_t_163_band_status_report_max_period = -1; static gint hf_ucd_tlv_t_164_band_amc_retry_timer = -1; static gint hf_ucd_tlv_t_171_harq_ack_delay_dl_burst = -1; @@ -369,17 +370,13 @@ static int dissect_mac_mgmt_msg_ucd_decoder(tvbuff_t *tvb, packet_info *pinfo, p } case UCD_BURST_RANGING_DATA_RATIO: { - proto_item *tlv_item2; - tlv_item2 = add_tlv_subtree(&tlv_info, tlv_tree, hf_ucd_burst_ranging_data_ratio, tvb, (offset+tlv_offset), ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item2, " dB"); + add_tlv_subtree(&tlv_info, tlv_tree, hf_ucd_burst_ranging_data_ratio, tvb, (offset+tlv_offset), ENC_BIG_ENDIAN); break; } #if 0 /* for OFDM */ case UCD_BURST_POWER_BOOST: { - proto_item *tlv_item2; - tlv_item2 = add_tlv_subtree(&tlv_info, tlv_tree, hf_ucd_burst_power_boost, tvb, (offset+tlv_offset), ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item2, " dB"); + add_tlv_subtree(&tlv_info, tlv_tree, hf_ucd_burst_power_boost, tvb, (offset+tlv_offset), ENC_BIG_ENDIAN); break; } case UCD_BURST_TCS_ENABLE: @@ -403,20 +400,17 @@ static int dissect_mac_mgmt_msg_ucd_decoder(tvbuff_t *tvb, packet_info *pinfo, p } case UCD_BW_REQ_SIZE: { - tlv_item1 = add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_bw_req_size, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item1, " PS"); + add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_bw_req_size, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } case UCD_RANGING_REQ_SIZE: { - tlv_item1 = add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_ranging_req_size, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item1, " PS"); + add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_ranging_req_size, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } case UCD_FREQUENCY: { - tlv_item1 = add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_freq, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item1, " kHz"); + add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_freq, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } case UCD_TLV_T_7_HO_RANGING_START: @@ -440,56 +434,47 @@ static int dissect_mac_mgmt_msg_ucd_decoder(tvbuff_t *tvb, packet_info *pinfo, p } case UCD_TLV_T_159_BAND_AMC_ALLOCATION_THRESHHOLD: { - tlv_item1 = add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_tlv_t_159_band_amc_allocation_threshold, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item1, " dB"); + add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_tlv_t_159_band_amc_allocation_threshold, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } case UCD_TLV_T_160_BAND_AMC_RELEASE_THRESHOLD: { - tlv_item1 = add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_tlv_t_160_band_amc_release_threshold, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item1, " dB"); + add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_tlv_t_160_band_amc_release_threshold, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } case UCD_TLV_T_161_BAND_AMC_ALLOCATION_TIMER: { - tlv_item1 = add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_tlv_t_161_band_amc_allocation_timer, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item1, " frames"); + add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_tlv_t_161_band_amc_allocation_timer, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } case UCD_TLV_T_162_BAND_AMC_RELEASE_TIMER: { - tlv_item1 = add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_tlv_t_161_band_amc_allocation_timer, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item1, " frames"); + add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_tlv_t_162_band_amc_release_timer, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } case UCD_TLV_T_163_BAND_STATUS_REPORT_MAX_PERIOD: { - tlv_item1 = add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_tlv_t_163_band_status_report_max_period, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item1, " frames"); + add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_tlv_t_163_band_status_report_max_period, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } case UCD_TLV_T_164_BAND_AMC_RETRY_TIMER: { - tlv_item1 = add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_tlv_t_164_band_amc_retry_timer, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item1, " frames"); + add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_tlv_t_164_band_amc_retry_timer, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } case UCD_TLV_T_170_SAFETY_CHANNEL_RETRY_TIMER: { - tlv_item1 = add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_tlv_t_170_safety_channel_retry_timer, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item1, " frames"); + add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_tlv_t_170_safety_channel_retry_timer, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } case UCD_TLV_T_171_HARQ_ACK_DELAY_FOR_DL_BURST: { - tlv_item1 = add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_tlv_t_171_harq_ack_delay_dl_burst, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item1, " frames offset"); + add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_tlv_t_171_harq_ack_delay_dl_burst, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } case UCD_TLV_T_172_CQICH_BAND_AMC_TRANSITION_DELAY: { - tlv_item1 = add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_tlv_t_172_cqich_band_amc_transition_delay, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item1, " frames"); + add_tlv_subtree(&tlv_info, ucd_tree, hf_ucd_tlv_t_172_cqich_band_amc_transition_delay, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; } case UCD_TLV_T_174_MAXIMUM_RETRANSMISSION: @@ -707,44 +692,42 @@ void proto_register_mac_mgmt_msg_ucd(void) &hf_ucd_tlv_t_159_band_amc_allocation_threshold, { "Band AMC Allocation Threshold", "wmx.ucd.band_amc.allocation_threshold", - FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL + FT_UINT8, BASE_HEX|BASE_UNIT_STRING, &wimax_units_db, 0, NULL, HFILL } }, { &hf_ucd_tlv_t_161_band_amc_allocation_timer, { "Band AMC Allocation Timer", "wmx.ucd.band_amc.allocation_timer", - FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL + FT_UINT8, BASE_HEX|BASE_UNIT_STRING, &wimax_units_frame_frames, 0, NULL, HFILL } }, { &hf_ucd_tlv_t_160_band_amc_release_threshold, { "Band AMC Release Threshold", "wmx.ucd.band_amc.release_threshold", - FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL + FT_UINT8, BASE_HEX|BASE_UNIT_STRING, &wimax_units_db, 0, NULL, HFILL } }, -#if 0 { &hf_ucd_tlv_t_162_band_amc_release_timer, { "Band AMC Release Timer", "wmx.ucd.band_amc.release_timer", - FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL + FT_UINT8, BASE_HEX|BASE_UNIT_STRING, &wimax_units_frame_frames, 0, NULL, HFILL } }, -#endif { &hf_ucd_tlv_t_164_band_amc_retry_timer, { "Band AMC Retry Timer", "wmx.ucd.band_amc.retry_timer", - FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL + FT_UINT8, BASE_HEX|BASE_UNIT_STRING, &wimax_units_frame_frames, 0, NULL, HFILL } }, { &hf_ucd_tlv_t_163_band_status_report_max_period, { "Band Status Report MAC Period", "wmx.ucd.band_status.report_max_period", - FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_frame_frames, 0, NULL, HFILL } }, { @@ -765,7 +748,7 @@ void proto_register_mac_mgmt_msg_ucd(void) &hf_ucd_burst_ranging_data_ratio, { "Ranging Data Ratio", "wmx.ucd.burst.ranging_data_ratio", - FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_db, 0, NULL, HFILL } }, { @@ -785,32 +768,32 @@ void proto_register_mac_mgmt_msg_ucd(void) #if 0 { &hf_ucd_burst_power_boost, - {"Focused Contention Power Boost", "wmx.ucd.burst.power_boost", FT_UINT8, BASE_HEX, NULL, 0, "", HFILL} + {"Focused Contention Power Boost", "wmx.ucd.burst.power_boost", FT_UINT8, BASE_HEX|BASE_UNIT_STRING, &wimax_units_db, 0, NULL, HFILL} }, { &hf_ucd_burst_tcs_enable, - {"TCS", "wmx.ucd.burst.tcs", FT_UINT8, BASE_DEC, VALS(vals_dcd_burst_tcs), 0, "", HFILL} + {"TCS", "wmx.ucd.burst.tcs", FT_UINT8, BASE_DEC, VALS(vals_dcd_burst_tcs), 0, NULL, HFILL} }, #endif { &hf_ucd_bw_req_size, { "Bandwidth Request Opportunity Size", "wmx.ucd.bw_req_size", - FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &wimax_units_ps, 0, NULL, HFILL } }, { &hf_ucd_tlv_t_172_cqich_band_amc_transition_delay, { "CQICH Band AMC-Transition Delay", "wmx.ucd.cqich_band_amc_transition_delay", - FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_frame_frames, 0, NULL, HFILL } }, { &hf_ucd_freq, { "Frequency", "wmx.ucd.frequency", - FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &wimax_units_khz, 0, NULL, HFILL } }, { @@ -824,7 +807,7 @@ void proto_register_mac_mgmt_msg_ucd(void) &hf_ucd_tlv_t_171_harq_ack_delay_dl_burst, { "HARQ ACK Delay for DL Burst", "wmx.ucd.harq_ack_delay_dl_burst", - FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_frame_offset, 0, NULL, HFILL } }, { @@ -945,7 +928,7 @@ void proto_register_mac_mgmt_msg_ucd(void) &hf_ucd_ranging_req_size, { "Ranging Request Opportunity Size", "wmx.ucd.ranging_req_size", - FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &wimax_units_db, 0, NULL, HFILL } }, { @@ -959,7 +942,7 @@ void proto_register_mac_mgmt_msg_ucd(void) &hf_ucd_tlv_t_170_safety_channel_retry_timer, { "Safety Channel Release Timer", "wmx.ucd.safety_channel_release_timer", - FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL + FT_UINT8, BASE_HEX|BASE_UNIT_STRING, &wimax_units_frame_frames, 0, NULL, HFILL } }, { diff --git a/plugins/wimax/wimax_utils.c b/plugins/wimax/wimax_utils.c index 83a86fe0d0..fbe77040f9 100644 --- a/plugins/wimax/wimax_utils.c +++ b/plugins/wimax/wimax_utils.c @@ -64,6 +64,18 @@ static gint ett_dl_service_flow_decoder = -1; static dissector_handle_t eap_handle = NULL; +const unit_name_string wimax_units_byte_bytes = { " byte", " bytes" }; +const unit_name_string wimax_units_bit_sec = { "bits/s", NULL }; +const unit_name_string wimax_units_db = { "dB", NULL }; +const unit_name_string wimax_units_dbm = { "dBm", NULL }; +const unit_name_string wimax_units_frame_frames = { " frame", " frames" }; +const unit_name_string wimax_units_frame_offset = { " frame offset", NULL }; +const unit_name_string wimax_units_hz = { "Hz", NULL }; +const unit_name_string wimax_units_khz = { "kHz", NULL }; +const unit_name_string wimax_units_ms = { "ms", NULL }; +const unit_name_string wimax_units_ps = { "PS", NULL }; + + /* The following two variables save the Scheduling Service type for the Grant Management subheader dissector and track whether or not one has been seen. @@ -739,15 +751,15 @@ void proto_register_wimax_utility_decoders(void) }, { /* 7 Maximum Sustained Traffic Rate */ &hf_sfe_max_str, - {"Maximum Sustained Traffic Rate", "wmx.sfe.msr", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL} + {"Maximum Sustained Traffic Rate", "wmx.sfe.msr", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &wimax_units_bit_sec, 0x0, NULL, HFILL} }, { /* 8 Maximum Traffic Burst */ &hf_sfe_max_traffic_burst, - {"Maximum Traffic Burst", "wmx.sfe.max_traffic_burst", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL} + {"Maximum Traffic Burst", "wmx.sfe.max_traffic_burst", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &wimax_units_byte_bytes, 0x0, NULL, HFILL} }, { /* 9 Minimum Reserved Traffic Rate */ &hf_sfe_min_rtr, - {"Minimum Reserved Traffic Rate", "wmx.sfe.mrr", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL} + {"Minimum Reserved Traffic Rate", "wmx.sfe.mrr", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &wimax_units_bit_sec, 0x0, NULL, HFILL} }, { /* 10 Reserved */ @@ -802,11 +814,11 @@ void proto_register_wimax_utility_decoders(void) }, { /* 13 Tolerated Jitter */ &hf_sfe_jitter, - {"Tolerated Jitter", "wmx.sfe.jitter", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL} + {"Tolerated Jitter", "wmx.sfe.jitter", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &wimax_units_ms, 0x0, NULL, HFILL} }, { /* 14 Maximum Latency */ &hf_sfe_max_latency, - {"Maximum Latency", "wmx.sfe.max_latency", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL} + {"Maximum Latency", "wmx.sfe.max_latency", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &wimax_units_ms, 0x0, NULL, HFILL} }, { /* 15 Fixed/Variable Length SDU */ &hf_sfe_fixed_len_sdu, @@ -814,7 +826,7 @@ void proto_register_wimax_utility_decoders(void) }, { /* 16 SDU Size */ &hf_sfe_sdu_size, - {"SDU Size", "wmx.sfe.sdu_size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL} + {"SDU Size", "wmx.sfe.sdu_size", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_byte_bytes, 0x0, NULL, HFILL} }, { /* 17 SAID Onto Which SF Is Mapped */ &hf_sfe_target_said, @@ -899,7 +911,7 @@ void proto_register_wimax_utility_decoders(void) }, { /* 31 Time Base */ &hf_sfe_time_base, - {"Time Base", "wmx.sfe.time_base", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL} + {"Time Base", "wmx.sfe.time_base", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &wimax_units_ms, 0x0, NULL, HFILL} }, { /* 32 Paging Preference */ &hf_sfe_paging_preference, @@ -943,11 +955,11 @@ void proto_register_wimax_utility_decoders(void) }, { /* 40 Unsolicited Grant Interval */ &hf_sfe_unsolicited_grant_interval, - {"Unsolicited Grant Interval", "wmx.sfe.unsolicited_grant_interval", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL} + {"Unsolicited Grant Interval", "wmx.sfe.unsolicited_grant_interval", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &wimax_units_ms, 0x0, NULL, HFILL} }, { /* 41 Unsolicited Polling Interval */ &hf_sfe_unsolicited_polling_interval, - {"Unsolicited Polling Interval", "wmx.sfe.unsolicited_polling_interval", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL} + {"Unsolicited Polling Interval", "wmx.sfe.unsolicited_polling_interval", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &wimax_units_ms, 0x0, NULL, HFILL} }, { /* 42 PDU SN extended subheader for HARQ reordering */ &hf_sfe_pdu_sn_ext_subheader_reorder, @@ -2214,16 +2226,13 @@ void wimax_service_flow_encodings_decoder(tvbuff_t *tvb, packet_info *pinfo, pro proto_item_append_text(tlv_item, " (allowed values are 0-7)"); break; case SFE_MAX_STR: - tlv_item = add_tlv_subtree(&tlv_info, tree, hf_sfe_max_str, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " bps"); + add_tlv_subtree(&tlv_info, tree, hf_sfe_max_str, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; case SFE_MAX_TRAFFIC_BURST: - tlv_item = add_tlv_subtree(&tlv_info, tree, hf_sfe_max_traffic_burst, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " bytes"); + add_tlv_subtree(&tlv_info, tree, hf_sfe_max_traffic_burst, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; case SFE_MIN_RTR: - tlv_item = add_tlv_subtree(&tlv_info, tree, hf_sfe_min_rtr, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " bps"); + add_tlv_subtree(&tlv_info, tree, hf_sfe_min_rtr, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; case SFE_RESERVED_10: add_tlv_subtree(&tlv_info, tree, hf_sfe_reserved_10, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); @@ -2248,12 +2257,10 @@ void wimax_service_flow_encodings_decoder(tvbuff_t *tvb, packet_info *pinfo, pro proto_tree_add_item(tlv_tree, hf_sfe_policy_rsvd1, tvb, offset, 1, ENC_BIG_ENDIAN); break; case SFE_TOLERATED_JITTER: - tlv_item = add_tlv_subtree(&tlv_info, tree, hf_sfe_jitter, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " ms"); + add_tlv_subtree(&tlv_info, tree, hf_sfe_jitter, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; case SFE_MAX_LATENCY: - tlv_item = add_tlv_subtree(&tlv_info, tree, hf_sfe_max_latency, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " ms"); + add_tlv_subtree(&tlv_info, tree, hf_sfe_max_latency, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; case SFE_FIXED_LEN_SDU: add_tlv_subtree(&tlv_info, tree, hf_sfe_fixed_len_sdu, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); @@ -2261,8 +2268,7 @@ void wimax_service_flow_encodings_decoder(tvbuff_t *tvb, packet_info *pinfo, pro case SFE_SDU_SIZE: /* save the SDU size */ mac_sdu_length = tvb_get_guint8(tvb, offset); - tlv_item = add_tlv_subtree(&tlv_info, tree, hf_sfe_sdu_size, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " bytes"); + add_tlv_subtree(&tlv_info, tree, hf_sfe_sdu_size, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; case SFE_TARGET_SAID: add_tlv_subtree(&tlv_info, tree, hf_sfe_target_said, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); @@ -2349,8 +2355,7 @@ void wimax_service_flow_encodings_decoder(tvbuff_t *tvb, packet_info *pinfo, pro add_tlv_subtree(&tlv_info, tree, hf_sfe_sdu_inter_arrival_interval, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; case SFE_TIME_BASE: - tlv_item = add_tlv_subtree(&tlv_info, tree, hf_sfe_time_base, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " ms"); + add_tlv_subtree(&tlv_info, tree, hf_sfe_time_base, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; case SFE_PAGING_PREFERENCE: add_tlv_subtree(&tlv_info, tree, hf_sfe_paging_preference, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); @@ -2382,12 +2387,10 @@ void wimax_service_flow_encodings_decoder(tvbuff_t *tvb, packet_info *pinfo, pro proto_tree_add_item(tlv_tree, hf_sfe_cid_alloc_for_active_bs_cid, tvb, (offset+i), 2, ENC_BIG_ENDIAN); break; case SFE_UNSOLICITED_GRANT_INTERVAL: - tlv_item = add_tlv_subtree(&tlv_info, tree, hf_sfe_unsolicited_grant_interval, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " ms"); + add_tlv_subtree(&tlv_info, tree, hf_sfe_unsolicited_grant_interval, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; case SFE_UNSOLOCITED_POLLING_INTERVAL: - tlv_item = add_tlv_subtree(&tlv_info, tree, hf_sfe_unsolicited_polling_interval, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); - proto_item_append_text(tlv_item, " ms"); + add_tlv_subtree(&tlv_info, tree, hf_sfe_unsolicited_polling_interval, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); break; case SFE_PDU_SN_EXT_SUBHEADER_HARQ_REORDER: add_tlv_subtree(&tlv_info, tree, hf_sfe_pdu_sn_ext_subheader_reorder, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); diff --git a/plugins/wimax/wimax_utils.h b/plugins/wimax/wimax_utils.h index cf9e61c29e..32bb7b0921 100644 --- a/plugins/wimax/wimax_utils.h +++ b/plugins/wimax/wimax_utils.h @@ -55,4 +55,16 @@ extern void wimax_security_capabilities_decoder(tvbuff_t *tvb, packet_info *pinf extern void wimax_vendor_specific_information_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); extern guint wimax_common_tlv_encoding_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +//Windows can't handle plugins using globals from epan, so copies are necessary +extern const unit_name_string wimax_units_byte_bytes; +extern const unit_name_string wimax_units_bit_sec; +extern const unit_name_string wimax_units_db; +extern const unit_name_string wimax_units_dbm; +extern const unit_name_string wimax_units_frame_frames; +extern const unit_name_string wimax_units_frame_offset; +extern const unit_name_string wimax_units_hz; +extern const unit_name_string wimax_units_khz; +extern const unit_name_string wimax_units_ms; +extern const unit_name_string wimax_units_ps; + #endif /* WIMAX_UTILS_H */ |