diff options
author | Michael Mann <mmann78@netscape.net> | 2014-09-06 18:04:28 -0400 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2014-09-08 15:46:05 +0000 |
commit | cf8f11f67876462510cc4254b845063c6cc047de (patch) | |
tree | c9fc47b3795bbb7bbb88c22a7c4014978342bd69 /epan | |
parent | 433a444d148f86f2562f804d25a57d00dc277cc0 (diff) |
Eliminate proto_tree_add_text from some of the dissectors.
Other minor cleanups while in the area.
Change-Id: I623d941e53128f169e55dfc629547b4221fa72fc
Reviewed-on: https://code.wireshark.org/review/4021
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-t30.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-tftp.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-time.c | 13 | ||||
-rw-r--r-- | epan/dissectors/packet-tn3270.c | 87 | ||||
-rw-r--r-- | epan/dissectors/packet-tn5250.c | 73 | ||||
-rw-r--r-- | epan/dissectors/packet-tpkt.c | 21 | ||||
-rw-r--r-- | epan/dissectors/packet-tpncp.c | 27 | ||||
-rw-r--r-- | epan/dissectors/packet-tr.c | 27 | ||||
-rw-r--r-- | epan/dissectors/packet-ua.c | 16 | ||||
-rw-r--r-- | epan/dissectors/packet-udld.c | 91 | ||||
-rw-r--r-- | epan/dissectors/packet-umts_fp.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-usb-ccid.c | 16 | ||||
-rw-r--r-- | epan/dissectors/packet-usb-hid.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-vicp.c | 5 | ||||
-rw-r--r-- | epan/dissectors/packet-vines.c | 17 | ||||
-rw-r--r-- | epan/dissectors/packet-vnc.c | 41 | ||||
-rw-r--r-- | epan/dissectors/packet-vp8.c | 20 | ||||
-rw-r--r-- | epan/dissectors/packet-vtp.c | 19 |
18 files changed, 282 insertions, 215 deletions
diff --git a/epan/dissectors/packet-t30.c b/epan/dissectors/packet-t30.c index 0169ee6ade..ea4a057e49 100644 --- a/epan/dissectors/packet-t30.c +++ b/epan/dissectors/packet-t30.c @@ -523,8 +523,8 @@ dissect_t30_numbers(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot g_snprintf(t38->desc, MAX_T38_DESC, "Num: %s", str_num); } else { - proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset), - "[MALFORMED OR SHORT PACKET: number of digits must be 20]"); + proto_tree_add_expert_format(tree, pinfo, &ei_t30_bad_length, tvb, offset, -1, + "MALFORMED OR SHORT PACKET: number of digits must be 20"); col_append_str(pinfo->cinfo, COL_INFO, " [MALFORMED OR SHORT PACKET: number of digits must be 20]" ); } diff --git a/epan/dissectors/packet-tftp.c b/epan/dissectors/packet-tftp.c index 18da7b148c..2fd1b869cb 100644 --- a/epan/dissectors/packet-tftp.c +++ b/epan/dissectors/packet-tftp.c @@ -80,6 +80,7 @@ static int hf_tftp_error_code = -1; static int hf_tftp_error_string = -1; static int hf_tftp_option_name = -1; static int hf_tftp_option_value = -1; +static int hf_tftp_data = -1; static gint ett_tftp = -1; static gint ett_tftp_option = -1; @@ -433,8 +434,7 @@ static void dissect_tftp_message(tftp_conv_info_t *tftp_info, break; default: - proto_tree_add_text(tftp_tree, tvb, offset, -1, - "Data (%d bytes)", tvb_reported_length_remaining(tvb, offset)); + proto_tree_add_item(tftp_tree, hf_tftp_data, tvb, offset, -1, ENC_NA); break; } @@ -599,6 +599,10 @@ proto_register_tftp(void) FT_STRINGZ, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_tftp_data, + { "Data", "tftp.data", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, }; static gint *ett[] = { &ett_tftp, diff --git a/epan/dissectors/packet-time.c b/epan/dissectors/packet-time.c index a8e7afcfb8..23fee5fba8 100644 --- a/epan/dissectors/packet-time.c +++ b/epan/dissectors/packet-time.c @@ -39,8 +39,11 @@ static const enum_val_t time_display_types[] = { { NULL, NULL, 0 } }; +static const true_false_string tfs_response_request = { "Response", "Request" }; + static int proto_time = -1; static int hf_time_time = -1; +static int hf_time_response = -1; static gint ett_time = -1; /* Instead of using absolute_time_display_e as the type for @@ -68,8 +71,7 @@ dissect_time(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ti = proto_tree_add_item(tree, proto_time, tvb, 0, -1, ENC_NA); time_tree = proto_item_add_subtree(ti, ett_time); - proto_tree_add_text(time_tree, tvb, 0, 0, - pinfo->srcport==pinfo->match_uint ? "Type: Response":"Type: Request"); + proto_tree_add_boolean(time_tree, hf_time_response, tvb, 0, 0, pinfo->srcport==pinfo->match_uint); if (pinfo->srcport == pinfo->match_uint) { /* seconds since 1900-01-01 00:00:00 GMT, *not* 1970 */ guint32 delta_seconds = tvb_get_ntohl(tvb, 0); @@ -87,8 +89,13 @@ proto_register_time(void) { &hf_time_time, { "Time", "time.time", FT_UINT32, BASE_DEC, NULL, 0x0, - "Seconds since 00:00 (midnight) 1 January 1900 GMT", HFILL }} + "Seconds since 00:00 (midnight) 1 January 1900 GMT", HFILL }}, + { &hf_time_response, + { "Type", "time.response", + FT_BOOLEAN, BASE_NONE, TFS(&tfs_response_request), 0x0, + "Response or Request", HFILL }} }; + static gint *ett[] = { &ett_time, }; diff --git a/epan/dissectors/packet-tn3270.c b/epan/dissectors/packet-tn3270.c index e6d8464267..fa113871b5 100644 --- a/epan/dissectors/packet-tn3270.c +++ b/epan/dissectors/packet-tn3270.c @@ -54,6 +54,7 @@ #include <epan/wmem/wmem.h> #include <epan/conversation.h> #include <epan/strutil.h> +#include <epan/expert.h> #include "packet-tn3270.h" @@ -1625,7 +1626,11 @@ static gint ett_tn3270_msr_state_mask = -1; static gint ett_tn3270_data_chain_fields = -1; static gint ett_tn3270_query_list = -1; -static gint dissect_orders_and_data(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info); +static expert_field ei_tn3270_order_code = EI_INIT; +static expert_field ei_tn3270_command_code = EI_INIT; +static expert_field ei_tn3270_aid = EI_INIT; + +static gint dissect_orders_and_data(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info); static gint dissect_buffer_address(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint hf, tn3270_conv_info_t *tn3270_info); typedef struct hf_items { @@ -2055,7 +2060,7 @@ dissect_outbound_text_header(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset /* 5.16 Outbound 3270DS */ static gint -dissect_outbound_3270ds(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, +dissect_outbound_3270ds(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info, gint sf_body_length ) { gint start = offset; @@ -2101,7 +2106,7 @@ dissect_outbound_3270ds(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, if ((offset - start) < sf_body_length) offset += dissect_wcc(tn3270_tree, tvb, offset); if ((offset - start) < sf_body_length) - offset += dissect_orders_and_data(tn3270_tree, tvb, offset, tn3270_info); + offset += dissect_orders_and_data(tn3270_tree, pinfo, tvb, offset, tn3270_info); break; default: break; @@ -4381,7 +4386,7 @@ process_inbound_structured_field(proto_tree *sf_tree, tvbuff_t *tvb, gint offset /* sf_body_length is the total length of the structured field including the sf_len and sf_id fields */ /* call only with valid sf_id */ static gint -process_outbound_structured_field(proto_tree *sf_tree, tvbuff_t *tvb, gint offset, +process_outbound_structured_field(proto_tree *sf_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info, guint sf_id, gint sf_body_length) { gint start = offset; /* start of structured field param(s) */ @@ -4425,7 +4430,7 @@ process_outbound_structured_field(proto_tree *sf_tree, tvbuff_t *tvb, gint offse offset += dissect_load_programmed_symbols(sf_tree, tvb, offset, sf_body_length); break; case SF_OB_OUTBOUND_3270DS: - offset += dissect_outbound_3270ds(sf_tree, tvb, offset, tn3270_info, sf_body_length); + offset += dissect_outbound_3270ds(sf_tree, pinfo, tvb, offset, tn3270_info, sf_body_length); break; case SF_OB_PRESENT_ABSOLUTE_FORMAT: offset += dissect_present_absolute_format(sf_tree, tvb, offset, sf_body_length); @@ -4666,7 +4671,7 @@ display_sf_hdr(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, } static gint -dissect_structured_fields(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, +dissect_structured_fields(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info, gboolean direction_inbound) { proto_tree *sf_tree; @@ -4715,7 +4720,7 @@ dissect_structured_fields(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, offset += process_inbound_structured_field(sf_tree, tvb, offset, tn3270_info, sf_id, sf_length-2-sf_id_len); } else { - offset += process_outbound_structured_field(sf_tree, tvb, offset, tn3270_info, sf_id, sf_length-2-sf_id_len); + offset += process_outbound_structured_field(sf_tree, pinfo, tvb, offset, tn3270_info, sf_id, sf_length-2-sf_id_len); } continue; } @@ -4960,10 +4965,11 @@ dissect_field_attribute_pairs(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offse } static gint -dissect_orders_and_data(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info) +dissect_orders_and_data(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info) { gint start = offset; gint order_code; + proto_item* item; /* Order Code */ @@ -4971,7 +4977,7 @@ dissect_orders_and_data(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, tn3 while (tvb_reported_length_remaining(tvb, offset) > 0) { order_code = tvb_get_guint8(tvb, offset); if ((order_code > 0) && (order_code <= OC_MAX)) { /* XXX: also 0xFF ?? */ - proto_tree_add_item(tn3270_tree, + item = proto_tree_add_item(tn3270_tree, hf_tn3270_order_code, tvb, offset, 1, @@ -5008,7 +5014,7 @@ dissect_orders_and_data(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, tn3 case OC_IC: break; default: - proto_tree_add_text(tn3270_tree, tvb, offset, 1, "Bogus value: %u", order_code); + expert_add_info(pinfo, item, &ei_tn3270_order_code); break; } /* switch */ } @@ -5089,10 +5095,11 @@ dissect_tn3270e_header(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset) /* Detect and Handle Direction of Stream */ static gint -dissect_outbound_stream(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info) +dissect_outbound_stream(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info) { gint command_code; gint start = offset; + proto_item* item; /* Command Code*/ command_code = tvb_get_guint8(tvb, offset); @@ -5117,6 +5124,13 @@ dissect_outbound_stream(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, tn3 break; } + item = proto_tree_add_item(tn3270_tree, + hf_tn3270_command_code, + tvb, offset, + 1, + ENC_BIG_ENDIAN); + offset += 1; + switch (command_code) { case CC_LCL_W: case CC_LCL_EW: @@ -5126,25 +5140,13 @@ dissect_outbound_stream(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, tn3 case CC_RMT_EW: case CC_RMT_EWA: case CC_RMT_EAU: - proto_tree_add_item(tn3270_tree, - hf_tn3270_command_code, - tvb, offset, - 1, - ENC_BIG_ENDIAN); - offset += 1; /* WCC */ offset += dissect_wcc(tn3270_tree, tvb, offset); - offset += dissect_orders_and_data(tn3270_tree, tvb, offset, tn3270_info); + offset += dissect_orders_and_data(tn3270_tree, pinfo, tvb, offset, tn3270_info); break; case CC_LCL_WSF: case CC_RMT_WSF: - proto_tree_add_item(tn3270_tree, - hf_tn3270_command_code, - tvb, offset, - 1, - ENC_BIG_ENDIAN); - offset += 1; - offset += dissect_structured_fields(tn3270_tree, tvb, offset, tn3270_info, FALSE); + offset += dissect_structured_fields(tn3270_tree, pinfo, tvb, offset, tn3270_info, FALSE); break; case CC_LCL_RB: case CC_LCL_RM: @@ -5152,17 +5154,9 @@ dissect_outbound_stream(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, tn3 case CC_RMT_RB: case CC_RMT_RM: case CC_RMT_RMA: - proto_tree_add_item(tn3270_tree, - hf_tn3270_command_code, - tvb, offset, - 1, - ENC_BIG_ENDIAN); - offset += 1; break; default: - /* XXX: Add expert item ? */ - proto_tree_add_text(tn3270_tree, tvb, offset, 1, "Bogus value: %u", command_code); - offset += 1; + expert_add_info(pinfo, item, &ei_tn3270_command_code); break; } @@ -5173,14 +5167,15 @@ dissect_outbound_stream(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, tn3 /* INBOUND DATA STREAM (DISPLAY -> MAINFRAME PROGRAM) */ /* Dissect tvb as inbound */ static gint -dissect_inbound_stream(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info) +dissect_inbound_stream(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info) { gint start = offset; gint aid; + proto_item* item; /* Command Code*/ aid = tvb_get_guint8(tvb, offset); - proto_tree_add_item(tn3270_tree, + item = proto_tree_add_item(tn3270_tree, hf_tn3270_aid, tvb, offset, 1, @@ -5188,7 +5183,7 @@ dissect_inbound_stream(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, tn32 offset += 1; switch (aid) { case AID_STRUCTURED_FIELD: - offset += dissect_structured_fields(tn3270_tree, tvb, offset, tn3270_info, TRUE); + offset += dissect_structured_fields(tn3270_tree, pinfo, tvb, offset, tn3270_info, TRUE); break; case AID_PA1_KEY: case AID_PA2_KEY_CNCL: @@ -5234,10 +5229,10 @@ dissect_inbound_stream(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, tn32 case AID_OPERATOR_ID_READER: case AID_MAG_READER_NUMBER: offset += dissect_buffer_address(tn3270_tree, tvb, offset, hf_tn3270_cursor_address, tn3270_info); - offset += dissect_orders_and_data(tn3270_tree, tvb, offset, tn3270_info); + offset += dissect_orders_and_data(tn3270_tree, pinfo, tvb, offset, tn3270_info); break; default: - proto_tree_add_text(tn3270_tree, tvb, offset, 1, "Bogus value: %u", aid); + expert_add_info(pinfo, item, &ei_tn3270_aid); offset += 1; break; } @@ -5292,10 +5287,10 @@ dissect_tn3270(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(tree) { while (tvb_reported_length_remaining(tvb, offset) > 0) { if (pinfo->srcport == tn3270_info->outbound_port) { - offset += dissect_outbound_stream(tn3270_tree, tvb, offset, tn3270_info); + offset += dissect_outbound_stream(tn3270_tree, pinfo, tvb, offset, tn3270_info); } else { - offset += dissect_inbound_stream(tn3270_tree, tvb, offset, tn3270_info); + offset += dissect_inbound_stream(tn3270_tree, pinfo, tvb, offset, tn3270_info); } } } @@ -7670,10 +7665,20 @@ proto_register_tn3270(void) &ett_tn3270_query_list }; + static ei_register_info ei[] = { + { &ei_tn3270_order_code, { "tn3270.order_code.bogus", PI_PROTOCOL, PI_WARN, "Bogus value", EXPFILL }}, + { &ei_tn3270_command_code, { "tn3270.command_code.bogus", PI_PROTOCOL, PI_WARN, "Bogus value", EXPFILL }}, + { &ei_tn3270_aid, { "tn3270.aid.bogus", PI_PROTOCOL, PI_WARN, "Bogus value", EXPFILL }}, + }; + + expert_module_t* expert_tn3270; + proto_tn3270 = proto_register_protocol("TN3270 Protocol", "TN3270", "tn3270"); register_dissector("tn3270", dissect_tn3270, proto_tn3270); proto_register_field_array(proto_tn3270, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_tn3270 = expert_register_protocol(proto_tn3270); + expert_register_field_array(expert_tn3270, ei, array_length(ei)); } diff --git a/epan/dissectors/packet-tn5250.c b/epan/dissectors/packet-tn5250.c index a9ec088482..14b3e01cd8 100644 --- a/epan/dissectors/packet-tn5250.c +++ b/epan/dissectors/packet-tn5250.c @@ -33,6 +33,7 @@ #include <glib.h> #include <epan/packet.h> +#include <epan/expert.h> #include <epan/address.h> #include <wmem/wmem.h> #include <epan/conversation.h> @@ -2898,6 +2899,8 @@ static gint ett_tn5250_qr_mask = -1; static gint ett_tn5250_wea_prim_attr = -1; static gint ett_cc = -1; +static expert_field ei_tn5250_command_code = EI_INIT; + static tn5250_conv_info_t *tn5250_info_items; static guint32 dissect_tn5250_orders_and_data(proto_tree *tn5250_tree, tvbuff_t *tvb, gint offset); @@ -4868,12 +4871,12 @@ dissect_tn5250_data_until_next_command(proto_tree *tn5250_tree, tvbuff_t *tvb, g #endif static guint32 -dissect_outbound_stream(proto_tree *tn5250_tree, tvbuff_t *tvb, gint offset) +dissect_outbound_stream(proto_tree *tn5250_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset) { gint command_code; gint start = offset, length = 0; proto_tree *cc_tree; - proto_item *ti; + proto_item *ti, *item; /*Escape*/ ti = proto_tree_add_item(tn5250_tree, hf_tn5250_escape_code, tvb, offset, 1, @@ -4883,32 +4886,24 @@ dissect_outbound_stream(proto_tree *tn5250_tree, tvbuff_t *tvb, gint offset) /* Command Code*/ command_code = tvb_get_guint8(tvb, offset); + item = proto_tree_add_item(cc_tree, hf_tn5250_command_code, tvb, offset, 1, + ENC_BIG_ENDIAN); + offset++; + switch (command_code) { case CLEAR_UNIT: case CLEAR_FORMAT_TABLE: - proto_tree_add_item(cc_tree, hf_tn5250_command_code, tvb, offset, 1, - ENC_BIG_ENDIAN); - offset++; break; case CLEAR_UNIT_ALTERNATE: - proto_tree_add_item(cc_tree, hf_tn5250_command_code, tvb, offset, 1, - ENC_BIG_ENDIAN); - offset++; proto_tree_add_item(cc_tree, hf_tn5250_cua_parm, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; break; case WRITE_TO_DISPLAY: - proto_tree_add_item(cc_tree, hf_tn5250_command_code, tvb, offset, 1, - ENC_BIG_ENDIAN); - offset++; /* WCC */ offset += dissect_wcc(cc_tree, tvb, offset); offset += dissect_tn5250_orders_and_data(cc_tree, tvb, offset); break; case WRITE_ERROR_CODE: - proto_tree_add_item(cc_tree, hf_tn5250_command_code, - tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; /* Check for the optional TN5250_IC */ offset += dissect_tn5250_orders_and_data(cc_tree, tvb, offset); /* Add Field Data */ @@ -4922,17 +4917,11 @@ dissect_outbound_stream(proto_tree *tn5250_tree, tvbuff_t *tvb, gint offset) offset++; break; case RESTORE_SCREEN: - proto_tree_add_item(cc_tree, hf_tn5250_command_code, tvb, offset, 1, - ENC_BIG_ENDIAN); - offset++; while (tvb_reported_length_remaining(tvb, offset) > 0) { - offset += dissect_outbound_stream(cc_tree, tvb, offset); + offset += dissect_outbound_stream(cc_tree, pinfo, tvb, offset); } break; case WRITE_ERROR_CODE_TO_WINDOW: - proto_tree_add_item(cc_tree, hf_tn5250_command_code, tvb, offset, 1, - ENC_BIG_ENDIAN); - offset++; proto_tree_add_item(cc_tree, hf_tn5250_wectw_start_column, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; @@ -4943,9 +4932,6 @@ dissect_outbound_stream(proto_tree *tn5250_tree, tvbuff_t *tvb, gint offset) case READ_INPUT_FIELDS: case READ_MDT_FIELDS: case READ_MDT_ALTERNATE: - proto_tree_add_item(cc_tree, hf_tn5250_command_code, tvb, offset, 1, - ENC_BIG_ENDIAN); - offset++; offset += dissect_wcc(cc_tree, tvb, offset); break; case READ_SCREEN: @@ -4957,20 +4943,11 @@ dissect_outbound_stream(proto_tree *tn5250_tree, tvbuff_t *tvb, gint offset) case READ_IMMEDIATE: case READ_MODIFIED_IMMEDIATE_ALTERNATE: case SAVE_SCREEN: - proto_tree_add_item(cc_tree, hf_tn5250_command_code, tvb, offset, 1, - ENC_BIG_ENDIAN); - offset++; break; case SAVE_PARTIAL_SCREEN: - proto_tree_add_item(cc_tree, hf_tn5250_command_code, tvb, offset, 1, - ENC_BIG_ENDIAN); - offset++; offset += dissect_save_partial_screen(cc_tree, tvb, offset); break; case RESTORE_PARTIAL_SCREEN: - proto_tree_add_item(cc_tree, hf_tn5250_command_code, tvb, offset, 1, - ENC_BIG_ENDIAN); - offset++; length = tvb_get_ntohs(tvb, offset); proto_tree_add_item(cc_tree, hf_tn5250_length_twobyte, tvb, offset, 2, ENC_BIG_ENDIAN); @@ -4981,34 +4958,22 @@ dissect_outbound_stream(proto_tree *tn5250_tree, tvbuff_t *tvb, gint offset) offset++; break; case ROLL: - proto_tree_add_item(cc_tree, hf_tn5250_command_code, tvb, offset, 1, - ENC_BIG_ENDIAN); - offset++; offset += dissect_roll(cc_tree, tvb, offset); break; case WRITE_SINGLE_STRUCTURED_FIELD: - proto_tree_add_item(cc_tree, hf_tn5250_command_code, tvb, offset, 1, - ENC_BIG_ENDIAN); - offset++; offset += dissect_write_single_structured_field(cc_tree, tvb, offset); break; case WRITE_STRUCTURED_FIELD: - proto_tree_add_item(cc_tree, hf_tn5250_command_code, tvb, offset, 1, - ENC_BIG_ENDIAN); - offset++; offset += dissect_write_structured_field(cc_tree, tvb, offset); break; case COPY_TO_PRINTER: - proto_tree_add_item(cc_tree, hf_tn5250_command_code, tvb, offset, 1, - ENC_BIG_ENDIAN); - offset++; proto_tree_add_item(cc_tree, hf_tn5250_ctp_lsid, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(cc_tree, hf_tn5250_ctp_mlpp, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; break; default: - proto_tree_add_text(cc_tree, tvb, offset, 1, "Bogus value: %u", command_code); + expert_add_info(pinfo, item, &ei_tn5250_command_code); offset ++; break; } @@ -5017,7 +4982,7 @@ dissect_outbound_stream(proto_tree *tn5250_tree, tvbuff_t *tvb, gint offset) } static guint32 -dissect_inbound_stream(proto_tree *tn5250_tree, tvbuff_t *tvb, gint offset, gint sna_flag) +dissect_inbound_stream(proto_tree *tn5250_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, gint sna_flag) { gint start = offset, aid; guint32 commands; @@ -5064,7 +5029,7 @@ dissect_inbound_stream(proto_tree *tn5250_tree, tvbuff_t *tvb, gint offset, gint /* FIXME: need to know when escape/commands are expected. */ /* Check the response data for commands */ if (tvb_get_guint8(tvb,offset) == TN5250_ESCAPE) { - commands = dissect_outbound_stream(tn5250_tree, tvb, offset); + commands = dissect_outbound_stream(tn5250_tree, pinfo, tvb, offset); /* It if contained commands then we're done. Anything else is unexpected data */ if (commands) { offset += commands; @@ -5129,9 +5094,9 @@ dissect_tn5250(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) while (tvb_reported_length_remaining(tvb, offset) > 0) { if (pinfo->srcport == tn5250_info->outbound_port) { - offset += dissect_outbound_stream(tn5250_tree, tvb, offset); + offset += dissect_outbound_stream(tn5250_tree, pinfo, tvb, offset); } else { - offset += dissect_inbound_stream(tn5250_tree, tvb, offset, sna_flag); + offset += dissect_inbound_stream(tn5250_tree, pinfo, tvb, offset, sna_flag); } } } @@ -7513,9 +7478,17 @@ proto_register_tn5250(void) &ett_cc, }; + static ei_register_info ei[] = { + { &ei_tn5250_command_code, { "tn5250.command_code.bogus", PI_PROTOCOL, PI_WARN, "Bogus value", EXPFILL }}, + }; + + expert_module_t* expert_tn5250; + proto_tn5250 = proto_register_protocol("TN5250 Protocol", "TN5250", "tn5250"); register_dissector("tn5250", dissect_tn5250, proto_tn5250); proto_register_field_array(proto_tn5250, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_tn5250 = expert_register_protocol(proto_tn5250); + expert_register_field_array(expert_tn5250, ei, array_length(ei)); } diff --git a/epan/dissectors/packet-tpkt.c b/epan/dissectors/packet-tpkt.c index a820aa81ad..13265a3e0a 100644 --- a/epan/dissectors/packet-tpkt.c +++ b/epan/dissectors/packet-tpkt.c @@ -48,6 +48,7 @@ static protocol_t *proto_tpkt_ptr; static int hf_tpkt_version = -1; static int hf_tpkt_reserved = -1; static int hf_tpkt_length = -1; +static int hf_tpkt_continuation_data = -1; /* TPKT fields defining a sub tree */ @@ -253,10 +254,8 @@ dissect_asciitpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, ti = proto_tree_add_item(tree, proto_tpkt, tvb, offset, -1, ENC_NA); tpkt_tree = proto_item_add_subtree(ti, ett_tpkt); - proto_item_set_text(ti, "TPKT"); - proto_tree_add_text(tpkt_tree, tvb, offset, -1, - "Continuation data"); + proto_tree_add_item(tpkt_tree, hf_tpkt_continuation_data, tvb, offset, -1, ENC_NA); } return; } @@ -408,10 +407,8 @@ dissect_tpkt_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, ti = proto_tree_add_item(tree, proto_tpkt, tvb, offset, -1, ENC_NA); tpkt_tree = proto_item_add_subtree(ti, ett_tpkt); - proto_item_set_text(ti, "TPKT"); - proto_tree_add_text(tpkt_tree, tvb, offset, -1, - "Continuation data"); + proto_tree_add_item(tpkt_tree, hf_tpkt_continuation_data, tvb, offset, -1, ENC_NA); } return; } @@ -637,6 +634,18 @@ proto_register_tpkt(void) "Length of data unit, including this header", HFILL } }, + { + &hf_tpkt_continuation_data, + { + "Continuation data", + "tpkt.continuation_data", + FT_BYTES, + BASE_NONE, + NULL, + 0x0, + NULL, HFILL + } + }, }; static gint *ett[] = diff --git a/epan/dissectors/packet-tpncp.c b/epan/dissectors/packet-tpncp.c index f75cbf6a50..b9a93072be 100644 --- a/epan/dissectors/packet-tpncp.c +++ b/epan/dissectors/packet-tpncp.c @@ -135,9 +135,8 @@ static hf_register_info *hf = NULL; /*-------------------------------------------------------------------------------------------------------------------------------------------*/ -static void dissect_tpncp_data(gint data_id, tvbuff_t *tvb, proto_item *item, +static void dissect_tpncp_data(gint data_id, tvbuff_t *tvb, proto_tree *ltree, gint *offset, tpncp_data_field_info *data_fields_info) { - proto_tree *ltree = NULL; proto_item *pi = NULL; gint32 g_int; gint16 g_short; @@ -147,7 +146,6 @@ static void dissect_tpncp_data(gint data_id, tvbuff_t *tvb, proto_item *item, gint g_str_len, counter, bitshift, bitmask; tpncp_data_field_info *current_tpncp_data_field_info = NULL; - ltree = proto_item_add_subtree(item, ett_tpncp_body); current_tpncp_data_field_info = &data_fields_info[data_id]; while (current_tpncp_data_field_info) { @@ -229,11 +227,11 @@ static void dissect_tpncp_data(gint data_id, tvbuff_t *tvb, proto_item *item, /*-------------------------------------------------------------------------------------------------------------------------------------------*/ static void dissect_tpncp_event(gint event_id, tvbuff_t *tvb, - proto_item *item, gint *offset) { + proto_tree *tree, gint *offset) { switch (event_id) { /* Place non-standard events here. */ default: - dissect_tpncp_data(event_id, tvb, item, offset, tpncp_events_info_db); + dissect_tpncp_data(event_id, tvb, tree, offset, tpncp_events_info_db); break; } } @@ -241,11 +239,11 @@ static void dissect_tpncp_event(gint event_id, tvbuff_t *tvb, /*-------------------------------------------------------------------------------------------------------------------------------------------*/ static void dissect_tpncp_command(gint command_id, tvbuff_t *tvb, - proto_item *item, gint *offset) { + proto_tree *tree, gint *offset) { switch (command_id) { /* Place non-standard commands here. */ default: - dissect_tpncp_data(command_id, tvb, item, offset, tpncp_commands_info_db); + dissect_tpncp_data(command_id, tvb, tree, offset, tpncp_commands_info_db); break; } } @@ -253,12 +251,11 @@ static void dissect_tpncp_command(gint command_id, tvbuff_t *tvb, /*-------------------------------------------------------------------------------------------------------------------------------------------*/ static int dissect_tpncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - proto_item *item = NULL, *tpncp_item = NULL; - proto_tree *tpncp_tree = NULL; + proto_item *item = NULL; + proto_tree *tpncp_tree = NULL, *event_tree, *command_tree; gint offset = 0; guint32 id, cid = 0; guint16 seq_number, len, ver, reserved; - gchar *tpncp_header; ver = tvb_get_ntohs(tvb, 0); len = tvb_get_ntohs(tvb, 2); @@ -298,10 +295,9 @@ static int dissect_tpncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo proto_tree_add_int(tpncp_tree, hf_tpncp_cid, tvb, 12, 4, cid); offset += 16; if (tpncp_events_info_db[id].tpncp_data_field_size) { - tpncp_header = wmem_strdup_printf(wmem_packet_scope(), "TPNCP Event: %s (%d)", + event_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_tpncp_body, NULL, "TPNCP Event: %s (%d)", val_to_str_const(id, tpncp_events_id_vals, "Unknown"), id); - tpncp_item = proto_tree_add_text(tree, tvb, offset, -1, "%s", tpncp_header); - dissect_tpncp_event(id, tvb, tpncp_item, &offset); + dissect_tpncp_event(id, tvb, event_tree, &offset); } } } @@ -310,10 +306,9 @@ static int dissect_tpncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo proto_tree_add_uint(tpncp_tree, hf_tpncp_command_id, tvb, 8, 4, id); offset += 12; if (tpncp_commands_info_db[id].tpncp_data_field_size) { - tpncp_header = wmem_strdup_printf(wmem_packet_scope(), "TPNCP Command: %s (%d)", + command_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_tpncp_body, NULL, "TPNCP Command: %s (%d)", val_to_str_const(id, tpncp_commands_id_vals, "Unknown"), id); - tpncp_item = proto_tree_add_text(tree, tvb, offset, -1, "%s", tpncp_header); - dissect_tpncp_command(id, tvb, tpncp_item, &offset); + dissect_tpncp_command(id, tvb, command_tree, &offset); } } } diff --git a/epan/dissectors/packet-tr.c b/epan/dissectors/packet-tr.c index 5a491af82c..38b358cfe2 100644 --- a/epan/dissectors/packet-tr.c +++ b/epan/dissectors/packet-tr.c @@ -26,6 +26,7 @@ #include <string.h> #include <glib.h> #include <epan/packet.h> +#include <epan/expert.h> #include <epan/exceptions.h> #include <epan/conversation_table.h> #include <wsutil/pint.h> @@ -59,11 +60,15 @@ static int hf_tr_direction = -1; static int hf_tr_rif = -1; static int hf_tr_rif_ring = -1; static int hf_tr_rif_bridge = -1; +static int hf_tr_extra_rif = -1; static gint ett_token_ring = -1; static gint ett_token_ring_ac = -1; static gint ett_token_ring_fc = -1; +static expert_field ei_token_empty_rif = EI_INIT; +static expert_field ei_token_fake_llc_snap_header = EI_INIT; + static int tr_tap = -1; /* @@ -609,12 +614,10 @@ dissect_tr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tcpdump. W/o that, however, I'm guessing that DSAP == SSAP if the frame type is LLC. It's very much a hack. */ if (actual_rif_bytes > trn_rif_bytes) { - proto_tree_add_text(tr_tree, tr_tvb, TR_MIN_HEADER_LEN + trn_rif_bytes, actual_rif_bytes - trn_rif_bytes, - "Empty RIF from Linux 2.0.x driver. The sniffing NIC " - "is also running a protocol stack."); + proto_tree_add_expert(tr_tree, pinfo, &ei_token_empty_rif, tr_tvb, TR_MIN_HEADER_LEN + trn_rif_bytes, actual_rif_bytes - trn_rif_bytes); } if (fixoffset) { - proto_tree_add_text(tr_tree, tr_tvb, TR_MIN_HEADER_LEN + 18,8,"Linux 2.0.x fake LLC and SNAP header"); + proto_tree_add_expert(tr_tree, pinfo, &ei_token_fake_llc_snap_header, tr_tvb, TR_MIN_HEADER_LEN + 18, 8); } } @@ -681,8 +684,7 @@ add_ring_bridge_pairs(int rcf_len, tvbuff_t *tvb, proto_tree *tree) proto_tree_add_string(tree, hf_tr_rif, tvb, TR_MIN_HEADER_LEN + 2, rcf_len, wmem_strbuf_get_str(buf)); if (unprocessed_rif > 0) { - proto_tree_add_text(tree, tvb, TR_MIN_HEADER_LEN + RIF_BYTES_TO_PROCESS, unprocessed_rif, - "Extra RIF bytes beyond spec: %d", unprocessed_rif); + proto_tree_add_item(tree, hf_tr_extra_rif, tvb, TR_MIN_HEADER_LEN + RIF_BYTES_TO_PROCESS, unprocessed_rif, ENC_NA); } } @@ -766,17 +768,30 @@ proto_register_tr(void) { &hf_tr_rif_bridge, { "RIF Bridge", "tr.rif.bridge", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + + { &hf_tr_extra_rif, + { "Extra RIF bytes beyond spec", "tr.rif.extra", FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, }; + static gint *ett[] = { &ett_token_ring, &ett_token_ring_ac, &ett_token_ring_fc, }; + static ei_register_info ei[] = { + { &ei_token_empty_rif, { "tr.empty_rif", PI_PROTOCOL, PI_NOTE, "Empty RIF from Linux 2.0.x driver. The sniffing NIC is also running a protocol stack.", EXPFILL }}, + { &ei_token_fake_llc_snap_header, { "tr.fake_llc_snap_header", PI_PROTOCOL, PI_NOTE, "Linux 2.0.x fake LLC and SNAP header", EXPFILL }}, + }; + module_t *tr_module; + expert_module_t* expert_tr; proto_tr = proto_register_protocol("Token-Ring", "Token-Ring", "tr"); proto_register_field_array(proto_tr, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_tr = expert_register_protocol(proto_tr); + expert_register_field_array(expert_tr, ei, array_length(ei)); /* Register configuration options */ tr_module = prefs_register_protocol(proto_tr, NULL); diff --git a/epan/dissectors/packet-ua.c b/epan/dissectors/packet-ua.c index 1bfbbaa324..26c7fed8dd 100644 --- a/epan/dissectors/packet-ua.c +++ b/epan/dissectors/packet-ua.c @@ -50,6 +50,7 @@ static gboolean setup_conversations_enabled = TRUE; static dissector_handle_t noe_handle; static dissector_handle_t ua3g_handle; +static dissector_handle_t data_handle; static void uadecode(e_ua_direction direction, proto_tree *tree, @@ -149,14 +150,12 @@ static void uadecode(e_ua_direction direction, default: { /* add text to the frame "INFO" column */ - col_append_str(pinfo->cinfo, COL_INFO, " - UA3G Message ERR: Opcode Unknown"); - - proto_tree_add_text(tree, - tvb, - offset, - length, - "Opcode Unknown 0x%02x", - tvb_get_guint8(tvb, (offset + 2))); + col_append_fstr(pinfo->cinfo, COL_INFO, " - UA3G Message ERR: Opcode (0x%02x) Unknown", tvb_get_guint8(tvb, (offset + 2))); + + call_dissector(data_handle, + tvb_new_subset_length(tvb, offset, length), + pinfo, + tree); break; } } @@ -312,5 +311,6 @@ void proto_reg_handoff_ua_msg(void) #endif noe_handle = find_dissector("noe"); ua3g_handle = find_dissector("ua3g"); + data_handle = find_dissector("data"); } diff --git a/epan/dissectors/packet-udld.c b/epan/dissectors/packet-udld.c index 7107f57bcb..ae08a3a111 100644 --- a/epan/dissectors/packet-udld.c +++ b/epan/dissectors/packet-udld.c @@ -25,6 +25,7 @@ #include <glib.h> #include <epan/packet.h> +#include <epan/expert.h> #include <epan/strutil.h> #include <epan/oui.h> @@ -55,6 +56,12 @@ static int hf_udld_flags_rsy = -1; static int hf_udld_checksum = -1; static int hf_udld_tlvtype = -1; static int hf_udld_tlvlength = -1; +static int hf_udld_device_id = -1; +static int hf_udld_sent_through_interface = -1; +static int hf_udld_data = -1; + + +static expert_field ei_udld_tlvlength = EI_INIT; static gint ett_udld = -1; static gint ett_udld_flags = -1; @@ -103,7 +110,6 @@ dissect_udld(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) int offset = 0; guint16 type; guint16 length; - proto_item *tlvi; proto_tree *tlv_tree; int real_length; @@ -136,19 +142,16 @@ dissect_udld(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) type = tvb_get_ntohs(tvb, offset + TLV_TYPE); length = tvb_get_ntohs(tvb, offset + TLV_LENGTH); if (length < 4) { - if (tree) { - tlvi = proto_tree_add_text(udld_tree, tvb, offset, 4, - "TLV with invalid length %u (< 4)", - length); - tlv_tree = proto_item_add_subtree(tlvi, ett_udld_tlv); - proto_tree_add_uint(tlv_tree, hf_udld_tlvtype, tvb, + tlv_tree = proto_tree_add_subtree_format(udld_tree, tvb, offset, 4, + ett_udld_tlv, NULL, "TLV with invalid length %u (< 4)", length); + proto_tree_add_uint(tlv_tree, hf_udld_tlvtype, tvb, offset + TLV_TYPE, 2, type); - proto_tree_add_uint(tlv_tree, hf_udld_tlvlength, tvb, + ti = proto_tree_add_uint(tlv_tree, hf_udld_tlvlength, tvb, offset + TLV_LENGTH, 2, length); - } - offset += 4; - break; - } + expert_add_info(pinfo, ti, &ei_udld_tlvlength); + offset += 4; + break; + } switch (type) { @@ -161,19 +164,18 @@ dissect_udld(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) length - 4)); if (tree) { - tlv_tree = proto_tree_add_subtree_format(udld_tree, tvb, offset, + tlv_tree = proto_tree_add_subtree_format(udld_tree, tvb, offset, length, ett_udld_tlv, NULL, "Device ID: %s", tvb_format_stringzpad(tvb, offset + 4, length - 4)); - proto_tree_add_uint(tlv_tree, hf_udld_tlvtype, tvb, + proto_tree_add_uint(tlv_tree, hf_udld_tlvtype, tvb, offset + TLV_TYPE, 2, type); - proto_tree_add_uint(tlv_tree, hf_udld_tlvlength, tvb, + proto_tree_add_uint(tlv_tree, hf_udld_tlvlength, tvb, offset + TLV_LENGTH, 2, length); - proto_tree_add_text(tlv_tree, tvb, offset + 4, - length - 4, "Device ID: %s", - tvb_format_stringzpad(tvb, offset + 4, length - 4)); - } - offset += length; - break; + proto_tree_add_item(tlv_tree, hf_udld_device_id, tvb, offset + 4, + length - 4, ENC_ASCII|ENC_NA); + } + offset += length; + break; case TYPE_PORT_ID: real_length = length; @@ -192,17 +194,15 @@ dissect_udld(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvb_format_stringzpad(tvb, offset + 4, length - 4)); if (tree) { - tlv_tree = proto_tree_add_subtree_format(udld_tree, tvb, offset, - real_length, ett_udld_tlv, NULL, "Port ID: %s", - tvb_format_text(tvb, offset + 4, real_length - 4)); - proto_tree_add_uint(tlv_tree, hf_udld_tlvtype, tvb, - offset + TLV_TYPE, 2, type); - proto_tree_add_uint(tlv_tree, hf_udld_tlvlength, tvb, - offset + TLV_LENGTH, 2, length); - proto_tree_add_text(tlv_tree, tvb, offset + 4, - real_length - 4, - "Sent through Interface: %s", - tvb_format_text(tvb, offset + 4, real_length - 4)); + tlv_tree = proto_tree_add_subtree_format(udld_tree, tvb, offset, + real_length, ett_udld_tlv, NULL, "Port ID: %s", + tvb_format_text(tvb, offset + 4, real_length - 4)); + proto_tree_add_uint(tlv_tree, hf_udld_tlvtype, tvb, + offset + TLV_TYPE, 2, type); + proto_tree_add_uint(tlv_tree, hf_udld_tlvlength, tvb, + offset + TLV_LENGTH, 2, length); + proto_tree_add_item(tlv_tree, hf_udld_sent_through_interface, tvb, offset + 4, + real_length - 4, ENC_ASCII|ENC_NA); } offset += real_length; break; @@ -222,8 +222,8 @@ dissect_udld(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_uint(tlv_tree, hf_udld_tlvlength, tvb, offset + TLV_LENGTH, 2, length); if (length > 4) { - proto_tree_add_text(tlv_tree, tvb, offset + 4, - length - 4, "Data"); + proto_tree_add_item(tlv_tree, hf_udld_data, tvb, offset + 4, + length - 4, ENC_NA); } else { return; } @@ -268,18 +268,39 @@ proto_register_udld(void) { &hf_udld_tlvlength, { "Length", "udld.tlv.len", FT_UINT16, BASE_DEC, NULL, 0x0, - NULL, HFILL }} + NULL, HFILL }}, + + { &hf_udld_device_id, + { "Device ID", "udld.device_id", FT_STRINGZ, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + { &hf_udld_sent_through_interface, + { "Sent through Interface", "udld.sent_through_interface", FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + { &hf_udld_data, + { "Data", "udld.data", FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, }; + static gint *ett[] = { &ett_udld, &ett_udld_flags, &ett_udld_tlv }; + static ei_register_info ei[] = { + { &ei_udld_tlvlength, { "udld.tlv.len.invalid", PI_PROTOCOL, PI_WARN, "TLV with invalid length (< 4)", EXPFILL }}, + }; + + expert_module_t* expert_udld; + proto_udld = proto_register_protocol("Unidirectional Link Detection", "UDLD", "udld"); proto_register_field_array(proto_udld, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_udld = expert_register_protocol(proto_udld); + expert_register_field_array(expert_udld, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-umts_fp.c b/epan/dissectors/packet-umts_fp.c index 49b41a06b6..d08ed7fa62 100644 --- a/epan/dissectors/packet-umts_fp.c +++ b/epan/dissectors/packet-umts_fp.c @@ -236,6 +236,7 @@ static expert_field ei_fp_e_rnti_first_entry = EI_INIT; static expert_field ei_fp_bad_header_checksum = EI_INIT; static expert_field ei_fp_crci_error_bit_set_for_tb = EI_INIT; static expert_field ei_fp_spare_extension = EI_INIT; +static expert_field ei_fp_no_per_frame_info = EI_INIT; static dissector_handle_t rlc_bcch_handle; static dissector_handle_t mac_fdd_dch_handle; @@ -4260,9 +4261,7 @@ dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Can't dissect anything without it... */ if (p_fp_info == NULL) { - ti = proto_tree_add_text(fp_tree, tvb, offset, -1, - "Can't dissect FP frame because no per-frame info was attached!"); - PROTO_ITEM_SET_GENERATED(ti); + proto_tree_add_expert(fp_tree, pinfo, &ei_fp_no_per_frame_info, tvb, offset, -1); return; } @@ -5528,6 +5527,7 @@ void proto_register_fp(void) { &ei_fp_hsdsch_common_experimental_support, { "fp.hsdsch_common.experimental_support", PI_DEBUG, PI_WARN, "HSDSCH COMMON - Experimental support!", EXPFILL }}, { &ei_fp_hsdsch_common_t3_not_implemented, { "fp.hsdsch_common_t3.not_implemented", PI_DEBUG, PI_ERROR, "HSDSCH COMMON T3 - Not implemeneted!", EXPFILL }}, { &ei_fp_channel_type_unknown, { "fp.channel_type.unknown", PI_MALFORMED, PI_ERROR, "Unknown channel type", EXPFILL }}, + { &ei_fp_no_per_frame_info, { "fp.no_per_frame_info", PI_UNDECODED, PI_ERROR, "Can't dissect FP frame because no per-frame info was attached!", EXPFILL }}, }; module_t *fp_module; diff --git a/epan/dissectors/packet-usb-ccid.c b/epan/dissectors/packet-usb-ccid.c index a644abcd97..a17b95698b 100644 --- a/epan/dissectors/packet-usb-ccid.c +++ b/epan/dissectors/packet-usb-ccid.c @@ -70,6 +70,7 @@ static int hf_ccid_bClassEnvelope = -1; static int hf_ccid_wLcdLayout = -1; static int hf_ccid_bPINSupport = -1; static int hf_ccid_bMaxCCIDBusySlots = -1; +static int hf_ccid_Reserved = -1; static dissector_handle_t usb_ccid_handle; @@ -374,7 +375,7 @@ dissect_ccid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) proto_tree_add_item(ccid_tree, hf_ccid_bProtocolNum, tvb, 7, 1, ENC_LITTLE_ENDIAN); /* Placeholder for abRFU */ - proto_tree_add_text(ccid_tree, tvb, 8, 2, "Reserved for Future Use"); + proto_tree_add_item(ccid_tree, hf_ccid_Reserved, tvb, 8, 2, ENC_LITTLE_ENDIAN); if (tvb_get_letohl(tvb, 1) != 0) { next_tvb = tvb_new_subset_remaining(tvb, 10); @@ -389,7 +390,7 @@ dissect_ccid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) proto_tree_add_item(ccid_tree, hf_ccid_bPowerSelect, tvb, 7, 1, ENC_LITTLE_ENDIAN); /* Placeholder for abRFU */ - proto_tree_add_text(ccid_tree, tvb, 8, 2, "Reserved for Future Use"); + proto_tree_add_item(ccid_tree, hf_ccid_Reserved, tvb, 8, 2, ENC_LITTLE_ENDIAN); break; case PC_RDR_ICC_OFF: @@ -398,7 +399,7 @@ dissect_ccid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) proto_tree_add_item(ccid_tree, hf_ccid_bSeq, tvb, 6, 1, ENC_LITTLE_ENDIAN); /* Placeholder for abRFU */ - proto_tree_add_text(ccid_tree, tvb, 7, 3, "Reserved for Future Use"); + proto_tree_add_item(ccid_tree, hf_ccid_Reserved, tvb, 7, 3, ENC_LITTLE_ENDIAN); break; case PC_RDR_GET_SLOT_STATUS: @@ -407,7 +408,7 @@ dissect_ccid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) proto_tree_add_item(ccid_tree, hf_ccid_bSeq, tvb, 6, 1, ENC_LITTLE_ENDIAN); /* Placeholder for abRFU */ - proto_tree_add_text(ccid_tree, tvb, 7, 3, "Reserved for Future Use"); + proto_tree_add_item(ccid_tree, hf_ccid_Reserved, tvb, 7, 3, ENC_LITTLE_ENDIAN); break; case PC_RDR_GET_PARAMS: @@ -416,7 +417,7 @@ dissect_ccid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) proto_tree_add_item(ccid_tree, hf_ccid_bSeq, tvb, 6, 1, ENC_LITTLE_ENDIAN); /* Placeholder for abRFU */ - proto_tree_add_text(ccid_tree, tvb, 7, 3, "Reserved for Future Use"); + proto_tree_add_item(ccid_tree, hf_ccid_Reserved, tvb, 7, 3, ENC_LITTLE_ENDIAN); break; case PC_RDR_XFR_BLOCK: @@ -623,7 +624,10 @@ proto_register_ccid(void) FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, {&hf_ccid_bMaxCCIDBusySlots, { "maximum number of busy slots", "usbccid.hf_ccid_bMaxCCIDBusySlots", - FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }} + FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + {&hf_ccid_Reserved, + { "Reserved for Future Use", "usbccid.hf_ccid_Reserved", + FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }} }; static gint *ett[] = { diff --git a/epan/dissectors/packet-usb-hid.c b/epan/dissectors/packet-usb-hid.c index 4ed0c6f13d..69034e7a3c 100644 --- a/epan/dissectors/packet-usb-hid.c +++ b/epan/dissectors/packet-usb-hid.c @@ -324,7 +324,7 @@ dissect_usb_hid_report_mainitem_data(packet_info *pinfo _U_, proto_tree *tree, t if (bSize > 1) { proto_tree_add_item(tree, hf_usb_hid_mainitem_bit8, tvb, offset, bSize, ENC_LITTLE_ENDIAN); } else { - proto_tree_add_text(tree, tvb, offset, 0, "Bits or bytes: Buffered bytes (default, no second byte present)"); + proto_tree_add_boolean_format_value(tree, hf_usb_hid_mainitem_bit8, tvb, offset, 0, FALSE, "Buffered bytes (default, no second byte present)"); } break; case USBHID_MAINITEM_TAG_COLLECTION: @@ -420,9 +420,7 @@ dissect_usb_hid_report_localitem_data(packet_info *pinfo _U_, proto_tree *tree, usage_page = (global->usage_page & 0xFFFFFF00) | tvb_get_guint8(tvb, offset); else if (bSize == 2) usage_page = (global->usage_page & 0xFFFF0000) | tvb_get_ntohs(tvb, offset); - proto_tree_add_text(tree, tvb, offset, bSize, "Usage: %s (0x%08x)", - rval_to_str(usage_page, usb_hid_item_usage_vals, "[Unknown page!]"), - usage_page); + proto_tree_add_uint(tree, hf_usb_hid_localitem_usage, tvb, offset, bSize, usage_page); } break; case USBHID_LOCALITEM_TAG_USAGE_MIN: diff --git a/epan/dissectors/packet-vicp.c b/epan/dissectors/packet-vicp.c index f32e6fd53a..74d7dd715d 100644 --- a/epan/dissectors/packet-vicp.c +++ b/epan/dissectors/packet-vicp.c @@ -73,10 +73,7 @@ static void dissect_vicp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) len=tvb_get_ntohl(tvb, ptvcursor_current_offset(cursor)); ptvcursor_add(cursor, hf_vicp_length, 4, ENC_BIG_ENDIAN); - if(len==0) - proto_tree_add_text(vicp_tree, tvb, 0, 0, "No data"); - else - ptvcursor_add(cursor, hf_vicp_data, len, ENC_NA); + ptvcursor_add(cursor, hf_vicp_data, len, ENC_NA); ptvcursor_free(cursor); } diff --git a/epan/dissectors/packet-vines.c b/epan/dissectors/packet-vines.c index 92276aada9..c4998dd198 100644 --- a/epan/dissectors/packet-vines.c +++ b/epan/dissectors/packet-vines.c @@ -148,6 +148,8 @@ static gint ett_vines_ip_tctl = -1; static int proto_vines_echo = -1; +static gint hf_vines_echo_data = -1; + static gint ett_vines_echo = -1; static int proto_vines_ipc = -1; @@ -720,19 +722,27 @@ dissect_vines_echo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_vines_echo, tvb, 0, -1, ENC_NA); vines_echo_tree = proto_item_add_subtree(ti, ett_vines_echo); - proto_tree_add_text(vines_echo_tree, tvb, 0, -1, "Data"); + proto_tree_add_item(vines_echo_tree, hf_vines_echo_data, tvb, 0, -1, ENC_NA); } } void proto_register_vines_echo(void) { + static hf_register_info hf[] = { + { &hf_vines_echo_data, + { "Data", "vines_echo.data", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + }; + static gint *ett[] = { &ett_vines_echo, }; proto_vines_echo = proto_register_protocol( "Banyan Vines Echo", "Vines Echo", "vines_echo"); + proto_register_field_array(proto_vines_echo, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); } @@ -1542,9 +1552,8 @@ dissect_vines_rtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 4; metric = tvb_get_ntohs(tvb, offset); if (metric == 0xffff) { - proto_tree_add_text(vines_rtp_tree, tvb, - offset, 2, - "Neighbor Metric: Unreachable"); + proto_tree_add_uint_format_value(vines_rtp_tree, hf_vines_rtp_neighbor_metric, tvb, + offset, 2, 0xffff, "Unreachable"); } else { proto_tree_add_uint_format_value(vines_rtp_tree, hf_vines_rtp_neighbor_metric, tvb, offset, 2, metric, diff --git a/epan/dissectors/packet-vnc.c b/epan/dissectors/packet-vnc.c index 0e3696ac93..6f97d00c3c 100644 --- a/epan/dissectors/packet-vnc.c +++ b/epan/dissectors/packet-vnc.c @@ -571,7 +571,7 @@ static guint vnc_h264_encoding(tvbuff_t *tvb, gint *offset, proto_tree *tree); pinfo->destport == vnc_preference_alternate_port #define VNC_BYTES_NEEDED(a) \ - if((a) > (guint)tvb_length_remaining(tvb, *offset)) \ + if((a) > (guint)tvb_reported_length_remaining(tvb, *offset)) \ return (a); /* Variables for our preferences */ @@ -684,6 +684,7 @@ static int hf_vnc_tight_auth_code = -1; /* TightVNC capabilities */ static int hf_vnc_tight_server_message_type = -1; static int hf_vnc_tight_server_vendor = -1; +static int hf_vnc_tight_signature = -1; static int hf_vnc_tight_server_name = -1; static int hf_vnc_tight_client_message_type = -1; @@ -784,6 +785,7 @@ static int hf_vnc_server_cut_text = -1; /* LibVNCServer additions */ static int hf_vnc_supported_messages_client2server = -1; static int hf_vnc_supported_messages_server2client = -1; +static int hf_vnc_num_supported_encodings = -1; static int hf_vnc_supported_encodings = -1; static int hf_vnc_server_identity = -1; @@ -909,6 +911,9 @@ static expert_field ei_vnc_too_many_sub_rectangles = EI_INIT; static expert_field ei_vnc_invalid_encoding = EI_INIT; static expert_field ei_vnc_too_many_colors = EI_INIT; static expert_field ei_vnc_too_many_cut_text = EI_INIT; +static expert_field ei_vnc_zrle_failed = EI_INIT; +static expert_field ei_vnc_unknown_tight = EI_INIT; +static expert_field ei_vnc_reassemble = EI_INIT; /* Global so they keep their value between packets */ guint8 vnc_bytes_per_pixel; @@ -1035,8 +1040,6 @@ process_tight_capabilities(proto_tree *tree, static gboolean vnc_is_client_or_server_version_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_item *bug_item; - if(tvb_length(tvb) != 12) { return FALSE; } @@ -1059,8 +1062,7 @@ vnc_is_client_or_server_version_message(tvbuff_t *tvb, packet_info *pinfo, proto * [1] http://git.gnome.org/browse/gtk-vnc/commit/?id=bc9e2b19167686dd381a0508af1a5113675d08a2 */ if ((pinfo != NULL) && (tree != NULL)) { - bug_item = proto_tree_add_text(tree, tvb, -1, 0, "NULL found in greeting"); - expert_add_info(pinfo, bug_item, &ei_vnc_possible_gtk_vnc_bug); + proto_tree_add_expert(tree, pinfo, &ei_vnc_possible_gtk_vnc_bug, tvb, -1, 0); } return TRUE; @@ -1296,7 +1298,7 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, process_vendor(tree, hf_vnc_tight_server_vendor, tvb, offset); offset += 4; signature = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, 8, ENC_ASCII); - proto_tree_add_text(tree, tvb, offset, 8, "Signature: %s", signature); + proto_tree_add_string(tree, hf_vnc_tight_signature, tvb, offset, 8, signature); offset += 8; switch(auth_code) { @@ -1383,8 +1385,7 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, case VNC_SESSION_STATE_TIGHT_UNKNOWN_PACKET3 : col_set_str(pinfo->cinfo, COL_INFO, "Unknown packet (TightVNC)"); - proto_tree_add_text(tree, tvb, offset, -1, - "Unknown packet (TightVNC)"); + proto_tree_add_expert(tree, pinfo, &ei_vnc_unknown_tight, tvb, offset, -1); per_conversation_info->vnc_next_state = VNC_SESSION_STATE_VNC_AUTHENTICATION_CHALLENGE; @@ -1756,8 +1757,7 @@ again: } if(bytes_needed > 0 && vnc_preference_desegment && pinfo->can_desegment) { - proto_tree_add_text(vnc_server_message_type_tree, tvb, start_offset, -1, - "[See further on for dissection of the complete (reassembled) PDU]"); + proto_tree_add_expert(vnc_server_message_type_tree, pinfo, &ei_vnc_reassemble, tvb, start_offset, -1); pinfo->desegment_offset = start_offset; pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; return; @@ -2471,8 +2471,7 @@ vnc_supported_encodings(tvbuff_t *tvb, gint *offset, proto_tree *tree, { guint16 i = width; - proto_tree_add_text(tree, tvb, *offset, 0, - "Number of supported encodings: %d", height); + proto_tree_add_uint(tree, hf_vnc_num_supported_encodings, tvb, *offset, 0, height); VNC_BYTES_NEEDED(width); for (; i >= 4; i -= 4) { @@ -3022,8 +3021,7 @@ vnc_zrle_encoding(tvbuff_t *tvb, packet_info *pinfo _U_, gint *offset, } } else { - proto_tree_add_text(tree, tvb, *offset, data_len, - "Decompression of ZRLE data failed"); + proto_tree_add_expert(tree, pinfo, &ei_vnc_zrle_failed, tvb, *offset, data_len); } #endif /* HAVE_LIBZ */ @@ -3548,6 +3546,11 @@ proto_register_vnc(void) FT_STRING, BASE_NONE, NULL, 0x0, "Server vendor code specific to TightVNC", HFILL } }, + { &hf_vnc_tight_signature, + { "Signature", "vnc.signature", + FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, { &hf_vnc_tight_server_name, { "Server name", "vnc.server_name", FT_STRING, BASE_NONE, NULL, 0x0, @@ -4309,6 +4312,11 @@ proto_register_vnc(void) FT_BYTES, BASE_NONE, NULL, 0x0, "Supported server to client messages (bit flags)", HFILL } }, + { &hf_vnc_num_supported_encodings, + { "Number of supported encodings", "vnc.num_supported_encodings", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, { &hf_vnc_supported_encodings, { "Encoding", "vnc.supported_encodings", FT_UINT32, BASE_HEX, NULL, 0x0, @@ -4725,7 +4733,7 @@ proto_register_vnc(void) }; static ei_register_info ei[] = { - { &ei_vnc_possible_gtk_vnc_bug, { "vnc.possible_gtk_vnc_bug", PI_MALFORMED, PI_ERROR, "client -> server greeting must be 12 bytes (possible gtk-vnc bug)", EXPFILL }}, + { &ei_vnc_possible_gtk_vnc_bug, { "vnc.possible_gtk_vnc_bug", PI_MALFORMED, PI_ERROR, "NULL found in greeting. client -> server greeting must be 12 bytes (possible gtk-vnc bug)", EXPFILL }}, { &ei_vnc_auth_code_mismatch, { "vnc.auth_code_mismatch", PI_PROTOCOL, PI_WARN, "Authentication code does not match vendor or signature", EXPFILL }}, { &ei_vnc_unknown_tight_vnc_auth, { "vnc.unknown_tight_vnc_auth", PI_PROTOCOL, PI_ERROR, "Unknown TIGHT VNC authentication", EXPFILL }}, { &ei_vnc_too_many_rectangles, { "vnc.too_many_rectangles", PI_MALFORMED, PI_ERROR, "Too many rectangles, aborting dissection", EXPFILL }}, @@ -4733,6 +4741,9 @@ proto_register_vnc(void) { &ei_vnc_invalid_encoding, { "vnc.invalid_encoding", PI_MALFORMED, PI_ERROR, "Invalid encoding", EXPFILL }}, { &ei_vnc_too_many_colors, { "vnc.too_many_colors", PI_MALFORMED, PI_ERROR, "Too many colors, aborting dissection", EXPFILL }}, { &ei_vnc_too_many_cut_text, { "vnc.too_many_cut_text", PI_MALFORMED, PI_ERROR, "Too much cut text, aborting dissection", EXPFILL }}, + { &ei_vnc_zrle_failed, { "vnc.zrle_failed", PI_UNDECODED, PI_ERROR, "Decompression of ZRLE data failed", EXPFILL }}, + { &ei_vnc_unknown_tight, { "vnc.unknown_tight_packet", PI_UNDECODED, PI_WARN, "Unknown packet (TightVNC)", EXPFILL }}, + { &ei_vnc_reassemble, { "vnc.reassemble", PI_REASSEMBLE, PI_CHAT, "See further on for dissection of the complete (reassembled) PDU", EXPFILL }}, }; /* Register the protocol name and description */ diff --git a/epan/dissectors/packet-vp8.c b/epan/dissectors/packet-vp8.c index 06b91b2534..da444c03cd 100644 --- a/epan/dissectors/packet-vp8.c +++ b/epan/dissectors/packet-vp8.c @@ -96,6 +96,9 @@ static int ett_vp8_keyframe = -1; static expert_field ei_vp8_startcode = EI_INIT; static expert_field ei_vp8_undecoded = EI_INIT; +static expert_field ei_vp8_continuation = EI_INIT; +static expert_field ei_vp8_first_partition_split = EI_INIT; +static expert_field ei_vp8_first_partition_plus = EI_INIT; static void dissect_vp8_payload_descriptor(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *vp8_tree, gint *offset, gboolean *hasHeader); @@ -344,9 +347,10 @@ static void dissect_vp8_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *vp8_tree, gint *offset, gint *frametype, gint *partition1_size) { proto_tree *vp8_payload_tree; + proto_item *payload_item; gint remainder; - vp8_payload_tree = proto_tree_add_subtree(vp8_tree, tvb, *offset, -1, ett_vp8_payload, NULL, "Payload"); + vp8_payload_tree = proto_tree_add_subtree(vp8_tree, tvb, *offset, -1, ett_vp8_payload, &payload_item, "Payload"); if (*frametype == 0) { @@ -390,24 +394,25 @@ dissect_vp8_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *vp8_tree, gin if ((*partition1_size) == -1) { /*no header, continuation?*/ - proto_tree_add_text(vp8_payload_tree, tvb, *offset, -1, "Continuation of partition fragment (%d bytes)", remainder); + proto_tree_add_expert_format(vp8_payload_tree, pinfo, &ei_vp8_continuation, tvb, *offset, -1, "Continuation of partition fragment (%d bytes)", remainder); } else { if (remainder < *partition1_size) { /* partition size has already been added to vp8 header tree, but it would be useful to provide additional explanation */ - proto_tree_add_text(vp8_payload_tree, tvb, *offset, -1, "First partition is split with %d bytes in this packet and %d bytes in subsequent frames", remainder, ((*partition1_size)-remainder)); + proto_tree_add_expert_format(vp8_payload_tree, pinfo, &ei_vp8_first_partition_split, tvb, *offset, -1, + "First partition is split with %d bytes in this packet and %d bytes in subsequent frames", remainder, ((*partition1_size)-remainder)); } else { (*offset)= (*offset) + (*partition1_size); - proto_tree_add_text(vp8_payload_tree, tvb, *offset, -1, + proto_tree_add_expert_format(vp8_payload_tree, pinfo, &ei_vp8_first_partition_plus, tvb, *offset, -1, "This frame contains all of first partition (%d bytes) and also %d bytes from other partitions", *partition1_size, remainder); } } - expert_add_info(pinfo, vp8_payload_tree, &ei_vp8_undecoded); + expert_add_info(pinfo, payload_item, &ei_vp8_undecoded); } void @@ -547,7 +552,10 @@ proto_register_vp8(void) static ei_register_info ei[] = { { &ei_vp8_startcode, { "vp8.keyframe.startcode", PI_PROTOCOL, PI_ERROR, "Startcode is incorrect", EXPFILL }}, - { &ei_vp8_undecoded, { "vp8.undecoded", PI_UNDECODED, PI_NOTE, "Payload not fully decoded", EXPFILL }} + { &ei_vp8_undecoded, { "vp8.undecoded", PI_UNDECODED, PI_NOTE, "Payload not fully decoded", EXPFILL }}, + { &ei_vp8_continuation, { "vp8.continuation", PI_REASSEMBLE, PI_CHAT, "Continuation of partition fragment", EXPFILL }}, + { &ei_vp8_first_partition_split, { "vp8.first_partition_split", PI_REASSEMBLE, PI_CHAT, "First partition is split", EXPFILL }}, + { &ei_vp8_first_partition_plus, { "vp8.first_partition_plus", PI_REASSEMBLE, PI_CHAT, "This frame contains all of first partition and also bytes from other partitions", EXPFILL }}, }; proto_vp8 = proto_register_protocol ( diff --git a/epan/dissectors/packet-vtp.c b/epan/dissectors/packet-vtp.c index e76b271599..2f01eeb961 100644 --- a/epan/dissectors/packet-vtp.c +++ b/epan/dissectors/packet-vtp.c @@ -50,6 +50,7 @@ static int hf_vtp_md5_digest = -1; static int hf_vtp_seq_num = -1; static int hf_vtp_start_value = -1; static int hf_vtp_vlan_info_len = -1; +static int hf_vtp_vlan_status = -1; static int hf_vtp_vlan_status_vlan_susp = -1; static int hf_vtp_vlan_type = -1; static int hf_vtp_vlan_name_len = -1; @@ -72,6 +73,7 @@ static int hf_vtp_vlan_bridge_type = -1; static int hf_vtp_vlan_max_are_hop_count = -1; static int hf_vtp_vlan_max_ste_hop_count = -1; static int hf_vtp_vlan_backup_crf_mode = -1; +static int hf_vtp_vlan_data = -1; static gint ett_vtp = -1; static gint ett_vtp_vlan_info = -1; @@ -327,9 +329,9 @@ dissect_vlan_info(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tre vlan_info_left -= 1; status = tvb_get_guint8(tvb, offset); - ti = proto_tree_add_text(vlan_info_tree, tvb, offset, 1, - "Status: 0x%02x%s", status, - (status & VLAN_SUSPENDED) ? "(VLAN suspended)" : ""); + ti = proto_tree_add_uint(vlan_info_tree, hf_vtp_vlan_status, tvb, offset, 1, status); + if (status & VLAN_SUSPENDED) + proto_item_append_text(ti, " (VLAN suspended)"); status_tree = proto_item_add_subtree(ti, ett_vtp_vlan_status); proto_tree_add_boolean(status_tree, hf_vtp_vlan_status_vlan_susp, tvb, offset, 1, status); @@ -498,7 +500,7 @@ dissect_vlan_info_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, break; default: - proto_tree_add_text(tree, tvb, offset, length, "Data"); + proto_tree_add_item(tree, hf_vtp_vlan_data, tvb, offset, length, ENC_NA); break; } } @@ -555,6 +557,10 @@ proto_register_vtp(void) { "VLAN Information Length", "vtp.vlan_info.len", FT_UINT8, BASE_DEC, NULL, 0x0, "Length of the VLAN information field", HFILL }}, + { &hf_vtp_vlan_status, + { "Status", "vtp.vlan_info.status", FT_UINT8, BASE_HEX, NULL, 0x0, + NULL, HFILL }}, + { &hf_vtp_vlan_status_vlan_susp, { "VLAN suspended", "vtp.vlan_info.status.vlan_susp", FT_BOOLEAN, 8, NULL, VLAN_SUSPENDED, NULL, HFILL }}, @@ -642,7 +648,12 @@ proto_register_vtp(void) { &hf_vtp_vlan_backup_crf_mode, { "Backup CRF Mode", "vtp.vlan_info.backup_crf_mode", FT_UINT16, BASE_HEX, VALS(backup_crf_mode_vals), 0x0, NULL, HFILL }}, + + { &hf_vtp_vlan_data, + { "Data", "vtp.vlan_info.data", FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, }; + static gint *ett[] = { &ett_vtp, &ett_vtp_vlan_info, |