From 2d448f0d5de5ba09aedd506e98c4a4395c495267 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Fri, 2 Jan 2015 22:19:53 -0500 Subject: Eliminate proto_tree_add_text from some dissectors. Change-Id: Ief4c377d56748e1a8ed0ef7fe5ba03b9be00cd8d Reviewed-on: https://code.wireshark.org/review/6267 Reviewed-by: Anders Broman --- epan/dissectors/packet-elcom.c | 2 +- epan/dissectors/packet-gsm_bsslap.c | 24 ++- epan/dissectors/packet-gssapi.c | 36 ++++- epan/dissectors/packet-gvrp.c | 298 +++++++++++++++++++----------------- epan/dissectors/packet-h264.c | 37 +++-- epan/dissectors/packet-manolito.c | 40 ++++- epan/dissectors/packet-rtp.c | 28 +++- epan/dissectors/packet-sctp.c | 2 +- epan/dissectors/packet-spdy.c | 19 ++- epan/dissectors/packet-stun.c | 31 +--- epan/dissectors/packet-sua.c | 58 +++---- epan/dissectors/packet-tcp.c | 2 +- 12 files changed, 330 insertions(+), 247 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-elcom.c b/epan/dissectors/packet-elcom.c index 80aea12700..881f630b2e 100644 --- a/epan/dissectors/packet-elcom.c +++ b/epan/dissectors/packet-elcom.c @@ -282,7 +282,7 @@ dissect_userdata(proto_item *ti_arg, gint ett_arg, tvbuff_t *tvb, gint arg_offse offset++; /* show the rest */ - /* tree2 = proto_tree_add_text(tree, tvb, offset, -1, "User Data"); */ + /* tree2 = proto_tree_add_subtree(tree, tvb, offset, -1, "User Data"); */ if (tvb_length_remaining(tvb, offset) <= 0) return offset; diff --git a/epan/dissectors/packet-gsm_bsslap.c b/epan/dissectors/packet-gsm_bsslap.c index 2334c1ea4a..a16c7d74e1 100644 --- a/epan/dissectors/packet-gsm_bsslap.c +++ b/epan/dissectors/packet-gsm_bsslap.c @@ -48,12 +48,14 @@ static int hf_gsm_bsslap_tfi = -1; static int hf_gsm_bsslap_poll_rep = -1; static int hf_gsm_bsslap_lac = -1; static int hf_gsm_bsslap_cell_id_disc = -1; +static int hf_gsm_bsslap_encryption_key = -1; /* Initialize the subtree pointers */ static int ett_gsm_bsslap = -1; static int ett_bsslap_cell_list = -1; static expert_field ei_gsm_bsslap_missing_mandatory_element = EI_INIT; +static expert_field ei_gsm_bsslap_not_decoded_yet = EI_INIT; /* Table 5.1: Element Indentifier codes */ #define BSSLAP_PARAM_TIMING_ADVANCE 0x01 @@ -182,12 +184,12 @@ de_ta(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, g */ #if 0 static guint16 -de_meas_rep(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_) +de_meas_rep(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_) { guint32 curr_offset; curr_offset = offset; - proto_tree_add_text(tree,tvb, curr_offset, len,"Not decoded yet"); + proto_tree_add_expert(tree, pinfo, &ei_gsm_bsslap_not_decoded_yet, tvb, curr_offset, len); return(len); @@ -315,7 +317,7 @@ de_cell_id_list(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 off /* 3G Cell identification container 2 */ /* fall trough */ default: - proto_tree_add_text(subtree,tvb, curr_offset, len,"Not decoded yet"); + proto_tree_add_expert(subtree, pinfo, &ei_gsm_bsslap_not_decoded_yet, tvb, curr_offset, len); consumed = len; break; } @@ -335,12 +337,12 @@ de_cell_id_list(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 off * "RR short PD", "Message type" and "Short layer 2 header")... */ static guint16 -de_enh_meas_rep(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_) +de_enh_meas_rep(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_) { guint32 curr_offset; curr_offset = offset; - proto_tree_add_text(tree,tvb, curr_offset, len,"Not decoded yet"); + proto_tree_add_expert(tree, pinfo, &ei_gsm_bsslap_not_decoded_yet, tvb, curr_offset, len); return(len); @@ -401,7 +403,7 @@ de_blap_enc_key(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 guint32 curr_offset; curr_offset = offset; - proto_tree_add_text(tree,tvb, curr_offset, 8,"Encryption Key (Kc)"); + proto_tree_add_item(tree, hf_gsm_bsslap_encryption_key, tvb, curr_offset, 8, ENC_NA); curr_offset = curr_offset + 8; return(curr_offset - offset); @@ -439,12 +441,12 @@ de_poll_rep(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 off * padding bits (binary 0) as required to achieve 4 complete octets */ static guint16 -de_pkt_ch_desc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_) +de_pkt_ch_desc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_) { guint32 curr_offset; curr_offset = offset; - proto_tree_add_text(tree,tvb, curr_offset, len,"Not decoded yet"); + proto_tree_add_expert(tree, pinfo, &ei_gsm_bsslap_not_decoded_yet, tvb, curr_offset, len); return(len); @@ -919,10 +921,16 @@ proto_register_gsm_bsslap(void) FT_UINT8, BASE_DEC, VALS(gsm_a_bsslap_cell_id_disc_vals), 0xf, NULL, HFILL } }, + { &hf_gsm_bsslap_encryption_key, + {"Encryption Key (Kc)", "gsm_bsslap.encryption_key", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, }; static ei_register_info ei[] = { { &ei_gsm_bsslap_missing_mandatory_element, { "gsm_bsslap.missing_mandatory_element", PI_PROTOCOL, PI_WARN, "Missing Mandatory element, rest of dissection is suspect", EXPFILL }}, + { &ei_gsm_bsslap_not_decoded_yet, { "gsm_bsslap.not_decoded_yet", PI_UNDECODED, PI_WARN, "Not decoded yet", EXPFILL }}, }; expert_module_t* expert_gsm_bsslap; diff --git a/epan/dissectors/packet-gssapi.c b/epan/dissectors/packet-gssapi.c index 070f6b6035..ee04ed38dc 100644 --- a/epan/dissectors/packet-gssapi.c +++ b/epan/dissectors/packet-gssapi.c @@ -27,6 +27,7 @@ #include +#include #include #include #include @@ -41,6 +42,9 @@ void proto_reg_handoff_gssapi(void); static int proto_gssapi = -1; +static int hf_gssapi_token_object = -1; +static int hf_gssapi_auth_verifier = -1; +static int hf_gssapi_auth_credentials = -1; static int hf_gssapi_oid = -1; static int hf_gssapi_segments = -1; static int hf_gssapi_segment = -1; @@ -57,6 +61,8 @@ static gint ett_gssapi = -1; static gint ett_gssapi_segment = -1; static gint ett_gssapi_segments = -1; +static expert_field ei_gssapi_unknown_header = EI_INIT; + static gboolean gssapi_reassembly = TRUE; typedef struct _gssapi_conv_info_t { @@ -372,7 +378,7 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } if (!oidvalue) { - proto_tree_add_text(subtree, gss_tvb, start_offset, 0, + proto_tree_add_expert_format(subtree, pinfo, &ei_gssapi_unknown_header, gss_tvb, start_offset, 0, "Unknown header (class=%d, pc=%d, tag=%d)", appclass, pc, tag); return_offset = tvb_length(gss_tvb); @@ -441,8 +447,7 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if ((oidvalue == NULL) || !proto_is_protocol_enabled(oidvalue->proto)) { /* No dissector for this oid */ - proto_tree_add_text(subtree, gss_tvb, oid_start_offset, -1, - "Token object"); + proto_tree_add_item(subtree, hf_gssapi_token_object, gss_tvb, oid_start_offset, -1, ENC_NA); return_offset = tvb_length(gss_tvb); goto done; @@ -471,8 +476,7 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, else return_offset = offset + len; } else { - proto_tree_add_text(subtree, gss_tvb, offset, -1, - "Authentication verifier"); + proto_tree_add_item(subtree, hf_gssapi_auth_verifier, gss_tvb, offset, -1, ENC_NA); return_offset = tvb_length(gss_tvb); } } else { @@ -486,8 +490,7 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, else return_offset = offset + len; } else { - proto_tree_add_text(subtree, gss_tvb, offset, -1, - "Authentication credentials"); + proto_tree_add_item(subtree, hf_gssapi_auth_credentials, gss_tvb, offset, -1, ENC_NA); return_offset = tvb_length(gss_tvb); } } @@ -531,8 +534,17 @@ proto_register_gssapi(void) { static hf_register_info hf[] = { { &hf_gssapi_oid, - { "OID", "gss-api.OID", FT_STRING, BASE_NONE, + { "OID", "gss-api.OID", FT_STRING, BASE_NONE, NULL, 0, "This is a GSS-API Object Identifier", HFILL }}, + { &hf_gssapi_token_object, + { "Token object", "gss-api.token_object", FT_BYTES, BASE_NONE, + NULL, 0, NULL, HFILL }}, + { &hf_gssapi_auth_verifier, + { "Authentication verifier", "gss-api.auth_verifier", FT_BYTES, BASE_NONE, + NULL, 0, NULL, HFILL }}, + { &hf_gssapi_auth_credentials, + { "Authentication credentials", "gss-api.auth_credentials", FT_BYTES, BASE_NONE, + NULL, 0, NULL, HFILL }}, { &hf_gssapi_segment, { "GSSAPI Segment", "gss-api.segment", FT_FRAMENUM, BASE_NONE, NULL, 0x0, NULL, HFILL }}, @@ -570,7 +582,13 @@ proto_register_gssapi(void) &ett_gssapi_segment, &ett_gssapi_segments, }; + + static ei_register_info ei[] = { + { &ei_gssapi_unknown_header, { "gssapi.unknown_header", PI_PROTOCOL, PI_WARN, "Unknown header", EXPFILL }}, + }; + module_t *gssapi_module; + expert_module_t *expert_gssapi; proto_gssapi = proto_register_protocol( "GSS-API Generic Security Service Application Program Interface", @@ -583,6 +601,8 @@ proto_register_gssapi(void) &gssapi_reassembly); proto_register_field_array(proto_gssapi, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_gssapi = expert_register_protocol(proto_gssapi); + expert_register_field_array(expert_gssapi, ei, array_length(ei)); register_dissector("gssapi", dissect_gssapi, proto_gssapi); new_register_dissector("gssapi_verf", dissect_gssapi_verf, proto_gssapi); diff --git a/epan/dissectors/packet-gvrp.c b/epan/dissectors/packet-gvrp.c index 7e8997d4e5..f2dc019a6b 100644 --- a/epan/dissectors/packet-gvrp.c +++ b/epan/dissectors/packet-gvrp.c @@ -24,6 +24,7 @@ #include "config.h" #include +#include void proto_register_gvrp(void); void proto_reg_handoff_gvrp(void); @@ -35,13 +36,14 @@ static int hf_gvrp_attribute_type = -1; static int hf_gvrp_attribute_length = -1; static int hf_gvrp_attribute_event = -1; static int hf_gvrp_attribute_value = -1; -/*static int hf_gvrp_end_of_mark = -1;*/ +static int hf_gvrp_end_of_mark = -1; /* Initialize the subtree pointers */ static gint ett_gvrp = -1; -/*static gint ett_gvrp_message = -1; -static gint ett_gvrp_attribute_list = -1; -static gint ett_gvrp_attribute = -1;*/ +static gint ett_gvrp_message = -1; +static gint ett_gvrp_attribute = -1; + +static expert_field ei_gvrp_proto_id = EI_INIT; static dissector_handle_t data_handle; @@ -90,8 +92,8 @@ static const value_string event_vals[] = { static void dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_item *ti; - proto_tree *gvrp_tree; + proto_item *ti, *id_item; + proto_tree *gvrp_tree, *msg_tree, *attr_tree; guint16 protocol_id; guint8 octet; int msg_index; @@ -103,57 +105,103 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_INFO, "GVRP"); - if (tree) + ti = proto_tree_add_item(tree, proto_gvrp, tvb, 0, length, ENC_NA); + gvrp_tree = proto_item_add_subtree(ti, ett_gvrp); + + /* Read in GARP protocol ID */ + protocol_id = tvb_get_ntohs(tvb, GARP_PROTOCOL_ID); + + id_item = proto_tree_add_uint_format_value(gvrp_tree, hf_gvrp_proto_id, tvb, + GARP_PROTOCOL_ID, 2, + protocol_id, + "0x%04x (%s)", + protocol_id, + protocol_id == GARP_DEFAULT_PROTOCOL_ID ? + "GARP VLAN Registration Protocol" : + "Unknown Protocol"); + + /* Currently only one protocol ID is supported */ + if (protocol_id != GARP_DEFAULT_PROTOCOL_ID) { - ti = proto_tree_add_item(tree, proto_gvrp, tvb, 0, length, ENC_NA); + expert_add_info(pinfo, id_item, &ei_gvrp_proto_id); + call_dissector(data_handle, + tvb_new_subset_remaining(tvb, GARP_PROTOCOL_ID + 2), + pinfo, tree); + return; + } + + offset += 2; + length -= 2; - gvrp_tree = proto_item_add_subtree(ti, ett_gvrp); + msg_index = 0; - /* Read in GARP protocol ID */ - protocol_id = tvb_get_ntohs(tvb, GARP_PROTOCOL_ID); + /* Begin to parse GARP messages */ + while (length) + { + proto_item *msg_item; + int msg_start = offset; - proto_tree_add_uint_format(gvrp_tree, hf_gvrp_proto_id, tvb, - GARP_PROTOCOL_ID, (int)sizeof(guint16), - protocol_id, - "Protocol Identifier: 0x%04x (%s)", - protocol_id, - protocol_id == GARP_DEFAULT_PROTOCOL_ID ? - "GARP VLAN Registration Protocol" : - "Unknown Protocol"); + /* Read in attribute type. */ + octet = tvb_get_guint8(tvb, offset); - /* Currently only one protocol ID is supported */ - if (protocol_id != GARP_DEFAULT_PROTOCOL_ID) + /* Check for end of mark */ + if (octet == GARP_END_OF_MARK) { - proto_tree_add_text(gvrp_tree, tvb, GARP_PROTOCOL_ID, (int)sizeof(guint16), - " (Warning: this version of Wireshark only knows about protocol id = 1)"); - call_dissector(data_handle, - tvb_new_subset_remaining(tvb, GARP_PROTOCOL_ID + (int)sizeof(guint16)), + /* End of GARP PDU */ + if (msg_index) + { + proto_tree_add_item(gvrp_tree, hf_gvrp_end_of_mark, tvb, offset, 1, ENC_NA); + break; + } + else + { + call_dissector(data_handle, + tvb_new_subset_remaining(tvb, offset), pinfo, tree); + return; + } + } + + offset += 1; + length -= 1; + + msg_tree = proto_tree_add_subtree_format(gvrp_tree, tvb, msg_start, -1, ett_gvrp_message, &msg_item, + "Message %d", msg_index + 1); + + proto_tree_add_uint(msg_tree, hf_gvrp_attribute_type, tvb, + msg_start, 1, octet); + + /* GVRP only supports one attribute type. */ + if (octet != GVRP_ATTRIBUTE_TYPE) + { + call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, tree); return; } - offset += (int)sizeof(guint16); - length -= (int)sizeof(guint16); + attr_index = 0; - msg_index = 0; - - /* Begin to parse GARP messages */ while (length) { - proto_item *msg_item; - int msg_start = offset; + int attr_start = offset; + proto_item *attr_item; - /* Read in attribute type. */ + /* Read in attribute length. */ octet = tvb_get_guint8(tvb, offset); /* Check for end of mark */ if (octet == GARP_END_OF_MARK) { - /* End of GARP PDU */ - if (msg_index) + /* If at least one message has been already read, + * check for another end of mark. + */ + if (attr_index) { - proto_tree_add_text(gvrp_tree, tvb, offset, (int)sizeof(guint8), - "End of mark"); + proto_tree_add_item(msg_tree, hf_gvrp_end_of_mark, tvb, offset, 1, ENC_NA); + + offset += 1; + length -= 1; + + proto_item_set_len(msg_item, offset - msg_start); break; } else @@ -163,127 +211,74 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) return; } } + else + { + guint8 event; - offset += (int)sizeof(guint8); - length -= (int)sizeof(guint8); - - msg_item = proto_tree_add_text(gvrp_tree, tvb, msg_start, -1, - "Message %d", msg_index + 1); - - proto_tree_add_uint(gvrp_tree, hf_gvrp_attribute_type, tvb, - msg_start, (int)sizeof(guint8), octet); + offset += 1; + length -= 1; - /* GVRP only supports one attribute type. */ - if (octet != GVRP_ATTRIBUTE_TYPE) - { - call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), - pinfo, tree); - return; - } + attr_tree = proto_tree_add_subtree_format(msg_tree, tvb, attr_start, -1, + ett_gvrp_attribute, &attr_item, "Attribute %d", attr_index + 1); - attr_index = 0; + proto_tree_add_uint(attr_tree, hf_gvrp_attribute_length, + tvb, attr_start, 1, octet); - while (length) - { - int attr_start = offset; - proto_item *attr_item; + /* Read in attribute event */ + event = tvb_get_guint8(tvb, offset); - /* Read in attribute length. */ - octet = tvb_get_guint8(tvb, offset); + proto_tree_add_uint(attr_tree, hf_gvrp_attribute_event, + tvb, offset, 1, event); - /* Check for end of mark */ - if (octet == GARP_END_OF_MARK) - { - /* If at least one message has been already read, - * check for another end of mark. - */ - if (attr_index) - { - proto_tree_add_text(gvrp_tree, tvb, offset, - (int)sizeof(guint8), " End of mark"); + offset += 1; + length -= 1; - offset += (int)sizeof(guint8); - length -= (int)sizeof(guint8); + switch (event) { - proto_item_set_len(msg_item, offset - msg_start); - break; - } - else + case GVRP_EVENT_LEAVEALL: + if (octet != GVRP_LENGTH_LEAVEALL) { call_dissector(data_handle, - tvb_new_subset_remaining(tvb, offset), pinfo, tree); + tvb_new_subset_remaining(tvb, offset), pinfo, + tree); return; } - } - else - { - guint8 event; - - offset += (int)sizeof(guint8); - length -= (int)sizeof(guint8); - - attr_item = proto_tree_add_text(gvrp_tree, tvb, - attr_start, -1, " Attribute %d", attr_index + 1); - - proto_tree_add_uint(gvrp_tree, hf_gvrp_attribute_length, - tvb, attr_start, (int)sizeof(guint8), octet); - - /* Read in attribute event */ - event = tvb_get_guint8(tvb, offset); - - proto_tree_add_uint(gvrp_tree, hf_gvrp_attribute_event, - tvb, offset, (int)sizeof(guint8), event); - - offset += (int)sizeof(guint8); - length -= (int)sizeof(guint8); - - switch (event) { - - case GVRP_EVENT_LEAVEALL: - if (octet != GVRP_LENGTH_LEAVEALL) - { - call_dissector(data_handle, - tvb_new_subset_remaining(tvb, offset), pinfo, - tree); - return; - } - break; - - case GVRP_EVENT_JOINEMPTY: - case GVRP_EVENT_JOININ: - case GVRP_EVENT_LEAVEEMPTY: - case GVRP_EVENT_LEAVEIN: - case GVRP_EVENT_EMPTY: - if (octet != GVRP_LENGTH_NON_LEAVEALL) - { - call_dissector(data_handle, - tvb_new_subset_remaining(tvb, offset),pinfo, - tree); - return; - } - - /* Show attribute value */ - proto_tree_add_item(gvrp_tree, hf_gvrp_attribute_value, - tvb, offset, (int)sizeof(guint16), ENC_BIG_ENDIAN); - - offset += (int)sizeof(guint16); - length -= (int)sizeof (guint16); - break; - - default: + break; + + case GVRP_EVENT_JOINEMPTY: + case GVRP_EVENT_JOININ: + case GVRP_EVENT_LEAVEEMPTY: + case GVRP_EVENT_LEAVEIN: + case GVRP_EVENT_EMPTY: + if (octet != GVRP_LENGTH_NON_LEAVEALL) + { call_dissector(data_handle, - tvb_new_subset_remaining(tvb, offset), pinfo, tree); + tvb_new_subset_remaining(tvb, offset),pinfo, + tree); return; } - } - proto_item_set_len(attr_item, offset - attr_start); + /* Show attribute value */ + proto_tree_add_item(attr_tree, hf_gvrp_attribute_value, + tvb, offset, 2, ENC_BIG_ENDIAN); - attr_index++; + offset += 2; + length -= 2; + break; + + default: + call_dissector(data_handle, + tvb_new_subset_remaining(tvb, offset), pinfo, tree); + return; + } } - msg_index++; + proto_item_set_len(attr_item, offset - attr_start); + + attr_index++; } + + msg_index++; } } @@ -294,7 +289,7 @@ proto_register_gvrp(void) { static hf_register_info hf[] = { { &hf_gvrp_proto_id, - { "Protocol ID", "gvrp.protocol_id", + { "Protocol Identifier", "gvrp.protocol_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, @@ -316,22 +311,37 @@ proto_register_gvrp(void) { &hf_gvrp_attribute_value, { "Value", "gvrp.attribute_value", FT_UINT16, BASE_DEC, NULL, 0x0, - NULL, HFILL } - } + NULL, HFILL }, + }, + { &hf_gvrp_end_of_mark, + { "End of Mark", "gvrp.end_of_mark", + FT_NONE, BASE_NONE, NULL, 0x0, + NULL, HFILL }, + }, + }; + + static ei_register_info ei[] = { + { &ei_gvrp_proto_id, { "gvrp.protocol_id.unknown", PI_PROTOCOL, PI_WARN, "Warning: this version of Wireshark only knows about protocol id = 1", EXPFILL }}, }; + expert_module_t* expert_gvrp; + static gint *ett[] = { - &ett_gvrp + &ett_gvrp, + &ett_gvrp_message, + &ett_gvrp_attribute, }; + /* Register the protocol name and description for GVRP */ - proto_gvrp = proto_register_protocol("GARP VLAN Registration Protocol", - "GVRP", "gvrp"); + proto_gvrp = proto_register_protocol("GARP VLAN Registration Protocol", "GVRP", "gvrp"); /* Required function calls to register the header fields and subtrees * used by GVRP */ proto_register_field_array(proto_gvrp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_gvrp = expert_register_protocol(proto_gvrp); + expert_register_field_array(expert_gvrp, ei, array_length(ei)); register_dissector("gvrp", dissect_gvrp, proto_gvrp); } diff --git a/epan/dissectors/packet-h264.c b/epan/dissectors/packet-h264.c index ba63e29532..d439ae5b8d 100644 --- a/epan/dissectors/packet-h264.c +++ b/epan/dissectors/packet-h264.c @@ -155,6 +155,7 @@ static int hf_h264_sei_ms_layer_desc_cb = -1; /* Microsoft Bitstream SEI */ static int hf_h264_sei_ms_bitstream_ref_frame_cnt = -1; static int hf_h264_sei_ms_bitstream_num_nalus = -1; +static int hf_h264_sei_iso_sec_info = -1; /* Microsoft Crop SEI */ static int hf_h264_sei_ms_crop_num_data = -1; static int hf_h264_sei_ms_crop_info_type = -1; @@ -251,10 +252,13 @@ static int ett_h264_par_AdditionalModesSupported = -1; static int ett_h264_par_ProfileIOP = -1; static int ett_h264_ms_layer_description = -1; static int ett_h264_ms_crop_data = -1; +static int ett_h264_ni_mtap = -1; static expert_field ei_h264_undecoded = EI_INIT; static expert_field ei_h264_ms_layout_wrong_length = EI_INIT; static expert_field ei_h264_bad_nal_length = EI_INIT; +static expert_field ei_h264_nal_unit_type_reserved = EI_INIT; +static expert_field ei_h264_nal_unit_type_unspecified = EI_INIT; /* The dynamic payload type range which will be dissected as H.264 */ @@ -1434,7 +1438,7 @@ h264_user_data_unregistered(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo } else { - proto_tree_add_text(tree, tvb, offset, 16, "Unparsed iso_iec information"); + proto_tree_add_item(tree, hf_h264_sei_iso_sec_info, tvb, offset, 16, ENC_NA); /* for (i = 16; i < payloadSize; i++) * user_data_payload_byte 5 b(8) */ @@ -2238,6 +2242,7 @@ dissect_h264_nalu_extension (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo guint8 bit_offset = offset << 3; guint8 unit = 1; proto_item *item; + proto_tree *nimtap_tree; subtype = tvb_get_bits8(tvb, bit_offset, 5); j_flag = tvb_get_bits8(tvb, bit_offset+5, 1); @@ -2256,24 +2261,24 @@ dissect_h264_nalu_extension (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo /* Multi-Time Aggregation Packet (NI-MTAP) - RFC 6190 Section 4.7.1 */ while (tvb_reported_length_remaining(tvb, offset) > 0) { - proto_tree_add_text(tree, tvb, offset, 1, "NI-MTAP Unit %d", unit++); - proto_tree_add_item(tree, hf_h264_nalu_size, tvb, offset, 2, ENC_BIG_ENDIAN); + nimtap_tree = proto_tree_add_subtree_format(tree, tvb, offset, 1, ett_h264_ni_mtap, NULL, "NI-MTAP Unit %d", unit++); + proto_tree_add_item(nimtap_tree, hf_h264_nalu_size, tvb, offset, 2, ENC_BIG_ENDIAN); nal_unit_size = tvb_get_ntohs(tvb, offset); size_offset = offset; offset += 2; - proto_tree_add_item(tree, hf_h264_ts_offset16, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(nimtap_tree, hf_h264_ts_offset16, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; /* If J flag is set then DON is present in packet */ if (j_flag) { - proto_tree_add_item(tree, hf_h264_don, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(nimtap_tree, hf_h264_don, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; } if (nal_unit_size == 0 || tvb_reported_length_remaining(tvb, offset) < nal_unit_size) { /* Throw an exception if the size is wrong and don't try to decode the rest of the packet. */ col_append_fstr(pinfo->cinfo, COL_INFO, " [Bad NAL Length]"); - item = proto_tree_add_expert (tree, pinfo, &ei_h264_bad_nal_length, tvb, size_offset, 2); + item = proto_tree_add_expert (nimtap_tree, pinfo, &ei_h264_bad_nal_length, tvb, size_offset, 2); proto_item_append_text(item, " Size of %d, Remaining %d", nal_unit_size, tvb_reported_length_remaining(tvb, offset)); offset += tvb_reported_length_remaining(tvb, offset); @@ -2283,7 +2288,7 @@ dissect_h264_nalu_extension (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo /* Make a new subset of the existing buffer for the NAL unit */ nalu_tvb = tvb_new_subset(tvb, offset, tvb_captured_length_remaining(tvb, offset), nal_unit_size); /* Decode the NAL unit */ - dissect_h264(nalu_tvb, pinfo, tree); + dissect_h264(nalu_tvb, pinfo, nimtap_tree); offset += nal_unit_size; } } @@ -2297,7 +2302,7 @@ dissect_h264_nalu_extension (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo void dissect_h264_nal_unit(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) { - proto_item *item; + proto_item *item, *nal_item; proto_tree *h264_nal_tree; gint offset = 0; guint8 nal_unit_type; @@ -2326,7 +2331,7 @@ startover: /* nal_ref_idc All u(2) */ proto_tree_add_item(h264_nal_tree, hf_h264_nal_ref_idc, tvb, offset, 1, ENC_BIG_ENDIAN); /* nal_unit_type All u(5) */ - proto_tree_add_item(h264_nal_tree, hf_h264_nal_unit_type, tvb, offset, 1, ENC_BIG_ENDIAN); + nal_item = proto_tree_add_item(h264_nal_tree, hf_h264_nal_unit_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; switch (nal_unit_type) { @@ -2382,7 +2387,7 @@ startover: case 16: /* Reserved */ case 17: /* Reserved */ case 18: /* Reserved */ - proto_tree_add_text(h264_nal_tree, tvb, offset, -1, "Reserved NAL unit type"); + expert_add_info(pinfo, nal_item, &ei_h264_nal_unit_type_reserved); break; case 19: /* Coded slice of an auxiliary coded picture without partitioning */ dissect_h264_slice_layer_without_partitioning_rbsp(tree, tvb, pinfo, offset); @@ -2393,7 +2398,7 @@ startover: case 0: /* Unspecified */ default: /* 24..31 Unspecified */ - proto_tree_add_text(h264_nal_tree, tvb, offset, -1, "Unspecified NAL unit type"); + expert_add_info(pinfo, nal_item, &ei_h264_nal_unit_type_unspecified); break; } } @@ -3493,6 +3498,11 @@ proto_register_h264(void) FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_h264_sei_iso_sec_info, + { "Unparsed iso_iec information", "h264.sei.iso_sec_info", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, /* MS Crop SEI */ { &hf_h264_sei_ms_crop_num_data, { "Number of Data Entries", "h264.sei.ms.crop.num_data", @@ -3657,13 +3667,16 @@ proto_register_h264(void) &ett_h264_par_AdditionalModesSupported, &ett_h264_par_ProfileIOP, &ett_h264_ms_layer_description, - &ett_h264_ms_crop_data + &ett_h264_ms_crop_data, + &ett_h264_ni_mtap }; static ei_register_info ei[] = { { &ei_h264_undecoded, { "h264.undecoded", PI_UNDECODED, PI_WARN, "[Not decoded yet]", EXPFILL }}, { &ei_h264_ms_layout_wrong_length, { "h264.ms_layout.wrong_length", PI_PROTOCOL, PI_WARN, "[Wrong Layer Description Table Length]", EXPFILL }}, { &ei_h264_bad_nal_length, { "h264.bad_nalu_length", PI_MALFORMED, PI_ERROR, "[Bad NAL Unit Length]", EXPFILL }}, + { &ei_h264_nal_unit_type_reserved, { "h264.nal_unit_type.reserved", PI_PROTOCOL, PI_WARN, "Reserved NAL unit type", EXPFILL }}, + { &ei_h264_nal_unit_type_unspecified, { "h264.nal_unit_type.unspecified", PI_PROTOCOL, PI_WARN, "Unspecified NAL unit type", EXPFILL }}, }; /* Register the protocol name and description */ diff --git a/epan/dissectors/packet-manolito.c b/epan/dissectors/packet-manolito.c index d84fb963da..a8827db691 100644 --- a/epan/dissectors/packet-manolito.c +++ b/epan/dissectors/packet-manolito.c @@ -26,6 +26,8 @@ #include "config.h" #include +#include + void proto_register_manolito(void); void proto_reg_handoff_manolito(void); @@ -37,10 +39,14 @@ static int hf_manolito_src = -1; static int hf_manolito_dest = -1; static int hf_manolito_options_short = -1; static int hf_manolito_options = -1; +static int hf_manolito_string = -1; +static int hf_manolito_integer = -1; /* Initialize the subtree pointers */ static gint ett_manolito = -1; +static expert_field ei_manolito_type = EI_INIT; + /* Code to actually dissect the packets */ static void dissect_manolito(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) @@ -176,8 +182,8 @@ dissect_manolito(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (dtype == MANOLITO_STRING) { data[length] = 0; - proto_tree_add_text(manolito_tree, tvb, start, - offset - start, "%s (%s): %s", + proto_tree_add_string_format(manolito_tree, hf_manolito_string, tvb, start, + offset - start, data, "%s (%s): %s", (char*)field_name_str, longname, data); } else if (dtype == MANOLITO_INTEGER) { int n = 0; @@ -191,12 +197,13 @@ dissect_manolito(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case 2: n += data[1] << ((length - 2) * 8); case 1: n += data[0] << ((length - 1) * 8); } - proto_tree_add_text(manolito_tree, tvb, start, - offset - start, "%s (%s): %d", + ti = proto_tree_add_uint_format(manolito_tree, hf_manolito_integer, tvb, start, + 1, n, "%s (%s): %d", (char*)field_name_str, longname, n); + proto_item_set_len(ti, offset - start); } else { - proto_tree_add_text(manolito_tree, tvb, start, - offset - start, "unknown type %d", dtype); + proto_tree_add_expert_format(manolito_tree, pinfo, &ei_manolito_type, + tvb, start, offset - start, "Unknown type %d", dtype); } } while(offset < tvb_reported_length(tvb)); @@ -248,17 +255,34 @@ proto_register_manolito(void) FT_UINT32, BASE_HEX, NULL, 0, "Packet-dependent data", HFILL } }, + { &hf_manolito_string, + { "String field", "manolito.string", + FT_STRING, BASE_NONE, NULL, 0, + NULL, HFILL } + }, + { &hf_manolito_integer, + { "Integer field", "manolito.integer", + FT_UINT32, BASE_DEC, NULL, 0, + NULL, HFILL } + }, }; static gint *ett[] = { &ett_manolito, }; - proto_manolito = proto_register_protocol("Blubster/Piolet MANOLITO Protocol", - "Manolito", "manolito"); + static ei_register_info ei[] = { + { &ei_manolito_type, { "manolito.type.unknown", PI_PROTOCOL, PI_WARN, "Unknown type", EXPFILL }}, + }; + + expert_module_t* expert_manolito; + + proto_manolito = proto_register_protocol("Blubster/Piolet MANOLITO Protocol", "Manolito", "manolito"); proto_register_field_array(proto_manolito, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_manolito = expert_register_protocol(proto_manolito); + expert_register_field_array(expert_manolito, ei, array_length(ei)); } diff --git a/epan/dissectors/packet-rtp.c b/epan/dissectors/packet-rtp.c index 413fcf4484..8105ae0587 100644 --- a/epan/dissectors/packet-rtp.c +++ b/epan/dissectors/packet-rtp.c @@ -58,6 +58,7 @@ #include #include +#include #include "packet-rtp.h" @@ -250,6 +251,7 @@ static gint ett_rtp_rfc2198_hdr = -1; /* SRTP fields */ static int hf_srtp_encrypted_payload = -1; +/* static int hf_srtp_null_encrypted_payload = -1; */ static int hf_srtp_mki = -1; static int hf_srtp_auth_tag = -1; @@ -261,6 +263,9 @@ static int hf_pkt_ccc_ts = -1; /* PacketCable CCC field defining a sub tree */ static gint ett_pkt_ccc = -1; +static expert_field ei_rtp_fragment_unfinished = EI_INIT; +static expert_field ei_rtp_padding_missing = EI_INIT; + /* PacketCable CCC port preference */ static guint global_pkt_ccc_udp_port = 0; @@ -1413,7 +1418,7 @@ process_rtp_payload(tvbuff_t *newtvb, packet_info *pinfo, proto_tree *tree, #error Currently the srtp_info structure contains no cipher data, see packet-sdp.c adding dummy_srtp_info structure if (p_conv_data->srtp_info->encryption_algorithm==SRTP_ENC_ALG_NULL) { if (rtp_tree) - proto_tree_add_text(rtp_tree, newtvb, offset, payload_len, "SRTP Payload with NULL encryption"); + proto_tree_add_item(rtp_tree, hf_srtp_null_encrypted_payload, newtvb, offset, payload_len, ENC_NA); } else #endif @@ -1681,7 +1686,7 @@ dissect_rtp_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g_debug("\tUnfinished fragment"); #endif /* this fragment is never reassembled */ - proto_tree_add_text( tree, tvb, deseg_offset, -1,"RTP fragment, unfinished"); + proto_tree_add_expert(tree, pinfo, &ei_rtp_fragment_unfinished, tvb, deseg_offset, -1); } } else @@ -2247,8 +2252,7 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ * tree, and just put in a raw data * item. */ - if ( tree ) proto_tree_add_text(rtp_tree, tvb, 0, 0, - "Frame has padding, but not all the frame data was captured"); + proto_tree_add_expert(rtp_tree, pinfo, &ei_rtp_padding_missing, tvb, 0, 0); call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, rtp_tree); @@ -3570,6 +3574,13 @@ proto_register_rtp(void) FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, +#if 0 + {&hf_srtp_null_encrypted_payload, + {"SRTP Payload with NULL encryption", "srtp.null_enc_payload", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, +#endif {&hf_srtp_mki, {"SRTP MKI", "srtp.mki", FT_BYTES, BASE_NONE, NULL, 0x0, @@ -3599,13 +3610,20 @@ proto_register_rtp(void) &ett_rtp_fragments }; - module_t *rtp_module; + static ei_register_info ei[] = { + { &ei_rtp_fragment_unfinished, { "rtp.fragment_unfinished", PI_REASSEMBLE, PI_CHAT, "RTP fragment, unfinished", EXPFILL }}, + { &ei_rtp_padding_missing, { "rtp.padding_missing", PI_MALFORMED, PI_ERROR, "Frame has padding, but not all the frame data was captured", EXPFILL }}, + }; + module_t *rtp_module; + expert_module_t *expert_rtp; proto_rtp = proto_register_protocol("Real-Time Transport Protocol", "RTP", "rtp"); proto_register_field_array(proto_rtp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_rtp = expert_register_protocol(proto_rtp); + expert_register_field_array(expert_rtp, ei, array_length(ei)); new_register_dissector("rtp", dissect_rtp, proto_rtp); register_dissector("rtp.rfc2198", dissect_rtp_rfc2198, proto_rtp); diff --git a/epan/dissectors/packet-sctp.c b/epan/dissectors/packet-sctp.c index 3e3e65bb68..63ee244a38 100644 --- a/epan/dissectors/packet-sctp.c +++ b/epan/dissectors/packet-sctp.c @@ -1306,7 +1306,7 @@ sctp_ack(packet_info *pinfo, tvbuff_t *tvb, proto_tree *acks_tree, ack_tree(t, acks_tree, tvb, pinfo); } /* else { - proto_tree_add_text(acks_tree, tvb, 0 , 0, "Assoc: %p vs %p ?? %ld",h,h->peer,tsn); + proto_tree_add_debug_text(acks_tree, tvb, 0 , 0, "Assoc: %p vs %p ?? %ld",h,h->peer,tsn); } */ } diff --git a/epan/dissectors/packet-spdy.c b/epan/dissectors/packet-spdy.c index 69050b8e7a..b9a0277dfa 100644 --- a/epan/dissectors/packet-spdy.c +++ b/epan/dissectors/packet-spdy.c @@ -236,6 +236,7 @@ static expert_field ei_spdy_mal_setting_frame = EI_INIT; static expert_field ei_spdy_invalid_rst_stream = EI_INIT; static expert_field ei_spdy_invalid_go_away = EI_INIT; static expert_field ei_spdy_invalid_frame_type = EI_INIT; +static expert_field ei_spdy_reassembly_info = EI_INIT; static dissector_handle_t data_handle; static dissector_handle_t media_handle; @@ -814,7 +815,6 @@ static int dissect_spdy_data_payload(tvbuff_t *tvb, */ tvbuff_t *uncomp_tvb = NULL; proto_item *e_ti = NULL; - proto_item *ce_ti = NULL; proto_tree *e_tree = NULL; if (spdy_decompress_body && @@ -835,21 +835,23 @@ static int dissect_spdy_data_payload(tvbuff_t *tvb, wmem_list_t *dflist = si->data_frames; wmem_list_frame_t *frame_item; spdy_data_frame_t *df; - guint32 framenum; - ce_ti = proto_tree_add_text(e_tree, data_tvb, 0, - tvb_reported_length(data_tvb), - "Assembled from %d frames in packet(s)", - si->num_data_frames); - framenum = 0; + guint32 framenum = 0; + wmem_strbuf_t *str_frames = wmem_strbuf_new(wmem_packet_scope(), ""); + frame_item = wmem_list_frame_next(wmem_list_head(dflist)); while (frame_item != NULL) { df = (spdy_data_frame_t *)wmem_list_frame_data(frame_item); if (framenum != df->framenum) { - proto_item_append_text(ce_ti, " #%u", df->framenum); + wmem_strbuf_append_printf(str_frames, " #%u", df->framenum); framenum = df->framenum; } frame_item = wmem_list_frame_next(frame_item); } + + proto_tree_add_expert_format(e_tree, pinfo, &ei_spdy_reassembly_info, data_tvb, 0, + tvb_reported_length(data_tvb), + "Assembled from %d frames in packet(s)%s", + si->num_data_frames, wmem_strbuf_get_str(str_frames)); } if (uncomp_tvb != NULL) { @@ -1894,6 +1896,7 @@ void proto_register_spdy(void) { &ei_spdy_invalid_rst_stream, { "spdy.rst_stream.invalid", PI_PROTOCOL, PI_WARN, "Invalid status code for RST_STREAM", EXPFILL }}, { &ei_spdy_invalid_go_away, { "spdy.goaway.invalid", PI_PROTOCOL, PI_WARN, "Invalid status code for GOAWAY", EXPFILL }}, { &ei_spdy_invalid_frame_type, { "spdy.type.invalid", PI_PROTOCOL, PI_WARN, "Invalid SPDY frame type", EXPFILL }}, + { &ei_spdy_reassembly_info, { "spdy.reassembly_info", PI_REASSEMBLE, PI_CHAT, "Assembled from frames in packet(s)", EXPFILL }}, }; module_t *spdy_module; diff --git a/epan/dissectors/packet-stun.c b/epan/dissectors/packet-stun.c index 92359779e5..50c8c2f186 100644 --- a/epan/dissectors/packet-stun.c +++ b/epan/dissectors/packet-stun.c @@ -714,18 +714,11 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboole ti = proto_tree_add_uint_format_value(stun_tree, hf_stun_type, tvb, 0, 2, msg_type, "0x%04x (%s %s)", msg_type, msg_method_str, msg_class_str); stun_type_tree = proto_item_add_subtree(ti, ett_stun_type); - proto_tree_add_uint(stun_type_tree, hf_stun_type_class, tvb, 0, 2, msg_type); - ti = proto_tree_add_text(stun_type_tree, tvb, 0, 2, "%s (%d)", msg_class_str, msg_type_class); - PROTO_ITEM_SET_GENERATED(ti); - proto_tree_add_uint(stun_type_tree, hf_stun_type_method, tvb, 0, 2, msg_type); - ti = proto_tree_add_text(stun_type_tree, tvb, 0, 2, "%s (0x%03x)", msg_method_str, msg_type_method); - PROTO_ITEM_SET_GENERATED(ti); + ti = proto_tree_add_uint(stun_type_tree, hf_stun_type_class, tvb, 0, 2, msg_type); + proto_item_append_text(ti, " %s (%d)", msg_class_str, msg_type_class); + ti = proto_tree_add_uint(stun_type_tree, hf_stun_type_method, tvb, 0, 2, msg_type); + proto_item_append_text(ti, " %s (0x%03x)", msg_method_str, msg_type_method); proto_tree_add_uint(stun_type_tree, hf_stun_type_method_assignment, tvb, 0, 2, msg_type); - ti = proto_tree_add_text(stun_type_tree, tvb, 0, 2, - "%s (%d)", - val_to_str((msg_type & 0x2000) >> 13, assignments, "Unknown: 0x%x"), - (msg_type & 0x2000) >> 13); - PROTO_ITEM_SET_GENERATED(ti); proto_tree_add_item(stun_tree, hf_stun_length, tvb, 2, 2, ENC_BIG_ENDIAN); proto_tree_add_item(stun_tree, hf_stun_cookie, tvb, 4, 4, ENC_NA); @@ -755,17 +748,7 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboole offset, 2, att_type); att_type_tree = proto_item_add_subtree(ti, ett_stun_att_type); proto_tree_add_uint(att_type_tree, hf_stun_att_type_comprehension, tvb, offset, 2, att_type); - ti = proto_tree_add_text(att_type_tree, tvb, offset, 2, - "%s (%d)", - val_to_str((att_type & 0x8000) >> 15, comprehensions, "Unknown: %d"), - (att_type & 0x8000) >> 15); - PROTO_ITEM_SET_GENERATED(ti); proto_tree_add_uint(att_type_tree, hf_stun_att_type_assignment, tvb, offset, 2, att_type); - ti = proto_tree_add_text(att_type_tree, tvb, offset, 2, - "%s (%d)", - val_to_str((att_type & 0x4000) >> 14, assignments, "Unknown: %d"), - (att_type & 0x4000) >> 14); - PROTO_ITEM_SET_GENERATED(ti); if ((offset+ATTR_HDR_LEN+att_length) > (STUN_HDR_LEN+msg_length)) { proto_tree_add_uint_format_value(att_tree, @@ -1314,7 +1297,7 @@ proto_register_stun(void) }, { &hf_stun_type_method_assignment, { "Message Method Assignment", "stun.type.method-assignment", FT_UINT16, - BASE_HEX, NULL, 0x2000, NULL, HFILL } + BASE_HEX, VALS(assignments), 0x2000, NULL, HFILL } }, { &hf_stun_length, { "Message Length", "stun.length", FT_UINT16, @@ -1359,11 +1342,11 @@ proto_register_stun(void) }, { &hf_stun_att_type_comprehension, { "Attribute Type Comprehension", "stun.att.type.comprehension", FT_UINT16, - BASE_HEX, NULL, 0x8000, NULL, HFILL } + BASE_HEX, VALS(comprehensions), 0x8000, NULL, HFILL } }, { &hf_stun_att_type_assignment, { "Attribute Type Assignment", "stun.att.type.assignment", FT_UINT16, - BASE_HEX, NULL, 0x4000, NULL, HFILL } + BASE_HEX, VALS(assignments), 0x4000, NULL, HFILL } }, { &hf_stun_att_length, { "Attribute Length", "stun.att.length", FT_UINT16, diff --git a/epan/dissectors/packet-sua.c b/epan/dissectors/packet-sua.c index 6f32185951..634e44b558 100644 --- a/epan/dissectors/packet-sua.c +++ b/epan/dissectors/packet-sua.c @@ -312,6 +312,8 @@ static int hf_sua_sequence_number_more_data_bit = -1; static int hf_sua_receive_sequence_number_reserved = -1; static int hf_sua_receive_sequence_number_number = -1; static int hf_sua_receive_sequence_number_spare_bit = -1; +static int hf_sua_protocol_classes = -1; +static int hf_sua_protocol_class_flags = -1; static int hf_sua_asp_capabilities_reserved = -1; static int hf_sua_asp_capabilities_reserved_bits = -1; static int hf_sua_asp_capabilities_a_bit =-1; @@ -333,6 +335,7 @@ static int hf_sua_protocol_class_reserved = -1; static int hf_sua_return_on_error_bit = -1; static int hf_sua_protocol_class = -1; static int hf_sua_sequence_control = -1; +static int hf_sua_first_remaining = -1; static int hf_sua_first_bit = -1; static int hf_sua_number_of_remaining_segments = -1; static int hf_sua_segmentation_reference = -1; @@ -1109,17 +1112,17 @@ static const value_string interworking_values[] = { static void dissect_asp_capabilities_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree) { - proto_item *protocol_classes_item; - proto_tree *protocol_classes_tree; + static const int * capabilities[] = { + &hf_sua_asp_capabilities_reserved_bits, + &hf_sua_asp_capabilities_a_bit, + &hf_sua_asp_capabilities_b_bit, + &hf_sua_asp_capabilities_c_bit, + &hf_sua_asp_capabilities_d_bit, + NULL + }; proto_tree_add_item(parameter_tree, hf_sua_asp_capabilities_reserved, parameter_tvb, PARAMETER_VALUE_OFFSET, RESERVED_2_LENGTH, ENC_NA); - protocol_classes_item = proto_tree_add_text(parameter_tree, parameter_tvb, PROTOCOL_CLASSES_OFFSET, PROTOCOL_CLASSES_LENGTH, "Protocol classes"); - protocol_classes_tree = proto_item_add_subtree(protocol_classes_item, ett_sua_protcol_classes); - proto_tree_add_item(protocol_classes_tree, hf_sua_asp_capabilities_reserved_bits, parameter_tvb, PROTOCOL_CLASSES_OFFSET, PROTOCOL_CLASSES_LENGTH, ENC_BIG_ENDIAN); - proto_tree_add_item(protocol_classes_tree, hf_sua_asp_capabilities_a_bit, parameter_tvb, PROTOCOL_CLASSES_OFFSET, PROTOCOL_CLASSES_LENGTH, ENC_BIG_ENDIAN); - proto_tree_add_item(protocol_classes_tree, hf_sua_asp_capabilities_b_bit, parameter_tvb, PROTOCOL_CLASSES_OFFSET, PROTOCOL_CLASSES_LENGTH, ENC_BIG_ENDIAN); - proto_tree_add_item(protocol_classes_tree, hf_sua_asp_capabilities_c_bit, parameter_tvb, PROTOCOL_CLASSES_OFFSET, PROTOCOL_CLASSES_LENGTH, ENC_BIG_ENDIAN); - proto_tree_add_item(protocol_classes_tree, hf_sua_asp_capabilities_d_bit, parameter_tvb, PROTOCOL_CLASSES_OFFSET, PROTOCOL_CLASSES_LENGTH, ENC_BIG_ENDIAN); + proto_tree_add_bitmask(parameter_tree, parameter_tvb, PROTOCOL_CLASSES_OFFSET, hf_sua_protocol_classes, ett_sua_protcol_classes, capabilities, ENC_BIG_ENDIAN); proto_tree_add_item(parameter_tree, hf_sua_asp_capabilities_interworking, parameter_tvb, INTERWORKING_OFFSET, INTERWORKING_LENGTH, ENC_BIG_ENDIAN); } @@ -1281,16 +1284,14 @@ static const true_false_string return_on_error_bit_value = { static void dissect_protocol_class_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item) { - proto_item *protocol_class_item; - proto_tree *protocol_class_tree; + static const int * capabilities[] = { + &hf_sua_return_on_error_bit, + &hf_sua_protocol_class, + NULL + }; proto_tree_add_item(parameter_tree, hf_sua_protocol_class_reserved, parameter_tvb, PARAMETER_VALUE_OFFSET, RESERVED_3_LENGTH, ENC_NA); - - protocol_class_item = proto_tree_add_text(parameter_tree, parameter_tvb, PROTOCOL_CLASS_OFFSET, PROTOCOL_CLASS_LENGTH, "Protocol Class"); - protocol_class_tree = proto_item_add_subtree(protocol_class_item, ett_sua_return_on_error_bit_and_protocol_class); - - proto_tree_add_item(protocol_class_tree, hf_sua_return_on_error_bit, parameter_tvb, PROTOCOL_CLASS_OFFSET, PROTOCOL_CLASS_LENGTH, ENC_BIG_ENDIAN); - proto_tree_add_item(protocol_class_tree, hf_sua_protocol_class, parameter_tvb, PROTOCOL_CLASS_OFFSET, PROTOCOL_CLASS_LENGTH, ENC_BIG_ENDIAN); + proto_tree_add_bitmask(parameter_tree, parameter_tvb, PROTOCOL_CLASS_OFFSET, hf_sua_protocol_class_flags, ett_sua_return_on_error_bit_and_protocol_class, capabilities, ENC_BIG_ENDIAN); proto_item_append_text(parameter_item, " (%d)", tvb_get_guint8(parameter_tvb, PROTOCOL_CLASS_OFFSET) & PROTOCOL_CLASS_MASK); } @@ -1320,13 +1321,13 @@ static const true_false_string first_bit_value = { static void dissect_segmentation_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree) { - proto_item *first_remaining_item; - proto_tree *first_remaining_tree; + static const int * first_remaining[] = { + &hf_sua_first_bit, + &hf_sua_number_of_remaining_segments, + NULL + }; - first_remaining_item = proto_tree_add_text(parameter_tree, parameter_tvb, FIRST_REMAINING_OFFSET, FIRST_REMAINING_LENGTH, "First / Remaining"); - first_remaining_tree = proto_item_add_subtree(first_remaining_item, ett_sua_first_remaining); - proto_tree_add_item(first_remaining_tree, hf_sua_first_bit, parameter_tvb, FIRST_REMAINING_OFFSET, FIRST_REMAINING_LENGTH, ENC_BIG_ENDIAN); - proto_tree_add_item(first_remaining_tree, hf_sua_number_of_remaining_segments, parameter_tvb, FIRST_REMAINING_OFFSET, FIRST_REMAINING_LENGTH, ENC_BIG_ENDIAN); + proto_tree_add_bitmask(parameter_tree, parameter_tvb, FIRST_REMAINING_OFFSET, hf_sua_first_remaining, ett_sua_first_remaining, first_remaining, ENC_BIG_ENDIAN); proto_tree_add_item(parameter_tree, hf_sua_segmentation_reference, parameter_tvb, SEGMENTATION_REFERENCE_OFFSET, SEGMENTATION_REFERENCE_LENGTH, ENC_BIG_ENDIAN); } @@ -2218,10 +2219,10 @@ dissect_sua_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *sua_t PROTO_ITEM_SET_GENERATED(assoc_item); #if 0 assoc_tree = proto_item_add_subtree(assoc_item, ett_sua_assoc); - proto_tree_add_text(assoc_tree, message_tvb, 0, 0, "routing_ind %u", assoc->calling_routing_ind); - proto_tree_add_text(assoc_tree, message_tvb, 0, 0, "routing_ind %u", assoc->called_routing_ind); - proto_tree_add_text(assoc_tree, message_tvb, 0, 0, "calling_ssn %u", assoc->calling_ssn); - proto_tree_add_text(assoc_tree, message_tvb, 0, 0, "called_ssn %u", assoc->called_ssn); + proto_tree_add_debug_text(assoc_tree, message_tvb, 0, 0, "routing_ind %u", assoc->calling_routing_ind); + proto_tree_add_debug_text(assoc_tree, message_tvb, 0, 0, "routing_ind %u", assoc->called_routing_ind); + proto_tree_add_debug_text(assoc_tree, message_tvb, 0, 0, "calling_ssn %u", assoc->calling_ssn); + proto_tree_add_debug_text(assoc_tree, message_tvb, 0, 0, "called_ssn %u", assoc->called_ssn); #endif /* 0 */ } @@ -2392,6 +2393,8 @@ proto_register_sua(void) { &hf_sua_receive_sequence_number_number, { "Receive Sequence Number P(R)", "sua.receive_sequence_number_number", FT_UINT8, BASE_DEC, NULL, SEQ_NUM_MASK, NULL, HFILL } }, { &hf_sua_receive_sequence_number_spare_bit, { "Spare Bit", "sua.receive_sequence_number_spare_bit", FT_UINT8, BASE_DEC, NULL, SPARE_BIT_MASK, NULL, HFILL } }, { &hf_sua_asp_capabilities_reserved, { "Reserved", "sua.asp_capabilities_reserved", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { &hf_sua_protocol_classes, { "Protocol classes", "sua.protocol_classes", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + { &hf_sua_protocol_class_flags, { "Protocol class", "sua.protocol_class_flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_sua_asp_capabilities_reserved_bits, { "Reserved Bits", "sua.asp_capabilities_reserved_bits", FT_UINT8, BASE_HEX, NULL, RESERVED_BITS_MASK, NULL, HFILL } }, { &hf_sua_asp_capabilities_a_bit, { "Protocol Class 3", "sua.asp_capabilities_a_bit", FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), A_BIT_MASK, NULL, HFILL } }, { &hf_sua_asp_capabilities_b_bit, { "Protocol Class 2", "sua.asp_capabilities_b_bit", FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), B_BIT_MASK, NULL, HFILL } }, @@ -2412,6 +2415,7 @@ proto_register_sua(void) { &hf_sua_return_on_error_bit, { "Return On Error Bit", "sua.protocol_class_return_on_error_bit", FT_BOOLEAN, 8, TFS(&return_on_error_bit_value), RETURN_ON_ERROR_BIT_MASK, NULL, HFILL } }, { &hf_sua_protocol_class, { "Protocol Class", "sua.protocol_class_class", FT_UINT8, BASE_DEC, NULL, PROTOCOL_CLASS_MASK, NULL, HFILL } }, { &hf_sua_sequence_control, { "Sequence Control", "sua.sequence_control_sequence_control", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_sua_first_remaining, { "First / Remaining", "sua.first_remaining", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_sua_first_bit, { "First Segment Bit", "sua.segmentation_first_bit", FT_BOOLEAN, 8, TFS(&first_bit_value), FIRST_BIT_MASK, NULL, HFILL } }, { &hf_sua_number_of_remaining_segments, { "Number of Remaining Segments", "sua.segmentation_number_of_remaining_segments", FT_UINT8, BASE_DEC, NULL, NUMBER_OF_SEGMENTS_MASK, NULL, HFILL } }, { &hf_sua_segmentation_reference, { "Segmentation Reference", "sua.segmentation_reference", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL } }, diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index b8dbeea2d5..d788d43e20 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -2453,7 +2453,7 @@ tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, PROTO_ITEM_SET_GENERATED(item); #if 0 } else { - item = proto_tree_add_text((proto_tree *)p_get_proto_data(pinfo->pool, pinfo, proto_tcp, pinfo->curr_layer_num), + item = proto_tree_add_expert_format((proto_tree *)p_get_proto_data(pinfo->pool, pinfo, proto_tcp, pinfo->curr_layer_num), tvb, offset, -1, "PDU Size: %u cut short at %u",plen,captured_length_remaining); PROTO_ITEM_SET_GENERATED(item); -- cgit v1.2.3