diff options
author | Michael Mann <mmann78@netscape.net> | 2014-08-03 21:10:24 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2014-08-05 07:36:26 +0000 |
commit | 9d5f9141af289d3d8b253907eaaae101da1bd9fd (patch) | |
tree | 4d2816511482c04e3e8af66bd6251f5f7ce2dc2f /epan | |
parent | edbb9edf3928e79b41f9b84d2399205810febef2 (diff) |
Eliminate proto_tree_add_text from some dissectors.
Other minor cleanup while in the area.
Change-Id: Id8d957d3d68a2e3dd5089f490bd59d773e1be967
Reviewed-on: https://code.wireshark.org/review/3427
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: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan')
25 files changed, 306 insertions, 259 deletions
diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common index 2e1050dc1e..758fab6654 100644 --- a/epan/dissectors/Makefile.common +++ b/epan/dissectors/Makefile.common @@ -1422,7 +1422,6 @@ DISSECTOR_INCLUDES = \ packet-dcom.h \ packet-dcom-dispatch.h \ packet-dcm.h \ - packet-ddtp.h \ packet-diameter.h \ packet-diffserv-mpls-common.h \ packet-disp.h \ diff --git a/epan/dissectors/packet-daap.c b/epan/dissectors/packet-daap.c index f449ee9d8d..47d979480d 100644 --- a/epan/dissectors/packet-daap.c +++ b/epan/dissectors/packet-daap.c @@ -441,15 +441,15 @@ dissect_daap_one_tag(proto_tree *tree, tvbuff_t *tvb) while ((offset >= 0) && (offset < reported_length)) { tagname = tvb_get_ntohl(tvb, offset); tagsize = tvb_get_ntohl(tvb, offset+4); - ti = proto_tree_add_text(tree, tvb, offset, 8, + new_tree = proto_tree_add_subtree_format(tree, tvb, offset, 8, ett_daap_sub, &ti, "Tag: %-40s %3u byte%c", val_to_str_ext(tagname, &vals_tag_code_ext, "Unknown tag (0x%0x)"), tagsize, plurality(tagsize, ' ', 's')); - ti2 = proto_tree_add_item(tree, hf_daap_name, tvb, offset, 4, ENC_ASCII|ENC_NA); + ti2 = proto_tree_add_item(new_tree, hf_daap_name, tvb, offset, 4, ENC_ASCII|ENC_NA); PROTO_ITEM_SET_HIDDEN(ti2); - ti2 = proto_tree_add_item(tree, hf_daap_size, tvb, offset+4, 4, ENC_BIG_ENDIAN); + ti2 = proto_tree_add_item(new_tree, hf_daap_size, tvb, offset+4, 4, ENC_BIG_ENDIAN); PROTO_ITEM_SET_HIDDEN(ti2); offset += 8; @@ -459,10 +459,10 @@ dissect_daap_one_tag(proto_tree *tree, tvbuff_t *tvb) if (tagsize <= (unsigned)len) { len = tagsize; } - proto_item_set_len(ti, 8+len); /* *Now* it's Ok to set the length. */ - /* (Done here so that the proto_tree_add_text */ - /* above will show tag and tagsize even if */ - /* tagsize is very large). */ + proto_item_set_len(ti, 8+len); /* *Now* it's Ok to set the length. */ + /* (Done here so that the proto_tree_add_subtree */ + /* above will show tag and tagsize even if */ + /* tagsize is very large). */ switch (tagname) { case daap_mcon: case daap_msrv: @@ -490,7 +490,6 @@ dissect_daap_one_tag(proto_tree *tree, tvbuff_t *tvb) case dacp_cmgt: case dacp_cmst: /* Container tags */ - new_tree = proto_item_add_subtree(ti, ett_daap_sub); new_tvb = tvb_new_subset_length(tvb, offset, len); /* Use a new tvb so bounds checking */ /* works Ok when dissecting container. */ /* Note: len is within tvb; checked above. */ diff --git a/epan/dissectors/packet-daytime.c b/epan/dissectors/packet-daytime.c index 6666b2d743..d3b09f4763 100644 --- a/epan/dissectors/packet-daytime.c +++ b/epan/dissectors/packet-daytime.c @@ -34,6 +34,8 @@ void proto_reg_handoff_daytime(void); static dissector_handle_t daytime_handle; +static const true_false_string tfs_response_request = { "Response", "Request" }; + static header_field_info *hfi_daytime = NULL; #define DAYTIME_HFI_INIT HFI_INIT(proto_daytime) @@ -43,6 +45,11 @@ static header_field_info hfi_daytime_string DAYTIME_HFI_INIT = FT_STRING, BASE_NONE, NULL, 0x0, "String containing time and date", HFILL }; +static header_field_info hfi_response_request DAYTIME_HFI_INIT = + { "Type", "daytime.string", + FT_BOOLEAN, 8, TFS(&tfs_response_request), 0x0, + NULL, HFILL }; + static gint ett_daytime = -1; /* This dissector works for TCP and UDP daytime packets */ @@ -64,8 +71,7 @@ dissect_daytime(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ti = proto_tree_add_item(tree, hfi_daytime, tvb, 0, -1, ENC_NA); daytime_tree = proto_item_add_subtree(ti, ett_daytime); - proto_tree_add_text(daytime_tree, tvb, 0, 0, - pinfo->srcport==DAYTIME_PORT ? "Type: Response":"Type: Request"); + proto_tree_add_boolean(daytime_tree, &hfi_response_request, tvb, 0, 0, pinfo->srcport==DAYTIME_PORT); if (pinfo->srcport == DAYTIME_PORT) { proto_tree_add_item(daytime_tree, &hfi_daytime_string, tvb, 0, -1, ENC_ASCII|ENC_NA); } @@ -78,6 +84,7 @@ proto_register_daytime(void) #ifndef HAVE_HFI_SECTION_INIT static header_field_info *hfi[] = { &hfi_daytime_string, + &hfi_response_request, }; #endif diff --git a/epan/dissectors/packet-dcm.c b/epan/dissectors/packet-dcm.c index 64713ee757..4c79d825f4 100644 --- a/epan/dissectors/packet-dcm.c +++ b/epan/dissectors/packet-dcm.c @@ -6273,67 +6273,60 @@ dissect_dcm_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, Display the information we collected so far. Don't wait until the value is parsed, because that parsing might cause an exception. If that happens within a sequence, the sequence tag would not show up with the value + + Use different ett_ for Sequences & Items, so that fold/unfold state makes sense */ tag_summary = dcm_tag_summary(grp, elm, vl, tag_def->description, vr, tag_def->is_retired, is_implicit); - - if (vl == 0xFFFFFFFF) { - /* 'Just' mark header as the length of the item */ - tag_pitem = proto_tree_add_text(tree, tvb, offset_tag, offset - offset_tag, "%s", tag_summary); - vl_max = 0; /* We don't know who long this sequence/item is */ - } - else if (offset + vl <= endpos) { - /* Show real length of item */ - tag_pitem = proto_tree_add_text(tree, tvb, offset_tag, offset + vl - offset_tag, "%s", tag_summary); - vl_max = vl; - } - else { - /* Value is longer than what we have in the PDV, -> we do have a OPEN tag */ - tag_pitem = proto_tree_add_text(tree, tvb, offset_tag, endpos - offset_tag, "%s", tag_summary); - vl_max = endpos - offset; - } - is_sequence = (strcmp(vr, "SQ") == 0) || (vl == 0xFFFFFFFF); is_item = ((grp == 0xFFFE) && (elm == 0xE000)); + if (vl == 0xFFFFFFFF) { + /* 'Just' mark header as the length of the item */ + tag_ptree = proto_tree_add_subtree(tree, tvb, offset_tag, offset - offset_tag, + is_item ? ett_dcm_data_item : ett_dcm_data_seq, &tag_pitem, tag_summary); + vl_max = 0; /* We don't know who long this sequence/item is */ + } + else if (offset + vl <= endpos) { + /* Show real length of item */ + tag_ptree = proto_tree_add_subtree(tree, tvb, offset_tag, offset + vl - offset_tag, + is_item ? ett_dcm_data_item : ett_dcm_data_seq, &tag_pitem, tag_summary); + vl_max = vl; + } + else { + /* Value is longer than what we have in the PDV, -> we do have a OPEN tag */ + tag_ptree = proto_tree_add_subtree(tree, tvb, offset_tag, endpos - offset_tag, + is_item ? ett_dcm_data_item : ett_dcm_data_seq, &tag_pitem, tag_summary); + vl_max = endpos - offset; + } /* If you are going to touch the following 25 lines, make sure you reserve a few hours to go through both display options and check for proper tree display :-) */ - if (is_sequence | is_item) { - - if (global_dcm_seq_subtree) { - /* Use different ett_ for Sequences & Items, so that fold/unfold state makes sense */ - seq_ptree = proto_item_add_subtree(tag_pitem, (is_sequence ? ett_dcm_data_seq : ett_dcm_data_item)); - if (global_dcm_tag_subtree) - tag_ptree = seq_ptree; - else - tag_ptree = NULL; + if (is_sequence | is_item) { + + if (global_dcm_seq_subtree) { + if (!global_dcm_tag_subtree) + tag_ptree = NULL; + } + else { + seq_ptree = tree; + if (!global_dcm_tag_subtree) { + tag_ptree = NULL; + } + } } else { - seq_ptree = tree; - if (global_dcm_tag_subtree) { - tag_ptree = proto_item_add_subtree(tag_pitem, ett_dcm_data_tag); - } - else { + /* For tags */ + if (!global_dcm_tag_subtree) { tag_ptree = NULL; - } - } - } - else { - /* For tags */ - if (global_dcm_tag_subtree) { - tag_ptree = proto_item_add_subtree(tag_pitem, ett_dcm_data_tag); - } - else { - tag_ptree = NULL; + } } - } - /* --------------------------------------------------------------- + /* --------------------------------------------------------------- Tag details as separate items --------------------------------------------------------------- - */ + */ proto_tree_add_uint_format_value(tag_ptree, hf_dcm_tag, tvb, offset_tag, 4, (grp << 16) | elm, "%04x,%04x (%s)", grp, elm, tag_def->description); diff --git a/epan/dissectors/packet-ddtp.c b/epan/dissectors/packet-ddtp.c index 5ac9ed54ba..2a91594541 100644 --- a/epan/dissectors/packet-ddtp.c +++ b/epan/dissectors/packet-ddtp.c @@ -26,7 +26,30 @@ #include <glib.h> #include <epan/packet.h> -#include "packet-ddtp.h" +#include <epan/expert.h> + +#define DDTP_VERSION_ERROR 0 +#define DDTP_VERSION_4 1 +#define DDTP_VERSION_5 2 + +#define DDTP_ENCRYPT_ERROR 0 +#define DDTP_ENCRYPT_PLAINTEXT 1 +#define DDTP_ENCRYPT_BLOWFISH 2 + +#define DDTP_MESSAGE_ERROR 0 +#define DDTP_UPDATE_QUERY 1 +#define DDTP_UPDATE_REPLY 2 +#define DDTP_ALIVE_QUERY 3 +#define DDTP_ALIVE_REPLY 4 + +#define DDTP_MARK_ONLINE 0 +#define DDTP_MARK_OFFLINE 1 + +#define DDTP_UPDATE_SUCCEEDED 0 +#define DDTP_UPDATE_FAILED 1 +#define DDTP_INVALID_PASSWORD 2 +#define DDTP_INVALID_ACCOUNT 3 +#define DDTP_INVALID_OPCODE 4 void proto_register_ddtp (void); void proto_reg_handoff_ddtp (void); @@ -39,9 +62,12 @@ static int hf_ddtp_msgtype = -1; static int hf_ddtp_opcode = -1; static int hf_ddtp_ipaddr = -1; static int hf_ddtp_status = -1; +static int hf_ddtp_alive = -1; static int ett_ddtp = -1; +static expert_field ei_ddtp_msgtype = EI_INIT; + #define UDP_PORT_DDTP 1052 /* @@ -90,73 +116,56 @@ static const value_string vals_ddtp_status[] = { static int dissect_ddtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { - proto_tree *ddtp_tree = NULL; + proto_tree *ddtp_tree; proto_item *ti; /* * If we don't recognize the version number, don't dissect this. */ - if (tvb_length(tvb) >= 4) { - if (try_val_to_str(tvb_get_ntohl(tvb, 0), vals_ddtp_version) == NULL) + if (tvb_reported_length(tvb) < 4) + return 0; + + if (try_val_to_str(tvb_get_ntohl(tvb, 0), vals_ddtp_version) == NULL) return 0; - } /* Indicate what kind of message this is. */ col_set_str (pinfo->cinfo, COL_PROTOCOL, "DDTP"); /* In case we throw an exception below. */ col_clear (pinfo->cinfo, COL_INFO); - if (tree) { ti = proto_tree_add_item(tree, proto_ddtp, tvb, 0, -1, ENC_NA); ddtp_tree = proto_item_add_subtree(ti, ett_ddtp); proto_tree_add_item(ddtp_tree, hf_ddtp_version, tvb, 0, 4, ENC_BIG_ENDIAN); proto_tree_add_item(ddtp_tree, hf_ddtp_encrypt, tvb, 4, 4, ENC_BIG_ENDIAN); proto_tree_add_item(ddtp_tree, hf_ddtp_hostid, tvb, 8, 4, ENC_BIG_ENDIAN); - } + if (tvb_get_ntohl(tvb, 4) == DDTP_ENCRYPT_PLAINTEXT) { - if (tree) - proto_tree_add_item(ddtp_tree, hf_ddtp_msgtype, tvb, 12, 4, ENC_BIG_ENDIAN); + ti = proto_tree_add_item(ddtp_tree, hf_ddtp_msgtype, tvb, 12, 4, ENC_BIG_ENDIAN); switch (tvb_get_ntohl(tvb, 12)) { case DDTP_MESSAGE_ERROR : col_set_str(pinfo->cinfo, COL_INFO, "Message Error"); break; case DDTP_UPDATE_QUERY : col_set_str(pinfo->cinfo, COL_INFO, "Update Query"); - if (tree) { - proto_tree_add_item(ddtp_tree, hf_ddtp_opcode, tvb, 16, 4, - ENC_BIG_ENDIAN); - proto_tree_add_item(ddtp_tree, hf_ddtp_ipaddr, tvb, 20, 4, - ENC_BIG_ENDIAN); - } + proto_tree_add_item(ddtp_tree, hf_ddtp_opcode, tvb, 16, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(ddtp_tree, hf_ddtp_ipaddr, tvb, 20, 4, ENC_BIG_ENDIAN); break; case DDTP_UPDATE_REPLY : col_set_str(pinfo->cinfo, COL_INFO, "Update Reply"); - if (tree) { - proto_tree_add_item(ddtp_tree, hf_ddtp_status, tvb, 16, 4, - ENC_BIG_ENDIAN); - } + proto_tree_add_item(ddtp_tree, hf_ddtp_status, tvb, 16, 4, ENC_BIG_ENDIAN); break; case DDTP_ALIVE_QUERY : col_set_str(pinfo->cinfo, COL_INFO, "Alive Query"); - if (tree) { - proto_tree_add_text(ddtp_tree, tvb, 16, 4, "Dummy : %u", - tvb_get_ntohl(tvb, 16)); - } + proto_tree_add_item(ddtp_tree, hf_ddtp_alive, tvb, 16, 4, ENC_BIG_ENDIAN); break; case DDTP_ALIVE_REPLY : col_set_str(pinfo->cinfo, COL_INFO, "Alive Reply"); - if (tree) { - proto_tree_add_text(ddtp_tree, tvb, 16, 4, "Dummy : %u", - tvb_get_ntohl(tvb, 16)); - } + proto_tree_add_item(ddtp_tree, hf_ddtp_alive, tvb, 16, 4, ENC_BIG_ENDIAN); break; default : col_set_str(pinfo->cinfo, COL_INFO, "Unknown type"); - if (tree) { - proto_tree_add_text(ddtp_tree, tvb, 12, 4, "Unknown type : %u", - tvb_get_ntohl(tvb, 12)); - } + expert_add_info(pinfo, ti, &ei_ddtp_msgtype); } } else { col_set_str(pinfo->cinfo, COL_INFO, "Encrypted payload"); @@ -188,15 +197,26 @@ proto_register_ddtp(void) NULL, HFILL }}, { &hf_ddtp_status, { "Status", "ddtp.status", FT_UINT32, BASE_DEC, VALS(vals_ddtp_status), 0x0, - "Update reply status", HFILL }} + "Update reply status", HFILL }}, + { &hf_ddtp_alive, + { "Dummy", "ddtp.alive", FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, }; static gint *ett[] = { &ett_ddtp }; + static ei_register_info ei[] = { + { &ei_ddtp_msgtype, { "ddtp.msgtype.unknown", PI_PROTOCOL, PI_WARN, "Unknown type", EXPFILL }}, + }; + + expert_module_t* expert_ddtp; + proto_ddtp = proto_register_protocol("Dynamic DNS Tools Protocol", "DDTP", "ddtp"); proto_register_field_array(proto_ddtp, hf_ddtp, array_length(hf_ddtp)); proto_register_subtree_array(ett, array_length(ett)); + expert_ddtp = expert_register_protocol(proto_ddtp); + expert_register_field_array(expert_ddtp, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-ddtp.h b/epan/dissectors/packet-ddtp.h deleted file mode 100644 index bb60dbbb58..0000000000 --- a/epan/dissectors/packet-ddtp.h +++ /dev/null @@ -1,54 +0,0 @@ -/* packet-ddtp.h - * Routines for DDTP (Dynamic DNS Tools Protocol) packet disassembly - * see http://ddt.sourceforge.net/ - * Olivier Abad <oabad@noos.fr> - * - * Wireshark - Network traffic analyzer - * By Gerald Combs <gerald@wireshark.org> - * Copyright 2000 - * - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * - */ - -#ifndef __PACKET_DDTP_H__ -#define __PACKET_DDTP_H__ - -#define DDTP_VERSION_ERROR 0 -#define DDTP_VERSION_4 1 -#define DDTP_VERSION_5 2 - -#define DDTP_ENCRYPT_ERROR 0 -#define DDTP_ENCRYPT_PLAINTEXT 1 -#define DDTP_ENCRYPT_BLOWFISH 2 - -#define DDTP_MESSAGE_ERROR 0 -#define DDTP_UPDATE_QUERY 1 -#define DDTP_UPDATE_REPLY 2 -#define DDTP_ALIVE_QUERY 3 -#define DDTP_ALIVE_REPLY 4 - -#define DDTP_MARK_ONLINE 0 -#define DDTP_MARK_OFFLINE 1 - -#define DDTP_UPDATE_SUCCEEDED 0 -#define DDTP_UPDATE_FAILED 1 -#define DDTP_INVALID_PASSWORD 2 -#define DDTP_INVALID_ACCOUNT 3 -#define DDTP_INVALID_OPCODE 4 - -#endif diff --git a/epan/dissectors/packet-devicenet.c b/epan/dissectors/packet-devicenet.c index a8a8264fef..38087127d3 100644 --- a/epan/dissectors/packet-devicenet.c +++ b/epan/dissectors/packet-devicenet.c @@ -92,6 +92,7 @@ static int hf_devicenet_class8 = -1; static int hf_devicenet_class16 = -1; static int hf_devicenet_instance8 = -1; static int hf_devicenet_instance16 = -1; +static int hf_devicenet_attribute = -1; static int hf_devicenet_fragment_type = -1; static int hf_devicenet_fragment_count = -1; @@ -273,6 +274,7 @@ static gint body_type_8_over_8_dissection(guint8 data_length, proto_tree *device guint16 class_id, instance, attribute; attribute_info_t* att_info; gint start_offset = offset, length; + proto_item* ti; devicenet_tree = proto_tree_add_subtree(devicenet_tree, tvb, offset, -1, ett_devicenet_8_8, NULL, "DeviceNet 8/8"); @@ -287,10 +289,11 @@ static gint body_type_8_over_8_dissection(guint8 data_length, proto_tree *device if (data_length > 3) { attribute = tvb_get_guint8(tvb, offset); + ti = proto_tree_add_item(devicenet_tree, hf_devicenet_attribute, tvb, offset, 1, ENC_LITTLE_ENDIAN); att_info = cip_get_attribute(class_id, instance, attribute); if (att_info != NULL) - proto_tree_add_text(devicenet_tree, tvb, offset, 1, "Instance Attribute: %s", att_info->text); + proto_item_append_text(ti, " (%s)", att_info->text); offset++; } @@ -310,6 +313,7 @@ static gint body_type_8_over_16_dissection(guint8 data_length, proto_tree *devic { guint16 class_id, instance, attribute; attribute_info_t* att_info; + proto_item* ti; devicenet_tree = proto_tree_add_subtree(devicenet_tree, tvb, offset, -1, ett_devicenet_8_16, NULL, "DeviceNet 8/16"); @@ -323,10 +327,11 @@ static gint body_type_8_over_16_dissection(guint8 data_length, proto_tree *devic if (data_length > 4) { attribute = tvb_get_guint8(tvb, offset); + ti = proto_tree_add_item(devicenet_tree, hf_devicenet_attribute, tvb, offset, 1, ENC_LITTLE_ENDIAN); att_info = cip_get_attribute(class_id, instance, attribute); if (att_info != NULL) - proto_tree_add_text(devicenet_tree, tvb, offset, 1, "Instance Attribute: %s", att_info->text); + proto_item_append_text(ti, " (%s)", att_info->text); offset++; } @@ -339,6 +344,7 @@ static gint body_type_16_over_8_dissection(guint8 data_length, proto_tree *devic { guint16 class_id, instance, attribute; attribute_info_t* att_info; + proto_item* ti; devicenet_tree = proto_tree_add_subtree(devicenet_tree, tvb, offset, -1, ett_devicenet_16_8, NULL, "DeviceNet 16/8"); @@ -353,10 +359,11 @@ static gint body_type_16_over_8_dissection(guint8 data_length, proto_tree *devic if (data_length > 4) { attribute = tvb_get_guint8(tvb, offset); + ti = proto_tree_add_item(devicenet_tree, hf_devicenet_attribute, tvb, offset, 1, ENC_LITTLE_ENDIAN); att_info = cip_get_attribute(class_id, instance, attribute); if (att_info != NULL) - proto_tree_add_text(devicenet_tree, tvb, offset, 1, "Instance Attribute: %s" ,att_info->text); + proto_item_append_text(ti, " (%s)", att_info->text); offset++; } @@ -369,6 +376,7 @@ static gint body_type_16_over_16_dissection(guint8 data_length, proto_tree *devi { guint16 class_id, instance, attribute; attribute_info_t* att_info; + proto_item* ti; devicenet_tree = proto_tree_add_subtree(devicenet_tree, tvb, offset, 4, ett_devicenet_16_16, NULL, "DeviceNet 16/16"); @@ -383,10 +391,11 @@ static gint body_type_16_over_16_dissection(guint8 data_length, proto_tree *devi if (data_length > 5) { attribute = tvb_get_guint8(tvb, offset); + ti = proto_tree_add_item(devicenet_tree, hf_devicenet_attribute, tvb, offset, 1, ENC_LITTLE_ENDIAN); att_info = cip_get_attribute(class_id, instance, attribute); if (att_info != NULL) - proto_tree_add_text(devicenet_tree, tvb, offset, 1, "Instance Attribute: %s" ,att_info->text); + proto_item_append_text(ti, " (%s)", att_info->text); offset++; } @@ -915,6 +924,11 @@ void proto_register_devicenet(void) FT_UINT16, BASE_HEX, NULL, 0x00, NULL, HFILL } }, + { &hf_devicenet_attribute, + { "Attribute", "devicenet.attribute", + FT_UINT8, BASE_HEX, NULL, 0x00, + NULL, HFILL } + }, { &hf_devicenet_fragment_type, { "Fragment Type", "devicenet.fragment_type", FT_UINT8, BASE_HEX, VALS(devicenet_fragmented_message_type_vals), 0xC0, diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c index bdf514efab..93077f9c9a 100644 --- a/epan/dissectors/packet-diameter.c +++ b/epan/dissectors/packet-diameter.c @@ -476,7 +476,7 @@ call_avp_subdissector(guint32 vendorid, guint32 code, tvbuff_t *subtvb, packet_i } /* Debug - proto_tree_add_text(avp_tree, subtvb, 0, -1, "AVP %u data, Vendor Id %u ",code,vendorid); + proto_tree_add_subtree(avp_tree, subtvb, 0, -1, "AVP %u data, Vendor Id %u ",code,vendorid); */ } CATCH_NONFATAL_ERRORS { diff --git a/epan/dissectors/packet-diameter_3gpp.c b/epan/dissectors/packet-diameter_3gpp.c index 8559f1d5c1..bc9fd77f89 100644 --- a/epan/dissectors/packet-diameter_3gpp.c +++ b/epan/dissectors/packet-diameter_3gpp.c @@ -46,6 +46,8 @@ void proto_reg_handoff_diameter_3gpp(void); /* Initialize the protocol and registered fields */ static int proto_diameter_3gpp = -1; +static int hf_diameter_3gpp_timezone = -1; +static int hf_diameter_3gpp_timezone_adjustment = -1; static int hf_diameter_3gpp_visited_nw_id = -1; static int hf_diameter_3gpp_msisdn = -1; static int hf_diameter_3gpp_path = -1; @@ -217,11 +219,11 @@ dissect_diameter_3gpp_ms_timezone(tvbuff_t *tvb, packet_info *pinfo _U_, proto_t hours = oct / 4; minutes = oct % 4 * 15; - proto_tree_add_text(tree, tvb, offset, 1, "Timezone: GMT %c %d hours %d minutes", sign, hours, minutes); + proto_tree_add_uint_format_value(tree, hf_diameter_3gpp_timezone, tvb, offset, 1, oct, "GMT %c %d hours %d minutes", sign, hours, minutes); offset++; oct = tvb_get_guint8(tvb, offset) & 0x3; - proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_const(oct, daylight_saving_time_vals, "Unknown")); + proto_tree_add_item(tree, hf_diameter_3gpp_timezone_adjustment, tvb, offset, 1, ENC_NA); offset++; diam_sub_dis->avp_str = wmem_strdup_printf(wmem_packet_scope(), "Timezone: GMT %c %d hours %d minutes %s", @@ -1101,6 +1103,16 @@ proto_register_diameter_3gpp(void) /* Setup list of header fields See Section 1.6.1 for details*/ static hf_register_info hf[] = { + { &hf_diameter_3gpp_timezone, + { "Timezone", "diameter.3gpp.3gpp_timezone", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_diameter_3gpp_timezone_adjustment, + { "Adjustment", "diameter.3gpp.timezone_adjustment", + FT_UINT8, BASE_DEC, VALS(daylight_saving_time_vals), 0x03, + NULL, HFILL } + }, { &hf_diameter_3gpp_path, { "Path", "diameter.3gpp.path", FT_STRING, BASE_NONE, NULL, 0x0, diff --git a/epan/dissectors/packet-dis.c b/epan/dissectors/packet-dis.c index 4a9723eed2..6a4634a430 100644 --- a/epan/dissectors/packet-dis.c +++ b/epan/dissectors/packet-dis.c @@ -3637,6 +3637,8 @@ static int hf_dis_obj_count = -1; static int hf_dis_clock_rate = -1; static int hf_dis_sec_since_1970 = -1; static int hf_dis_str_data = -1; +static int hf_dis_record_data = -1; +static int hf_dis_alignment_padding = -1; static int hf_dis_vp_change_indicator = -1; static int hf_dis_vp_association_status = -1; static int hf_dis_vp_association_type = -1; @@ -5124,9 +5126,8 @@ static int dissect_DIS_PARSER_SIGNAL_PDU(tvbuff_t *tvb, packet_info *pinfo, prot if (tdlType == DIS_TDL_TYPE_LINK16_STD) { offset = parse_DIS_FIELDS_SIGNAL_LINK16_NETWORK_HEADER(tvb, tree, offset, &messageType); - ti = proto_tree_add_text(tree, tvb, offset, -1, "Link 16 Message Data: %s", - val_to_str_const(messageType, DIS_PDU_Link16_MessageType_Strings, "")); - sub_tree = proto_item_add_subtree(ti, ett_dis_signal_link16_message_data); + sub_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_dis_signal_link16_message_data, NULL, + "Link 16 Message Data: %s", val_to_str_const(messageType, DIS_PDU_Link16_MessageType_Strings, "")); offset = parse_Link16_Message_Data(sub_tree, tvb, offset, pinfo, encodingScheme, messageType); proto_item_set_end(ti, tvb, offset); } else { @@ -5902,8 +5903,7 @@ static gint parseField_VariableRecord(tvbuff_t *tvb, proto_tree *tree, gint offs if (dataLength > 0) { - proto_tree_add_text(tree, tvb, offset, dataLength, - "Record Data (%d bytes)", dataLength); + proto_tree_add_item(tree, hf_dis_record_data, tvb, offset, dataLength, ENC_NA); offset += dataLength; } } @@ -5915,8 +5915,7 @@ static gint parseField_VariableRecord(tvbuff_t *tvb, proto_tree *tree, gint offs { guint32 alignmentPadding = (8 - (record_length % 8)); - proto_tree_add_text(tree, tvb, offset, alignmentPadding, - "Alignment Padding (%d bytes)", alignmentPadding); + proto_tree_add_item(tree, hf_dis_alignment_padding, tvb, offset, alignmentPadding, ENC_NA); offset += alignmentPadding; } @@ -6109,17 +6108,16 @@ static gint dissect_dis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi /* Add a node to contain the DIS PDU fields. */ - dis_payload_node = proto_tree_add_text(dis_tree, tvb, offset, -1, - "%s PO PDU", pduString); - + dis_payload_tree = proto_tree_add_subtree_format(dis_tree, tvb, offset, -1, + ett_dis_payload, &dis_payload_node, "%s PO PDU", pduString); } break; default: /* Add a node to contain the DIS PDU fields. */ - dis_payload_node = proto_tree_add_text(dis_tree, tvb, offset, -1, - "%s PDU", pduString); + dis_payload_tree = proto_tree_add_subtree_format(dis_tree, tvb, offset, -1, + ett_dis_payload, &dis_payload_node, "%s PDU", pduString); switch (header.pduType) { @@ -6248,7 +6246,6 @@ static gint dissect_dis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi */ if (pduFunc != NULL) { - dis_payload_tree = proto_item_add_subtree(dis_payload_node, ett_dis_payload); offset = (*pduFunc)(tvb, pinfo, dis_payload_tree, offset); proto_item_set_end(dis_payload_node, tvb, offset); } @@ -7447,6 +7444,16 @@ void proto_register_dis(void) FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { &hf_dis_record_data, + { "Record data", "dis.record_data", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, + { &hf_dis_alignment_padding, + { "Alignment padding", "dis.alignment_padding", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, { &hf_dis_vp_change_indicator, { "Change Indicator", "dis.vp.change_indicator", FT_UINT8, BASE_DEC, NULL, 0x0, diff --git a/epan/dissectors/packet-distcc.c b/epan/dissectors/packet-distcc.c index 196ca7a92d..44ac975112 100644 --- a/epan/dissectors/packet-distcc.c +++ b/epan/dissectors/packet-distcc.c @@ -32,7 +32,7 @@ #include <glib.h> #include <epan/packet.h> - +#include <epan/expert.h> #include <epan/prefs.h> @@ -49,6 +49,8 @@ static int hf_distcc_doto_object = -1; static gint ett_distcc = -1; +static expert_field ei_distcc_short_pdu = EI_INIT; + static dissector_handle_t data_handle; @@ -75,7 +77,7 @@ extern void proto_reg_handoff_distcc(void); /* only attempt reassembly if whe have the full segment */\ if(tvb_length_remaining(tvb, offset)==tvb_reported_length_remaining(tvb, offset)){\ if(parameter>tvb_length_remaining(tvb, offset)){\ - proto_tree_add_text(tree, tvb, offset-12, -1, "[Short " x " PDU]");\ + proto_tree_add_expert_format(tree, pinfo, &ei_distcc_short_pdu, tvb, offset-12, -1, "[Short " x " PDU]");\ pinfo->desegment_offset=offset-12;\ pinfo->desegment_len=parameter-tvb_length_remaining(tvb, offset);\ return offset+len;\ @@ -133,25 +135,23 @@ dissect_distcc_argv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int char argv[256]; int argv_len; gint len=parameter; - + proto_item* ti; CHECK_PDU_LEN("ARGV"); /* see if we need to desegment the PDU */ DESEGMENT_TCP("ARGV"); - - argv_len=len>255?255:len; tvb_memcpy(tvb, argv, offset, argv_len); argv[argv_len]=0; - proto_tree_add_item(tree, hf_distcc_argv, tvb, offset, len, ENC_ASCII|ENC_NA); + ti = proto_tree_add_item(tree, hf_distcc_argv, tvb, offset, len, ENC_ASCII|ENC_NA); col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", argv); if(len!=parameter){ - proto_tree_add_text(tree, tvb, 0, 0, "[Short ARGV PDU]"); + expert_add_info_format(pinfo, ti, &ei_distcc_short_pdu, "[Short ARGV PDU]"); } return offset+len; } @@ -162,7 +162,7 @@ dissect_distcc_serr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int char argv[256]; int argv_len; gint len=parameter; - + proto_item* ti; CHECK_PDU_LEN("SERR"); @@ -175,12 +175,12 @@ dissect_distcc_serr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int tvb_memcpy(tvb, argv, offset, argv_len); argv[argv_len]=0; - proto_tree_add_item(tree, hf_distcc_serr, tvb, offset, len, ENC_ASCII|ENC_NA); + ti = proto_tree_add_item(tree, hf_distcc_serr, tvb, offset, len, ENC_ASCII|ENC_NA); col_append_fstr(pinfo->cinfo, COL_INFO, "SERR:%s ", argv); if(len!=parameter){ - proto_tree_add_text(tree, tvb, 0, 0, "[Short SERR PDU]"); + expert_add_info_format(pinfo, ti, &ei_distcc_short_pdu, "[Short SERR PDU]"); } return offset+len; } @@ -191,25 +191,23 @@ dissect_distcc_sout(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int char argv[256]; int argv_len; gint len=parameter; - + proto_item* ti; CHECK_PDU_LEN("SOUT"); /* see if we need to desegment the PDU */ DESEGMENT_TCP("SOUT"); - - argv_len=len>255?255:len; tvb_memcpy(tvb, argv, offset, argv_len); argv[argv_len]=0; - proto_tree_add_item(tree, hf_distcc_sout, tvb, offset, len, ENC_ASCII|ENC_NA); + ti = proto_tree_add_item(tree, hf_distcc_sout, tvb, offset, len, ENC_ASCII|ENC_NA); col_append_fstr(pinfo->cinfo, COL_INFO, "SOUT:%s ", argv); if(len!=parameter){ - proto_tree_add_text(tree, tvb, 0, 0, "[Short SOUT PDU]"); + expert_add_info_format(pinfo, ti, &ei_distcc_short_pdu, "[Short SOUT PDU]"); } return offset+len; } @@ -219,7 +217,7 @@ static int dissect_distcc_doti(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, gint parameter) { gint len=parameter; - + proto_item* ti; CHECK_PDU_LEN("DOTI"); @@ -228,9 +226,9 @@ dissect_distcc_doti(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int off col_append_str(pinfo->cinfo, COL_INFO, "DOTI source "); - proto_tree_add_item(tree, hf_distcc_doti_source, tvb, offset, len, ENC_ASCII|ENC_NA); + ti = proto_tree_add_item(tree, hf_distcc_doti_source, tvb, offset, len, ENC_ASCII|ENC_NA); if(len!=parameter){ - proto_tree_add_text(tree, tvb, 0, 0, "[Short DOTI PDU]"); + expert_add_info_format(pinfo, ti, &ei_distcc_short_pdu, "[Short DOTI PDU]"); } return offset+len; } @@ -239,6 +237,7 @@ static int dissect_distcc_doto(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, gint parameter) { gint len=parameter; + proto_item* ti; CHECK_PDU_LEN("DOTO"); @@ -248,9 +247,9 @@ dissect_distcc_doto(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int off col_append_str(pinfo->cinfo, COL_INFO, "DOTO object "); - proto_tree_add_item(tree, hf_distcc_doto_object, tvb, offset, len, ENC_NA); + ti = proto_tree_add_item(tree, hf_distcc_doto_object, tvb, offset, len, ENC_NA); if(len!=parameter){ - proto_tree_add_text(tree, tvb, 0, 0, "[Short DOTO PDU]"); + expert_add_info_format(pinfo, ti, &ei_distcc_short_pdu, "[Short DOTO PDU]"); } return offset+len; } @@ -359,12 +358,19 @@ proto_register_distcc(void) &ett_distcc, }; + static ei_register_info ei[] = { + { &ei_distcc_short_pdu, { "distcc.short_pdu", PI_MALFORMED, PI_ERROR, "Short PDU", EXPFILL }}, + }; + module_t *distcc_module; + expert_module_t* expert_distcc; + + proto_distcc = proto_register_protocol("Distcc Distributed Compiler", "DISTCC", "distcc"); - proto_distcc = proto_register_protocol("Distcc Distributed Compiler", - "DISTCC", "distcc"); proto_register_field_array(proto_distcc, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_distcc = expert_register_protocol(proto_distcc); + expert_register_field_array(expert_distcc, ei, array_length(ei)); distcc_module = prefs_register_protocol(proto_distcc, proto_reg_handoff_distcc); diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c index e10672babf..f75b41019e 100644 --- a/epan/dissectors/packet-dns.c +++ b/epan/dissectors/packet-dns.c @@ -1460,7 +1460,7 @@ dissect_type_bitmap(proto_tree *rr_tree, tvbuff_t *tvb, int cur_offset, int rr_l mask = 1<<7; for (i = 0; i < 8; i++) { if (bits & mask) { - proto_tree_add_text(rr_tree, tvb, cur_offset, 1, + proto_tree_add_uint_format(rr_tree, hf_dns_rr_type, tvb, cur_offset, 1, rr_type, "RR type in bit map: %s", val_to_str_ext(rr_type, &dns_types_description_vals_ext, "Unknown (%d)")); } diff --git a/epan/dissectors/packet-dtpt.c b/epan/dissectors/packet-dtpt.c index 04bda209a3..e865b0c035 100644 --- a/epan/dissectors/packet-dtpt.c +++ b/epan/dissectors/packet-dtpt.c @@ -115,6 +115,7 @@ static int hf_dtpt_blob_data_pointer = -1; static int hf_dtpt_blob_data_length = -1; static int hf_dtpt_blob_data = -1; static int hf_dtpt_connect_addr = -1; +static int hf_dtpt_padding = -1; static gint ett_dtpt = -1; static gint ett_dtpt_flags = -1; @@ -252,8 +253,8 @@ dissect_dtpt_wstring(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex) proto_tree_add_string(dtpt_wstring_tree, hf_dtpt_wstring_data, tvb, offset+4, wstring_length, wstring_data); if (wstring_padding) - proto_tree_add_text(dtpt_wstring_tree, tvb, - offset+4+wstring_length,wstring_padding, "Padding"); + proto_tree_add_item(dtpt_wstring_tree, hf_dtpt_padding, tvb, + offset+4+wstring_length,wstring_padding, ENC_NA); } } offset += 4+wstring_size; @@ -361,8 +362,8 @@ dissect_dtpt_sockaddr(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex addr = tvb_get_ipv4(tvb,offset+4); proto_tree_add_ipv4(sockaddr_tree, hf_dtpt_sockaddr_address, tvb, offset+4,4,addr); - proto_tree_add_text(sockaddr_tree, tvb, offset+8, 8, "Padding"); - proto_item_append_text(sockaddr_item, ": %s:%d", ip_to_str((guint8*)&addr), port); + proto_tree_add_item(sockaddr_tree, hf_dtpt_padding, tvb, offset+8, 8, ENC_NA); + proto_item_append_text(sockaddr_item, ": %s:%d", ip_to_str((guint8*)&addr), port); } break; } @@ -379,14 +380,14 @@ dissect_dtpt_sockaddr(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex guint16 port; guint32 addr; - proto_tree_add_text(sockaddr_tree, tvb, offset+4, 4, "Padding"); + proto_tree_add_item(sockaddr_tree, hf_dtpt_padding, tvb, offset+4, 4, ENC_NA); port = tvb_get_ntohs(tvb,offset+8); proto_tree_add_uint(sockaddr_tree, hf_dtpt_sockaddr_port, tvb, offset+8,2,port); addr = tvb_get_ipv4(tvb,offset+10); proto_tree_add_ipv4(sockaddr_tree, hf_dtpt_sockaddr_address, tvb, offset+10,4,addr); - proto_tree_add_text(sockaddr_tree, tvb, offset+14, 16, "Padding"); + proto_tree_add_item(sockaddr_tree, hf_dtpt_padding, tvb, offset+14, 16, ENC_NA); proto_item_append_text(sockaddr_item, ": %s:%d", ip_to_str((guint8*)&addr), port); } break; @@ -1159,6 +1160,11 @@ proto_register_dtpt(void) { "Address", "dtpt.connect_addr", FT_UINT32, BASE_DEC, NULL, 0x0, "Connect to Address", HFILL }}, + + { &hf_dtpt_padding, + { "Padding", "dtpt.padding", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, }; static gint *ett[] = { &ett_dtpt, diff --git a/epan/dissectors/packet-dvb-eit.c b/epan/dissectors/packet-dvb-eit.c index 67ea0ce25f..4de1770100 100644 --- a/epan/dissectors/packet-dvb-eit.c +++ b/epan/dissectors/packet-dvb-eit.c @@ -156,13 +156,16 @@ dissect_dvb_eit(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tvb_memeql(tvb, offset, "\xFF\xFF\xFF\xFF\xFF", 5)) { if (packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &start_time) < 0) { - proto_tree_add_text(tree, tvb, offset, 5, "Unparseable time"); + proto_tree_add_time_format(dvb_eit_event_tree, hf_dvb_eit_start_time, tvb, offset, 5, + &start_time, "Unparseable time"); } else { proto_tree_add_time(dvb_eit_event_tree, hf_dvb_eit_start_time, tvb, offset, 5, &start_time); } } else { - proto_tree_add_text(tree, tvb, offset, 5, "Start Time: Undefined (0xFFFFFFFFFF)"); + start_time.secs = 0xFFFFFFFF; + start_time.nsecs = 0xFFFFFFFF; + proto_tree_add_time_format_value(tree, hf_dvb_eit_start_time, tvb, offset, 5, &start_time, "Undefined (0xFFFFFFFFFF)"); } offset += 5; diff --git a/epan/dissectors/packet-dvb-tdt.c b/epan/dissectors/packet-dvb-tdt.c index 5ae1815f8c..a7954f1cc8 100644 --- a/epan/dissectors/packet-dvb-tdt.c +++ b/epan/dissectors/packet-dvb-tdt.c @@ -55,7 +55,7 @@ dissect_dvb_tdt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += packet_mpeg_sect_header(tvb, offset, dvb_tdt_tree, NULL, NULL); if (packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &utc_time) < 0) { - proto_tree_add_text(dvb_tdt_tree, tvb, offset, 5, "Unparseable time"); + proto_tree_add_time_format(dvb_tdt_tree, hf_dvb_tdt_utc_time, tvb, offset, 5, &utc_time, "Unparseable time"); } else { proto_tree_add_time(dvb_tdt_tree, hf_dvb_tdt_utc_time, tvb, offset, 5, &utc_time); } diff --git a/epan/dissectors/packet-dvb-tot.c b/epan/dissectors/packet-dvb-tot.c index be201331ed..98e485875a 100644 --- a/epan/dissectors/packet-dvb-tot.c +++ b/epan/dissectors/packet-dvb-tot.c @@ -63,7 +63,7 @@ dissect_dvb_tot(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += packet_mpeg_sect_header(tvb, offset, dvb_tot_tree, NULL, NULL); if (packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &utc_time) < 0) { - proto_tree_add_text(dvb_tot_tree, tvb, offset, 5, "UTC Time : Unparseable time"); + proto_tree_add_time_format_value(dvb_tot_tree, hf_dvb_tot_utc_time, tvb, offset, 5, &utc_time, "Unparseable time"); } else { proto_tree_add_time(dvb_tot_tree, hf_dvb_tot_utc_time, tvb, offset, 5, &utc_time); } diff --git a/epan/dissectors/packet-e164.c b/epan/dissectors/packet-e164.c index 44082f0727..93118e30dd 100644 --- a/epan/dissectors/packet-e164.c +++ b/epan/dissectors/packet-e164.c @@ -400,6 +400,8 @@ const value_string E164_International_Networks_883_vals[] = { static int proto_e164 = -1; static int hf_E164_calling_party_number = -1; static int hf_E164_called_party_number = -1; +static int hf_E164_identification_code = -1; +static int hf_E164_country_code = -1; @@ -585,8 +587,7 @@ dissect_e164_cc(tvbuff_t *tvb, proto_tree *tree, int offset, gboolean bcd_coded) break; }/* end switch cc_length */ - proto_tree_add_text(tree, tvb, cc_offset, length,"Country Code: %x %s (length %u)", cc, - val_to_str_ext_const(cc,&E164_country_code_value_ext,"Unknown"), cc_length); + proto_tree_add_uint(tree, hf_E164_country_code, tvb, cc_offset, length, cc); switch ( cc ) { case 0x881 : @@ -595,8 +596,8 @@ dissect_e164_cc(tvbuff_t *tvb, proto_tree *tree, int offset, gboolean bcd_coded) } else { id_code = (tvb_get_guint8(tvb, cc_offset + 1) & 0xf0) >> 4; } - proto_tree_add_text(tree,tvb, (cc_offset + 1), 1,"Identification Code: %x %s ",id_code, - val_to_str_const(id_code,E164_GMSS_vals,"Unknown")); + proto_tree_add_uint_format_value(tree, hf_E164_identification_code, tvb, (cc_offset + 1), 1, + id_code, "%x %s", id_code, val_to_str_const(id_code, E164_GMSS_vals, "Unknown")); break; case 0x882 : if (!bcd_coded) { @@ -606,8 +607,8 @@ dissect_e164_cc(tvbuff_t *tvb, proto_tree *tree, int offset, gboolean bcd_coded) id_code = tvb_get_guint8(tvb, cc_offset + 1) & 0xf0; id_code |= tvb_get_guint8(tvb, cc_offset + 2) & 0x0f; } - proto_tree_add_text(tree,tvb, (cc_offset + 1), 2,"Identification Code: %x %s ",id_code, - val_to_str_ext_const(id_code,&E164_International_Networks_882_vals_ext,"Unknown")); + proto_tree_add_uint_format_value(tree, hf_E164_identification_code, tvb, (cc_offset + 1), 2, + id_code, "%x %s", id_code, val_to_str_ext_const(id_code, &E164_International_Networks_882_vals_ext, "Unknown")); break; case 0x883 : if (!bcd_coded) { @@ -624,11 +625,11 @@ dissect_e164_cc(tvbuff_t *tvb, proto_tree *tree, int offset, gboolean bcd_coded) } else { id_code = (id_code << 4) | (tvb_get_guint8(tvb, cc_offset + 3) & 0x0f); } - proto_tree_add_text(tree,tvb, (cc_offset + 1), 3,"Identification Code: %x %s ",id_code, - val_to_str_const(id_code,E164_International_Networks_883_vals,"Unknown")); + proto_tree_add_uint_format_value(tree, hf_E164_identification_code, tvb, (cc_offset + 1), 3, + id_code, "%x %s", id_code, val_to_str_const(id_code, E164_International_Networks_883_vals, "Unknown")); } else { - proto_tree_add_text(tree,tvb, (cc_offset + 1), 2,"Identification Code: %x %s ",id_code, - val_to_str_const(id_code,E164_International_Networks_883_vals,"Unknown")); + proto_tree_add_uint_format_value(tree, hf_E164_identification_code, tvb, (cc_offset + 1), 2, + id_code, "%x %s", id_code, val_to_str_const(id_code, E164_International_Networks_883_vals, "Unknown")); } break; default: @@ -658,7 +659,17 @@ proto_register_e164(void) { &hf_E164_called_party_number, { "E.164 Called party number digits", "e164.called_party_number.digits", FT_STRING, BASE_NONE, NULL, 0x0, - NULL, HFILL }} + NULL, HFILL }}, + + { &hf_E164_identification_code, + { "Identification Code", "e164.identification_code", + FT_UINT32, BASE_HEX, NULL, 0x0, + NULL, HFILL }}, + + { &hf_E164_country_code, + { "Country Code", "e164.country_code", + FT_UINT16, BASE_HEX|BASE_EXT_STRING, &E164_country_code_value_ext, 0x0, + NULL, HFILL }}, }; /* diff --git a/epan/dissectors/packet-eap.c b/epan/dissectors/packet-eap.c index cf3bb80092..9e9d8e4728 100644 --- a/epan/dissectors/packet-eap.c +++ b/epan/dissectors/packet-eap.c @@ -73,6 +73,7 @@ static int hf_eap_leap_peer_challenge = -1; static int hf_eap_leap_peer_response = -1; static int hf_eap_leap_ap_challenge = -1; static int hf_eap_leap_ap_response = -1; +static int hf_eap_leap_data = -1; static int hf_eap_leap_name = -1; static int hf_eap_ms_chap_v2_opcode = -1; @@ -85,8 +86,11 @@ static int hf_eap_ms_chap_v2_peer_challenge = -1; static int hf_eap_ms_chap_v2_reserved = -1; static int hf_eap_ms_chap_v2_nt_response = -1; static int hf_eap_ms_chap_v2_flags = -1; +static int hf_eap_ms_chap_v2_response = -1; static int hf_eap_ms_chap_v2_message = -1; static int hf_eap_ms_chap_v2_failure_request = -1; +static int hf_eap_ms_chap_v2_data = -1; +static int hf_eap_data = -1; static gint ett_eap = -1; @@ -494,9 +498,7 @@ dissect_eap_mschapv2(proto_tree *eap_tree, tvbuff_t *tvb, packet_info *pinfo, in offset += 1; left -= value_size; } else { - proto_tree_add_text(eap_tree, tvb, offset, value_size, - "EAP-MS-CHAP-v2 Response (Unknown Length): %s", - tvb_bytes_to_ep_str(tvb, offset, value_size)); + proto_tree_add_item(eap_tree, hf_eap_ms_chap_v2_response, tvb, offset, value_size, ENC_NA); offset += value_size; left -= value_size; } @@ -517,10 +519,7 @@ dissect_eap_mschapv2(proto_tree *eap_tree, tvbuff_t *tvb, packet_info *pinfo, in tvb, offset, left, ENC_ASCII|ENC_NA); break; default: - proto_tree_add_text(eap_tree, tvb, offset, left, - "EAP-MS-CHAP-v2 Data (%d byte%s): \"%s\"", - left, plurality(left, "", "s"), - tvb_bytes_to_ep_str(tvb, offset, left)); + proto_tree_add_item(eap_tree, hf_eap_ms_chap_v2_data, tvb, offset, left, ENC_NA); break; } } @@ -1127,10 +1126,7 @@ dissect_eap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) break; default: - proto_tree_add_text(eap_tree, tvb, offset, count, - "EAP-LEAP Data (%d byte%s): \"%s\"", - count, plurality(count, "", "s"), - tvb_bytes_to_ep_str(tvb, offset, count)); + proto_tree_add_item(eap_tree, hf_eap_leap_data, tvb, offset, count, ENC_NA); break; } } @@ -1185,12 +1181,7 @@ dissect_eap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) /********************************************************************* **********************************************************************/ default: - if (tree) { - proto_tree_add_text(eap_tree, tvb, offset, size, - "EAP Data (%d byte%s): \"%s\"", - size, plurality(size, "", "s"), - tvb_bytes_to_ep_str(tvb, offset, size)); - } + proto_tree_add_item(eap_tree, hf_eap_data, tvb, offset, size, ENC_NA); break; /********************************************************************* **********************************************************************/ @@ -1427,6 +1418,11 @@ proto_register_eap(void) FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_eap_leap_data, { + "EAP-LEAP Data", "eap.leap.data", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + { &hf_eap_leap_name, { "EAP-LEAP Name", "eap.leap.name", FT_STRING, BASE_NONE, NULL, 0x0, @@ -1482,6 +1478,11 @@ proto_register_eap(void) FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_eap_ms_chap_v2_response, { + "EAP-MS-CHAP-v2 Response (Unknown Length)", "eap.ms_chap_v2.response", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + { &hf_eap_ms_chap_v2_message, { "EAP-MS-CHAP-v2 Message", "eap.ms_chap_v2.message", FT_STRING, BASE_NONE, NULL, 0x0, @@ -1492,6 +1493,16 @@ proto_register_eap(void) FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_eap_ms_chap_v2_data, { + "EAP-MS-CHAP-v2 Data", "eap.ms_chap_v2.data", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + { &hf_eap_data, { + "EAP Data", "eap.data", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + /* Expanded type fields */ { &hf_eap_ext_vendor_id, { "EAP-EXT Vendor Id", "eap.ext.vendor_id", diff --git a/epan/dissectors/packet-elcom.c b/epan/dissectors/packet-elcom.c index d9194a97fd..7375a4a331 100644 --- a/epan/dissectors/packet-elcom.c +++ b/epan/dissectors/packet-elcom.c @@ -320,7 +320,7 @@ dissect_datarequest(proto_item *ti_arg, gint ett_arg, tvbuff_t *tvb, gint arg_of { gint offset = arg_offset; guint8 gtype, oidlen; - proto_tree *tree, *tree2; + proto_tree *tree; proto_item *ti; tree = proto_item_add_subtree(ti_arg, ett_arg); @@ -392,13 +392,7 @@ dissect_datarequest(proto_item *ti_arg, gint ett_arg, tvbuff_t *tvb, gint arg_of return offset; /* show the rest */ - tree2 = proto_tree_add_text(tree, tvb, offset, -1, "leftover ="); - while (tvb_length_remaining(tvb, offset) > 0) { - proto_item_append_text(tree2, elcom_show_hex ? " %02x" : " %03o", - tvb_get_guint8(tvb, offset)); - offset++; - } - + proto_tree_add_item(tree, hf_elcom_strangeleftover, tvb, offset, -1, ENC_NA); return offset; } @@ -558,16 +552,10 @@ dissect_elcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; } - - if (tvb_length_remaining(tvb, offset) <= 0) - return; - - /* We should not get here, but if we do, show what is left over: */ - ti = proto_tree_add_item(elcom_tree, hf_elcom_strangeleftover, tvb, offset, -1, ENC_NA); - while (tvb_length_remaining(tvb, offset) > 0) { - proto_item_append_text(ti, elcom_show_hex ? " %02x" : " %03o", - tvb_get_guint8(tvb, offset)); - offset++; + if (tvb_length_remaining(tvb, offset) > 0) + { + /* We should not get here, but if we do, show what is left over: */ + proto_tree_add_item(elcom_tree, hf_elcom_strangeleftover, tvb, offset, -1, ENC_NA); } } @@ -737,7 +725,7 @@ proto_register_elcom(void) }, { &hf_elcom_strangeleftover, { "Strange Leftover", "elcom.leftover", - FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL } + FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL } } }; diff --git a/epan/dissectors/packet-elmi.c b/epan/dissectors/packet-elmi.c index c2f62c3834..f4665bcd97 100644 --- a/epan/dissectors/packet-elmi.c +++ b/epan/dissectors/packet-elmi.c @@ -51,6 +51,7 @@ static int hf_elmi_report_type = -1; static int hf_elmi_snd_seq_num = -1; static int hf_elmi_rcv_seq_num = -1; static int hf_elmi_dat_inst = -1; +static int hf_elmi_reserved = -1; static const value_string elmi_msg_type[] = { { 0x75, "Status enquiry" }, @@ -121,7 +122,7 @@ dissect_elmi_info_elem( offset++; break; case TAG_DATA_INST: - proto_tree_add_text(info_elem_tree, tvb, offset, 1, "Reserved"); + proto_tree_add_item(info_elem_tree, hf_elmi_reserved, tvb, offset, 1, ENC_NA); offset++; proto_tree_add_item(info_elem_tree, hf_elmi_dat_inst, tvb, offset, 4, ENC_BIG_ENDIAN); @@ -204,7 +205,10 @@ proto_register_elmi(void) NULL, 0, NULL, HFILL } }, { &hf_elmi_dat_inst, { "Data instance", "elmi.data_instance", FT_UINT32, BASE_HEX, - NULL, 0, NULL, HFILL } } + NULL, 0, NULL, HFILL } }, + { &hf_elmi_reserved, + { "Reserved", "elmi.reserved", FT_UINT8, BASE_HEX, + NULL, 0, NULL, HFILL } }, }; static gint *ett[] = { diff --git a/epan/dissectors/packet-erldp.c b/epan/dissectors/packet-erldp.c index 9f23e53a76..a6be1fcdc7 100644 --- a/epan/dissectors/packet-erldp.c +++ b/epan/dissectors/packet-erldp.c @@ -124,6 +124,7 @@ static const value_string erldp_ctlmsg_vals[] = { int proto_erldp = -1; static int hf_erldp_length_2 = -1; static int hf_erldp_length_4 = -1; +static int hf_etf_version_magic = -1; static int hf_erldp_tag = -1; static int hf_erldp_type = -1; static int hf_erldp_version = -1; @@ -358,7 +359,7 @@ static gint dissect_etf_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, etf_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_etf, &ti, (label) ? label : "External Term Format"); - proto_tree_add_text(etf_tree, tvb, offset, 1, "VERSION_MAGIC: %d", mag); + proto_tree_add_item(etf_tree, hf_etf_version_magic, tvb, offset, 1, ENC_NA); offset++; tag = tvb_get_guint8(tvb, offset); @@ -554,6 +555,9 @@ void proto_register_erldp(void) { { &hf_erldp_length_2, { "Length", "erldp.len", FT_UINT16, BASE_DEC, NULL, 0x0, "Message Length", HFILL}}, + { &hf_etf_version_magic, { "VERSION_MAGIC", "erldp.version_magic", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL}}, { &hf_erldp_tag, { "Tag", "erldp.tag", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}, diff --git a/epan/dissectors/packet-etch.c b/epan/dissectors/packet-etch.c index b86f7d1a46..abb455b774 100644 --- a/epan/dissectors/packet-etch.c +++ b/epan/dissectors/packet-etch.c @@ -117,7 +117,7 @@ static gint ett_etch_value = -1; static int hf_etch_sig = -1; static int hf_etch_length = -1; static int hf_etch_version = -1; -/* static int hf_etch_typecode = -1; */ +static int hf_etch_typecode = -1; static int hf_etch_value = -1; static int hf_etch_bytes = -1; static int hf_etch_byte = -1; @@ -379,11 +379,9 @@ read_type(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree) { guint32 type_code; - const gchar *type_as_string; type_code = tvb_get_guint8(tvb, *offset); - type_as_string = val_to_str(type_code, tc_lookup_table, "Etch TypeCode: 0x%02x"); - proto_tree_add_text(etch_tree, tvb, *offset, 1, "%s", type_as_string); + proto_tree_add_item(etch_tree, hf_etch_typecode, tvb, *offset, 1, ENC_NA); (*offset)++; return type_code; } @@ -835,14 +833,12 @@ void proto_register_etch(void) NULL, 0x0, NULL, HFILL} }, -#if 0 {&hf_etch_typecode, {"Etch TypeCode", "etch.typecode", - FT_STRING, BASE_NONE, /* FT_INT8 */ - NULL, 0x0, + FT_UINT8, BASE_HEX, + VALS(tc_lookup_table), 0x0, NULL, HFILL} }, -#endif {&hf_etch_value, {"Etch Value", "etch.value", FT_UINT64, BASE_DEC, diff --git a/epan/dissectors/packet-evrc.c b/epan/dissectors/packet-evrc.c index 219f05b6dd..9601843018 100644 --- a/epan/dissectors/packet-evrc.c +++ b/epan/dissectors/packet-evrc.c @@ -176,6 +176,7 @@ static int hf_evrc_toc_frame_type_low = -1; static int hf_evrc_b_toc_frame_type_high = -1; static int hf_evrc_b_toc_frame_type_low = -1; static int hf_evrc_padding = -1; +static int hf_evrc_speech_data = -1; static int hf_evrc_legacy_toc_fe_ind = -1; static int hf_evrc_legacy_toc_reduc_rate = -1; static int hf_evrc_legacy_toc_frame_type = -1; @@ -396,7 +397,7 @@ dissect_evrc_aux(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, evrc_varia while ((i < frame_count) && ((len - offset) >= speech_data_len[i])) { - proto_tree_add_text(evrc_tree, tvb, offset, speech_data_len[i], "Speech Data [%u]", i+1); + proto_tree_add_bytes_format(evrc_tree, hf_evrc_speech_data, tvb, offset, speech_data_len[i], NULL, "Speech Data [%u]", i+1); offset += speech_data_len[i]; i++; @@ -530,6 +531,11 @@ proto_register_evrc(void) FT_UINT8, BASE_DEC, NULL, 0x0f, "Padding bits", HFILL } }, + { &hf_evrc_speech_data, + { "Speech data", "evrc.speech_data", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, { &hf_evrc_legacy_toc_fe_ind, { "ToC Further Entries Indicator", "evrc.legacy.toc.further_entries_ind", FT_BOOLEAN, 8, TFS(&toc_further_entries_bit_vals), 0x80, diff --git a/epan/dissectors/packet-exec.c b/epan/dissectors/packet-exec.c index 27f829619f..1ecd3c9dca 100644 --- a/epan/dissectors/packet-exec.c +++ b/epan/dissectors/packet-exec.c @@ -50,6 +50,8 @@ static int hf_exec_stderr_port = -1; static int hf_exec_username = -1; static int hf_exec_password = -1; static int hf_exec_command = -1; +static int hf_exec_client_server_data = -1; +static int hf_exec_server_client_data = -1; /* Initialize the subtree pointers */ static gint ett_exec = -1; @@ -324,13 +326,13 @@ dissect_exec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(pinfo->destport == EXEC_PORT){ /* Packet going to the server */ /* offset = 0 since the whole packet is data */ - proto_tree_add_text(exec_tree, tvb, 0, -1, "Client -> Server Data"); + proto_tree_add_item(exec_tree, hf_exec_client_server_data, tvb, 0, -1, ENC_NA); col_append_str(pinfo->cinfo, COL_INFO, "Client -> Server data"); } else { /* This packet must be going back to the client */ /* offset = 0 since the whole packet is data */ - proto_tree_add_text(exec_tree, tvb, 0, -1, "Server -> Client Data"); + proto_tree_add_item(exec_tree, hf_exec_server_client_data, tvb, 0, -1, ENC_NA); col_append_str(pinfo->cinfo, COL_INFO, "Server -> Client Data"); } @@ -361,7 +363,15 @@ proto_register_exec(void) { &hf_exec_command, { "Command to execute", "exec.command", FT_STRINGZ, BASE_NONE, NULL, 0, - "Command client is requesting the server to run.", HFILL } } + "Command client is requesting the server to run.", HFILL } }, + + { &hf_exec_client_server_data, { "Client -> Server Data", "exec.client_server_data", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL } }, + + { &hf_exec_server_client_data, { "Server -> Client Data", "exec.server_client_data", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL } }, }; diff --git a/epan/dissectors/packet-exported_pdu.c b/epan/dissectors/packet-exported_pdu.c index f220896d2d..2cbc331210 100644 --- a/epan/dissectors/packet-exported_pdu.c +++ b/epan/dissectors/packet-exported_pdu.c @@ -55,7 +55,7 @@ static int hf_exported_pdu_ss7_opc = -1; static int hf_exported_pdu_ss7_dpc = -1; static int hf_exported_pdu_orig_fno = -1; static int hf_exported_pdu_dvbci_evt = -1; - +static int hf_exported_pdu_exported_pdu = -1; /* Initialize the subtree pointers */ static gint ett_exported_pdu = -1; @@ -215,7 +215,7 @@ dissect_exported_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; } - proto_tree_add_text(exported_pdu_tree, payload_tvb, 0, -1,"Exported PDU"); + proto_tree_add_item(exported_pdu_tree, hf_exported_pdu_exported_pdu, payload_tvb, 0, -1, ENC_NA); } /* Register the protocol with Wireshark. @@ -308,7 +308,12 @@ proto_register_exported_pdu(void) { "DVB-CI event", "exported_pdu.dvb-ci.event", FT_UINT8, BASE_HEX, VALS(dvbci_event), 0, NULL, HFILL } - } + }, + { &hf_exported_pdu_exported_pdu, + { "Exported PDU", "exported_pdu.exported_pdu", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL } + }, }; /* Setup protocol subtree array */ |