diff options
-rw-r--r-- | epan/dissectors/packet-tacacs.c | 24 | ||||
-rw-r--r-- | epan/dissectors/packet-tapa.c | 16 | ||||
-rw-r--r-- | epan/dissectors/packet-tcp.c | 45 | ||||
-rw-r--r-- | epan/dissectors/packet-tds.c | 35 | ||||
-rw-r--r-- | epan/dissectors/packet-telnet.c | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-tftp.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-tipc.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-tn3270.c | 17 | ||||
-rw-r--r-- | epan/dissectors/packet-tns.c | 206 | ||||
-rw-r--r-- | epan/dissectors/packet-trmac.c | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-tsp.c | 11 | ||||
-rw-r--r-- | epan/dissectors/packet-tzsp.c | 7 | ||||
-rw-r--r-- | epan/dissectors/packet-ua3g.c | 47 | ||||
-rw-r--r-- | epan/dissectors/packet-udld.c | 19 | ||||
-rw-r--r-- | epan/dissectors/packet-udp.c | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-uma.c | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-usb-audio.c | 11 | ||||
-rw-r--r-- | epan/dissectors/packet-usb-ccid.c | 7 | ||||
-rw-r--r-- | epan/dissectors/packet-usb-com.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-usb-hid.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-usb-video.c | 27 | ||||
-rw-r--r-- | epan/dissectors/packet-usb.c | 25 | ||||
-rw-r--r-- | epan/dissectors/packet-uts.c | 6 |
23 files changed, 178 insertions, 365 deletions
diff --git a/epan/dissectors/packet-tacacs.c b/epan/dissectors/packet-tacacs.c index 7d133a8a60..2d5c5c1104 100644 --- a/epan/dissectors/packet-tacacs.c +++ b/epan/dissectors/packet-tacacs.c @@ -480,11 +480,9 @@ dissect_tacplus_body_authen_req_login( tvbuff_t* tvb, proto_tree *tree, int var_ case TAC_PLUS_AUTHEN_TYPE_CHAP: proto_tree_add_text( tree, tvb, AUTHEN_S_DATA_LEN_OFF, 1, "CHAP Data Length %d", val ); if( val ) { - proto_item *pi; proto_tree *pt; guint8 chal_len=val-(1+16); /* Response field alwayes 16 octets */ - pi = proto_tree_add_text(tree, tvb, var_off, val, "CHAP Data" ); - pt = proto_item_add_subtree( pi, ett_tacplus_body_chap ); + pt = proto_tree_add_subtree(tree, tvb, var_off, val, ett_tacplus_body_chap, NULL, "CHAP Data" ); proto_tree_add_item(pt, hf_tacplus_chap_id, tvb, var_off, 1, ENC_NA); var_off++; proto_tree_add_item(pt, hf_tacplus_chap_challenge, tvb, var_off, chal_len, ENC_ASCII|ENC_NA); @@ -495,11 +493,9 @@ dissect_tacplus_body_authen_req_login( tvbuff_t* tvb, proto_tree *tree, int var_ case TAC_PLUS_AUTHEN_TYPE_MSCHAP: proto_tree_add_text( tree, tvb, AUTHEN_S_DATA_LEN_OFF, 1, "MSCHAP Data Length %d", val ); if( val ) { - proto_item *pi; proto_tree *pt; guint8 chal_len=val-(1+49); /* Response field alwayes 49 octets */ - pi = proto_tree_add_text(tree, tvb, var_off, val, "MSCHAP Data" ); - pt = proto_item_add_subtree( pi, ett_tacplus_body_chap ); + pt = proto_tree_add_subtree(tree, tvb, var_off, val, ett_tacplus_body_chap, NULL, "MSCHAP Data" ); proto_tree_add_item(pt, hf_tacplus_mschap_id, tvb, var_off, 1, ENC_NA); var_off++; proto_tree_add_item(pt, hf_tacplus_mschap_challenge, tvb, var_off, chal_len, ENC_ASCII|ENC_NA); @@ -510,10 +506,8 @@ dissect_tacplus_body_authen_req_login( tvbuff_t* tvb, proto_tree *tree, int var_ case TAC_PLUS_AUTHEN_TYPE_ARAP: proto_tree_add_text( tree, tvb, AUTHEN_S_DATA_LEN_OFF, 1, "ARAP Data Length %d", val ); if( val ) { - proto_item *pi; proto_tree *pt; - pi = proto_tree_add_text(tree, tvb, var_off, val, "ARAP Data" ); - pt = proto_item_add_subtree( pi, ett_tacplus_body_chap ); + pt = proto_tree_add_subtree(tree, tvb, var_off, val, ett_tacplus_body_chap, NULL, "ARAP Data" ); proto_tree_add_item(pt, hf_tacplus_arap_nas_challenge, tvb, var_off, 8, ENC_ASCII|ENC_NA); var_off+=8; proto_tree_add_item(pt, hf_tacplus_arap_remote_challenge, tvb, var_off, 8, ENC_ASCII|ENC_NA); @@ -880,7 +874,7 @@ static void dissect_tacplus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { tvbuff_t *new_tvb=NULL; - proto_tree *tacplus_tree; + proto_tree *tacplus_tree, *body_tree; proto_item *ti, *hidden_item; guint8 version,flags; proto_tree *flags_tree; @@ -957,8 +951,8 @@ dissect_tacplus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) expert_add_info_format(pinfo, tmp_pi, &ei_tacplus_packet_len_invalid, "Invalid length: %u", len); } - tmp_pi = proto_tree_add_text(tacplus_tree, tvb, TAC_PLUS_HDR_SIZE, len, "%s%s", - ((flags&FLAGS_UNENCRYPTED)?"":"Encrypted "), request?"Request":"Reply" ); + body_tree = proto_tree_add_subtree_format(tacplus_tree, tvb, TAC_PLUS_HDR_SIZE, len, + ett_tacplus_body, NULL, "%s%s", ((flags&FLAGS_UNENCRYPTED)?"":"Encrypted "), request?"Request":"Reply" ); if( flags&FLAGS_UNENCRYPTED ) { new_tvb = tvb_new_subset_length( tvb, TAC_PLUS_HDR_SIZE, len ); @@ -971,10 +965,10 @@ dissect_tacplus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if( new_tvb ) { /* Check to see if I've a decrypted tacacs packet */ if( !(flags&FLAGS_UNENCRYPTED) ){ - tmp_pi = proto_tree_add_text(tacplus_tree, new_tvb, 0, len, "Decrypted %s", - request?"Request":"Reply" ); + body_tree = proto_tree_add_subtree_format(tacplus_tree, new_tvb, 0, len, + ett_tacplus_body, NULL, "Decrypted %s", request?"Request":"Reply" ); } - dissect_tacplus_body( tvb, new_tvb, proto_item_add_subtree( tmp_pi, ett_tacplus_body )); + dissect_tacplus_body( tvb, new_tvb, body_tree); } } } diff --git a/epan/dissectors/packet-tapa.c b/epan/dissectors/packet-tapa.c index 49bc6e4845..c646f8d6b2 100644 --- a/epan/dissectors/packet-tapa.c +++ b/epan/dissectors/packet-tapa.c @@ -181,7 +181,6 @@ dissect_tapa_discover_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tapa_ static int dissect_tapa_discover_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tapa_discover_tree, guint32 offset, gint remaining) { - proto_item *item; proto_tree *tapa_discover_item_tree; guint8 item_type; gint item_length; @@ -194,17 +193,13 @@ dissect_tapa_discover_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tapa_di item_length = tvb_get_ntohs(tvb, offset + 2); item_text = tvb_format_text(tvb, offset + 4, item_length); - DISSECTOR_ASSERT(item_length > 0); - col_append_fstr(pinfo->cinfo, COL_INFO, ", %s: %s", item_type_text, item_text); - item = proto_tree_add_text(tapa_discover_tree, tvb, offset, 4 + item_length, - "Type %d = %s, length %d, value %s", + tapa_discover_item_tree = proto_tree_add_subtree_format(tapa_discover_tree, tvb, offset, 4 + item_length, + ett_tapa_discover_req, NULL, "Type %d = %s, length %d, value %s", item_type, item_type_text, item_length, item_text); - tapa_discover_item_tree = proto_item_add_subtree(item, ett_tapa_discover_req); - proto_tree_add_item(tapa_discover_item_tree, hf_tapa_discover_req_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; @@ -228,7 +223,6 @@ dissect_tapa_discover_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tapa_di static int dissect_tapa_discover_unknown_new_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tapa_discover_tree, guint32 offset, gint remaining) { - proto_item *item; proto_tree *tapa_discover_item_tree; guint8 item_type; gint item_length; @@ -252,12 +246,10 @@ dissect_tapa_discover_unknown_new_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_t col_append_fstr(pinfo->cinfo, COL_INFO, ", T=%d L=%d", item_type, item_length); - item = proto_tree_add_text(tapa_discover_tree, tvb, offset, 4 + item_length, - "Type %d, length %d, value %s", + tapa_discover_item_tree = proto_tree_add_subtree_format(tapa_discover_tree, tvb, offset, 4 + item_length, + ett_tapa_discover_req, NULL, "Type %d, length %d, value %s", item_type, item_length, item_text); - tapa_discover_item_tree = proto_item_add_subtree(item, ett_tapa_discover_req); - proto_tree_add_item(tapa_discover_item_tree, hf_tapa_discover_newtlv_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index 601bf46616..2d69807b96 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -706,9 +706,8 @@ tcp_print_timestamps(packet_info *pinfo, tvbuff_t *tvb, proto_tree *parent_tree, if (!tcpd) return; - item=proto_tree_add_text(parent_tree, tvb, 0, 0, "Timestamps"); + tree=proto_tree_add_subtree(parent_tree, tvb, 0, 0, ett_tcp_timestamps, &item, "Timestamps"); PROTO_ITEM_SET_GENERATED(item); - tree=proto_item_add_subtree(item, ett_tcp_timestamps); nstime_delta(&ts, &pinfo->fd->abs_ts, &tcpd->ts_first); item = proto_tree_add_time(tree, hf_tcp_ts_relative, tvb, 0, 0, &ts); @@ -2462,8 +2461,7 @@ dissect_tcpopt_wscale(const ip_tcp_opt *optp _U_, tvbuff_t *tvb, tcpd=get_tcp_conversation_data(NULL,pinfo); - wscale_pi = proto_tree_add_text(opt_tree, tvb, offset, 3, "Window scale: "); - wscale_tree = proto_item_add_subtree(wscale_pi, ett_tcp_option_wscale); + wscale_tree = proto_tree_add_subtree(opt_tree, tvb, offset, 3, ett_tcp_option_wscale, &wscale_pi, "Window scale: "); proto_tree_add_item(wscale_tree, hf_tcp_option_kind, tvb, offset, 1, ENC_NA); offset += 1; @@ -2494,7 +2492,7 @@ dissect_tcpopt_sack(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset, guint optlen, packet_info *pinfo, proto_tree *opt_tree, void *data) { proto_tree *field_tree = NULL; - proto_item *tf=NULL; + proto_item *tf; proto_item *hidden_item; guint32 leftedge, rightedge; struct tcp_analysis *tcpd=NULL; @@ -2511,8 +2509,8 @@ dissect_tcpopt_sack(const ip_tcp_opt *optp, tvbuff_t *tvb, } } - tf = proto_tree_add_text(opt_tree, tvb, offset, optlen, "%s:", optp->name); - field_tree = proto_item_add_subtree(tf, *optp->subtree_index); + field_tree = proto_tree_add_subtree_format(opt_tree, tvb, offset, optlen, + *optp->subtree_index, NULL, "%s:", optp->name); proto_tree_add_item(field_tree, hf_tcp_option_kind, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -2576,8 +2574,7 @@ static void dissect_tcpopt_echo(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset, guint optlen, packet_info *pinfo, proto_tree *opt_tree, void *data _U_) { - proto_tree *field_tree = NULL; - proto_item *tf = NULL; + proto_tree *field_tree; proto_item *hidden_item; guint32 echo; @@ -2585,11 +2582,10 @@ dissect_tcpopt_echo(const ip_tcp_opt *optp, tvbuff_t *tvb, hidden_item = proto_tree_add_boolean(opt_tree, hf_tcp_option_echo, tvb, offset, optlen, TRUE); PROTO_ITEM_SET_HIDDEN(hidden_item); - tf = proto_tree_add_text(opt_tree, tvb, offset, optlen, - "%s: %u", optp->name, echo); + field_tree = proto_tree_add_subtree_format(opt_tree, tvb, offset, optlen, + ett_tcp_opt_echo, NULL, "%s: %u", optp->name, echo); tcp_info_append_uint(pinfo, "ECHO", echo); - field_tree = proto_item_add_subtree(tf, ett_tcp_opt_echo); proto_tree_add_item(field_tree, hf_tcp_option_kind, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(field_tree, hf_tcp_option_len, tvb, @@ -2608,8 +2604,7 @@ dissect_tcpopt_timestamp(const ip_tcp_opt *optp _U_, tvbuff_t *tvb, proto_tree *ts_tree; guint32 ts_val, ts_ecr; - ti = proto_tree_add_text(opt_tree, tvb, offset, 10, "Timestamps: "); - ts_tree = proto_item_add_subtree(ti, ett_tcp_option_timestamp); + ts_tree = proto_tree_add_subtree(opt_tree, tvb, offset, 10, ett_tcp_option_timestamp, &ti, "Timestamps: "); proto_tree_add_item(ts_tree, hf_tcp_option_kind, tvb, offset, 1, ENC_NA); offset += 1; @@ -2655,8 +2650,7 @@ dissect_tcpopt_mptcp(const ip_tcp_opt *optp _U_, tvbuff_t *tvb, guint8 flags; guint8 ipver; - ti = proto_tree_add_text(opt_tree, tvb, offset, optlen, "Multipath TCP"); - mptcp_tree = proto_item_add_subtree(ti, ett_tcp_option_mptcp); + mptcp_tree = proto_tree_add_subtree(opt_tree, tvb, offset, optlen, ett_tcp_option_mptcp, &ti, "Multipath TCP"); proto_tree_add_item(mptcp_tree, hf_tcp_option_kind, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; @@ -2905,8 +2899,7 @@ static void dissect_tcpopt_cc(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset, guint optlen, packet_info *pinfo, proto_tree *opt_tree, void *data _U_) { - proto_tree *field_tree = NULL; - proto_item *tf = NULL; + proto_tree *field_tree; proto_item *hidden_item; guint32 cc; @@ -2914,10 +2907,9 @@ dissect_tcpopt_cc(const ip_tcp_opt *optp, tvbuff_t *tvb, hidden_item = proto_tree_add_boolean(opt_tree, hf_tcp_option_cc, tvb, offset, optlen, TRUE); PROTO_ITEM_SET_HIDDEN(hidden_item); - tf = proto_tree_add_text(opt_tree, tvb, offset, optlen, - "%s: %u", optp->name, cc); + field_tree = proto_tree_add_subtree_format(opt_tree, tvb, offset, optlen, + ett_tcp_opt_cc, NULL, "%s: %u", optp->name, cc); tcp_info_append_uint(pinfo, "CC", cc); - field_tree = proto_item_add_subtree(tf, ett_tcp_opt_cc); proto_tree_add_item(field_tree, hf_tcp_option_kind, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(field_tree, hf_tcp_option_len, tvb, @@ -2928,8 +2920,7 @@ static void dissect_tcpopt_qs(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset, guint optlen, packet_info *pinfo, proto_tree *opt_tree, void *data _U_) { - proto_tree *field_tree = NULL; - proto_item *tf = NULL; + proto_tree *field_tree; proto_item *hidden_item; guint8 rate = tvb_get_guint8(tvb, offset + 2) & 0x0f; @@ -2937,14 +2928,13 @@ dissect_tcpopt_qs(const ip_tcp_opt *optp, tvbuff_t *tvb, hidden_item = proto_tree_add_boolean(opt_tree, hf_tcp_option_qs, tvb, offset, optlen, TRUE); PROTO_ITEM_SET_HIDDEN(hidden_item); - tf = proto_tree_add_text(opt_tree, tvb, offset, optlen, - "%s: Rate response, %s, TTL diff %u ", optp->name, + field_tree = proto_tree_add_subtree_format(opt_tree, tvb, offset, optlen, + ett_tcp_opt_qs, NULL, "%s: Rate response, %s, TTL diff %u ", optp->name, val_to_str_ext_const(rate, &qs_rate_vals_ext, "Unknown"), tvb_get_guint8(tvb, offset + 3)); col_append_lstr(pinfo->cinfo, COL_INFO, " QSresp=", val_to_str_ext_const(rate, &qs_rate_vals_ext, "Unknown"), COL_ADD_LSTR_TERMINATOR); - field_tree = proto_item_add_subtree(tf, ett_tcp_opt_qs); proto_tree_add_item(field_tree, hf_tcp_option_kind, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(field_tree, hf_tcp_option_len, tvb, @@ -4868,9 +4858,8 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (tcpd && ((tcpd->fwd && tcpd->fwd->command) || (tcpd->rev && tcpd->rev->command))) { - ti = proto_tree_add_text(tcp_tree, tvb, offset, 0, "Process Information"); + field_tree = proto_tree_add_subtree(tcp_tree, tvb, offset, 0, ett_tcp_process_info, &ti, "Process Information"); PROTO_ITEM_SET_GENERATED(ti); - field_tree = proto_item_add_subtree(ti, ett_tcp_process_info); if (tcpd->fwd && tcpd->fwd->command) { proto_tree_add_uint_format_value(field_tree, hf_tcp_proc_dst_uid, tvb, 0, 0, tcpd->fwd->process_uid, "%u", tcpd->fwd->process_uid); diff --git a/epan/dissectors/packet-tds.c b/epan/dissectors/packet-tds.c index 48e811fb4d..14b52a2ba7 100644 --- a/epan/dissectors/packet-tds.c +++ b/epan/dissectors/packet-tds.c @@ -941,8 +941,7 @@ dissect_tds_all_headers(tvbuff_t *tvb, guint *offset, packet_info *pinfo, proto_ guint16 header_type; header_length = tvb_get_letohl(tvb, *offset); - item = proto_tree_add_text(sub_tree, tvb, *offset, header_length, "Header"); - header_sub_tree = proto_item_add_subtree(item, ett_tds_all_headers_header); + header_sub_tree = proto_tree_add_subtree(sub_tree, tvb, *offset, header_length, ett_tds_all_headers_header, NULL, "Header"); length_item = proto_tree_add_item(header_sub_tree, hf_tds_all_headers_header_length, tvb, *offset, 4, ENC_LITTLE_ENDIAN); if(header_length == 0 ) { expert_add_info_format(pinfo, length_item, &ei_tds_invalid_length, "Empty header"); @@ -981,12 +980,10 @@ dissect_tds_query_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, td guint string_encoding = ENC_UTF_16|ENC_LITTLE_ENDIAN; char *msg; - proto_item *query_hdr; proto_tree *query_tree; offset = 0; - query_hdr = proto_tree_add_text(tree, tvb, offset, -1, "TDS Query Packet"); - query_tree = proto_item_add_subtree(query_hdr, ett_tds7_query); + query_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_tds7_query, NULL, "TDS Query Packet"); dissect_tds_all_headers(tvb, &offset, pinfo, query_tree); len = tvb_reported_length_remaining(tvb, offset); @@ -1023,14 +1020,11 @@ dissect_tds_query5_packet(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre guint token_len_field_val = 0; guint8 token; guint token_sz; - proto_item *query_hdr; proto_tree *query_tree; - proto_item *token_item; proto_tree *token_tree; offset = 0; - query_hdr = proto_tree_add_text(tree, tvb, offset, -1, "TDS5 Query Packet"); - query_tree = proto_item_add_subtree(query_hdr, ett_tds7_query); + query_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_tds7_query, NULL, "TDS5 Query Packet"); /* * Until we reach the end of the packet, read tokens. @@ -1054,10 +1048,9 @@ dissect_tds_query5_packet(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre break; } - token_item = proto_tree_add_text(query_tree, tvb, pos, token_sz, - "Token 0x%02x %s", token, + token_tree = proto_tree_add_subtree_format(query_tree, tvb, pos, token_sz, + ett_tds_token, NULL, "Token 0x%02x %s", token, val_to_str_const(token, token_names, "Unknown Token Type")); - token_tree = proto_item_add_subtree(token_item, ett_tds_token); /* * If it's a variable token, put the length field in here @@ -1086,11 +1079,8 @@ dissect_tds7_login(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint offset, i, j, k, offset2, len; char *val, *val2; - proto_item *login_hdr; proto_tree *login_tree; - proto_item *header_hdr; proto_tree *header_tree; - proto_item *length_hdr; proto_tree *length_tree; struct tds7_login_packet_hdr td7hdr; @@ -1099,10 +1089,8 @@ dissect_tds7_login(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* create display subtree for the protocol */ offset = 0; - login_hdr = proto_tree_add_text(tree, tvb, offset, -1, "TDS7 Login Packet"); - login_tree = proto_item_add_subtree(login_hdr, ett_tds7_login); - header_hdr = proto_tree_add_text(login_tree, tvb, offset, 36, "Login Packet Header"); - header_tree = proto_item_add_subtree(header_hdr, ett_tds7_hdr); + login_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_tds7_login, NULL, "TDS7 Login Packet"); + header_tree = proto_tree_add_subtree(login_tree, tvb, offset, 36, ett_tds7_hdr, NULL, "Login Packet Header"); td7hdr.total_packet_size = tvb_get_letohl(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_login_total_size, tvb, offset, @@ -1153,8 +1141,7 @@ dissect_tds7_login(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_uint(header_tree, hf_tds7_collation, tvb, offset, sizeof(td7hdr.collation), td7hdr.collation); offset += (int)sizeof(td7hdr.collation); - length_hdr = proto_tree_add_text(login_tree, tvb, offset, 50, "Lengths and offsets"); - length_tree = proto_item_add_subtree(length_hdr, ett_tds7_hdr); + length_tree = proto_tree_add_subtree(login_tree, tvb, offset, 50, ett_tds7_hdr, NULL, "Lengths and offsets"); for (i = 0; i < 9; i++) { offset2 = tvb_get_letohs(tvb, offset + i*4); @@ -2223,8 +2210,8 @@ dissect_tds_resp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, tds_conv_i expert_add_info_format(pinfo, token_item, &ei_tds_token_length_invalid, "Bogus token size: %u", token_sz); break; } - token_item = proto_tree_add_text(tree, tvb, pos, token_sz, - "Token 0x%02x %s", token, + token_tree = proto_tree_add_subtree_format(tree, tvb, pos, token_sz, + ett_tds_token, &token_item, "Token 0x%02x %s", token, val_to_str_const(token, token_names, "Unknown Token Type")); if ((int) token_len_field_size < 0) { @@ -2232,8 +2219,6 @@ dissect_tds_resp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, tds_conv_i break; } - token_tree = proto_item_add_subtree(token_item, ett_tds_token); - /* * If it's a variable token, put the length field in here * instead of replicating this for each token subdissector. diff --git a/epan/dissectors/packet-telnet.c b/epan/dissectors/packet-telnet.c index 8274beff16..9a940b5f1f 100644 --- a/epan/dissectors/packet-telnet.c +++ b/epan/dissectors/packet-telnet.c @@ -1664,8 +1664,7 @@ telnet_command(packet_info *pinfo, proto_tree *telnet_tree, tvbuff_t *tvb, int s offset += 1; /* skip IAC */ optcode = tvb_get_guint8(tvb, offset); - cmd_item = proto_tree_add_text(telnet_tree, tvb, start_offset, 2, "Command header"); - cmd_tree = proto_item_add_subtree(cmd_item, ett_telnet_cmd); + cmd_tree = proto_tree_add_subtree(telnet_tree, tvb, start_offset, 2, ett_telnet_cmd, &cmd_item, "Command header"); proto_tree_add_item(cmd_tree, hf_telnet_cmd, tvb, offset, 1, ENC_NA); offset++; diff --git a/epan/dissectors/packet-tftp.c b/epan/dissectors/packet-tftp.c index 426feb7924..629a40f750 100644 --- a/epan/dissectors/packet-tftp.c +++ b/epan/dissectors/packet-tftp.c @@ -138,7 +138,6 @@ tftp_dissect_options(tvbuff_t *tvb, packet_info *pinfo, int offset, int value_offset; const char *optionname; const char *optionvalue; - proto_item *opt_item; proto_tree *opt_tree; while (tvb_offset_exists(tvb, offset)) { @@ -147,10 +146,9 @@ tftp_dissect_options(tvbuff_t *tvb, packet_info *pinfo, int offset, value_len = tvb_strsize(tvb, value_offset); /* length of value */ optionname = tvb_format_text(tvb, offset, option_len); optionvalue = tvb_format_text(tvb, value_offset, value_len); - opt_item = proto_tree_add_text(tree, tvb, offset, option_len+value_len, - "Option: %s = %s", optionname, optionvalue); + opt_tree = proto_tree_add_subtree_format(tree, tvb, offset, option_len+value_len, + ett_tftp_option, NULL, "Option: %s = %s", optionname, optionvalue); - opt_tree = proto_item_add_subtree(opt_item, ett_tftp_option); proto_tree_add_item(opt_tree, hf_tftp_option_name, tvb, offset, option_len, ENC_ASCII|ENC_NA); proto_tree_add_item(opt_tree, hf_tftp_option_value, tvb, value_offset, diff --git a/epan/dissectors/packet-tipc.c b/epan/dissectors/packet-tipc.c index d542823532..667e257c9a 100644 --- a/epan/dissectors/packet-tipc.c +++ b/epan/dissectors/packet-tipc.c @@ -2023,7 +2023,7 @@ dissect_tipc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, voi static int dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - proto_item *ti, *tipc_data_item, *item; + proto_item *ti, *item; proto_tree *tipc_tree, *tipc_data_tree; int offset = 0; guint32 dword; @@ -2259,8 +2259,8 @@ dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ destination port of that header have no meaning for such messages */ offset = offset + 8; - tipc_data_item = proto_tree_add_text(tipc_tree, tvb, offset, -1, "TIPC_NAME_DISTRIBUTOR %u bytes User Data", (msg_size - hdr_size*4)); - tipc_data_tree = proto_item_add_subtree(tipc_data_item , ett_tipc_data); + tipc_data_tree = proto_tree_add_subtree_format(tipc_tree, tvb, offset, -1, ett_tipc_data, NULL, + "TIPC_NAME_DISTRIBUTOR %u bytes User Data", (msg_size - hdr_size*4)); data_tvb = tvb_new_subset_remaining(tipc_tvb, offset); dissect_tipc_name_dist_data(data_tvb, tipc_data_tree, 0); return tvb_length(tvb); diff --git a/epan/dissectors/packet-tn3270.c b/epan/dissectors/packet-tn3270.c index c434ef29cf..e6d8464267 100644 --- a/epan/dissectors/packet-tn3270.c +++ b/epan/dissectors/packet-tn3270.c @@ -2192,7 +2192,6 @@ dissect_read_partition(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, { gint start = offset; gint type; - proto_item *pi; proto_tree *query_list_tree; gint qcode_list_len, i; @@ -2227,9 +2226,8 @@ dissect_read_partition(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, if (sf_body_length > (offset - start)) { qcode_list_len = sf_body_length - (offset - start); - pi = proto_tree_add_text(tn3270_tree, tvb, offset, qcode_list_len, - "Query List"); - query_list_tree = proto_item_add_subtree(pi, ett_tn3270_query_list); + query_list_tree = proto_tree_add_subtree(tn3270_tree, tvb, offset, qcode_list_len, + ett_tn3270_query_list, NULL, "Query List"); for (i = 0; i < qcode_list_len; i++) { proto_tree_add_item(query_list_tree, hf_tn3270_sf_query_reply, @@ -4648,12 +4646,10 @@ static proto_tree * display_sf_hdr(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint sf_length, guint sf_id, guint sf_id_len, const gchar *sf_id_str) { - proto_item *pi; proto_tree *sf_tree; - pi = proto_tree_add_text(tn3270_tree, tvb, offset, sf_length, - "Structured Field: %s", sf_id_str); - sf_tree = proto_item_add_subtree(pi, ett_sf); + sf_tree = proto_tree_add_subtree_format(tn3270_tree, tvb, offset, sf_length, + ett_sf, NULL, "Structured Field: %s", sf_id_str); proto_tree_add_item(sf_tree, hf_tn3270_sf_length, @@ -5043,10 +5039,9 @@ dissect_tn3270e_header(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset) data_type = tvb_get_guint8(tvb, offset); - pi = proto_tree_add_text(tn3270_tree, tvb, offset, -1, - "TN3270E Header (Data Type: %s)", + tn3270e_hdr_tree = proto_tree_add_subtree_format(tn3270_tree, tvb, offset, -1, + ett_tn3270e_hdr, &pi, "TN3270E Header (Data Type: %s)", val_to_str_const(data_type, vals_tn3270_header_data_types, "Unknown")); - tn3270e_hdr_tree = proto_item_add_subtree(pi, ett_tn3270e_hdr); offset += tn3270_add_hf_items(tn3270e_hdr_tree, tvb, offset, fields); diff --git a/epan/dissectors/packet-tns.c b/epan/dissectors/packet-tns.c index 82967fd433..86c176bc9b 100644 --- a/epan/dissectors/packet-tns.c +++ b/epan/dissectors/packet-tns.c @@ -256,15 +256,14 @@ static void dissect_tns_data(tvbuff_t *tvb, int offset, packet_info *pinfo, { if ( is_sns ) { - ti = proto_tree_add_text(tns_tree, tvb, offset, -1, - "Secure Network Services"); + data_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1, + ett_tns_data, NULL, "Secure Network Services"); } else { - ti = proto_tree_add_text(tns_tree, tvb, offset, -1, - "Data"); + data_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1, + ett_tns_data, NULL, "Data"); } - data_tree = proto_item_add_subtree(ti, ett_tns_data); hidden_item = proto_tree_add_boolean(tns_tree, hf_tns_data, tvb, 0, 0, TRUE); @@ -316,9 +315,8 @@ static void dissect_tns_connect(tvbuff_t *tvb, int offset, packet_info *pinfo, if ( tree ) { - ti = proto_tree_add_text(tns_tree, tvb, offset, -1, - "Connect"); - connect_tree = proto_item_add_subtree(ti, ett_tns_connect); + connect_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1, + ett_tns_connect, NULL, "Connect"); hidden_item = proto_tree_add_boolean(tns_tree, hf_tns_connect, tvb, 0, 0, TRUE); @@ -498,32 +496,25 @@ static void dissect_tns_connect(tvbuff_t *tvb, int offset, packet_info *pinfo, } static void dissect_tns_accept(tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *tree, proto_tree *tns_tree) + proto_tree *tree _U_, proto_tree *tns_tree) { - proto_tree *accept_tree = NULL, *ti; + proto_tree *accept_tree, *ti; proto_item *hidden_item; int accept_offset; int accept_len; int tns_offset = offset-8; - if ( tree ) - { - ti = proto_tree_add_text(tns_tree, tvb, offset, -1, - "Accept"); - accept_tree = proto_item_add_subtree(ti, ett_tns_accept); + accept_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1, + ett_tns_accept, NULL, "Accept"); - hidden_item = proto_tree_add_boolean(tns_tree, hf_tns_accept, tvb, + hidden_item = proto_tree_add_boolean(tns_tree, hf_tns_accept, tvb, 0, 0, TRUE); - PROTO_ITEM_SET_HIDDEN(hidden_item); - } + PROTO_ITEM_SET_HIDDEN(hidden_item); col_append_str(pinfo->cinfo, COL_INFO, ", Accept"); - if ( accept_tree ) - { - proto_tree_add_item(accept_tree, hf_tns_version, tvb, + proto_tree_add_item(accept_tree, hf_tns_version, tvb, offset, 2, ENC_BIG_ENDIAN); - } offset += 2; if ( accept_tree ) @@ -615,220 +606,145 @@ static void dissect_tns_accept(tvbuff_t *tvb, int offset, packet_info *pinfo, static void dissect_tns_refuse(tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *tree, proto_tree *tns_tree) + proto_tree *tree _U_, proto_tree *tns_tree) { - proto_tree *refuse_tree = NULL, *ti; + proto_tree *refuse_tree; proto_item *hidden_item; - if ( tree ) - { - ti = proto_tree_add_text(tns_tree, tvb, offset, -1, - "Refuse"); - refuse_tree = proto_item_add_subtree(ti, ett_tns_refuse); + refuse_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1, + ett_tns_refuse, NULL, "Refuse"); - hidden_item = proto_tree_add_boolean(tns_tree, hf_tns_refuse, tvb, + hidden_item = proto_tree_add_boolean(tns_tree, hf_tns_refuse, tvb, 0, 0, TRUE); - PROTO_ITEM_SET_HIDDEN(hidden_item); - } + PROTO_ITEM_SET_HIDDEN(hidden_item); col_append_str(pinfo->cinfo, COL_INFO, ", Refuse"); - if ( refuse_tree ) - { - proto_tree_add_item(refuse_tree, hf_tns_refuse_reason_user, tvb, + proto_tree_add_item(refuse_tree, hf_tns_refuse_reason_user, tvb, offset, 1, ENC_BIG_ENDIAN); - } offset += 1; - if ( refuse_tree ) - { - proto_tree_add_item(refuse_tree, hf_tns_refuse_reason_system, tvb, + proto_tree_add_item(refuse_tree, hf_tns_refuse_reason_system, tvb, offset, 1, ENC_BIG_ENDIAN); - } offset += 1; - if ( refuse_tree ) - { - proto_tree_add_item(refuse_tree, hf_tns_refuse_data_length, tvb, + proto_tree_add_item(refuse_tree, hf_tns_refuse_data_length, tvb, offset, 2, ENC_BIG_ENDIAN); - } offset += 2; - if ( refuse_tree ) - { - proto_tree_add_item(refuse_tree, hf_tns_refuse_data, tvb, + proto_tree_add_item(refuse_tree, hf_tns_refuse_data, tvb, offset, -1, ENC_ASCII|ENC_NA); - } - return; } static void dissect_tns_abort(tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *tree, proto_tree *tns_tree) + proto_tree *tree _U_, proto_tree *tns_tree) { - proto_tree *abort_tree = NULL, *ti; + proto_tree *abort_tree; proto_item *hidden_item; - if ( tree ) - { - ti = proto_tree_add_text(tns_tree, tvb, offset, -1, - "Abort"); - abort_tree = proto_item_add_subtree(ti, ett_tns_abort); + abort_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1, + ett_tns_abort, NULL, "Abort"); - hidden_item = proto_tree_add_boolean(tns_tree, hf_tns_abort, tvb, + hidden_item = proto_tree_add_boolean(tns_tree, hf_tns_abort, tvb, 0, 0, TRUE); - PROTO_ITEM_SET_HIDDEN(hidden_item); - } + PROTO_ITEM_SET_HIDDEN(hidden_item); col_append_str(pinfo->cinfo, COL_INFO, ", Abort"); - if ( abort_tree ) - { - proto_tree_add_item(abort_tree, hf_tns_abort_reason_user, tvb, + proto_tree_add_item(abort_tree, hf_tns_abort_reason_user, tvb, offset, 1, ENC_BIG_ENDIAN); - } offset += 1; - if ( abort_tree ) - { - proto_tree_add_item(abort_tree, hf_tns_abort_reason_system, tvb, + proto_tree_add_item(abort_tree, hf_tns_abort_reason_system, tvb, offset, 1, ENC_BIG_ENDIAN); - } offset += 1; - if ( abort_tree ) - { - proto_tree_add_item(abort_tree, hf_tns_abort_data, tvb, + proto_tree_add_item(abort_tree, hf_tns_abort_data, tvb, offset, -1, ENC_ASCII|ENC_NA); - } - return; } static void dissect_tns_marker(tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *tree, proto_tree *tns_tree, int is_attention) + proto_tree *tree _U_, proto_tree *tns_tree, int is_attention) { - proto_tree *marker_tree = NULL, *ti; + proto_tree *marker_tree; proto_item *hidden_item; - if ( tree ) - { - if ( is_attention ) - { - ti = proto_tree_add_text(tns_tree, tvb, offset, -1, - "Marker"); - } - else - { - ti = proto_tree_add_text(tns_tree, tvb, offset, -1, - "Attention"); - } - - marker_tree = proto_item_add_subtree(ti, ett_tns_marker); - hidden_item = proto_tree_add_boolean(tns_tree, hf_tns_marker, tvb, - 0, 0, TRUE); - PROTO_ITEM_SET_HIDDEN(hidden_item); - } - if ( is_attention ) { col_append_str(pinfo->cinfo, COL_INFO, ", Marker"); + marker_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1, + ett_tns_marker, NULL, "Marker"); } else { col_append_str(pinfo->cinfo, COL_INFO, ", Attention"); + marker_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1, + ett_tns_marker, NULL, "Attention"); } - if ( marker_tree ) - { - proto_tree_add_item(marker_tree, hf_tns_marker_type, tvb, + hidden_item = proto_tree_add_boolean(tns_tree, hf_tns_marker, tvb, + 0, 0, TRUE); + PROTO_ITEM_SET_HIDDEN(hidden_item); + + proto_tree_add_item(marker_tree, hf_tns_marker_type, tvb, offset, 1, ENC_BIG_ENDIAN); - } offset += 1; - if ( marker_tree ) - { - proto_tree_add_item(marker_tree, hf_tns_marker_data_byte, tvb, + proto_tree_add_item(marker_tree, hf_tns_marker_data_byte, tvb, offset, 1, ENC_BIG_ENDIAN); - } offset += 1; - if ( marker_tree ) - { - proto_tree_add_item(marker_tree, hf_tns_marker_data_byte, tvb, + proto_tree_add_item(marker_tree, hf_tns_marker_data_byte, tvb, offset, 1, ENC_BIG_ENDIAN); - } /*offset += 1;*/ - - return; } static void dissect_tns_redirect(tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *tree, proto_tree *tns_tree) + proto_tree *tree _U_, proto_tree *tns_tree) { - proto_tree *redirect_tree = NULL, *ti; + proto_tree *redirect_tree; proto_item *hidden_item; - if ( tree ) - { - ti = proto_tree_add_text(tns_tree, tvb, offset, -1, - "Redirect"); - redirect_tree = proto_item_add_subtree(ti, ett_tns_redirect); + redirect_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1, + ett_tns_redirect, NULL, "Redirect"); - hidden_item = proto_tree_add_boolean(tns_tree, hf_tns_redirect, tvb, + hidden_item = proto_tree_add_boolean(tns_tree, hf_tns_redirect, tvb, 0, 0, TRUE); - PROTO_ITEM_SET_HIDDEN(hidden_item); - } + PROTO_ITEM_SET_HIDDEN(hidden_item); col_append_str(pinfo->cinfo, COL_INFO, ", Redirect"); - if ( redirect_tree ) - { - proto_tree_add_item(redirect_tree, hf_tns_redirect_data_length, tvb, + proto_tree_add_item(redirect_tree, hf_tns_redirect_data_length, tvb, offset, 2, ENC_BIG_ENDIAN); - } offset += 2; - if ( redirect_tree ) - { - proto_tree_add_item(redirect_tree, hf_tns_redirect_data, tvb, + proto_tree_add_item(redirect_tree, hf_tns_redirect_data, tvb, offset, -1, ENC_ASCII|ENC_NA); - } - return; } static void dissect_tns_control(tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *tree, proto_tree *tns_tree) + proto_tree *tree _U_, proto_tree *tns_tree) { - proto_tree *control_tree = NULL, *ti; + proto_tree *control_tree; proto_item *hidden_item; - if ( tree ) - { - ti = proto_tree_add_text(tns_tree, tvb, offset, -1, - "Control"); - control_tree = proto_item_add_subtree(ti, ett_tns_control); + control_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1, + ett_tns_control, NULL, "Control"); - hidden_item = proto_tree_add_boolean(tns_tree, hf_tns_control, tvb, + hidden_item = proto_tree_add_boolean(tns_tree, hf_tns_control, tvb, 0, 0, TRUE); - PROTO_ITEM_SET_HIDDEN(hidden_item); - } + PROTO_ITEM_SET_HIDDEN(hidden_item); col_append_str(pinfo->cinfo, COL_INFO, ", Control"); - if ( control_tree ) - { - proto_tree_add_item(control_tree, hf_tns_control_cmd, tvb, + proto_tree_add_item(control_tree, hf_tns_control_cmd, tvb, offset, 2, ENC_BIG_ENDIAN); - } offset += 2; - if ( control_tree ) - { - proto_tree_add_item(control_tree, hf_tns_control_data, tvb, + proto_tree_add_item(control_tree, hf_tns_control_data, tvb, offset, -1, ENC_NA); - } - return; } static guint diff --git a/epan/dissectors/packet-trmac.c b/epan/dissectors/packet-trmac.c index 8185b2856e..60939e8532 100644 --- a/epan/dissectors/packet-trmac.c +++ b/epan/dissectors/packet-trmac.c @@ -167,8 +167,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) guchar errors[6]; /* isolating or non-isolating */ - sv_item = proto_tree_add_text(tree, tvb, svoff+0, 1, "Subvector"); - sv_tree = proto_item_add_subtree(sv_item, ett_tr_sv); + sv_tree = proto_tree_add_subtree(tree, tvb, svoff+0, 1, ett_tr_sv, &sv_item, "Subvector"); sv_length = tvb_get_guint8(tvb, svoff+0); len_item = proto_tree_add_item(sv_tree, hf_trmac_sv_len, tvb, svoff+0, 1, ENC_NA); diff --git a/epan/dissectors/packet-tsp.c b/epan/dissectors/packet-tsp.c index 96b9364f19..a7f830a5cc 100644 --- a/epan/dissectors/packet-tsp.c +++ b/epan/dissectors/packet-tsp.c @@ -109,8 +109,8 @@ static const value_string names_tsp_type[] = { static void dissect_tsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_tree *tsp_tree = NULL; - proto_item *tsp_item = NULL; + proto_tree *tsp_tree; + proto_item *tsp_item; guint8 tsp_type; @@ -121,12 +121,9 @@ dissect_tsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_add_str(pinfo->cinfo, COL_INFO, val_to_str(tsp_type, names_tsp_type, "Unknown message type (%u)")); - if (tree) { - tsp_item = proto_tree_add_item(tree, proto_tsp, + tsp_item = proto_tree_add_item(tree, proto_tsp, tvb, 0, -1, ENC_NA); - if (tsp_item) - tsp_tree = proto_item_add_subtree(tsp_item, ett_tsp); - } + tsp_tree = proto_item_add_subtree(tsp_item, ett_tsp); if (tsp_tree) { proto_tree_add_uint(tsp_tree, hf_tsp_type, diff --git a/epan/dissectors/packet-tzsp.c b/epan/dissectors/packet-tzsp.c index 32359f9ab1..ac8467c4ef 100644 --- a/epan/dissectors/packet-tzsp.c +++ b/epan/dissectors/packet-tzsp.c @@ -165,7 +165,6 @@ add_option_info(tvbuff_t *tvb, int pos, proto_tree *tree, proto_item *ti) { guint8 tag, length, fcs_err = 0, encr = 0, seen_fcs_err = 0; proto_tree *tag_tree; - proto_item *tag_item; /* * Read all option tags in an endless loop. If the packet is malformed this @@ -175,14 +174,12 @@ add_option_info(tvbuff_t *tvb, int pos, proto_tree *tree, proto_item *ti) tag = tvb_get_guint8(tvb, pos); if ((tag != TZSP_HDR_PAD) && (tag != TZSP_HDR_END)) { length = tvb_get_guint8(tvb, pos+1); - tag_item = proto_tree_add_text(tree, tvb, pos, 2+length, "%s", val_to_str_const(tag, option_tag_vals, "Unknown")); + tag_tree = proto_tree_add_subtree(tree, tvb, pos, 2+length, ett_tag, NULL, val_to_str_const(tag, option_tag_vals, "Unknown")); } else { - tag_item = proto_tree_add_text(tree, tvb, pos, 1, "%s", val_to_str_const(tag, option_tag_vals, "Unknown")); + tag_tree = proto_tree_add_subtree(tree, tvb, pos, 1, ett_tag, NULL, val_to_str_const(tag, option_tag_vals, "Unknown")); length = 0; } - tag_tree = proto_item_add_subtree(tag_item, ett_tag); - proto_tree_add_item(tag_tree, hf_option_tag, tvb, pos, 1, ENC_NA); pos++; if ((tag != TZSP_HDR_PAD) && (tag != TZSP_HDR_END)) { diff --git a/epan/dissectors/packet-ua3g.c b/epan/dissectors/packet-ua3g.c index 16e57be868..dbe1bf48d8 100644 --- a/epan/dissectors/packet-ua3g.c +++ b/epan/dissectors/packet-ua3g.c @@ -1273,10 +1273,9 @@ decode_ip_device_routing(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, frequency_2 = tvb_get_ntohs(tvb, offset + 3); level_2 = (signed char)(tvb_get_guint8(tvb, offset + 5)) / 2; - ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, 6, - "Tone Pair %d: %d Hz at %d dB / %d Hz at %d dB", + ua3g_param_tree = proto_tree_add_subtree_format(ua3g_body_tree, tvb, offset, 6, + ett_ua3g_param, NULL, "Tone Pair %d: %d Hz at %d dB / %d Hz at %d dB", i, frequency_1, level_1, frequency_2, level_2); - ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param); proto_tree_add_item(ua3g_param_tree, hf_ua3g_ip_device_routing_def_tones_frequency_1, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; @@ -1321,14 +1320,13 @@ decode_ip_device_routing(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, tone_silence = tvb_get_guint8(tvb, offset + 2); #endif - ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, 6, + ua3g_param_tree = proto_tree_add_subtree_format(ua3g_body_tree, tvb, offset, 6, #if 0 - "Tone Pair %d: Id: %d, Duration: %d ms, Silence: %d ms", + ett_ua3g_param, NULL, "Tone Pair %d: Id: %d, Duration: %d ms, Silence: %d ms", ii+1, tone_id, tone_duration, tone_silence); #endif - "Tone Pair %d: Id: %d, Duration: %d ms", + ett_ua3g_param, NULL, "Tone Pair %d: Id: %d, Duration: %d ms", ii+1, tone_id, tone_duration); - ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param); proto_tree_add_item(ua3g_param_tree, hf_ua3g_ip_device_routing_start_tone_identification, tvb, offset, 1, ENC_NA); offset++; @@ -1641,7 +1639,7 @@ decode_lcd_line_cmd(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, guint8 command, column_n; const gchar* command_str; proto_tree *ua3g_body_tree = tree, *ua3g_param_tree, *ua3g_option_tree; - proto_item *ua3g_param_item, *ua3g_option_item; + proto_item *ua3g_option_item; wmem_strbuf_t *strbuf; command = tvb_get_guint8(tvb, offset) & 0x03; @@ -1658,10 +1656,9 @@ decode_lcd_line_cmd(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, wmem_strbuf_append_printf(strbuf, "\"%s\"", tvb_format_text(tvb, offset + 2, length - 2)); - ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, - length, "%s %d: %s", + ua3g_param_tree = proto_tree_add_subtree_format(ua3g_body_tree, tvb, offset, + length, ett_ua3g_param, NULL, "%s %d: %s", command_str, column_n, wmem_strbuf_get_str(strbuf)); - ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param); proto_tree_add_item(ua3g_body_tree, hf_ua3g_command_lcd_line, tvb, offset, 1, ENC_NA); ua3g_option_item = proto_tree_add_item(ua3g_param_tree, hf_ua3g_lcd_line_cmd_lcd_options, tvb, offset, 1, ENC_NA); @@ -2694,7 +2691,6 @@ decode_ua_dwl_protocol(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, { guint8 command; proto_tree *ua3g_body_tree = tree, *ua3g_param_tree; - proto_item *ua3g_param_item; command = tvb_get_guint8(tvb, offset); @@ -2733,8 +2729,7 @@ decode_ua_dwl_protocol(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, length -= 2; if (length > 2) { /* Not R1 */ - ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "Files Included"); - ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param); + ua3g_param_tree = proto_tree_add_subtree(ua3g_body_tree, tvb, offset, 1, ett_ua3g_param, NULL, "Files Included"); proto_tree_add_item(ua3g_param_tree, hf_ua3g_ua_dwl_protocol_files_inc_boot_binary, tvb, offset, 1, ENC_NA); proto_tree_add_item(ua3g_param_tree, hf_ua3g_ua_dwl_protocol_files_inc_loader_binary, @@ -2746,8 +2741,7 @@ decode_ua_dwl_protocol(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, offset++; length--; - ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "Model Selection"); - ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param); + ua3g_param_tree = proto_tree_add_subtree(ua3g_body_tree, tvb, offset, 1, ett_ua3g_param, NULL, "Model Selection"); proto_tree_add_item(ua3g_param_tree, hf_ua3g_ua_dwl_protocol_model_selection_a, tvb, offset, 1, ENC_NA); proto_tree_add_item(ua3g_param_tree, hf_ua3g_ua_dwl_protocol_model_selection_b, @@ -2758,8 +2752,7 @@ decode_ua_dwl_protocol(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, tvb, offset, 1, ENC_NA); offset++; length--; - ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "Hardware Selection"); - ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param); + ua3g_param_tree = proto_tree_add_subtree(ua3g_body_tree, tvb, offset, 1, ett_ua3g_param, NULL, "Hardware Selection"); proto_tree_add_item(ua3g_param_tree, hf_ua3g_ua_dwl_protocol_hardware_selection_ivanoe1, tvb, offset, 1, ENC_NA); proto_tree_add_item(ua3g_param_tree, hf_ua3g_ua_dwl_protocol_hardware_selection_ivanoe2, @@ -2767,8 +2760,7 @@ decode_ua_dwl_protocol(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, offset++; length--; - ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "Memory Sizes Required"); - ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param); + ua3g_param_tree = proto_tree_add_subtree(ua3g_body_tree, tvb, offset, 1, ett_ua3g_param, NULL, "Memory Sizes Required"); proto_tree_add_item(ua3g_param_tree, hf_ua3g_ua_dwl_protocol_memory_sizes_flash, tvb, offset, 1, ENC_NA); proto_tree_add_item(ua3g_param_tree, hf_ua3g_ua_dwl_protocol_memory_sizes_ext_ram, @@ -3391,7 +3383,6 @@ decode_unsolicited_msg(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, { guint8 command; proto_tree *ua3g_body_tree = tree, *ua3g_param_tree; - proto_item *ua3g_param_item; command = tvb_get_guint8(tvb, offset); @@ -3440,8 +3431,7 @@ decode_unsolicited_msg(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, case 0x04: case 0x05: { - ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "Characteristic Number"); - ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param); + ua3g_param_tree = proto_tree_add_subtree(ua3g_body_tree, tvb, offset, 1, ett_ua3g_param, NULL, "Characteristic Number"); proto_tree_add_item(ua3g_param_tree, hf_ua3g_unsolicited_msg_char_num_vta_subtype, tvb, offset, 1, ENC_NA); proto_tree_add_item(ua3g_param_tree, hf_ua3g_unsolicited_msg_char_num_generation, @@ -3454,8 +3444,7 @@ decode_unsolicited_msg(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, offset++; length--; - ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "Hardware Configuration"); - ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param); + ua3g_param_tree = proto_tree_add_subtree(ua3g_body_tree, tvb, offset, 1, ett_ua3g_param, NULL, "Hardware Configuration"); proto_tree_add_item(ua3g_param_tree, hf_ua3g_unsolicited_msg_hardware_config_vta_type, tvb, offset, 1, ENC_NA); proto_tree_add_item(ua3g_param_tree, hf_ua3g_unsolicited_msg_hardware_config_design, @@ -3491,8 +3480,7 @@ decode_unsolicited_msg(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, offset++; length--; - ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "Hardware Configuration"); - ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param); + ua3g_param_tree = proto_tree_add_subtree(ua3g_body_tree, tvb, offset, 1, ett_ua3g_param, NULL, "Hardware Configuration"); proto_tree_add_item(ua3g_param_tree, hf_ua3g_unsolicited_msg_hardware_config_hard_config_chip, tvb, offset, 1, ENC_NA); proto_tree_add_item(ua3g_param_tree, hf_ua3g_unsolicited_msg_hardware_config_hard_config_flash, @@ -3691,7 +3679,7 @@ static int dissect_ua3g(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { gint offset = 0; - proto_item *ua3g_item, *ua3g_body_item; + proto_item *ua3g_item; proto_tree *ua3g_tree, *ua3g_body_tree; gint length; guint8 opcode; @@ -3737,8 +3725,7 @@ dissect_ua3g(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) proto_item_append_text(ua3g_item, ", %s", opcode_str); - ua3g_body_item = proto_tree_add_text(ua3g_tree, tvb, offset, length, "UA3G Body"); - ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + ua3g_body_tree = proto_tree_add_subtree(ua3g_tree, tvb, offset, length, ett_ua3g_body, NULL, "UA3G Body"); if (*message_direction == SYS_TO_TERM) { switch (opcode) { diff --git a/epan/dissectors/packet-udld.c b/epan/dissectors/packet-udld.c index b1e9786c59..7107f57bcb 100644 --- a/epan/dissectors/packet-udld.c +++ b/epan/dissectors/packet-udld.c @@ -111,10 +111,10 @@ dissect_udld(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_clear(pinfo->cinfo, COL_INFO); if (tree) { - proto_item *flags_ti; + proto_item *flags_ti; proto_tree *flags_tree; - ti = proto_tree_add_item(tree, proto_udld, tvb, offset, -1, ENC_NA); + ti = proto_tree_add_item(tree, proto_udld, tvb, offset, -1, ENC_NA); udld_tree = proto_item_add_subtree(ti, ett_udld); /* UDLD header */ @@ -161,10 +161,9 @@ dissect_udld(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) length - 4)); if (tree) { - tlvi = proto_tree_add_text(udld_tree, tvb, offset, - length, "Device ID: %s", + tlv_tree = proto_tree_add_subtree_format(udld_tree, tvb, offset, + length, ett_udld_tlv, NULL, "Device ID: %s", tvb_format_stringzpad(tvb, offset + 4, length - 4)); - tlv_tree = proto_item_add_subtree(tlvi, ett_udld_tlv); proto_tree_add_uint(tlv_tree, hf_udld_tlvtype, tvb, offset + TLV_TYPE, 2, type); proto_tree_add_uint(tlv_tree, hf_udld_tlvlength, tvb, @@ -193,10 +192,9 @@ dissect_udld(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvb_format_stringzpad(tvb, offset + 4, length - 4)); if (tree) { - tlvi = proto_tree_add_text(udld_tree, tvb, offset, - real_length, "Port ID: %s", + tlv_tree = proto_tree_add_subtree_format(udld_tree, tvb, offset, + real_length, ett_udld_tlv, NULL, "Port ID: %s", tvb_format_text(tvb, offset + 4, real_length - 4)); - tlv_tree = proto_item_add_subtree(tlvi, ett_udld_tlv); proto_tree_add_uint(tlv_tree, hf_udld_tlvtype, tvb, offset + TLV_TYPE, 2, type); proto_tree_add_uint(tlv_tree, hf_udld_tlvlength, tvb, @@ -215,11 +213,10 @@ dissect_udld(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case TYPE_DEVICE_NAME: case TYPE_SEQUENCE_NUMBER: default: - tlvi = proto_tree_add_text(udld_tree, tvb, offset, - length, "Type: %s, length: %u", + tlv_tree = proto_tree_add_subtree_format(udld_tree, tvb, offset, + length, ett_udld_tlv, NULL, "Type: %s, length: %u", val_to_str(type, type_vals, "Unknown (0x%04x)"), length); - tlv_tree = proto_item_add_subtree(tlvi, ett_udld_tlv); proto_tree_add_uint(tlv_tree, hf_udld_tlvtype, tvb, offset + TLV_TYPE, 2, type); proto_tree_add_uint(tlv_tree, hf_udld_tlvlength, tvb, diff --git a/epan/dissectors/packet-udp.c b/epan/dissectors/packet-udp.c index 7c312ebd33..1def80f2d3 100644 --- a/epan/dissectors/packet-udp.c +++ b/epan/dissectors/packet-udp.c @@ -722,9 +722,8 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto) } if (udpd && ((udpd->fwd && udpd->fwd->command) || (udpd->rev && udpd->rev->command))) { - ti = proto_tree_add_text(udp_tree, tvb, offset, 0, "Process Information"); + process_tree = proto_tree_add_subtree(udp_tree, tvb, offset, 0, ett_udp_process_info, &ti, "Process Information"); PROTO_ITEM_SET_GENERATED(ti); - process_tree = proto_item_add_subtree(ti, ett_udp_process_info); if (udpd->fwd && udpd->fwd->command) { proto_tree_add_uint_format_value(process_tree, hfi_udp_proc_dst_uid.id, tvb, 0, 0, udpd->fwd->process_uid, "%u", udpd->fwd->process_uid); diff --git a/epan/dissectors/packet-uma.c b/epan/dissectors/packet-uma.c index 6fef5a4546..0d842969f8 100644 --- a/epan/dissectors/packet-uma.c +++ b/epan/dissectors/packet-uma.c @@ -874,9 +874,8 @@ dissect_uma_IE(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) address src_addr; ie_value = tvb_get_guint8(tvb,offset); - urr_ie_item = proto_tree_add_text(tree,tvb,offset,-1,"%s", + urr_ie_tree = proto_tree_add_subtree(tree,tvb,offset,-1, ett_urr_ie, &urr_ie_item, val_to_str_ext(ie_value, &uma_urr_IE_type_vals_ext, "Unknown IE (%u)")); - urr_ie_tree = proto_item_add_subtree(urr_ie_item, ett_urr_ie); proto_tree_add_item(urr_ie_tree, hf_uma_urr_IE, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; diff --git a/epan/dissectors/packet-usb-audio.c b/epan/dissectors/packet-usb-audio.c index ea8f788910..e8ca37b464 100644 --- a/epan/dissectors/packet-usb-audio.c +++ b/epan/dissectors/packet-usb-audio.c @@ -249,25 +249,22 @@ dissect_usb_audio_descriptor(tvbuff_t *tvb, packet_info *pinfo _U_, gint offset = 0; guint8 descriptor_len; guint8 descriptor_type; - proto_item *item = NULL; proto_tree *desc_tree; descriptor_len = tvb_get_guint8(tvb, offset); descriptor_type = tvb_get_guint8(tvb, offset+1); if (descriptor_type == CS_INTERFACE) { - item = proto_tree_add_text(tree, tvb, offset, descriptor_len, - "AUDIO CONTROL INTERFACE DESCRIPTOR"); + desc_tree = proto_tree_add_subtree(tree, tvb, offset, descriptor_len, + ett_usb_audio_desc, NULL, "AUDIO CONTROL INTERFACE DESCRIPTOR"); } else if (descriptor_type == CS_ENDPOINT) { - item = proto_tree_add_text(tree, tvb, offset, descriptor_len, - "AUDIO CONTROL ENDPOINT DESCRIPTOR"); + desc_tree = proto_tree_add_subtree(tree, tvb, offset, descriptor_len, + ett_usb_audio_desc, NULL, "AUDIO CONTROL ENDPOINT DESCRIPTOR"); } else return 0; - desc_tree = proto_item_add_subtree(item, ett_usb_audio_desc); - dissect_usb_descriptor_header(desc_tree, tvb, offset, &aud_descriptor_type_vals_ext); diff --git a/epan/dissectors/packet-usb-ccid.c b/epan/dissectors/packet-usb-ccid.c index 6a50c24025..a644abcd97 100644 --- a/epan/dissectors/packet-usb-ccid.c +++ b/epan/dissectors/packet-usb-ccid.c @@ -240,7 +240,7 @@ dissect_usb_ccid_descriptor(tvbuff_t *tvb, packet_info *pinfo _U_, gint offset = 0; guint8 descriptor_type; guint8 descriptor_len; - proto_item *item, *freq_item; + proto_item *freq_item; proto_tree *desc_tree; guint8 num_clock_supp; @@ -249,9 +249,8 @@ dissect_usb_ccid_descriptor(tvbuff_t *tvb, packet_info *pinfo _U_, if (descriptor_type!=USB_DESC_TYPE_SMARTCARD) return 0; - item = proto_tree_add_text(tree, tvb, offset, descriptor_len, - "SMART CARD DEVICE CLASS DESCRIPTOR"); - desc_tree = proto_item_add_subtree(item, ett_ccid_desc); + desc_tree = proto_tree_add_subtree(tree, tvb, offset, descriptor_len, + ett_ccid_desc, NULL, "SMART CARD DEVICE CLASS DESCRIPTOR"); dissect_usb_descriptor_header(desc_tree, tvb, offset, &ccid_descriptor_type_vals_ext); diff --git a/epan/dissectors/packet-usb-com.c b/epan/dissectors/packet-usb-com.c index b7e1beb837..21b3d535b7 100644 --- a/epan/dissectors/packet-usb-com.c +++ b/epan/dissectors/packet-usb-com.c @@ -296,10 +296,8 @@ dissect_usb_com_descriptor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *subtree; proto_tree *subtree_capabilities; proto_item *subitem_capabilities; - proto_item *ti; - ti = proto_tree_add_text(tree, tvb, offset, -1, "COMMUNICATIONS DESCRIPTOR"); - subtree = proto_item_add_subtree(ti, ett_usb_com); + subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_usb_com, NULL, "COMMUNICATIONS DESCRIPTOR"); dissect_usb_descriptor_header(subtree, tvb, offset, &usb_com_descriptor_type_vals_ext); offset += 2; diff --git a/epan/dissectors/packet-usb-hid.c b/epan/dissectors/packet-usb-hid.c index 02184e2910..5356b6cd50 100644 --- a/epan/dissectors/packet-usb-hid.c +++ b/epan/dissectors/packet-usb-hid.c @@ -464,7 +464,7 @@ dissect_usb_hid_report_localitem_data(packet_info *pinfo _U_, proto_tree *tree, static int dissect_usb_hid_report_item(packet_info *pinfo _U_, proto_tree *parent_tree, tvbuff_t *tvb, int offset, usb_trans_info_t *usb_trans_info _U_, usb_conv_info_t *usb_conv_info _U_, const struct usb_hid_global_state *global) { - proto_item *item=NULL, *subitem=NULL; + proto_item *subitem=NULL; proto_tree *tree=NULL, *subtree=NULL; int old_offset; unsigned int tmp; @@ -503,14 +503,13 @@ dissect_usb_hid_report_item(packet_info *pinfo _U_, proto_tree *parent_tree, tvb break; } - subitem = proto_tree_add_text(parent_tree, tvb, offset, bSize + 1, "%s item (%s)", + subtree = proto_tree_add_subtree_format(parent_tree, tvb, offset, bSize + 1, + ett_usb_hid_item_header, NULL, "%s item (%s)", val_to_str(bType, usb_hid_item_bType_vals, "Unknown/%u"), val_to_str(bTag, usb_hid_cur_bTag_vals, "Unknown/%u tag") ); - subtree = proto_item_add_subtree(subitem, ett_usb_hid_item_header); - item = proto_tree_add_text(subtree, tvb, offset, 1, "Header"); - tree = proto_item_add_subtree(item, ett_usb_hid_item_header); + tree = proto_tree_add_subtree(subtree, tvb, offset, 1, ett_usb_hid_item_header, NULL, "Header"); proto_tree_add_item(tree, hf_usb_hid_item_bSize, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, hf_usb_hid_item_bType, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, hf_usb_hid_curitem_bTag, tvb, offset, 1, ENC_LITTLE_ENDIAN); @@ -837,8 +836,7 @@ dissect_usb_hid_class_descriptors(tvbuff_t *tvb, packet_info *pinfo _U_, if (type != USB_DT_HID) return 0; - ti = proto_tree_add_text(tree, tvb, offset, -1, "HID DESCRIPTOR"); - desc_tree = proto_item_add_subtree(ti, ett_usb_hid_descriptor); + desc_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_usb_hid_descriptor, &ti, "HID DESCRIPTOR"); dissect_usb_descriptor_header(desc_tree, tvb, offset, &hid_descriptor_type_vals_ext); diff --git a/epan/dissectors/packet-usb-video.c b/epan/dissectors/packet-usb-video.c index 1a82e20385..75bcddd4d0 100644 --- a/epan/dissectors/packet-usb-video.c +++ b/epan/dissectors/packet-usb-video.c @@ -912,10 +912,9 @@ dissect_usb_video_control_interface_descriptor(proto_tree *parent_tree, tvbuff_t subtype_str = val_to_str_ext(subtype, &vc_if_descriptor_subtypes_ext, "Unknown (0x%x)"); - item = proto_tree_add_text(parent_tree, tvb, offset, descriptor_len, - "VIDEO CONTROL INTERFACE DESCRIPTOR [%s]", + tree = proto_tree_add_subtree_format(parent_tree, tvb, offset, descriptor_len, + ett_descriptor_video_control, &item, "VIDEO CONTROL INTERFACE DESCRIPTOR [%s]", subtype_str); - tree = proto_item_add_subtree(item, ett_descriptor_video_control); } /* Common fields */ @@ -1346,7 +1345,6 @@ static int dissect_usb_video_streaming_interface_descriptor(proto_tree *parent_tree, tvbuff_t *tvb, guint8 descriptor_len) { - proto_item *item; proto_tree *tree; int offset = 0; const gchar *subtype_str; @@ -1355,10 +1353,9 @@ dissect_usb_video_streaming_interface_descriptor(proto_tree *parent_tree, tvbuff subtype = tvb_get_guint8(tvb, offset+2); subtype_str = val_to_str_ext(subtype, &vs_if_descriptor_subtypes_ext, "Unknown (0x%x)"); - item = proto_tree_add_text(parent_tree, tvb, offset, descriptor_len, - "VIDEO STREAMING INTERFACE DESCRIPTOR [%s]", + tree = proto_tree_add_subtree_format(parent_tree, tvb, offset, descriptor_len, + ett_descriptor_video_streaming, NULL, "VIDEO STREAMING INTERFACE DESCRIPTOR [%s]", subtype_str); - tree = proto_item_add_subtree(item, ett_descriptor_video_streaming); dissect_usb_descriptor_header(tree, tvb, offset, &vid_descriptor_type_vals_ext); proto_tree_add_item(tree, hf_usb_vid_streaming_ifdesc_subtype, tvb, offset+2, 1, ENC_NA); @@ -1416,7 +1413,6 @@ static int dissect_usb_video_endpoint_descriptor(proto_tree *parent_tree, tvbuff_t *tvb, guint8 descriptor_len) { - proto_item *item = NULL; proto_tree *tree = NULL; int offset = 0; guint8 subtype; @@ -1428,10 +1424,9 @@ dissect_usb_video_endpoint_descriptor(proto_tree *parent_tree, tvbuff_t *tvb, const gchar* subtype_str; subtype_str = val_to_str(subtype, vc_ep_descriptor_subtypes, "Unknown (0x%x)"); - item = proto_tree_add_text(parent_tree, tvb, offset, descriptor_len, - "VIDEO CONTROL ENDPOINT DESCRIPTOR [%s]", + tree = proto_tree_add_subtree_format(parent_tree, tvb, offset, descriptor_len, + ett_descriptor_video_endpoint, NULL, "VIDEO CONTROL ENDPOINT DESCRIPTOR [%s]", subtype_str); - tree = proto_item_add_subtree(item, ett_descriptor_video_endpoint); } dissect_usb_descriptor_header(tree, tvb, offset, &vid_descriptor_type_vals_ext); @@ -1522,7 +1517,7 @@ dissect_usb_vid_descriptor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, static int dissect_usb_vid_probe(proto_tree *parent_tree, tvbuff_t *tvb, int offset) { - proto_tree *tree = NULL; + proto_tree *tree; static const int *hint_bits[] = { &hf_usb_vid_probe_hint_D[0], @@ -1535,13 +1530,7 @@ dissect_usb_vid_probe(proto_tree *parent_tree, tvbuff_t *tvb, int offset) DISSECTOR_ASSERT(array_length(hint_bits) == (1+array_length(hf_usb_vid_probe_hint_D))); - if (parent_tree) - { - proto_item *item; - - item = proto_tree_add_text(parent_tree, tvb, offset, -1, "Probe/Commit Info"); - tree = proto_item_add_subtree(item, ett_video_probe); - } + tree = proto_tree_add_subtree(parent_tree, tvb, offset, -1, ett_video_probe, NULL, "Probe/Commit Info"); proto_tree_add_bitmask(tree, tvb, offset, hf_usb_vid_probe_hint, ett_probe_hint, hint_bits, ENC_LITTLE_ENDIAN); diff --git a/epan/dissectors/packet-usb.c b/epan/dissectors/packet-usb.c index 8fc3dd5897..11dc9c63fa 100644 --- a/epan/dissectors/packet-usb.c +++ b/epan/dissectors/packet-usb.c @@ -1205,8 +1205,7 @@ dissect_usb_device_qualifier_descriptor(packet_info *pinfo _U_, proto_tree *pare guint32 protocol; const gchar *description; - item = proto_tree_add_text(parent_tree, tvb, offset, -1, "DEVICE QUALIFIER DESCRIPTOR"); - tree = proto_item_add_subtree(item, ett_descriptor_device); + tree = proto_tree_add_subtree(parent_tree, tvb, offset, -1, ett_descriptor_device, &item, "DEVICE QUALIFIER DESCRIPTOR"); dissect_usb_descriptor_header(tree, tvb, offset, NULL); offset += 2; @@ -1295,8 +1294,7 @@ dissect_usb_device_descriptor(packet_info *pinfo, proto_tree *parent_tree, gint field_description_length; header_field_info *hfi; - item = proto_tree_add_text(parent_tree, tvb, offset, -1, "DEVICE DESCRIPTOR"); - tree = proto_item_add_subtree(item, ett_descriptor_device); + tree = proto_tree_add_subtree(parent_tree, tvb, offset, -1, ett_descriptor_device, &item, "DEVICE DESCRIPTOR"); dissect_usb_descriptor_header(tree, tvb, offset, NULL); offset += 2; @@ -1423,8 +1421,7 @@ dissect_usb_string_descriptor(packet_info *pinfo _U_, proto_tree *parent_tree, guint8 len; proto_item *len_item; - item = proto_tree_add_text(parent_tree, tvb, offset, -1, "STRING DESCRIPTOR"); - tree = proto_item_add_subtree(item, ett_descriptor_device); + tree = proto_tree_add_subtree(parent_tree, tvb, offset, -1, ett_descriptor_device, &item, "STRING DESCRIPTOR"); len = tvb_get_guint8(tvb, offset); /* The USB spec says that the languages / the string are UTF16 and not @@ -1482,8 +1479,7 @@ dissect_usb_interface_descriptor(packet_info *pinfo, proto_tree *parent_tree, guint8 interface_num; guint8 alt_setting; - item = proto_tree_add_text(parent_tree, tvb, offset, -1, "INTERFACE DESCRIPTOR"); - tree = proto_item_add_subtree(item, ett_descriptor_device); + tree = proto_tree_add_subtree(parent_tree, tvb, offset, -1, ett_descriptor_device, &item, "INTERFACE DESCRIPTOR"); len = tvb_get_guint8(tvb, offset); dissect_usb_descriptor_header(tree, tvb, offset, NULL); @@ -1635,8 +1631,7 @@ dissect_usb_endpoint_descriptor(packet_info *pinfo, proto_tree *parent_tree, guint8 ep_type; guint8 len; - item = proto_tree_add_text(parent_tree, tvb, offset, -1, "ENDPOINT DESCRIPTOR"); - tree = proto_item_add_subtree(item, ett_descriptor_device); + tree = proto_tree_add_subtree(parent_tree, tvb, offset, -1, ett_descriptor_device, &item, "ENDPOINT DESCRIPTOR"); len = tvb_get_guint8(tvb, offset); dissect_usb_descriptor_header(tree, tvb, offset, NULL); @@ -1731,8 +1726,7 @@ dissect_usb_interface_assn_descriptor(packet_info *pinfo _U_, proto_tree *parent proto_tree *tree; int old_offset = offset; - item = proto_tree_add_text(parent_tree, tvb, offset, -1, "INTERFACE ASSOCIATION DESCRIPTOR"); - tree = proto_item_add_subtree(item, ett_descriptor_device); + tree = proto_tree_add_subtree(parent_tree, tvb, offset, -1, ett_descriptor_device, &item, "INTERFACE ASSOCIATION DESCRIPTOR"); dissect_usb_descriptor_header(tree, tvb, offset, NULL); offset += 2; @@ -1776,9 +1770,7 @@ dissect_usb_unknown_descriptor(packet_info *pinfo _U_, proto_tree *parent_tree, proto_tree *tree; guint8 bLength; - item = proto_tree_add_text(parent_tree, tvb, offset, -1, "UNKNOWN DESCRIPTOR"); - tree = proto_item_add_subtree(item, ett_descriptor_device); - + tree = proto_tree_add_subtree(parent_tree, tvb, offset, -1, ett_descriptor_device, &item, "UNKNOWN DESCRIPTOR"); bLength = tvb_get_guint8(tvb, offset); dissect_usb_descriptor_header(tree, tvb, offset, NULL); @@ -1823,8 +1815,7 @@ dissect_usb_configuration_descriptor(packet_info *pinfo _U_, proto_tree *parent_ usb_conv_info->interfaceSubclass = IF_SUBCLASS_UNKNOWN; usb_conv_info->interfaceProtocol = IF_PROTOCOL_UNKNOWN; - item = proto_tree_add_text(parent_tree, tvb, offset, -1, "CONFIGURATION DESCRIPTOR"); - tree = proto_item_add_subtree(item, ett_descriptor_device); + tree = proto_tree_add_subtree(parent_tree, tvb, offset, -1, ett_descriptor_device, &item, "CONFIGURATION DESCRIPTOR"); dissect_usb_descriptor_header(tree, tvb, offset, NULL); offset += 2; diff --git a/epan/dissectors/packet-uts.c b/epan/dissectors/packet-uts.c index 24fbce752e..109deadc3a 100644 --- a/epan/dissectors/packet-uts.c +++ b/epan/dissectors/packet-uts.c @@ -259,8 +259,7 @@ dissect_uts(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree) proto_tree_add_protocol_format(uts_tree, proto_uts, tvb, 0, 2, "No Traffic"); proto_tree_add_protocol_format(uts_tree, proto_uts, tvb, 2, -1, "ETX + padding"); } else { - ti = proto_tree_add_text(uts_tree, tvb, 0, header_length, "Header"); - uts_header_tree = proto_item_add_subtree(ti, ett_header_uts); + uts_header_tree = proto_tree_add_subtree(uts_tree, tvb, 0, header_length, ett_header_uts, NULL, "Header"); proto_tree_add_protocol_format(uts_header_tree, proto_uts, tvb, 0, 1, "SOH"); @@ -310,8 +309,7 @@ dissect_uts(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree) } if (etx_start) { - ti = proto_tree_add_text(uts_tree, tvb, etx_start, -1, "Trailer"); - uts_trailer_tree = proto_item_add_subtree(ti, ett_trailer_uts); + uts_trailer_tree = proto_tree_add_subtree(uts_tree, tvb, etx_start, -1, ett_trailer_uts, NULL, "Trailer"); if (etx_start) proto_tree_add_protocol_format(uts_trailer_tree, proto_uts, tvb, etx_start, 1, "ETX"); |