diff options
Diffstat (limited to 'epan')
25 files changed, 396 insertions, 226 deletions
diff --git a/epan/dissectors/packet-babel.c b/epan/dissectors/packet-babel.c index 580b17b0d2..586aef8955 100644 --- a/epan/dissectors/packet-babel.c +++ b/epan/dissectors/packet-babel.c @@ -285,12 +285,11 @@ dissect_babel(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U tvb, message + 4, 2, ENC_BIG_ENDIAN); proto_tree_add_item(message_tree, hf_babel_message_interval, tvb, message + 6, 2, ENC_BIG_ENDIAN); - ti = proto_tree_add_text(message_tree, + subtree = proto_tree_add_subtree_format(message_tree, tvb, message + 4, len - 2, - "Address: %s", + ett_subtree, NULL, "Address: %s", format_address(rc < 0 ? NULL : addr_str)); - subtree = proto_item_add_subtree(ti, ett_subtree); proto_tree_add_item(subtree, hf_babel_message_ae, tvb, message + 2, 1, ENC_NA); proto_tree_add_item(subtree, hf_babel_message_prefix, diff --git a/epan/dissectors/packet-bacnet.c b/epan/dissectors/packet-bacnet.c index 2910beb955..34824f507b 100644 --- a/epan/dissectors/packet-bacnet.c +++ b/epan/dissectors/packet-bacnet.c @@ -160,6 +160,7 @@ static int hf_bacnet_perf = -1; static int hf_bacnet_rejectreason = -1; static int hf_bacnet_rportnum = -1; static int hf_bacnet_portid = -1; +static int hf_bacnet_pinfo = -1; static int hf_bacnet_pinfolen = -1; static int hf_bacnet_term_time_value = -1; @@ -416,9 +417,8 @@ dissect_bacnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_uint(bacnet_tree, hf_bacnet_pinfolen, tvb, offset, 1, bacnet_pinfolen); offset ++; - proto_tree_add_text(bacnet_tree, tvb, offset, - bacnet_pinfolen, "Port Info: %s", - tvb_bytes_to_ep_str(tvb, offset, bacnet_pinfolen)); + proto_tree_add_item(bacnet_tree, hf_bacnet_pinfo, tvb, offset, + bacnet_pinfolen, ENC_NA); offset += bacnet_pinfolen; } } @@ -599,6 +599,11 @@ proto_register_bacnet(void) FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } }, + { &hf_bacnet_pinfo, + { "Port Inf", "bacnet.pinfo", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL } + }, { &hf_bacnet_portid, { "Port ID", "bacnet.portid", FT_UINT8, BASE_HEX, NULL, 0, diff --git a/epan/dissectors/packet-bat.c b/epan/dissectors/packet-bat.c index ffea48911c..8ae2c08095 100644 --- a/epan/dissectors/packet-bat.c +++ b/epan/dissectors/packet-bat.c @@ -114,6 +114,8 @@ static int hf_bat_batman_version = -1; static int hf_bat_batman_flags = -1; static int hf_bat_batman_ttl = -1; static int hf_bat_batman_gwflags = -1; +static int hf_bat_batman_gwflags_dl_speed = -1; +static int hf_bat_batman_gwflags_ul_speed = -1; static int hf_bat_batman_seqno = -1; static int hf_bat_batman_gwport = -1; static int hf_bat_batman_orig = -1; @@ -223,8 +225,8 @@ static void dissect_bat_gwflags(tvbuff_t *tvb, guint8 gwflags, int offset, proto up = ((upbits + 1) * down) / 8; gwflags_tree = proto_item_add_subtree(tgw, ett_bat_batman_gwflags); - proto_tree_add_text(gwflags_tree, tvb, offset, 1, "Download Speed: %dkbit", down); - proto_tree_add_text(gwflags_tree, tvb, offset, 1, "Upload Speed: %dkbit", up); + proto_tree_add_uint_format_value(gwflags_tree, hf_bat_batman_gwflags_dl_speed, tvb, offset, 1, down, "%dkbit", down); + proto_tree_add_uint_format_value(gwflags_tree, hf_bat_batman_gwflags_ul_speed, tvb, offset, 1, up, "%dkbit", up); } @@ -746,6 +748,16 @@ void proto_register_bat(void) FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + { &hf_bat_batman_gwflags_dl_speed, + { "Download Speed", "bat.batman.gwflags.dl_speed", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_bat_batman_gwflags_ul_speed, + { "Upload Speed", "bat.batman.gwflags.ul_speed", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, { &hf_bat_batman_seqno, { "Sequence number", "bat.batman.seq", FT_UINT16, BASE_DEC, NULL, 0x0, diff --git a/epan/dissectors/packet-batadv.c b/epan/dissectors/packet-batadv.c index d871030d59..665b18ad76 100644 --- a/epan/dissectors/packet-batadv.c +++ b/epan/dissectors/packet-batadv.c @@ -368,6 +368,8 @@ static int hf_batadv_batman_version = -1; static int hf_batadv_batman_flags = -1; static int hf_batadv_batman_ttl = -1; static int hf_batadv_batman_gwflags = -1; +static int hf_batadv_batman_gwflags_dl_speed = -1; +static int hf_batadv_batman_gwflags_ul_speed = -1; static int hf_batadv_batman_tq = -1; static int hf_batadv_batman_seqno = -1; static int hf_batadv_batman_seqno32 = -1; @@ -393,6 +395,9 @@ static int hf_batadv_icmp_ttl = -1; static int hf_batadv_icmp_uid = -1; static int hf_batadv_icmp_seqno = -1; +static int hf_batadv_icmp_rr_pointer = -1; +static int hf_batadv_icmp_rr_ether = -1; + static int hf_batadv_unicast_version = -1; static int hf_batadv_unicast_dst = -1; static int hf_batadv_unicast_ttl = -1; @@ -706,9 +711,8 @@ static void dissect_batadv_gwflags(tvbuff_t *tvb, guint8 gwflags, int offset, pr } gwflags_tree = proto_item_add_subtree(tgw, ett_batadv_batman_gwflags); - proto_tree_add_text(gwflags_tree, tvb, offset, 1, "Download Speed: %dkbit", down); - proto_tree_add_text(gwflags_tree, tvb, offset, 1, "Upload Speed: %dkbit", up); - + proto_tree_add_uint_format_value(gwflags_tree, hf_batadv_batman_gwflags_dl_speed, tvb, offset, 1, down, "%dkbit", down); + proto_tree_add_uint_format_value(gwflags_tree, hf_batadv_batman_gwflags_ul_speed, tvb, offset, 1, up, "%dkbit", up); } static int dissect_batadv_batman_v5(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) @@ -1753,13 +1757,13 @@ dissect_batadv_icmp_rr(proto_tree *batadv_icmp_tree, tvbuff_t *tvb, int offset) field_tree = proto_tree_add_subtree(batadv_icmp_tree, tvb, offset, 1+ 6 * BAT_RR_LEN, ett_batadv_icmp_rr, NULL, "ICMP RR"); - proto_tree_add_text(field_tree, tvb, offset, 1, "Pointer: %d", ptr); + proto_tree_add_item(field_tree, hf_batadv_icmp_rr_pointer, tvb, offset, 1, ENC_NA); ptr--; offset++; for (i = 0; i < BAT_RR_LEN; i++) { - proto_tree_add_text(field_tree, tvb, offset, 6, "%s%s", - (i > ptr) ? "-" : tvb_ether_to_str(tvb, offset), + proto_tree_add_ether_format(field_tree, hf_batadv_icmp_rr_ether, tvb, offset, 6, tvb_get_ptr(tvb, offset, 6), + "%s%s", (i > ptr) ? "-" : tvb_ether_to_str(tvb, offset), (i == ptr) ? " <- (current)" : ""); offset += 6; @@ -3188,6 +3192,16 @@ void proto_register_batadv(void) FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + { &hf_batadv_batman_gwflags_dl_speed, + { "Download Speed", "batadv.batman.gwflags.dl_speed", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_batadv_batman_gwflags_ul_speed, + { "Upload Speed", "batadv.batman.gwflags.ul_speed", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, { &hf_batadv_batman_tq, { "Transmission Quality", "batadv.batman.tq", FT_UINT8, BASE_DEC, NULL, 0x0, @@ -3318,6 +3332,16 @@ void proto_register_batadv(void) FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL} }, + { &hf_batadv_icmp_rr_pointer, + { "Pointer", "batadv.icmp.rr_pointer", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL} + }, + { &hf_batadv_icmp_rr_ether, + { "RR MAC", "batadv.icmp.rr_ether", + FT_ETHER, BASE_NONE, NULL, 0x0, + NULL, HFILL} + }, { &hf_batadv_unicast_version, { "Version", "batadv.unicast.version", FT_UINT8, BASE_DEC, NULL, 0x0, diff --git a/epan/dissectors/packet-bfd.c b/epan/dissectors/packet-bfd.c index a5430a81fa..59005a6c18 100644 --- a/epan/dissectors/packet-bfd.c +++ b/epan/dissectors/packet-bfd.c @@ -131,7 +131,7 @@ static gint proto_bfd = -1; static gint hf_bfd_version = -1; static gint hf_bfd_diag = -1; static gint hf_bfd_sta = -1; -/* static gint hf_bfd_flags = -1; */ +static gint hf_bfd_flags = -1; static gint hf_bfd_flags_h = -1; static gint hf_bfd_flags_p = -1; static gint hf_bfd_flags_f = -1; @@ -149,6 +149,7 @@ static gint hf_bfd_your_discriminator = -1; static gint hf_bfd_desired_min_tx_interval = -1; static gint hf_bfd_required_min_rx_interval = -1; static gint hf_bfd_required_min_echo_interval = -1; +static gint hf_bfd_checksum = -1; static gint hf_bfd_auth_type = -1; static gint hf_bfd_auth_len = -1; @@ -355,21 +356,17 @@ dissect_bfd_authentication(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case BFD_AUTH_SHA1: case BFD_AUTH_MET_SHA1: if (auth_len != get_bfd_required_auth_len(auth_type)) { - if (tree) { - ti = proto_tree_add_text(auth_tree, tvb, offset, auth_len, - "Length of authentication is invalid (%d)", auth_len); - proto_item_append_text(auth_item, ": Invalid Authentication Section"); - } - expert_add_info_format(pinfo, ti, &ei_bfd_auth_len_invalid, - "Length of authentication section is invalid for Authentication Type: %s", - val_to_str(auth_type, bfd_control_auth_type_values, "Unknown Authentication Type (%d)") ); + proto_tree_add_expert_format(auth_tree, pinfo, &ei_bfd_auth_len_invalid, tvb, offset, auth_len, + "Length of authentication section (%d) is invalid for Authentication Type: %s", + auth_len, val_to_str(auth_type, bfd_control_auth_type_values, "Unknown Authentication Type (%d)") ); + + proto_item_append_text(auth_item, ": Invalid Authentication Section"); } if (tree) { proto_tree_add_item(auth_tree, hf_bfd_auth_seq_num, tvb, offset+4, 4, ENC_BIG_ENDIAN); - proto_tree_add_text(auth_tree, tvb, offset+8, get_bfd_checksum_len(auth_type), "Checksum: 0x%s", - tvb_bytes_to_ep_str(tvb, offset+8, get_bfd_checksum_len(auth_type)) ); + proto_tree_add_item(auth_tree, hf_bfd_checksum, tvb, offset+8, get_bfd_checksum_len(auth_type), ENC_NA); } break; default: @@ -457,7 +454,6 @@ dissect_bfd_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tree) { proto_item *ti; - proto_tree *bfd_flags_tree; const char *sep; ti = proto_tree_add_protocol_format(tree, proto_bfd, tvb, 0, bfd_length, @@ -483,13 +479,15 @@ dissect_bfd_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } switch (bfd_version) { case 0: - ti = proto_tree_add_text ( bfd_tree, tvb, 1, 1, "Message Flags: 0x%02x", - bfd_flags); - bfd_flags_tree = proto_item_add_subtree(ti, ett_bfd_flags); - proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_h, tvb, 1, 1, bfd_flags_h); - proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_d_v0, tvb, 1, 1, bfd_flags_d_v0); - proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_p_v0, tvb, 1, 1, bfd_flags_p_v0); - proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_f_v0, tvb, 1, 1, bfd_flags_f_v0); + { + static const int * bfd_message_flags[] = { + &hf_bfd_flags_h, + &hf_bfd_flags_d_v0, + &hf_bfd_flags_p_v0, + &hf_bfd_flags_f_v0, + NULL + }; + proto_tree_add_bitmask(bfd_tree, tvb, 1, hf_bfd_flags, ett_bfd_flags, bfd_message_flags, ENC_NA); sep = initial_sep; APPEND_BOOLEAN_FLAG(bfd_flags_h, ti, "%sH"); @@ -499,18 +497,21 @@ dissect_bfd_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (sep != initial_sep) { proto_item_append_text (ti, ")"); } + } break; case 1: default: - ti = proto_tree_add_text ( bfd_tree, tvb, 1, 1, "Message Flags: 0x%02x", - bfd_flags); - bfd_flags_tree = proto_item_add_subtree(ti, ett_bfd_flags); - proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_p, tvb, 1, 1, bfd_flags_p); - proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_f, tvb, 1, 1, bfd_flags_f); - proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_c, tvb, 1, 1, bfd_flags_c); - proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_a, tvb, 1, 1, bfd_flags_a); - proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_d, tvb, 1, 1, bfd_flags_d); - proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_m, tvb, 1, 1, bfd_flags_m); + { + static const int * bfd_message_flags[] = { + &hf_bfd_flags_p, + &hf_bfd_flags_f, + &hf_bfd_flags_c, + &hf_bfd_flags_a, + &hf_bfd_flags_d, + &hf_bfd_flags_m, + NULL + }; + proto_tree_add_bitmask(bfd_tree, tvb, 1, hf_bfd_flags, ett_bfd_flags, bfd_message_flags, ENC_NA); sep = initial_sep; APPEND_BOOLEAN_FLAG(bfd_flags_p, ti, "%sP"); @@ -522,6 +523,7 @@ dissect_bfd_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (sep != initial_sep) { proto_item_append_text (ti, ")"); } + } break; } @@ -566,9 +568,8 @@ dissect_bfd_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (bfd_length >= 28) { dissect_bfd_authentication(tvb, pinfo, bfd_tree); } else { - proto_item *ti = proto_tree_add_text(bfd_tree, tvb, 24, bfd_length-24, + proto_tree_add_expert_format(bfd_tree, pinfo, &ei_bfd_auth_no_data, tvb, 24, bfd_length-24, "Authentication: Length of the BFD frame is invalid (%d)", bfd_length); - expert_add_info(pinfo, ti, &ei_bfd_auth_no_data); } } @@ -701,13 +702,11 @@ proto_register_bfd(void) FT_UINT8, BASE_HEX, VALS(bfd_control_sta_values), 0xc0, "The BFD state as seen by the transmitting system", HFILL } }, -#if 0 { &hf_bfd_flags, { "Message Flags", "bfd.flags", - FT_UINT8, BASE_HEX, NULL, 0xf0, + FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL } }, -#endif { &hf_bfd_flags_h, { "I hear you", "bfd.flags.h", FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x80, @@ -795,6 +794,11 @@ proto_register_bfd(void) FT_UINT32, BASE_DEC, NULL, 0x0, "The minimum interval between received BFD Echo packets that this system can support", HFILL } }, + { &hf_bfd_checksum, + { "Checksum", "bfd.checksum", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, { &hf_bfd_auth_type, { "Authentication Type", "bfd.auth.type", FT_UINT8, BASE_DEC, VALS(bfd_control_auth_type_values), 0x0, diff --git a/epan/dissectors/packet-bitcoin.c b/epan/dissectors/packet-bitcoin.c index 1704a072e1..1992705f6c 100644 --- a/epan/dissectors/packet-bitcoin.c +++ b/epan/dissectors/packet-bitcoin.c @@ -676,8 +676,7 @@ dissect_bitcoin_msg_inv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) { proto_tree *subtree; - ti = proto_tree_add_text(tree, tvb, offset, 36, "Inventory vector"); - subtree = proto_item_add_subtree(ti, ett_inv_list); + subtree = proto_tree_add_subtree(tree, tvb, offset, 36, ett_inv_list, NULL, "Inventory vector"); proto_tree_add_item(subtree, &hfi_msg_inv_type, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; diff --git a/epan/dissectors/packet-bittorrent.c b/epan/dissectors/packet-bittorrent.c index ccbdb1b8e4..49a514898b 100644 --- a/epan/dissectors/packet-bittorrent.c +++ b/epan/dissectors/packet-bittorrent.c @@ -155,6 +155,8 @@ static gint hf_azureus_jpc_port = -1; static gint hf_azureus_jpc_session = -1; static gint hf_bittorrent_port = -1; static gint hf_bittorrent_extended = -1; +static gint hf_bittorrent_continuous_data = -1; +static gint hf_bittorrent_version = -1; static gint ett_bittorrent = -1; static gint ett_bittorrent_msg = -1; @@ -362,7 +364,7 @@ dissect_bittorrent_message (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } #endif if (msgtype == NULL) { - proto_tree_add_text(tree, tvb, offset, -1, "Continuation data"); + proto_tree_add_item(tree, hf_bittorrent_continuous_data, tvb, offset, -1, ENC_NA); col_set_str(pinfo->cinfo, COL_INFO, "Continuation data"); return; } @@ -514,9 +516,8 @@ dissect_bittorrent_welcome (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t if(tvb_memeql(tvb, offset, peer_id[i].id, (int)strlen(peer_id[i].id)) == 0) { version = tvb_get_string_enc(wmem_packet_scope(), tvb, offset + (int)strlen(peer_id[i].id), peer_id[i].ver_len, ENC_ASCII); - proto_tree_add_text(tree, tvb, offset, 20, "Client is %s v%s", - peer_id[i].name, - format_text((guchar*)version, peer_id[i].ver_len)); + proto_tree_add_string_format(tree, hf_bittorrent_version, tvb, offset, 20, version, "Client is %s v%s", + peer_id[i].name, format_text((guchar*)version, peer_id[i].ver_len)); break; } } @@ -655,7 +656,13 @@ proto_register_bittorrent(void) }, { &hf_bittorrent_extended, { "Extended Message", "bittorrent.extended", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } - } + }, + { &hf_bittorrent_continuous_data, + { "Extended Message", "bittorrent.continuous_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_bittorrent_version, + { "Client version", "bittorrent.version", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } + }, }; static gint *ett[] = { diff --git a/epan/dissectors/packet-bofl.c b/epan/dissectors/packet-bofl.c index 96be5eb8ea..1ce85c09f6 100644 --- a/epan/dissectors/packet-bofl.c +++ b/epan/dissectors/packet-bofl.c @@ -54,6 +54,7 @@ void proto_reg_handoff_bofl(void); static int proto_bofl = -1; static int hf_bofl_pdu = -1; static int hf_bofl_sequence = -1; +static int hf_bofl_padding = -1; /* Initialize the subtree pointers */ static gint ett_bofl = -1; @@ -86,10 +87,9 @@ dissect_bofl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_uint(bofl_tree, hf_bofl_sequence, tvb, 4, 4, sequence); - len = tvb_length_remaining(tvb, 8); + len = tvb_captured_length_remaining(tvb, 8); if (len > 0) - proto_tree_add_text(bofl_tree, tvb, 8, len, - "Padding (%d byte)", len); + proto_tree_add_item(bofl_tree, hf_bofl_padding, tvb, 8, -1, ENC_NA); } @@ -101,11 +101,16 @@ proto_register_bofl(void) { "PDU", "bofl.pdu", FT_UINT32, BASE_HEX, NULL, 0, "PDU; normally equals 0x01010000 or 0x01011111", HFILL } - }, + }, { &hf_bofl_sequence, { "Sequence", "bofl.sequence", FT_UINT32, BASE_DEC, NULL, 0, "incremental counter", HFILL } + }, + { &hf_bofl_padding, + { "Padding", "bofl.padding", + FT_UINT32, BASE_DEC, NULL, 0, + "incremental counter", HFILL } } }; diff --git a/epan/dissectors/packet-bvlc.c b/epan/dissectors/packet-bvlc.c index 56b645d288..6807c0a611 100644 --- a/epan/dissectors/packet-bvlc.c +++ b/epan/dissectors/packet-bvlc.c @@ -162,12 +162,10 @@ dissect_bvlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ bvlc_length = packet_length; } + if (bvlc_length < 4) { + return 0; /* reject */ + } if (tree) { - if (bvlc_length < 4) { - proto_tree_add_text(tree, tvb, 2, 2, - "Bogus length: %d", bvlc_length); - return tvb_reported_length(tvb); /* XXX - reject? */ - } ti = proto_tree_add_item(tree, proto_bvlc, tvb, 0, bvlc_length, ENC_NA); bvlc_tree = proto_item_add_subtree(ti, ett_bvlc); diff --git a/epan/dissectors/packet-carp.c b/epan/dissectors/packet-carp.c index b9d5e347bd..36a05ee243 100644 --- a/epan/dissectors/packet-carp.c +++ b/epan/dissectors/packet-carp.c @@ -46,6 +46,7 @@ static gint hf_carp_demotion = -1; static gint hf_carp_advbase = -1; static gint hf_carp_counter = -1; static gint hf_carp_hmac = -1; +static gint hf_carp_checksum = -1; #define CARP_VERSION_MASK 0xf0 #define CARP_TYPE_MASK 0x0f @@ -134,6 +135,7 @@ dissect_carp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) offset++; cksum = tvb_get_ntohs(tvb, offset); + ti = proto_tree_add_item(carp_tree, hf_carp_checksum, tvb, offset, 2, ENC_BIG_ENDIAN); carp_len = (gint)tvb_reported_length(tvb); if (!pinfo->fragmented && (gint)tvb_length(tvb) >= carp_len) { /* The packet isn't part of a fragmented datagram @@ -142,19 +144,13 @@ dissect_carp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) cksum_vec[0].len = carp_len; computed_cksum = in_cksum(&cksum_vec[0], 1); if (computed_cksum == 0) { - proto_tree_add_text(carp_tree, tvb, offset, 2, - "Checksum: 0x%04x [correct]", - cksum); + proto_item_append_text(ti, " [correct]"); } else { - proto_tree_add_text(carp_tree, tvb, offset, 2, - "Checksum: 0x%04x [incorrect, should be 0x%04x]", - cksum, + proto_item_append_text(ti, " [incorrect, should be 0x%04x]", in_cksum_shouldbe(cksum, computed_cksum)); } - } else { - proto_tree_add_text(carp_tree, tvb, offset, 2, - "Checksum: 0x%04x", cksum); } + offset+=2; /* Counter */ @@ -229,6 +225,11 @@ void proto_register_carp(void) {"HMAC", "carp.hmac", FT_BYTES, BASE_NONE, NULL, 0x0, "SHA-1 HMAC", HFILL }}, + + { &hf_carp_checksum, + {"Checksum", "carp.checksum", + FT_UINT16, BASE_HEX, NULL, 0x0, + NULL, HFILL }}, }; static gint *ett[] = { diff --git a/epan/dissectors/packet-ccsds.c b/epan/dissectors/packet-ccsds.c index daf27d4f3a..109bd224fa 100644 --- a/epan/dissectors/packet-ccsds.c +++ b/epan/dissectors/packet-ccsds.c @@ -78,6 +78,8 @@ static int hf_ccsds_format_version_id = -1; static int hf_ccsds_extended_format_id = -1; /* static int hf_ccsds_spare3 = -1; */ static int hf_ccsds_frame_id = -1; +static int hf_ccsds_embedded_time = -1; +static int hf_ccsds_user_data = -1; /* ccsds checkword (checksum) */ static int hf_ccsds_checkword = -1; @@ -91,6 +93,7 @@ static gint ett_ccsds_secondary_header = -1; static gint ett_ccsds_checkword = -1; static expert_field ei_ccsds_length_error = EI_INIT; +static expert_field ei_ccsds_checkword = EI_INIT; /* Dissectot table */ static dissector_table_t ccsds_dissector_table; @@ -314,7 +317,7 @@ dissect_ccsds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gint reported_length; guint8 checkword_flag = 0; gint counter = 0; - proto_item *item; + proto_item *item, *checkword_item; proto_tree *checkword_tree; guint16 checkword_field = 0; guint16 checkword_sum = 0; @@ -384,10 +387,10 @@ dissect_ccsds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ++offset; time_string = embedded_time_to_string ( coarse_time, fine_time ); - proto_tree_add_text(secondary_header_tree, tvb, offset-5, 5, "%s = Embedded Time", time_string); + proto_tree_add_string(secondary_header_tree, hf_ccsds_embedded_time, tvb, offset-5, 5, time_string); proto_tree_add_item(secondary_header_tree, hf_ccsds_timeid, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(secondary_header_tree, hf_ccsds_checkword_flag, tvb, offset, 1, ENC_BIG_ENDIAN); + checkword_item = proto_tree_add_item(secondary_header_tree, hf_ccsds_checkword_flag, tvb, offset, 1, ENC_BIG_ENDIAN); /* Global Preference: how to handle checkword flag */ switch (global_dissect_checkword) { @@ -448,10 +451,10 @@ dissect_ccsds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (reported_length < ccsds_length || ccsds_length < CCSDS_PRIMARY_HEADER_LENGTH + CCSDS_SECONDARY_HEADER_LENGTH) { /* Label CCSDS payload 'User Data' */ if (length > offset) - proto_tree_add_text(ccsds_tree, tvb, offset, length-offset, "User Data"); + proto_tree_add_item(ccsds_tree, hf_ccsds_user_data, tvb, offset, length-offset, ENC_NA); offset += length-offset; if (checkword_flag == 1) - proto_tree_add_text(ccsds_tree, tvb, offset, 0, "Packet does not contain a Checkword"); + expert_add_info(pinfo, checkword_item, &ei_ccsds_checkword); } /* Handle checkword according to CCSDS preference setting. */ else { @@ -459,7 +462,7 @@ dissect_ccsds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Look for a subdissector for the CCSDS payload */ if (!dissector_try_uint(ccsds_dissector_table, first_word&HDR_APID, next_tvb, pinfo, tree)) { /* If no subdissector is found, label the CCSDS payload as 'User Data' */ - proto_tree_add_text(ccsds_tree, tvb, offset, length-offset-2*checkword_flag, "User Data"); + proto_tree_add_item(ccsds_tree, hf_ccsds_user_data, tvb, offset, length-offset-2*checkword_flag, ENC_NA); } offset += length-offset-2*checkword_flag; @@ -640,6 +643,16 @@ proto_register_ccsds(void) FT_UINT8, BASE_DEC, NULL, 0xff, NULL, HFILL } }, + { &hf_ccsds_embedded_time, + { "Embedded Time", "ccsds.embedded_time", + FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, + { &hf_ccsds_user_data, + { "User Data", "ccsds.user_data", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, { &hf_ccsds_checkword, { "CCSDS checkword", "ccsds.checkword", FT_UINT16, BASE_HEX, NULL, 0x0, @@ -667,6 +680,7 @@ proto_register_ccsds(void) static ei_register_info ei[] = { { &ei_ccsds_length_error, { "ccsds.length.error", PI_MALFORMED, PI_ERROR, "Length field value is greater than the packet seen on the wire", EXPFILL }}, + { &ei_ccsds_checkword, { "ccsds.no_checkword", PI_PROTOCOL, PI_WARN, "Packet does not contain a Checkword", EXPFILL }}, }; /* Define the CCSDS preferences module */ diff --git a/epan/dissectors/packet-cell_broadcast.c b/epan/dissectors/packet-cell_broadcast.c index cd59cdd3ca..7ae7ed6232 100644 --- a/epan/dissectors/packet-cell_broadcast.c +++ b/epan/dissectors/packet-cell_broadcast.c @@ -31,6 +31,7 @@ #include <epan/asn1.h> #include <epan/packet.h> +#include <epan/expert.h> #include <epan/reassemble.h> #include "packet-gsm_map.h" @@ -139,6 +140,8 @@ static gint ett_gsm_cbs_page = -1; static gint ett_gsm_cbs_page_content = -1; static gint ett_gsm_cbs_pages = -1; +static expert_field ei_gsm_cbs_unhandled_encoding = EI_INIT; + /* reassembly of GSM multi-page messages */ static reassembly_table gsm_cbs_reassembly_table; @@ -288,7 +291,8 @@ tvbuff_t * dissect_cbs_data(guint8 sms_encoding, tvbuff_t *tvb, proto_tree *tree break; default: - proto_tree_add_text(tree, tvb, offset, length, "Unhandled encoding %d of CBS String", sms_encoding); + proto_tree_add_expert_format(tree, pinfo, &ei_gsm_cbs_unhandled_encoding, tvb, offset, length, + "Unhandled encoding %d of CBS String", sms_encoding); break; } return tvb_out; @@ -393,6 +397,7 @@ void dissect_umts_cell_broadcast_message(tvbuff_t *tvb, packet_info *pinfo, prot proto_item *cbs_item; proto_tree *cbs_tree, *cbs_subtree; guint msg_len; + guint8 *msg; tvbuff_t * cbs_msg_tvb = NULL; len = tvb_length(tvb); @@ -410,7 +415,8 @@ void dissect_umts_cell_broadcast_message(tvbuff_t *tvb, packet_info *pinfo, prot msg_len = tvb_length(cbs_msg_tvb); cbs_subtree = proto_tree_add_subtree_format(cbs_tree, tvb, offset, -1, ett_cbs_msg, NULL, "Cell Broadcast Message Contents (length: %d)", msg_len); - proto_tree_add_text(cbs_subtree, cbs_msg_tvb , 0, tvb_length(cbs_msg_tvb), "%s", tvb_get_string_enc(wmem_packet_scope(), cbs_msg_tvb, 0, msg_len, ENC_ASCII)); + msg = tvb_get_string_enc(wmem_packet_scope(), cbs_msg_tvb, 0, msg_len, ENC_ASCII); + proto_tree_add_string_format(cbs_subtree, hf_gsm_cbs_message_content, cbs_msg_tvb, 0, -1, msg, "%s", msg); } /* Register the protocol with Wireshark */ @@ -560,6 +566,11 @@ proto_register_cbs(void) &ett_gsm_cbs_pages, }; + static ei_register_info ei[] = { + { &ei_gsm_cbs_unhandled_encoding, { "gsm_cbs.unhandled_encoding", PI_PROTOCOL, PI_WARN, "Unhandled encoding", EXPFILL }}, + }; + expert_module_t* expert_cell_broadcast; + /* Register the protocol name and description */ proto_cell_broadcast = proto_register_protocol("GSM Cell Broadcast Service", "GSM Cell Broadcast Service", "gsm_cbs"); @@ -572,4 +583,6 @@ proto_register_cbs(void) /* subtree array */ proto_register_subtree_array(ett, array_length(ett)); + expert_cell_broadcast = expert_register_protocol(proto_cell_broadcast); + expert_register_field_array(expert_cell_broadcast, ei, array_length(ei)); } diff --git a/epan/dissectors/packet-chdlc.c b/epan/dissectors/packet-chdlc.c index f30a0faf5e..b280bdb42b 100644 --- a/epan/dissectors/packet-chdlc.c +++ b/epan/dissectors/packet-chdlc.c @@ -48,15 +48,18 @@ void proto_reg_handoff_slarp(void); static int proto_chdlc = -1; static int hf_chdlc_addr = -1; static int hf_chdlc_proto = -1; +static int hf_chdlc_clns_padding = -1; static gint ett_chdlc = -1; static int proto_slarp = -1; static int hf_slarp_ptype = -1; static int hf_slarp_address = -1; +static int hf_slarp_netmask = -1; static int hf_slarp_mysequence = -1; /* static int hf_slarp_yoursequence = -1; */ + static gint ett_slarp = -1; static dissector_handle_t data_handle; @@ -127,12 +130,10 @@ chdlctype(guint16 chdlc_type, tvbuff_t *tvb, int offset_after_chdlctype, int chdlctype_id) { tvbuff_t *next_tvb; - int padbyte = 0; + int padbyte; - if (tree) { - proto_tree_add_uint(fh_tree, chdlctype_id, tvb, + proto_tree_add_uint(fh_tree, chdlctype_id, tvb, offset_after_chdlctype - 2, 2, chdlc_type); - } padbyte = tvb_get_guint8(tvb, offset_after_chdlctype); if (chdlc_type == CHDLCTYPE_OSI && @@ -140,8 +141,7 @@ chdlctype(guint16 chdlc_type, tvbuff_t *tvb, int offset_after_chdlctype, padbyte == NLPID_ISO9542_ESIS || padbyte == NLPID_ISO10589_ISIS)) { /* There is a Padding Byte for CLNS protocols over Cisco HDLC */ - proto_tree_add_text(fh_tree, tvb, offset_after_chdlctype, 1, "CLNS Padding: 0x%02x", - padbyte); + proto_tree_add_item(fh_tree, hf_chdlc_clns_padding, tvb, offset_after_chdlctype, 1, ENC_NA); next_tvb = tvb_new_subset_remaining(tvb, offset_after_chdlctype + 1); } else { next_tvb = tvb_new_subset_remaining(tvb, offset_after_chdlctype); @@ -210,7 +210,11 @@ proto_register_chdlc(void) { &hf_chdlc_proto, { "Protocol", "chdlc.protocol", FT_UINT16, BASE_HEX, VALS(chdlc_vals), 0x0, NULL, HFILL }}, + { &hf_chdlc_clns_padding, + { "CLNS Padding", "chdlc.clns_padding", FT_UINT8, BASE_HEX, + NULL, 0x0, NULL, HFILL }}, }; + static gint *ett[] = { &ett_chdlc, }; @@ -296,8 +300,7 @@ dissect_slarp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tree) { proto_tree_add_uint(slarp_tree, hf_slarp_ptype, tvb, 0, 4, code); proto_tree_add_item(slarp_tree, hf_slarp_address, tvb, 4, 4, ENC_BIG_ENDIAN); - proto_tree_add_text(slarp_tree, tvb, 8, 4, - "Netmask: %s", tvb_ip_to_str(tvb, 8)); + proto_tree_add_item(slarp_tree, hf_slarp_netmask, tvb, 8, 4, ENC_BIG_ENDIAN); } break; @@ -340,6 +343,9 @@ proto_register_slarp(void) NULL, 0x0, NULL, HFILL }}, /* XXX - need an FT_ for netmasks, which is like FT_IPV4 but doesn't get translated to a host name. */ + { &hf_slarp_netmask, + { "Netmask", "slarp.netmask", FT_IPv4, BASE_NONE, + NULL, 0x0, NULL, HFILL }}, { &hf_slarp_mysequence, { "Outgoing sequence number", "slarp.mysequence", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-cigi.c b/epan/dissectors/packet-cigi.c index 1e11f0e748..b7e1208e30 100644 --- a/epan/dissectors/packet-cigi.c +++ b/epan/dissectors/packet-cigi.c @@ -168,7 +168,7 @@ static const true_false_string cigi_valid_tfs = { static int hf_cigi_src_port = -1; static int hf_cigi_dest_port = -1; static int hf_cigi_port = -1; - +static int hf_cigi_data = -1; static int hf_cigi_packet_id = -1; static int hf_cigi_packet_size = -1; static int hf_cigi_version = -1; @@ -483,6 +483,7 @@ static int hf_cigi2_special_effect_definition_x_scale = -1; static int hf_cigi2_special_effect_definition_y_scale = -1; static int hf_cigi2_special_effect_definition_z_scale = -1; static int hf_cigi2_special_effect_definition_time_scale = -1; +static int hf_cigi2_special_effect_definition_spare = -1; static int hf_cigi2_special_effect_definition_effect_count = -1; static int hf_cigi2_special_effect_definition_separation = -1; static int hf_cigi2_special_effect_definition_burst_interval = -1; @@ -2755,7 +2756,7 @@ cigi_add_tree(tvbuff_t *tvb, proto_tree *cigi_tree) data_size--; } - proto_tree_add_text(cigi_packet_tree, tvb, offset, data_size, "Data (%i bytes)", data_size ); + proto_tree_add_item(cigi_packet_tree, hf_cigi_data, tvb, offset, data_size, ENC_NA); offset += data_size; } } @@ -2775,7 +2776,7 @@ cigi_add_data(tvbuff_t *tvb, proto_tree *tree, gint offset) THROW(ReportedBoundsError); } - proto_tree_add_text(tree, tvb, offset, packet_size-2, "Data (%i bytes)", packet_size-2 ); + proto_tree_add_item(tree, hf_cigi_data, tvb, offset, packet_size-2, ENC_NA); offset += packet_size-2; return offset; @@ -2915,62 +2916,93 @@ cigi2_add_tree(tvbuff_t *tvb, proto_tree *cigi_tree) proto_tree_add_item(cigi_packet_tree, hf_cigi_packet_size, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; - if ( packet_id == CIGI2_PACKET_ID_IG_CONTROL ) { + switch(packet_id) + { + case CIGI2_PACKET_ID_IG_CONTROL: offset = cigi2_add_ig_control(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_ENTITY_CONTROL ) { + break; + case CIGI2_PACKET_ID_ENTITY_CONTROL: offset = cigi2_add_entity_control(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_COMPONENT_CONTROL ) { + break; + case CIGI2_PACKET_ID_COMPONENT_CONTROL: offset = cigi2_add_component_control(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_ARTICULATED_PARTS_CONTROL ) { + break; + case CIGI2_PACKET_ID_ARTICULATED_PARTS_CONTROL: offset = cigi2_add_articulated_parts_control(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_RATE_CONTROL ) { + break; + case CIGI2_PACKET_ID_RATE_CONTROL: offset = cigi2_add_rate_control(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_ENVIRONMENT_CONTROL ) { + break; + case CIGI2_PACKET_ID_ENVIRONMENT_CONTROL: offset = cigi2_add_environment_control(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_WEATHER_CONTROL ) { + break; + case CIGI2_PACKET_ID_WEATHER_CONTROL: offset = cigi2_add_weather_control(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_VIEW_CONTROL ) { + break; + case CIGI2_PACKET_ID_VIEW_CONTROL: offset = cigi2_add_view_control(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_SENSOR_CONTROL ) { + break; + case CIGI2_PACKET_ID_SENSOR_CONTROL: offset = cigi2_add_sensor_control(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_TRAJECTORY_DEFINITION ) { + break; + case CIGI2_PACKET_ID_TRAJECTORY_DEFINITION: offset = cigi2_add_trajectory_definition(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_SPECIAL_EFFECT_DEFINITION ) { + break; + case CIGI2_PACKET_ID_SPECIAL_EFFECT_DEFINITION: offset = cigi2_add_special_effect_definition(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_VIEW_DEFINITION ) { + break; + case CIGI2_PACKET_ID_VIEW_DEFINITION: offset = cigi2_add_view_definition(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_COLLISION_DETECTION_SEGMENT_DEFINITION ) { + break; + case CIGI2_PACKET_ID_COLLISION_DETECTION_SEGMENT_DEFINITION: offset = cigi2_add_collision_detection_segment_definition(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_COLLISION_DETECTION_VOLUME_DEFINITION ) { + break; + case CIGI2_PACKET_ID_COLLISION_DETECTION_VOLUME_DEFINITION: offset = cigi2_add_collision_detection_volume_definition(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_HEIGHT_ABOVE_TERRAIN_REQUEST ) { + break; + case CIGI2_PACKET_ID_HEIGHT_ABOVE_TERRAIN_REQUEST: offset = cigi2_add_height_above_terrain_request(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_LINE_OF_SIGHT_OCCULT_REQUEST ) { + break; + case CIGI2_PACKET_ID_LINE_OF_SIGHT_OCCULT_REQUEST: offset = cigi2_add_line_of_sight_occult_request(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_LINE_OF_SIGHT_RANGE_REQUEST ) { + break; + case CIGI2_PACKET_ID_LINE_OF_SIGHT_RANGE_REQUEST: offset = cigi2_add_line_of_sight_range_request(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_HEIGHT_OF_TERRAIN_REQUEST ) { + break; + case CIGI2_PACKET_ID_HEIGHT_OF_TERRAIN_REQUEST: offset = cigi2_add_height_of_terrain_request(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_START_OF_FRAME ) { + break; + case CIGI2_PACKET_ID_START_OF_FRAME: offset = cigi2_add_start_of_frame(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_HEIGHT_ABOVE_TERRAIN_RESPONSE ) { + break; + case CIGI2_PACKET_ID_HEIGHT_ABOVE_TERRAIN_RESPONSE: offset = cigi2_add_height_above_terrain_response(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_LINE_OF_SIGHT_RESPONSE ) { + break; + case CIGI2_PACKET_ID_LINE_OF_SIGHT_RESPONSE: offset = cigi2_add_line_of_sight_response(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_COLLISION_DETECTION_SEGMENT_RESPONSE ) { + break; + case CIGI2_PACKET_ID_COLLISION_DETECTION_SEGMENT_RESPONSE: offset = cigi2_add_collision_detection_segment_response(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_SENSOR_RESPONSE ) { + break; + case CIGI2_PACKET_ID_SENSOR_RESPONSE: offset = cigi2_add_sensor_response(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_HEIGHT_OF_TERRAIN_RESPONSE ) { + break; + case CIGI2_PACKET_ID_HEIGHT_OF_TERRAIN_RESPONSE: offset = cigi2_add_height_of_terrain_response(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_COLLISION_DETECTION_VOLUME_RESPONSE ) { + break; + case CIGI2_PACKET_ID_COLLISION_DETECTION_VOLUME_RESPONSE: offset = cigi2_add_collision_detection_volume_response(tvb, cigi_packet_tree, offset); - } else if ( packet_id == CIGI2_PACKET_ID_IMAGE_GENERATOR_MESSAGE ) { + break; + case CIGI2_PACKET_ID_IMAGE_GENERATOR_MESSAGE: offset = cigi2_add_image_generator_message(tvb, cigi_packet_tree, offset); - } else if ( packet_id >= CIGI2_PACKET_ID_USER_DEFINABLE_MIN && packet_id <= CIGI2_PACKET_ID_USER_DEFINABLE_MAX ) { - offset = cigi_add_data(tvb, cigi_packet_tree, offset); - } else { - offset = cigi_add_data(tvb, cigi_packet_tree, offset); + break; + default: + if ( packet_id >= CIGI2_PACKET_ID_USER_DEFINABLE_MIN && packet_id <= CIGI2_PACKET_ID_USER_DEFINABLE_MAX ) { + offset = cigi_add_data(tvb, cigi_packet_tree, offset); + } else { + offset = cigi_add_data(tvb, cigi_packet_tree, offset); + } + break; } /* Does the packet offset match the supposed length of the packet? */ @@ -3749,7 +3781,7 @@ cigi2_add_special_effect_definition(tvbuff_t *tvb, proto_tree *tree, gint offset proto_tree_add_float(tree, hf_cigi2_special_effect_definition_time_scale, tvb, offset, 2, tvb_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); offset += 2; - proto_tree_add_text(tree, tvb, offset, 2, "Spare"); + proto_tree_add_item(tree, hf_cigi2_special_effect_definition_spare, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(tree, hf_cigi2_special_effect_definition_effect_count, tvb, offset, 2, ENC_BIG_ENDIAN); @@ -6424,6 +6456,11 @@ proto_register_cigi(void) FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_cigi_data, + { "Data", "cigi.data", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, { &hf_cigi_frame_size, { "Frame Size (bytes)", "cigi.frame_size", @@ -8628,6 +8665,11 @@ proto_register_cigi(void) FT_FLOAT, BASE_NONE, NULL, 0x0, "Specifies a scale factor to apply to the time period for the effect's animation sequence", HFILL } }, + { &hf_cigi2_special_effect_definition_spare, + { "Spare", "cigi.special_effect_def.spare", + FT_UINT16, BASE_HEX, NULL, 0x0, + NULL, HFILL } + }, { &hf_cigi2_special_effect_definition_effect_count, { "Effect Count", "cigi.special_effect_def.effect_count", FT_UINT16, BASE_DEC, NULL, 0x0, diff --git a/epan/dissectors/packet-cimd.c b/epan/dissectors/packet-cimd.c index 3eb9171a64..3b9738e36a 100644 --- a/epan/dissectors/packet-cimd.c +++ b/epan/dissectors/packet-cimd.c @@ -685,17 +685,15 @@ static void dissect_cimd_ud(tvbuff_t *tvb, proto_tree *tree, gint pindex, gint s static void dissect_cimd_dcs(tvbuff_t *tvb, proto_tree *tree, gint pindex, gint startOffset, gint endOffset) { /* Set up structures needed to add the param subtree and manage it */ - proto_item *param_item; proto_tree *param_tree; gint offset; guint32 dcs; guint32 dcs_cg; /* coding group */ - param_item = proto_tree_add_text(tree, tvb, + param_tree = proto_tree_add_subtree(tree, tvb, startOffset + 1, endOffset - (startOffset + 1), - "%s", cimd_vals_PC[pindex].strptr + (*vals_hdr_PC[pindex].ett_p), NULL, cimd_vals_PC[pindex].strptr ); - param_tree = proto_item_add_subtree(param_item, (*vals_hdr_PC[pindex].ett_p)); proto_tree_add_item(param_tree, hf_cimd_pcode_indicator, tvb, startOffset + 1, CIMD_PC_LENGTH, ENC_ASCII|ENC_NA); diff --git a/epan/dissectors/packet-cip.c b/epan/dissectors/packet-cip.c index 5a9a8fdc9a..802a8d61a2 100644 --- a/epan/dissectors/packet-cip.c +++ b/epan/dissectors/packet-cip.c @@ -223,6 +223,8 @@ static int hf_cip_cco_target_config_data = -1; static int hf_cip_cco_iomap_attribute = -1; static int hf_cip_cco_safety = -1; static int hf_cip_cco_change_type = -1; +static int hf_cip_cco_connection_name = -1; +static int hf_cip_cco_ext_status = -1; static int hf_cip_path_segment = -1; static int hf_cip_path_segment_type = -1; @@ -3385,21 +3387,18 @@ dissect_transport_type_trigger(tvbuff_t *tvb, int offset, proto_tree *tree, } /* Dissect EPATH */ -void dissect_epath( tvbuff_t *tvb, packet_info *pinfo, proto_item *epath_item, int offset, int path_length, +void dissect_epath( tvbuff_t *tvb, packet_info *pinfo, proto_tree *path_tree, proto_item *epath_item, int offset, int path_length, gboolean generate, gboolean packed, cip_simple_request_info_t* req_data, cip_safety_epath_info_t* safety) { int pathpos, temp_data, temp_data2, seg_size, i; unsigned char segment_type, opt_link_size; - proto_tree *path_tree, *port_tree, *net_tree; + proto_tree *port_tree, *net_tree; proto_tree *cia_tree, *ds_tree, *ds_data_tree, *path_seg_tree, *safety_tree; proto_item *it, *cia_item, *cia_ret_item, *port_item, *ds_item, *ds_data_item; proto_item *net_item, *hidden_item, *path_seg_item; attribute_info_t* att_info; - /* Create a sub tree for the epath */ - path_tree = proto_item_add_subtree( epath_item, ett_path ); - /* can't populate req_data unless it's there */ if (req_data != NULL) { @@ -3458,19 +3457,18 @@ void dissect_epath( tvbuff_t *tvb, packet_info *pinfo, proto_item *epath_item, i PROTO_ITEM_SET_GENERATED(it); it = proto_tree_add_uint(path_seg_tree, hf_cip_port, NULL, 0, 0, ( segment_type & 0x0F ) ); PROTO_ITEM_SET_GENERATED(it); - port_item = proto_tree_add_text(path_seg_tree, NULL, 0, 0, "Port Segment"); + port_tree = proto_tree_add_subtree(path_seg_tree, NULL, 0, 0, ett_port_path, &port_item, "Port Segment"); PROTO_ITEM_SET_GENERATED(port_item); } else { proto_tree_add_item(path_seg_tree, hf_cip_port_ex_link_addr, tvb, offset+pathpos, 1, ENC_LITTLE_ENDIAN ); proto_tree_add_item(path_seg_tree, hf_cip_port, tvb, offset + pathpos, 1, ENC_LITTLE_ENDIAN); - port_item = proto_tree_add_text(path_seg_tree, tvb, offset + pathpos, 1, "Port Segment"); + port_tree = proto_tree_add_subtree(path_seg_tree, tvb, offset + pathpos, 1, ett_port_path, &port_item, "Port Segment"); } proto_item_append_text( path_seg_item, " (Port Segment)"); proto_item_append_text( epath_item, "Port: %d", ( segment_type & CI_PORT_SEG_PORT_ID_MASK ) ); - port_tree = proto_item_add_subtree( port_item, ett_port_path ); if( segment_type & CI_PORT_SEG_EX_LINK_ADDRESS ) { @@ -3541,7 +3539,8 @@ void dissect_epath( tvbuff_t *tvb, packet_info *pinfo, proto_item *epath_item, i it = proto_tree_add_uint(path_seg_tree, hf_cip_logical_seg_format, NULL, 0, 0, segment_type & CI_LOGICAL_SEG_FORMAT_MASK); PROTO_ITEM_SET_GENERATED(it); } - cia_item = proto_tree_add_text(path_seg_tree, NULL, 0, 0, "%s", val_to_str_const( ((segment_type & (CI_LOGICAL_SEG_TYPE_MASK|CI_LOGICAL_SEG_FORMAT_MASK))), cip_logical_seg_vals, "Reserved")); + cia_tree = proto_tree_add_subtree(path_seg_tree, NULL, 0, 0, ett_cia_path, &cia_item, + val_to_str_const( ((segment_type & (CI_LOGICAL_SEG_TYPE_MASK|CI_LOGICAL_SEG_FORMAT_MASK))), cip_logical_seg_vals, "Reserved")); PROTO_ITEM_SET_GENERATED(cia_item); } else @@ -3549,11 +3548,11 @@ void dissect_epath( tvbuff_t *tvb, packet_info *pinfo, proto_item *epath_item, i proto_tree_add_item(path_seg_tree, hf_cip_logical_seg_type, tvb, offset+pathpos, 1, ENC_LITTLE_ENDIAN ); if ((segment_type & CI_LOGICAL_SEG_TYPE_MASK) <= CI_LOGICAL_SEG_ATTR_ID) proto_tree_add_item(path_seg_tree, hf_cip_logical_seg_format, tvb, offset + pathpos, 1, ENC_LITTLE_ENDIAN); - cia_item = proto_tree_add_text(path_seg_tree, tvb, offset + pathpos, 1, "%s", val_to_str_const( ((segment_type & (CI_LOGICAL_SEG_TYPE_MASK|CI_LOGICAL_SEG_FORMAT_MASK))), cip_logical_seg_vals, "Reserved")); + cia_tree = proto_tree_add_subtree(path_seg_tree, tvb, offset + pathpos, 1, ett_cia_path, &cia_item, + val_to_str_const( ((segment_type & (CI_LOGICAL_SEG_TYPE_MASK|CI_LOGICAL_SEG_FORMAT_MASK))), cip_logical_seg_vals, "Reserved")); } proto_item_append_text( path_seg_item, " (%s)", val_to_str_const( ((segment_type & (CI_LOGICAL_SEG_TYPE_MASK|CI_LOGICAL_SEG_FORMAT_MASK))), cip_logical_seg_vals, "Reserved")); - cia_tree = proto_item_add_subtree( cia_item, ett_cia_path ); switch( segment_type & CI_LOGICAL_SEG_TYPE_MASK ) { @@ -3667,17 +3666,18 @@ void dissect_epath( tvbuff_t *tvb, packet_info *pinfo, proto_item *epath_item, i { it = proto_tree_add_uint(path_seg_tree, hf_cip_data_seg_type, NULL, 0, 0, segment_type & CI_DATA_SEG_TYPE_MASK); PROTO_ITEM_SET_GENERATED(it); - ds_item = proto_tree_add_text(path_seg_tree, NULL, 0, 0, "%s", val_to_str_const( (segment_type & CI_DATA_SEG_TYPE_MASK), cip_data_segment_type_vals, "Reserved")); + ds_tree = proto_tree_add_subtree(path_seg_tree, NULL, 0, 0, ett_data_seg, &ds_item, + val_to_str_const( (segment_type & CI_DATA_SEG_TYPE_MASK), cip_data_segment_type_vals, "Reserved")); PROTO_ITEM_SET_GENERATED(ds_item); } else { proto_tree_add_item(path_seg_tree, hf_cip_data_seg_type, tvb, offset+pathpos, 1, ENC_LITTLE_ENDIAN ); - ds_item = proto_tree_add_text(path_seg_tree, tvb, offset + pathpos, 1, "%s", val_to_str_const( (segment_type & CI_DATA_SEG_TYPE_MASK), cip_data_segment_type_vals, "Reserved")); + ds_tree = proto_tree_add_subtree(path_seg_tree, tvb, offset + pathpos, 1, ett_data_seg, &ds_item, + val_to_str_const( (segment_type & CI_DATA_SEG_TYPE_MASK), cip_data_segment_type_vals, "Reserved")); } proto_item_append_text( path_seg_item, " (%s)", val_to_str_const( (segment_type & CI_DATA_SEG_TYPE_MASK), cip_data_segment_type_vals, "Reserved")); - ds_tree = proto_item_add_subtree( ds_item, ett_data_seg ); switch( segment_type & CI_DATA_SEG_TYPE_MASK) { @@ -3762,17 +3762,18 @@ void dissect_epath( tvbuff_t *tvb, packet_info *pinfo, proto_item *epath_item, i { it = proto_tree_add_uint(path_seg_tree, hf_cip_network_seg_type, NULL, 0, 0, segment_type & CI_NETWORK_SEG_TYPE_MASK); PROTO_ITEM_SET_GENERATED(it); - net_item = proto_tree_add_text(path_seg_tree, NULL, 0, 0, "%s", val_to_str_const( (segment_type & CI_NETWORK_SEG_TYPE_MASK), cip_network_segment_type_vals, "Reserved")); + net_tree = proto_tree_add_subtree(path_seg_tree, NULL, 0, 0, ett_network_seg, &net_item, + val_to_str_const( (segment_type & CI_NETWORK_SEG_TYPE_MASK), cip_network_segment_type_vals, "Reserved")); PROTO_ITEM_SET_GENERATED(net_item); } else { proto_tree_add_item(path_seg_tree, hf_cip_network_seg_type, tvb, offset+pathpos, 1, ENC_LITTLE_ENDIAN ); - net_item = proto_tree_add_text(path_seg_tree, tvb, offset + pathpos, 1, "%s", val_to_str_const( (segment_type & CI_NETWORK_SEG_TYPE_MASK), cip_network_segment_type_vals, "Reserved")); + net_tree = proto_tree_add_subtree(path_seg_tree, tvb, offset + pathpos, 1, ett_network_seg, &net_item, + val_to_str_const( (segment_type & CI_NETWORK_SEG_TYPE_MASK), cip_network_segment_type_vals, "Reserved")); } proto_item_append_text( path_seg_item, " (%s)", val_to_str_const( (segment_type & CI_NETWORK_SEG_TYPE_MASK), cip_network_segment_type_vals, "Reserved")); - net_tree = proto_item_add_subtree( net_item, ett_network_seg ); switch( segment_type & CI_NETWORK_SEG_TYPE_MASK ) { @@ -4850,6 +4851,7 @@ static void dissect_cip_cm_fwd_open_req(cip_req_info_t *preq_info, proto_tree *cmd_tree, tvbuff_t *tvb, int offset, gboolean large_fwd_open, packet_info *pinfo) { proto_item *pi; + proto_tree *epath_tree; int conn_path_size, rpi, net_param_offset = 0; guint32 O2TConnID, T2OConnID, DeviceSerialNumber; guint16 ConnSerialNumber, VendorID; @@ -4928,8 +4930,8 @@ dissect_cip_cm_fwd_open_req(cip_req_info_t *preq_info, proto_tree *cmd_tree, tvb proto_tree_add_uint_format_value(cmd_tree, hf_cip_cm_conn_path_size, tvb, offset+26+net_param_offset+5, 1, conn_path_size/2, "%d (words)", conn_path_size/2); /* Add the epath */ - pi = proto_tree_add_text(cmd_tree, tvb, offset+26+net_param_offset+6, conn_path_size, "Connection Path: "); - dissect_epath( tvb, pinfo, pi, offset+26+net_param_offset+6, conn_path_size, FALSE, FALSE, &connection_path, &safety_fwdopen); + epath_tree = proto_tree_add_subtree(cmd_tree, tvb, offset+26+net_param_offset+6, conn_path_size, ett_path, &pi, "Connection Path: "); + dissect_epath( tvb, pinfo, epath_tree, pi, offset+26+net_param_offset+6, conn_path_size, FALSE, FALSE, &connection_path, &safety_fwdopen); if (pinfo->fd->flags.visited) { @@ -5061,7 +5063,7 @@ static void dissect_cip_cm_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_length, packet_info *pinfo ) { proto_item *pi, *rrsc_item, *status_item, *temp_item; - proto_tree *rrsc_tree, *cmd_data_tree, *status_tree, *add_status_tree, *temp_tree; + proto_tree *rrsc_tree, *cmd_data_tree, *status_tree, *add_status_tree, *temp_tree, *epath_tree; int req_path_size, conn_path_size, temp_data; unsigned char service, gen_status, add_stat_size; unsigned short add_status; @@ -5109,7 +5111,7 @@ dissect_cip_cm_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_ p_remove_proto_data(wmem_file_scope(), pinfo, proto_cip, 0); p_add_proto_data(wmem_file_scope(), pinfo, proto_cip, 0, pembedded_req_info ); - proto_tree_add_text( item_tree, NULL, 0, 0, "(Service: Unconnected Send (Response))" ); + proto_tree_add_uint_format( item_tree, hf_cip_cm_sc, NULL, 0, 0, SC_CM_UNCON_SEND|CIP_SC_RESPONSE_MASK, "(Service: Unconnected Send (Response))" ); next_tvb = tvb_new_subset_length(tvb, offset, item_length); if ( pembedded_req_info && pembedded_req_info->dissector ) call_dissector(pembedded_req_info->dissector, next_tvb, pinfo, item_tree ); @@ -5387,8 +5389,8 @@ dissect_cip_cm_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_ proto_tree_add_item(cmd_data_tree, hf_cip_reserved8, tvb, offset+2+req_path_size+11, 1, ENC_LITTLE_ENDIAN); /* Add the EPATH */ - pi = proto_tree_add_text(cmd_data_tree, tvb, offset+2+req_path_size+12, conn_path_size, "Connection Path: "); - dissect_epath( tvb, pinfo, pi, offset+2+req_path_size+12, conn_path_size, FALSE, FALSE, NULL, NULL ); + epath_tree = proto_tree_add_subtree(cmd_data_tree, tvb, offset+2+req_path_size+12, conn_path_size, ett_path, &pi, "Connection Path: "); + dissect_epath( tvb, pinfo, epath_tree, pi, offset+2+req_path_size+12, conn_path_size, FALSE, FALSE, NULL, NULL ); break; case SC_CM_UNCON_SEND: { @@ -5445,8 +5447,8 @@ dissect_cip_cm_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_ proto_tree_add_item(cmd_data_tree, hf_cip_reserved8, tvb, offset+2+req_path_size+5+msg_req_siz, 1, ENC_LITTLE_ENDIAN); /* Route Path */ - temp_item = proto_tree_add_text(cmd_data_tree, tvb, offset+2+req_path_size+6+msg_req_siz, route_path_size, "Route Path: "); - dissect_epath( tvb, pinfo, temp_item, offset+2+req_path_size+6+msg_req_siz, route_path_size, FALSE, FALSE, NULL, NULL ); + epath_tree = proto_tree_add_subtree(cmd_data_tree, tvb, offset+2+req_path_size+6+msg_req_siz, route_path_size, ett_path, &temp_item, "Route Path: "); + dissect_epath( tvb, pinfo, epath_tree, temp_item, offset+2+req_path_size+6+msg_req_siz, route_path_size, FALSE, FALSE, NULL, NULL ); } break; case SC_CM_GET_CONN_OWNER: @@ -5460,8 +5462,8 @@ dissect_cip_cm_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_ proto_tree_add_uint_format_value(cmd_data_tree, hf_cip_cm_conn_path_size, tvb, offset+2+req_path_size+1, 1, conn_path_size/2, "%d (words)", conn_path_size/2); /* Add the epath */ - pi = proto_tree_add_text(cmd_data_tree, tvb, offset+2+req_path_size+2, conn_path_size, "Connection Path: "); - dissect_epath( tvb, pinfo, pi, offset+2+req_path_size+2, conn_path_size, FALSE, FALSE, NULL, NULL ); + epath_tree = proto_tree_add_subtree(cmd_data_tree, tvb, offset+2+req_path_size+2, conn_path_size, ett_path, &pi, "Connection Path: "); + dissect_epath( tvb, pinfo, epath_tree, pi, offset+2+req_path_size+2, conn_path_size, FALSE, FALSE, NULL, NULL ); break; default: /* Add data */ @@ -5708,7 +5710,7 @@ static int dissect_cip_cco_all_attribute_common( proto_tree *cmd_tree, tvbuff_t *tvb, int offset, int item_length, packet_info *pinfo) { proto_item *pi, *confgi; - proto_tree *tdi_tree, *iomap_tree; + proto_tree *tdi_tree, *iomap_tree, *epath_tree; proto_tree *ncp_tree, *confg_tree; int conn_path_size, variable_data_size = 0, config_data_size; int connection_name_size, iomap_size, ot_rtf, to_rtf; @@ -5770,8 +5772,8 @@ dissect_cip_cco_all_attribute_common( proto_tree *cmd_tree, tvbuff_t *tvb, int o proto_tree_add_item(cmd_tree, hf_cip_reserved8, tvb, offset+29, 1, ENC_LITTLE_ENDIAN ); /* Add the epath */ - pi = proto_tree_add_text(cmd_tree, tvb, offset+30, conn_path_size, "Connection Path: "); - dissect_epath( tvb, pinfo, pi, offset+30, conn_path_size, FALSE, FALSE, NULL, NULL ); + epath_tree = proto_tree_add_subtree(cmd_tree, tvb, offset+30, conn_path_size, ett_path, &pi, "Connection Path: "); + dissect_epath( tvb, pinfo, epath_tree, pi, offset+30, conn_path_size, FALSE, FALSE, NULL, NULL ); variable_data_size += (conn_path_size+30); @@ -5794,7 +5796,7 @@ dissect_cip_cco_all_attribute_common( proto_tree *cmd_tree, tvbuff_t *tvb, int o /* Connection Name */ connection_name_size = tvb_get_guint8( tvb, offset+variable_data_size); str_connection_name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset+variable_data_size+2, connection_name_size, ENC_ASCII); - proto_tree_add_text(cmd_tree, tvb, offset+variable_data_size, connection_name_size+2, "Connection Name: %s", str_connection_name); + proto_tree_add_string(cmd_tree, hf_cip_cco_connection_name, tvb, offset+variable_data_size, connection_name_size+2, str_connection_name); variable_data_size += ((connection_name_size*2)+2); @@ -5878,7 +5880,6 @@ dissect_cip_cco_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item proto_item *rrsc_item; proto_tree *rrsc_tree, *cmd_data_tree, *con_st_tree; int req_path_size; - int temp_data; guint8 service, gen_status, add_stat_size; cip_req_info_t* preq_info; cip_simple_request_info_t req_data; @@ -5956,8 +5957,7 @@ dissect_cip_cco_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item proto_tree_add_item(con_st_tree, hf_cip_pad8, tvb, offset+4+add_stat_size+1, 1, ENC_LITTLE_ENDIAN); /* Extended Status */ - temp_data = tvb_get_letohs( tvb, offset+4+add_stat_size+2); - proto_tree_add_text(con_st_tree, tvb, offset+4+add_stat_size+2, 2, "Extended Status: 0x%04X", temp_data ); + proto_tree_add_item(con_st_tree, hf_cip_cco_ext_status, tvb, offset+4+add_stat_size+2, 2, ENC_LITTLE_ENDIAN); dissect_cip_cco_all_attribute_common( cmd_data_tree, tvb, offset+4+add_stat_size+4, item_length, pinfo); } @@ -6121,7 +6121,7 @@ static void dissect_cip_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, packet_info *pinfo, cip_req_info_t* preq_info ) { proto_item *ti; - proto_tree *cip_tree; + proto_tree *cip_tree, *epath_tree; proto_item *pi, *rrsc_item, *status_item; proto_tree *rrsc_tree, *status_tree, *add_status_tree; int req_path_size; @@ -6203,15 +6203,15 @@ dissect_cip_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, packet_info tvbIOI = tvb_new_real_data((const guint8 *)preq_info->pIOI, preq_info->IOILen * 2, preq_info->IOILen * 2); if ( tvbIOI ) { - pi = proto_tree_add_text( cip_tree, NULL, 0, 0, "Request Path Size: %d (words)", preq_info->IOILen ); + pi = proto_tree_add_uint_format_value( cip_tree, hf_cip_request_path_size, NULL, 0, 0, preq_info->IOILen, "%d (words)", preq_info->IOILen ); PROTO_ITEM_SET_GENERATED(pi); /* Add the epath */ - pi = proto_tree_add_text(cip_tree, NULL, 0, 0, "Request Path: "); + epath_tree = proto_tree_add_subtree(cip_tree, NULL, 0, 0, ett_path, &pi, "Request Path: "); PROTO_ITEM_SET_GENERATED(pi); preq_info->ciaData = wmem_new(wmem_file_scope(), cip_simple_request_info_t); - dissect_epath( tvbIOI, pinfo, pi, 0, preq_info->IOILen*2, TRUE, FALSE, preq_info->ciaData, NULL); + dissect_epath( tvbIOI, pinfo, epath_tree, pi, 0, preq_info->IOILen*2, TRUE, FALSE, preq_info->ciaData, NULL); tvb_free(tvbIOI); } } @@ -6246,16 +6246,16 @@ dissect_cip_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, packet_info tvb, offset+1, 1, req_path_size, "%d (words)", req_path_size); /* Add the epath */ - pi = proto_tree_add_text(cip_tree, tvb, offset+2, req_path_size*2, "Request Path: "); + epath_tree = proto_tree_add_subtree(cip_tree, tvb, offset+2, req_path_size*2, ett_path, &pi, "Request Path: "); if (preq_info) { preq_info->ciaData = wmem_new(wmem_file_scope(), cip_simple_request_info_t); - dissect_epath( tvb, pinfo, pi, offset+2, req_path_size*2, FALSE, FALSE, preq_info->ciaData, NULL); + dissect_epath( tvb, pinfo, epath_tree, pi, offset+2, req_path_size*2, FALSE, FALSE, preq_info->ciaData, NULL); memcpy(&path_info, preq_info->ciaData, sizeof(cip_simple_request_info_t)); } else { - dissect_epath( tvb, pinfo, pi, offset+2, req_path_size*2, FALSE, FALSE, &path_info, NULL); + dissect_epath( tvb, pinfo, epath_tree, pi, offset+2, req_path_size*2, FALSE, FALSE, &path_info, NULL); } ioilen = tvb_get_guint8( tvb, offset + 1 ); @@ -6750,6 +6750,8 @@ proto_register_cip(void) { &hf_cip_cco_iomap_attribute, { "Attribute Data", "cip.cco.iomap", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cip_cco_safety, { "Safety Parameters", "cip.cco.safety", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cip_cco_change_type, { "Change Type", "cip.cco.change_type", FT_UINT16, BASE_DEC, VALS(cip_cco_change_type_vals), 0, NULL, HFILL }}, + { &hf_cip_cco_connection_name, { "Connection Name", "cip.cco.connection_name", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, + { &hf_cip_cco_ext_status, { "Extended Status", "cip.cco.ext_status", FT_UINT16, BASE_HEX|BASE_EXT_STRING, &cip_cm_ext_st_vals_ext, 0, NULL, HFILL }}, }; /* Setup protocol subtree array */ diff --git a/epan/dissectors/packet-cip.h b/epan/dissectors/packet-cip.h index 28dfa012cc..4034979df0 100644 --- a/epan/dissectors/packet-cip.h +++ b/epan/dissectors/packet-cip.h @@ -310,7 +310,7 @@ typedef struct cip_req_info { /* ** Exported functions */ -extern void dissect_epath( tvbuff_t *tvb, packet_info *pinfo, proto_item *epath_item, int offset, int path_length, +extern void dissect_epath( tvbuff_t *tvb, packet_info *pinfo, proto_tree *path_tree, proto_item *epath_item, int offset, int path_length, gboolean generate, gboolean packed, cip_simple_request_info_t* req_data, cip_safety_epath_info_t* safety); extern void dissect_cip_date_and_time(proto_tree *tree, tvbuff_t *tvb, int offset, int hf_datetime); extern attribute_info_t* cip_get_attribute(guint class_id, guint instance, guint attribute); diff --git a/epan/dissectors/packet-cipsafety.c b/epan/dissectors/packet-cipsafety.c index e96f1cba6e..2b62572ca4 100644 --- a/epan/dissectors/packet-cipsafety.c +++ b/epan/dissectors/packet-cipsafety.c @@ -243,6 +243,7 @@ static int hf_tcpip_snn_time = -1; /* Initialize the subtree pointers */ static gint ett_cip_safety = -1; +static gint ett_path = -1; static gint ett_cipsafety_mode_byte = -1; static gint ett_cipsafety_ack_byte = -1; static gint ett_cipsafety_mcast_byte = -1; @@ -900,7 +901,7 @@ static int dissect_s_supervisor_output_connection_point_owners(packet_info *pinf { guint16 i, num_entries; proto_item *entry_item, *app_path_item; - proto_tree *entry_tree; + proto_tree *entry_tree, *epath_tree; int attr_len = 0, app_path_size; if (total_len < 2) @@ -946,9 +947,9 @@ static int dissect_s_supervisor_output_connection_point_owners(packet_info *pinf return total_len; } - app_path_item = proto_tree_add_text(entry_tree, - tvb, offset+attr_len, app_path_size, "Application Resource: "); - dissect_epath( tvb, pinfo, app_path_item, offset+attr_len, app_path_size, FALSE, TRUE, NULL, NULL); + epath_tree = proto_tree_add_subtree(entry_tree, + tvb, offset+attr_len, app_path_size, ett_path, &app_path_item, "Application Resource: "); + dissect_epath( tvb, pinfo, epath_tree, app_path_item, offset+attr_len, app_path_size, FALSE, TRUE, NULL, NULL); attr_len += app_path_size; } } @@ -1095,10 +1096,12 @@ static int dissect_s_validator_coordination_conn_inst(packet_info *pinfo, proto_ return (size+1); } -static int dissect_s_validator_app_data_path(packet_info *pinfo, proto_tree *tree _U_, - proto_item *item, tvbuff_t *tvb, int offset, int total_len) +static int dissect_s_validator_app_data_path(packet_info *pinfo, proto_tree *tree, + proto_item *item _U_, tvbuff_t *tvb, int offset, int total_len) { - dissect_epath(tvb, pinfo, item, offset, total_len, FALSE, FALSE, NULL, NULL); + proto_item* pi; + proto_tree* epath_tree = proto_tree_add_subtree(tree, NULL, 0, 0, ett_path, &pi, "Application Data Path: "); + dissect_epath(tvb, pinfo, epath_tree, pi, offset, total_len, FALSE, FALSE, NULL, NULL); return total_len; } @@ -2466,6 +2469,7 @@ proto_register_cipsafety(void) static gint *ett[] = { &ett_cip_safety, + &ett_path, &ett_cipsafety_mode_byte, &ett_cipsafety_ack_byte, &ett_cipsafety_mcast_byte diff --git a/epan/dissectors/packet-cisco-wids.c b/epan/dissectors/packet-cisco-wids.c index 8fa76a9de2..4bc90f225d 100644 --- a/epan/dissectors/packet-cisco-wids.c +++ b/epan/dissectors/packet-cisco-wids.c @@ -66,6 +66,8 @@ static int hf_cwids_unknown3 = -1; static gint ett_cwids = -1; +static expert_field ie_ieee80211_subpacket = EI_INIT; + static dissector_handle_t ieee80211_handle; static void @@ -116,16 +118,7 @@ dissect_cwids(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * was unable to restore it). */ pinfo->private_data = pd_save; - -#if 0 - wlan_tvb = tvb_new_subset_length(tvb, offset, capturelen); - /* FIXME: Why does this throw an exception? */ - proto_tree_add_text(cwids_tree, wlan_tvb, offset, capturelen, - "[Malformed or short IEEE80211 subpacket]"); -#else - tvb_new_subset_length(tvb, offset, capturelen); -#endif - ; + expert_add_info(pinfo, ti, &ie_ieee80211_subpacket); } ENDTRY; offset += capturelen; @@ -172,11 +165,18 @@ proto_register_cwids(void) &ett_cwids, }; + static ei_register_info ei[] = { + { &ie_ieee80211_subpacket, { "cwids.ieee80211_malformed", PI_MALFORMED, PI_ERROR, "Malformed or short IEEE80211 subpacket", EXPFILL }}, + }; + module_t *cwids_module; + expert_module_t* expert_cwids; proto_cwids = proto_register_protocol("Cisco Wireless IDS Captures", "CWIDS", "cwids"); proto_register_field_array(proto_cwids, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_cwids = expert_register_protocol(proto_cwids); + expert_register_field_array(expert_cwids, ei, array_length(ei)); cwids_module = prefs_register_protocol(proto_cwids, proto_reg_handoff_cwids); prefs_register_uint_preference(cwids_module, "udp.port", diff --git a/epan/dissectors/packet-clip.c b/epan/dissectors/packet-clip.c index 8def9fb6df..8dd493cabb 100644 --- a/epan/dissectors/packet-clip.c +++ b/epan/dissectors/packet-clip.c @@ -28,6 +28,7 @@ #include <glib.h> #include <epan/packet.h> +#include <epan/expert.h> #include <wiretap/wtap.h> #include "packet-clip.h" @@ -36,8 +37,12 @@ void proto_register_clip(void); void proto_reg_handoff_clip(void); +static int proto_clip = -1; + static gint ett_clip = -1; +static expert_field ei_no_link_info = EI_INIT; + static dissector_handle_t ip_handle; void @@ -49,7 +54,7 @@ capture_clip( const guchar *pd, int len, packet_counts *ld ) { static void dissect_clip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_tree *fh_tree; + proto_item *fh_item; pinfo->current_proto = "CLIP"; @@ -83,10 +88,9 @@ dissect_clip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) A future version of libpcap, however, will probably use DLT_LINUX_SLL for both of those cases, to avoid the headache of having to generate capture-filter code to handle both of those cases. */ - if(tree) { - fh_tree = proto_tree_add_subtree(tree, tvb, 0, 0, ett_clip, NULL, "Classical IP frame" ); - proto_tree_add_text(fh_tree, tvb, 0, 0, "No link information available"); - } + fh_item = proto_tree_add_item(tree, proto_clip, tvb, 0, 0, ENC_NA); + expert_add_info(pinfo, fh_item, &ei_no_link_info); + call_dissector(ip_handle, tvb, pinfo, tree); } @@ -97,7 +101,17 @@ proto_register_clip(void) &ett_clip, }; + static ei_register_info ei[] = { + { &ei_no_link_info, { "clip.no_link_info", PI_PROTOCOL, PI_NOTE, "No link information available", EXPFILL }}, + }; + + expert_module_t* expert_clip; + + proto_clip = proto_register_protocol("Classical IP frame", "CLIP", "clip"); + proto_register_subtree_array(ett, array_length(ett)); + expert_clip = expert_register_protocol(proto_clip); + expert_register_field_array(expert_clip, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-clnp.c b/epan/dissectors/packet-clnp.c index 032e1d550c..bbeef099aa 100644 --- a/epan/dissectors/packet-clnp.c +++ b/epan/dissectors/packet-clnp.c @@ -61,6 +61,9 @@ static int hf_clnp_cnf_more_segments = -1; static int hf_clnp_cnf_report_error = -1; static int hf_clnp_cnf_type = -1; static int hf_clnp_pdu_length = -1; +static int hf_clnp_data_unit_identifier = -1; +static int hf_clnp_segment_offset = -1; +static int hf_clnp_total_length = -1; static int hf_clnp_checksum = -1; static int hf_clnp_dest_length = -1; static int hf_clnp_dest = -1; @@ -454,18 +457,13 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) FIXED_PART_LEN + 1 + dst_len + 1 + SEGMENTATION_PART_LEN); return; } + du_id = tvb_get_ntohs(tvb, offset); - proto_tree_add_text(clnp_tree, tvb, offset, 2, - "Data unit identifier: %06u", - du_id); + proto_tree_add_item(clnp_tree, hf_clnp_data_unit_identifier, tvb, offset, 2, ENC_BIG_ENDIAN); segment_offset = tvb_get_ntohs(tvb, offset + 2); - proto_tree_add_text(clnp_tree, tvb, offset + 2 , 2, - "Segment offset : %6u", - segment_offset); + proto_tree_add_item(clnp_tree, hf_clnp_segment_offset, tvb, offset + 2 , 2, ENC_BIG_ENDIAN); total_length = tvb_get_ntohs(tvb, offset + 4); - ti_tot_len = proto_tree_add_text(clnp_tree, tvb, offset + 4 , 2, - "Total length : %6u", - total_length); + ti_tot_len = proto_tree_add_item(clnp_tree, hf_clnp_total_length, tvb, offset + 4 , 2, ENC_BIG_ENDIAN); if (total_length < segment_length) { /* Reassembled length is less than the length of this segment. */ expert_add_info_format(pinfo, ti_tot_len, &ei_clnp_length, @@ -651,6 +649,15 @@ proto_register_clnp(void) { &hf_clnp_pdu_length, { "PDU length", "clnp.pdu.len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_clnp_data_unit_identifier, + { "Data unit identifier", "clnp.data_unit_identifier", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + + { &hf_clnp_segment_offset, + { "Segment offset", "clnp.segment_offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + + { &hf_clnp_total_length, + { "Total length", "clnp.total_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_clnp_checksum, { "Checksum", "clnp.checksum", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-collectd.c b/epan/dissectors/packet-collectd.c index 08d90cf004..f3175f162d 100644 --- a/epan/dissectors/packet-collectd.c +++ b/epan/dissectors/packet-collectd.c @@ -376,13 +376,14 @@ dissect_collectd_string (tvbuff_t *tvb, packet_info *pinfo, gint type_hf, type = tvb_get_ntohs(tvb, offset); length = tvb_get_ntohs(tvb, offset + 2); + pt = proto_tree_add_subtree_format(tree_root, tvb, offset, length, + ett_collectd_string, &pi, "collectd %s segment: ", + val_to_str_const (type, part_names, "UNKNOWN")); + if (length > size) { - pi = proto_tree_add_text (tree_root, tvb, offset, length, - "collectd %s segment: Length = %i <BAD>", - val_to_str_const (type, part_names, "UNKNOWN"), - length); - expert_add_info_format(pinfo, pi, &ei_collectd_invalid_length, + proto_item_append_text(pt, "Length = %i <BAD>", length); + expert_add_info_format(pinfo, pt, &ei_collectd_invalid_length, "String part with invalid part length: " "Part is longer than rest of package."); return (-1); @@ -392,11 +393,7 @@ dissect_collectd_string (tvbuff_t *tvb, packet_info *pinfo, gint type_hf, *ret_length = length - 4; *ret_string = tvb_get_string_enc(wmem_packet_scope(), tvb, *ret_offset, *ret_length, ENC_ASCII); - - pt = proto_tree_add_subtree_format(tree_root, tvb, offset, length, - ett_collectd_string, &pi, "collectd %s segment: \"%s\"", - val_to_str_const (type, part_names, "UNKNOWN"), - *ret_string); + proto_item_append_text(pt, "\"%s\"", *ret_string); if (ret_item != NULL) *ret_item = pi; diff --git a/epan/dissectors/packet-cosine.c b/epan/dissectors/packet-cosine.c index 3bc281a8bd..8e0f1d9371 100644 --- a/epan/dissectors/packet-cosine.c +++ b/epan/dissectors/packet-cosine.c @@ -43,6 +43,8 @@ static int hf_off = -1; static int hf_pri = -1; static int hf_rm = -1; static int hf_err = -1; +static int hf_sar = -1; +static int hf_channel_id = -1; static gint ett_raw = -1; @@ -85,20 +87,18 @@ dissect_cosine(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case COSINE_ENCAP_ATM: case COSINE_ENCAP_PPoATM: - proto_tree_add_text(fh_tree, tvb, 0, 16, "SAR header"); + proto_tree_add_item(fh_tree, hf_sar, tvb, 0, 16, ENC_NA); break; case COSINE_ENCAP_PPP: case COSINE_ENCAP_FR: case COSINE_ENCAP_PPoFR: - proto_tree_add_text(fh_tree, tvb, 0, 4, "Channel handle ID"); + proto_tree_add_item(fh_tree, hf_channel_id, tvb, 0, 4, ENC_NA); break; case COSINE_ENCAP_HDLC: if (pseudo_header->cosine.direction == COSINE_DIR_TX) { - proto_tree_add_text(fh_tree, tvb, 0, 2, - "Channel handle ID"); + proto_tree_add_item(fh_tree, hf_channel_id, tvb, 0, 2, ENC_NA); } else if (pseudo_header->cosine.direction == COSINE_DIR_RX) { - proto_tree_add_text(fh_tree, tvb, 0, 4, - "Channel handle ID"); + proto_tree_add_item(fh_tree, hf_channel_id, tvb, 0, 4, ENC_NA); } break; default: @@ -157,6 +157,10 @@ proto_register_cosine(void) { "Rate Marking", "cosine.rm", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}}, { &hf_err, { "Error Code", "cosine.err", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}}, + { &hf_sar, + { "SAR header", "cosine.sar", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}}, + { &hf_channel_id, + { "Channel handle ID", "cosine.channel_id", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}}, }; static gint *ett[] = { diff --git a/epan/dissectors/packet-cups.c b/epan/dissectors/packet-cups.c index b99c586d8d..190541e3e3 100644 --- a/epan/dissectors/packet-cups.c +++ b/epan/dissectors/packet-cups.c @@ -97,6 +97,10 @@ static int hf_cups_ptype_bw = -1; static int hf_cups_ptype_remote = -1; static int hf_cups_ptype_class = -1; static int hf_cups_state = -1; +static int hf_cups_uri = -1; +static int hf_cups_location = -1; +static int hf_cups_information = -1; +static int hf_cups_make_model = -1; static gint ett_cups = -1; static gint ett_cups_ptype = -1; @@ -182,8 +186,7 @@ dissect_cups(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (str == NULL) return; /* separator/terminator not found */ - proto_tree_add_text(cups_tree, tvb, offset, len, - "URI: %.*s", (guint16) len, str); + proto_tree_add_string(cups_tree, hf_cups_uri, tvb, offset, len, str); col_add_fstr(pinfo->cinfo, COL_INFO, "%.*s (%s)", (guint16) len, str, val_to_str(state, cups_state_values, "0x%x")); offset = next_offset; @@ -198,8 +201,7 @@ dissect_cups(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) str = get_quoted_string(tvb, offset, &next_offset, &len); if (str == NULL) return; /* separator/terminator not found */ - proto_tree_add_text(cups_tree, tvb, offset+1, len, - "Location: \"%.*s\"", (guint16) len, str); + proto_tree_add_string(cups_tree, hf_cups_location, tvb, offset+1, len, str); offset = next_offset; if (!skip_space(tvb, offset, &next_offset)) @@ -209,8 +211,7 @@ dissect_cups(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) str = get_quoted_string(tvb, offset, &next_offset, &len); if (str == NULL) return; /* separator/terminator not found */ - proto_tree_add_text(cups_tree, tvb, offset+1, len, - "Information: \"%.*s\"", (guint16) len, str); + proto_tree_add_string(cups_tree, hf_cups_information, tvb, offset+1, len, str); offset = next_offset; if (!skip_space(tvb, offset, &next_offset)) @@ -220,8 +221,7 @@ dissect_cups(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) str = get_quoted_string(tvb, offset, &next_offset, &len); if (str == NULL) return; /* separator/terminator not found */ - proto_tree_add_text(cups_tree, tvb, offset+1, len, - "Make and model: \"%.*s\"", (guint16) len, str); + proto_tree_add_string(cups_tree, hf_cups_make_model, tvb, offset+1, len, str); } static guint @@ -375,7 +375,19 @@ proto_register_cups(void) TFS(&tfs_printer_class), CUPS_PRINTER_CLASS, NULL, HFILL }}, { &hf_cups_state, { "State", "cups.state", FT_UINT8, BASE_HEX, - VALS(cups_state_values), 0x0, NULL, HFILL }} + VALS(cups_state_values), 0x0, NULL, HFILL }}, + { &hf_cups_uri, + { "URI", "cups.uri", FT_STRING, BASE_NONE, + NULL, 0x0, NULL, HFILL }}, + { &hf_cups_location, + { "Location", "cups.location", FT_STRING, BASE_NONE, + NULL, 0x0, NULL, HFILL }}, + { &hf_cups_information, + { "Information", "cups.information", FT_STRING, BASE_NONE, + NULL, 0x0, NULL, HFILL }}, + { &hf_cups_make_model, + { "Make and model", "cups.make_model", FT_STRING, BASE_NONE, + NULL, 0x0, NULL, HFILL }}, }; static gint *ett[] = { diff --git a/epan/dissectors/packet-enip.c b/epan/dissectors/packet-enip.c index 2edfdf860a..1d7a1e2c1b 100644 --- a/epan/dissectors/packet-enip.c +++ b/epan/dissectors/packet-enip.c @@ -284,6 +284,7 @@ static int hf_dlr_active_gateway_precedence = -1; /* Initialize the subtree pointers */ static gint ett_enip = -1; +static gint ett_path = -1; static gint ett_count_tree = -1; static gint ett_type_tree = -1; static gint ett_command_tree = -1; @@ -1343,6 +1344,7 @@ dissect_tcpip_physical_link(packet_info *pinfo, proto_tree *tree, proto_item *it { guint16 path_size; + proto_tree *epath_tree; proto_item *path_item; path_size = tvb_get_letohs( tvb, offset)*2; @@ -1354,8 +1356,8 @@ dissect_tcpip_physical_link(packet_info *pinfo, proto_tree *tree, proto_item *it return total_len; } - path_item = proto_tree_add_text(tree, tvb, offset+2, path_size, "Path: "); - dissect_epath( tvb, pinfo, path_item, offset+2, path_size, FALSE, FALSE, NULL, NULL); + epath_tree = proto_tree_add_subtree(tree, tvb, offset+2, path_size, ett_path, &path_item, "Path: "); + dissect_epath( tvb, pinfo, epath_tree, path_item, offset+2, path_size, FALSE, FALSE, NULL, NULL); return path_size+2; } @@ -3431,6 +3433,7 @@ proto_register_enip(void) /* Setup protocol subtree array */ static gint *ett[] = { &ett_enip, + &ett_path, &ett_count_tree, &ett_type_tree, &ett_command_tree, |