aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-06-29 17:00:12 -0400
committerMichael Mann <mmann78@netscape.net>2014-06-29 21:18:04 +0000
commitdd63ae2b8c889aa91577efe4621e6d0fe5432a99 (patch)
treeda25c2914161eba08b579a96a533b482f225c067
parente39e44df246c89c31d708923a181f99810240731 (diff)
proto_tree_add_subtree[_format]
Change-Id: Id00f456479415adf0a219af6c9a2108d4b3642d0 Reviewed-on: https://code.wireshark.org/review/2702 Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--epan/dissectors/packet-j1939.c7
-rw-r--r--epan/dissectors/packet-juniper.c5
-rw-r--r--epan/dissectors/packet-kafka.c59
-rw-r--r--epan/dissectors/packet-kink.c44
-rw-r--r--epan/dissectors/packet-kismet.c5
-rw-r--r--epan/dissectors/packet-l2tp.c86
-rw-r--r--epan/dissectors/packet-ldp.c260
-rw-r--r--epan/dissectors/packet-ldss.c7
-rw-r--r--epan/dissectors/packet-lg8979.c52
-rw-r--r--epan/dissectors/packet-linx.c32
-rw-r--r--epan/dissectors/packet-lldp.c81
-rw-r--r--epan/dissectors/packet-lltd.c56
-rw-r--r--epan/dissectors/packet-lmi.c5
-rw-r--r--epan/dissectors/packet-lmp.c23
-rw-r--r--epan/dissectors/packet-lon.c16
-rw-r--r--epan/dissectors/packet-ltp.c36
-rw-r--r--epan/dissectors/packet-lwm.c6
-rw-r--r--epan/dissectors/packet-lwres.c212
18 files changed, 367 insertions, 625 deletions
diff --git a/epan/dissectors/packet-j1939.c b/epan/dissectors/packet-j1939.c
index d5375b83bb..ee3c196536 100644
--- a/epan/dissectors/packet-j1939.c
+++ b/epan/dissectors/packet-j1939.c
@@ -196,8 +196,8 @@ static int dissect_j1939(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo
ti = proto_tree_add_item(tree, proto_j1939, tvb, offset, -1, ENC_NA);
j1939_tree = proto_item_add_subtree(ti, ett_j1939);
- ti = proto_tree_add_text(j1939_tree, tvb, 0, 0, "CAN Identifier: 0x%08x", can_id.id);
- can_tree = proto_item_add_subtree(ti, ett_j1939_can);
+ can_tree = proto_tree_add_subtree_format(j1939_tree, tvb, 0, 0,
+ ett_j1939_can, NULL, "CAN Identifier: 0x%08x", can_id.id);
can_id_item = proto_tree_add_uint(can_tree, hf_j1939_can_id, tvb, 0, 0, can_id.id);
PROTO_ITEM_SET_GENERATED(can_id_item);
ti = proto_tree_add_uint(can_tree, hf_j1939_priority, tvb, 0, 0, can_id.id);
@@ -244,8 +244,7 @@ static int dissect_j1939(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo
/* For now just include raw bytes */
col_append_fstr(pinfo->cinfo, COL_INFO, " %s", tvb_bytes_to_ep_str_punct(tvb, 0, data_length, ' '));
- ti = proto_tree_add_text(j1939_tree, tvb, 0, -1, "Message");
- msg_tree = proto_item_add_subtree(ti, ett_j1939_message);
+ msg_tree = proto_tree_add_subtree(j1939_tree, tvb, 0, -1, ett_j1939_message, NULL, "Message");
ti = proto_tree_add_uint(msg_tree, hf_j1939_pgn, tvb, 0, 0, pgn);
PROTO_ITEM_SET_GENERATED(ti);
diff --git a/epan/dissectors/packet-juniper.c b/epan/dissectors/packet-juniper.c
index 6803a9eb85..e35c5275c4 100644
--- a/epan/dissectors/packet-juniper.c
+++ b/epan/dissectors/packet-juniper.c
@@ -549,14 +549,13 @@ dissect_juniper_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, prot
if (ext_len == 0 || ext_len > (ext_total_len - EXT_TLV_HEADER_SIZE)) /* a few sanity checks */
break;
- tisub = proto_tree_add_text (juniper_ext_subtree, tvb, ext_offset, EXT_TLV_HEADER_SIZE + ext_len,
- "%s Extension TLV #%u, length: %u",
+ juniper_ext_subtree_item = proto_tree_add_subtree_format(juniper_ext_subtree, tvb, ext_offset, EXT_TLV_HEADER_SIZE + ext_len,
+ ett_juniper, &tisub, "%s Extension TLV #%u, length: %u",
val_to_str_const(ext_type, ext_tlv_vals, "Unknown"),
ext_type,
ext_len);
ext_val = juniper_ext_get_tlv_value(tvb, ext_type, ext_len, ext_offset+EXT_TLV_HEADER_SIZE);
- juniper_ext_subtree_item = proto_item_add_subtree(tisub, ett_juniper);
switch (ext_type) {
case EXT_TLV_IFD_MEDIATYPE:
diff --git a/epan/dissectors/packet-kafka.c b/epan/dissectors/packet-kafka.c
index 55aeddfdf5..02703d621a 100644
--- a/epan/dissectors/packet-kafka.c
+++ b/epan/dissectors/packet-kafka.c
@@ -250,8 +250,7 @@ dissect_kafka_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int s
guint8 codec;
- ti = proto_tree_add_text(tree, tvb, offset, -1, "Message");
- subtree = proto_item_add_subtree(ti, ett_kafka_message);
+ subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_kafka_message, &ti, "Message");
proto_tree_add_item(subtree, hf_kafka_message_crc, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
@@ -355,8 +354,7 @@ dissect_kafka_offset_fetch_request_topic(tvbuff_t *tvb, packet_info *pinfo, prot
proto_tree *subtree;
int offset = start_offset;
- ti = proto_tree_add_text(tree, tvb, offset, -1, "Offset Fetch Request Topic");
- subtree = proto_item_add_subtree(ti, ett_kafka_request_topic);
+ subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_kafka_request_topic, &ti, "Offset Fetch Request Topic");
offset = dissect_kafka_string(subtree, hf_kafka_topic_name, tvb, pinfo, offset);
offset = dissect_kafka_array(subtree, tvb, pinfo, offset, &dissect_kafka_offset_fetch_request_partition);
@@ -383,8 +381,7 @@ dissect_kafka_offset_fetch_response_partition(tvbuff_t *tvb, packet_info *pinfo
proto_tree *subtree;
int offset = start_offset;
- ti = proto_tree_add_text(tree, tvb, offset, -1, "Offset Fetch Response Partition");
- subtree = proto_item_add_subtree(ti, ett_kafka_request_partition);
+ subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_kafka_request_partition, &ti, "Offset Fetch Response Partition");
proto_tree_add_item(subtree, hf_kafka_partition_id, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
@@ -409,8 +406,7 @@ dissect_kafka_offset_fetch_response_topic(tvbuff_t *tvb, packet_info *pinfo, pro
proto_tree *subtree;
int offset = start_offset;
- ti = proto_tree_add_text(tree, tvb, offset, -1, "offset fetch response topic");
- subtree = proto_item_add_subtree(ti, ett_kafka_response_topic);
+ subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_kafka_response_topic, &ti, "offset fetch response topic");
offset = dissect_kafka_string(subtree, hf_kafka_topic_name, tvb, pinfo, offset);
offset = dissect_kafka_array(subtree, tvb, pinfo, offset, &dissect_kafka_offset_fetch_response_partition);
@@ -447,8 +443,7 @@ dissect_kafka_metadata_broker(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
proto_tree *subtree;
int offset = start_offset;
- ti = proto_tree_add_text(tree, tvb, offset, 14, "Broker");
- subtree = proto_item_add_subtree(ti, ett_kafka_metadata_broker);
+ subtree = proto_tree_add_subtree(tree, tvb, offset, 14, ett_kafka_metadata_broker, &ti, "Broker");
proto_tree_add_item(subtree, hf_kafka_broker_nodeid, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
@@ -485,8 +480,7 @@ dissect_kafka_metadata_partition(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr
int offset = start_offset;
int sub_start_offset;
- ti = proto_tree_add_text(tree, tvb, offset, -1, "Partition");
- subtree = proto_item_add_subtree(ti, ett_kafka_response_partition);
+ subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_kafka_response_partition, &ti, "Partition");
proto_tree_add_item(subtree, hf_kafka_error, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
@@ -498,14 +492,12 @@ dissect_kafka_metadata_partition(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr
offset += 4;
sub_start_offset = offset;
- subti = proto_tree_add_text(subtree, tvb, offset, -1, "Replicas");
- subsubtree = proto_item_add_subtree(subti, ett_kafka_metadata_replicas);
+ subsubtree = proto_tree_add_subtree(subtree, tvb, offset, -1, ett_kafka_metadata_replicas, &subti, "Replicas");
offset = dissect_kafka_array(subsubtree, tvb, pinfo, offset, &dissect_kafka_metadata_replica);
proto_item_set_len(subti, offset - sub_start_offset);
sub_start_offset = offset;
- subti = proto_tree_add_text(subtree, tvb, offset, -1, "Caught-Up Replicas");
- subsubtree = proto_item_add_subtree(subti, ett_kafka_metadata_isr);
+ subsubtree = proto_tree_add_subtree(subtree, tvb, offset, -1, ett_kafka_metadata_isr, &subti, "Caught-Up Replicas");
offset = dissect_kafka_array(subsubtree, tvb, pinfo, offset, &dissect_kafka_metadata_isr);
proto_item_set_len(subti, offset - sub_start_offset);
@@ -521,8 +513,7 @@ dissect_kafka_metadata_topic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
proto_tree *subtree;
int offset = start_offset;
- ti = proto_tree_add_text(tree, tvb, offset, -1, "Topic");
- subtree = proto_item_add_subtree(ti, ett_kafka_response_topic);
+ subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_kafka_response_topic, &ti, "Topic");
proto_tree_add_item(subtree, hf_kafka_error, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
@@ -543,14 +534,12 @@ dissect_kafka_metadata_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
proto_tree *subtree;
int offset = start_offset;
- ti = proto_tree_add_text(tree, tvb, offset, -1, "Broker Metadata");
- subtree = proto_item_add_subtree(ti, ett_kafka_metadata_brokers);
+ subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_kafka_metadata_brokers, &ti, "Broker Metadata");
offset = dissect_kafka_array(subtree, tvb, pinfo, offset, &dissect_kafka_metadata_broker);
proto_item_set_len(ti, offset - start_offset);
start_offset = offset;
- ti = proto_tree_add_text(tree, tvb, offset, -1, "Topic Metadata");
- subtree = proto_item_add_subtree(ti, ett_kafka_metadata_topics);
+ subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_kafka_metadata_topics, &ti, "Topic Metadata");
offset = dissect_kafka_array(subtree, tvb, pinfo, offset, &dissect_kafka_metadata_topic);
proto_item_set_len(ti, offset - start_offset);
@@ -565,8 +554,7 @@ dissect_kafka_fetch_request_partition(tvbuff_t *tvb, packet_info *pinfo _U_, pro
proto_item *ti;
proto_tree *subtree;
- ti = proto_tree_add_text(tree, tvb, offset, 16, "Fetch Request Partition");
- subtree = proto_item_add_subtree(ti, ett_kafka_request_partition);
+ subtree = proto_tree_add_subtree(tree, tvb, offset, 16, ett_kafka_request_partition, &ti, "Fetch Request Partition");
proto_tree_add_item(subtree, hf_kafka_partition_id, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
@@ -587,8 +575,7 @@ dissect_kafka_fetch_request_topic(tvbuff_t *tvb, packet_info *pinfo, proto_tree
proto_tree *subtree;
int offset = start_offset;
- ti = proto_tree_add_text(tree, tvb, offset, -1, "Fetch Request Topic");
- subtree = proto_item_add_subtree(ti, ett_kafka_request_topic);
+ subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_kafka_request_topic, &ti, "Fetch Request Topic");
offset = dissect_kafka_string(subtree, hf_kafka_topic_name, tvb, pinfo, offset);
offset = dissect_kafka_array(subtree, tvb, pinfo, offset, &dissect_kafka_fetch_request_partition);
@@ -622,8 +609,7 @@ dissect_kafka_fetch_response_partition(tvbuff_t *tvb, packet_info *pinfo _U_, pr
proto_tree *subtree;
int offset = start_offset;
- ti = proto_tree_add_text(tree, tvb, offset, -1, "Fetch Response Partition");
- subtree = proto_item_add_subtree(ti, ett_kafka_response_partition);
+ subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_kafka_response_partition, &ti, "Fetch Response Partition");
proto_tree_add_item(subtree, hf_kafka_partition_id, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
@@ -648,8 +634,7 @@ dissect_kafka_fetch_response_topic(tvbuff_t *tvb, packet_info *pinfo, proto_tree
proto_tree *subtree;
int offset = start_offset;
- ti = proto_tree_add_text(tree, tvb, offset, -1, "Fetch Response Topic");
- subtree = proto_item_add_subtree(ti, ett_kafka_response_topic);
+ subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_kafka_response_topic, &ti, "Fetch Response Topic");
offset = dissect_kafka_string(subtree, hf_kafka_topic_name, tvb, pinfo, offset);
offset = dissect_kafka_array(subtree, tvb, pinfo, offset, &dissect_kafka_fetch_response_partition);
@@ -670,11 +655,9 @@ dissect_kafka_fetch_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
static int
dissect_kafka_produce_request_partition(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
- proto_item *ti;
proto_tree *subtree;
- ti = proto_tree_add_text(tree, tvb, offset, 14, "Produce Request Partition");
- subtree = proto_item_add_subtree(ti, ett_kafka_request_partition);
+ subtree = proto_tree_add_subtree(tree, tvb, offset, 14, ett_kafka_request_partition, NULL, "Produce Request Partition");
proto_tree_add_item(subtree, hf_kafka_partition_id, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
@@ -691,8 +674,7 @@ dissect_kafka_produce_request_topic(tvbuff_t *tvb, packet_info *pinfo, proto_tre
proto_tree *subtree;
int offset = start_offset;
- ti = proto_tree_add_text(tree, tvb, offset, -1, "Produce Request Topic");
- subtree = proto_item_add_subtree(ti, ett_kafka_request_topic);
+ subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_kafka_request_topic, &ti, "Produce Request Topic");
offset = dissect_kafka_string(subtree, hf_kafka_topic_name, tvb, pinfo, offset);
offset = dissect_kafka_array(subtree, tvb, pinfo, offset, &dissect_kafka_produce_request_partition);
@@ -719,11 +701,9 @@ dissect_kafka_produce_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
static int
dissect_kafka_produce_response_partition(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
- proto_item *ti;
proto_tree *subtree;
- ti = proto_tree_add_text(tree, tvb, offset, 14, "Produce Response Partition");
- subtree = proto_item_add_subtree(ti, ett_kafka_response_partition);
+ subtree = proto_tree_add_subtree(tree, tvb, offset, 14, ett_kafka_response_partition, NULL, "Produce Response Partition");
proto_tree_add_item(subtree, hf_kafka_partition_id, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
@@ -744,8 +724,7 @@ dissect_kafka_produce_response_topic(tvbuff_t *tvb, packet_info *pinfo, proto_tr
proto_tree *subtree;
int offset = start_offset;
- ti = proto_tree_add_text(tree, tvb, offset, -1, "Produce Response Topic");
- subtree = proto_item_add_subtree(ti, ett_kafka_response_topic);
+ subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_kafka_response_topic, &ti, "Produce Response Topic");
offset = dissect_kafka_string(subtree, hf_kafka_topic_name, tvb, pinfo, offset);
offset = dissect_kafka_array(subtree, tvb, pinfo, offset, &dissect_kafka_produce_response_partition);
diff --git a/epan/dissectors/packet-kink.c b/epan/dissectors/packet-kink.c
index ab1e49803a..2789a8c348 100644
--- a/epan/dissectors/packet-kink.c
+++ b/epan/dissectors/packet-kink.c
@@ -340,8 +340,8 @@ dissect_payload_kink_ap_req(packet_info *pinfo, tvbuff_t *tvb, int offset, proto
payload_length = tvb_get_ntohs(tvb, offset + TO_PAYLOAD_LENGTH);
/* Make the subtree. */
- ti = proto_tree_add_text(tree, tvb, offset, payload_length, "KINK_AP_REQ");
- payload_kink_ap_req_tree = proto_item_add_subtree(ti, ett_payload_kink_ap_req);
+ payload_kink_ap_req_tree = proto_tree_add_subtree(tree, tvb, offset, payload_length,
+ ett_payload_kink_ap_req, NULL, "KINK_AP_REQ");
next_payload = tvb_get_guint8(tvb, offset);
proto_tree_add_uint(payload_kink_ap_req_tree, hf_kink_next_payload, tvb, offset, 1, next_payload);
@@ -395,8 +395,8 @@ dissect_payload_kink_ap_rep(packet_info *pinfo, tvbuff_t *tvb, int offset, proto
start_payload_offset = offset;
/* Make the subtree */
- ti = proto_tree_add_text(tree, tvb, offset, payload_length,"KINK_AP_REP");
- payload_kink_ap_rep_tree = proto_item_add_subtree(ti, ett_payload_kink_ap_rep);
+ payload_kink_ap_rep_tree = proto_tree_add_subtree(tree, tvb, offset, payload_length,
+ ett_payload_kink_ap_rep, NULL, "KINK_AP_REP");
next_payload = tvb_get_guint8(tvb, offset);
proto_tree_add_uint(payload_kink_ap_rep_tree, hf_kink_next_payload, tvb, offset, 1, next_payload);
@@ -450,8 +450,8 @@ dissect_payload_kink_krb_error(packet_info *pinfo, tvbuff_t *tvb, int offset, pr
start_payload_offset = offset;
/* Make the subtree */
- ti = proto_tree_add_text(tree, tvb, offset, payload_length,"KINK_KRB_ERROR");
- payload_kink_krb_error_tree = proto_item_add_subtree(ti, ett_payload_kink_krb_error);
+ payload_kink_krb_error_tree = proto_tree_add_subtree(tree, tvb, offset, payload_length,
+ ett_payload_kink_krb_error, NULL, "KINK_KRB_ERROR");
next_payload = tvb_get_guint8(tvb, offset);
proto_tree_add_uint(payload_kink_krb_error_tree, hf_kink_next_payload, tvb, offset, 1, next_payload);
@@ -492,7 +492,6 @@ dissect_payload_kink_krb_error(packet_info *pinfo, tvbuff_t *tvb, int offset, pr
static void
dissect_payload_kink_tgt_req(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){
proto_tree *payload_kink_tgt_req_tree;
- proto_item *ti;
guint8 next_payload;
guint payload_length;
guint16 realm_name_length;
@@ -503,8 +502,8 @@ dissect_payload_kink_tgt_req(packet_info *pinfo, tvbuff_t *tvb, int offset, prot
start_payload_offset = offset;
/* Make the subtree */
- ti = proto_tree_add_text(tree, tvb, offset, payload_length,"KINK_TGT_REQ");
- payload_kink_tgt_req_tree = proto_item_add_subtree(ti, ett_payload_kink_tgt_req);
+ payload_kink_tgt_req_tree = proto_tree_add_subtree(tree, tvb, offset, payload_length,
+ ett_payload_kink_tgt_req, NULL, "KINK_TGT_REQ");
next_payload = tvb_get_guint8(tvb, offset);
proto_tree_add_uint(payload_kink_tgt_req_tree, hf_kink_next_payload, tvb, offset, 1, next_payload);
@@ -535,7 +534,6 @@ dissect_payload_kink_tgt_req(packet_info *pinfo, tvbuff_t *tvb, int offset, prot
static void
dissect_payload_kink_tgt_rep(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){
proto_tree *payload_kink_tgt_rep_tree;
- proto_item *ti;
guint8 next_payload;
guint payload_length;
guint princ_name_length;
@@ -546,8 +544,8 @@ dissect_payload_kink_tgt_rep(packet_info *pinfo, tvbuff_t *tvb, int offset, prot
start_payload_offset = offset;
/* Make the subtree */
- ti = proto_tree_add_text(tree, tvb, offset, payload_length,"KINK_TGT_REP");
- payload_kink_tgt_rep_tree = proto_item_add_subtree(ti, ett_payload_kink_tgt_rep);
+ payload_kink_tgt_rep_tree = proto_tree_add_subtree(tree, tvb, offset, payload_length,
+ ett_payload_kink_tgt_rep, NULL, "KINK_TGT_REP");
next_payload = tvb_get_guint8(tvb, offset);
proto_tree_add_uint(payload_kink_tgt_rep_tree, hf_kink_next_payload, tvb, offset, 1, next_payload);
@@ -607,8 +605,8 @@ dissect_payload_kink_isakmp(packet_info *pinfo, tvbuff_t *tvb, int offset, proto
start_payload_offset = offset;
/* Make the subtree. */
- ti = proto_tree_add_text(tree, tvb, offset, payload_length,"KINK_ISAKMP");
- payload_kink_isakmp_tree = proto_item_add_subtree(ti, ett_payload_kink_isakmp);
+ payload_kink_isakmp_tree = proto_tree_add_subtree(tree, tvb, offset, payload_length,
+ ett_payload_kink_isakmp, NULL, "KINK_ISAKMP");
next_payload = tvb_get_guint8(tvb, offset);
proto_tree_add_uint(payload_kink_isakmp_tree, hf_kink_next_payload, tvb, offset, 1, next_payload);
@@ -685,8 +683,8 @@ dissect_payload_kink_encrypt(packet_info *pinfo, tvbuff_t *tvb, int offset, prot
encrypt_length = payload_length - FROM_NP_TO_PL;
#endif
/* Make the subtree */
- ti = proto_tree_add_text(tree, tvb, offset, payload_length,"KINK_ENCRYPT");
- payload_kink_encrypt_tree = proto_item_add_subtree(ti, ett_payload_kink_encrypt);
+ payload_kink_encrypt_tree = proto_tree_add_subtree(tree, tvb, offset, payload_length,
+ ett_payload_kink_encrypt, NULL, "KINK_ENCRYPT");
next_payload = tvb_get_guint8(tvb, offset);
proto_tree_add_uint(payload_kink_encrypt_tree, hf_kink_next_payload, tvb, offset, 1, next_payload);
@@ -748,12 +746,11 @@ static void
dissect_decrypt_kink_encrypt(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree, int payload_length){
proto_tree *decrypt_kink_encrypt_tree;
- proto_item *ti;
int offset=0;
guint8 next_payload;
- ti = proto_tree_add_text(tree, tvb, offset, payload_length, "decrypted data");
- decrypt_kink_encrypt_tree = proto_item_add_subtree(ti, ett_decrypt_kink_encrypt);
+ decrypt_kink_encrypt_tree = proto_tree_add_subtree(tree, tvb, offset, payload_length,
+ ett_decrypt_kink_encrypt, NULL, "decrypted data");
next_payload = tvb_get_guint8(tvb, offset);
@@ -789,8 +786,8 @@ dissect_payload_kink_error(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_
start_payload_offset = offset;
/* Make the subtree */
- ti = proto_tree_add_text(tree, tvb, offset, payload_length,"KINK_ERROR");
- payload_kink_error_tree = proto_item_add_subtree(ti, ett_payload_kink_error);
+ payload_kink_error_tree = proto_tree_add_subtree(tree, tvb, offset, payload_length,
+ ett_payload_kink_error, NULL, "KINK_ERROR");
next_payload = tvb_get_guint8(tvb, offset);
proto_tree_add_uint(payload_kink_error_tree, hf_kink_next_payload, tvb, offset, 1, next_payload);
@@ -838,7 +835,6 @@ dissect_payload_kink_error(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_
static void
dissect_payload_kink_not_defined(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){
proto_tree *payload_kink_not_defined_tree;
- proto_item *ti;
guint8 next_payload;
guint payload_length;
int start_payload_offset = 0; /* Keep the beginning of the payload offset */
@@ -847,8 +843,8 @@ dissect_payload_kink_not_defined(packet_info *pinfo, tvbuff_t *tvb, int offset,
payload_length = tvb_get_ntohs(tvb, offset + TO_PAYLOAD_LENGTH);
/* Make the subtree */
- ti = proto_tree_add_text(tree, tvb, offset, payload_length, "UNKNOWN PAYLOAD");
- payload_kink_not_defined_tree = proto_item_add_subtree(ti, ett_payload_not_defined);
+ payload_kink_not_defined_tree = proto_tree_add_subtree(tree, tvb, offset, payload_length,
+ ett_payload_not_defined, NULL, "UNKNOWN PAYLOAD");
next_payload = tvb_get_guint8(tvb, offset);
proto_tree_add_uint(payload_kink_not_defined_tree, hf_kink_next_payload, tvb, offset, 1, next_payload);
diff --git a/epan/dissectors/packet-kismet.c b/epan/dissectors/packet-kismet.c
index 57da5d5ff7..8972b2cd16 100644
--- a/epan/dissectors/packet-kismet.c
+++ b/epan/dissectors/packet-kismet.c
@@ -156,11 +156,10 @@ dissect_kismet(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * da
/*
* Put this line.
*/
- ti = proto_tree_add_text(kismet_tree, tvb, offset,
- next_offset - offset, "%s",
+ reqresp_tree = proto_tree_add_subtree(kismet_tree, tvb, offset,
+ next_offset - offset, ett_kismet_reqresp, NULL,
tvb_format_text(tvb, offset,
next_offset - offset - 1));
- reqresp_tree = proto_item_add_subtree(ti, ett_kismet_reqresp);
tokenlen = get_token_len(line, line + linelen, &next_token);
if (tokenlen != 0) {
guint8 *reqresp;
diff --git a/epan/dissectors/packet-l2tp.c b/epan/dissectors/packet-l2tp.c
index 8a4047600c..ebec397251 100644
--- a/epan/dissectors/packet-l2tp.c
+++ b/epan/dissectors/packet-l2tp.c
@@ -1305,7 +1305,6 @@ static int dissect_l2tp_cisco_avps(tvbuff_t *tvb, packet_info *pinfo _U_, proto_
guint32 avp_vendor_id;
guint16 avp_len;
guint16 ver_len_hidden;
- proto_item *tf, *te;
proto_tree *l2tp_avp_tree, *l2tp_avp_tree_sub;
ver_len_hidden = tvb_get_ntohs(tvb, offset);
@@ -1313,14 +1312,11 @@ static int dissect_l2tp_cisco_avps(tvbuff_t *tvb, packet_info *pinfo _U_, proto_
avp_vendor_id = tvb_get_ntohs(tvb, offset + 2);
avp_type = tvb_get_ntohs(tvb, offset + 4);
- tf = proto_tree_add_text(tree, tvb, offset,
- avp_len, "Vendor %s: %s AVP",
+ l2tp_avp_tree = proto_tree_add_subtree_format(tree, tvb, offset,
+ avp_len, ett_l2tp_avp, NULL, "Vendor %s: %s AVP",
val_to_str_ext(avp_vendor_id, &sminmpec_values_ext, "Unknown (%u)"),
val_to_str(avp_type, cisco_avp_type_vals, "Unknown (%u)"));
-
- l2tp_avp_tree = proto_item_add_subtree(tf, ett_l2tp_avp);
-
proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_mandatory, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_hidden, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_length, tvb, offset, 2, ENC_BIG_ENDIAN);
@@ -1347,9 +1343,8 @@ static int dissect_l2tp_cisco_avps(tvbuff_t *tvb, packet_info *pinfo _U_, proto_
break;
case CISCO_PW_CAPABILITY_LIST:
- te = proto_tree_add_text(l2tp_avp_tree, tvb, offset, avp_len,
- "Pseudowire Capabilities List");
- l2tp_avp_tree_sub = proto_item_add_subtree(te, ett_l2tp_avp_sub);
+ l2tp_avp_tree_sub = proto_tree_add_subtree(l2tp_avp_tree, tvb, offset, avp_len,
+ ett_l2tp_avp_sub, NULL, "Pseudowire Capabilities List");
while (avp_len >= 2) {
proto_tree_add_item(l2tp_avp_tree_sub, hf_l2tp_cisco_pw_type, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
@@ -1414,7 +1409,6 @@ dissect_l2tp_vnd_cablelabs_avps(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre
guint32 avp_vendor_id;
guint32 avp_len;
guint16 ver_len_hidden;
- proto_item *tf;
proto_tree *l2tp_avp_tree;
ver_len_hidden = tvb_get_ntohs(tvb, offset);
@@ -1422,11 +1416,10 @@ dissect_l2tp_vnd_cablelabs_avps(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre
avp_vendor_id = tvb_get_ntohs(tvb, offset + 2);
avp_type = tvb_get_ntohs(tvb, offset + 4);
- tf = proto_tree_add_text(tree, tvb, offset,
- avp_len, "Vendor %s: %s AVP",
+ l2tp_avp_tree = proto_tree_add_subtree_format(tree, tvb, offset,
+ avp_len, ett_l2tp_avp, NULL, "Vendor %s: %s AVP",
val_to_str_ext(avp_vendor_id, &sminmpec_values_ext, "Unknown (%u)"),
val_to_str(avp_type, cablelabs_avp_type_vals, "Unknown (%u)"));
- l2tp_avp_tree = proto_item_add_subtree(tf, ett_l2tp_avp);
proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_mandatory, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_hidden, tvb, offset, 2, ENC_BIG_ENDIAN);
@@ -1545,13 +1538,11 @@ static void process_control_avps(tvbuff_t *tvb,
} else {
/* Vendor-Specific AVP */
if (!dissector_try_uint_new(l2tp_vendor_avp_dissector_table, avp_vendor_id, avp_tvb, pinfo, l2tp_tree, FALSE, l2tp_cntrl_data)){
- tf = proto_tree_add_text(l2tp_tree, tvb, idx,
- avp_len, "Vendor %s AVP Type %u",
+ l2tp_avp_tree = proto_tree_add_subtree_format(l2tp_tree, tvb, idx,
+ avp_len, ett_l2tp_avp, NULL, "Vendor %s AVP Type %u",
val_to_str_ext(avp_vendor_id, &sminmpec_values_ext, "Unknown (%u)"),
avp_type);
- l2tp_avp_tree = proto_item_add_subtree(tf, ett_l2tp_avp);
-
proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_mandatory, tvb, idx, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_hidden, tvb, idx, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_length, tvb, idx, 2, ENC_BIG_ENDIAN);
@@ -1575,12 +1566,10 @@ static void process_control_avps(tvbuff_t *tvb,
}
/* IETF AVP:s */
- tf = proto_tree_add_text(l2tp_tree, tvb, idx,
- avp_len, "%s AVP",
+ l2tp_avp_tree = proto_tree_add_subtree_format(l2tp_tree, tvb, idx,
+ avp_len, ett_l2tp_avp, NULL, "%s AVP",
val_to_str_ext(avp_type, &avp_type_vals_ext, "Unknown (%u)"));
- l2tp_avp_tree = proto_item_add_subtree(tf, ett_l2tp_avp);
-
proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_mandatory, tvb, idx, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_hidden, tvb, idx, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_length, tvb, idx, 2, ENC_BIG_ENDIAN);
@@ -1938,9 +1927,8 @@ static void process_control_avps(tvbuff_t *tvb,
store_ccid(tunnel, tvb, idx, msg_type);
break;
case PW_CAPABILITY_LIST:
- te = proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len,
- "Pseudowire Capabilities List");
- l2tp_avp_tree_sub = proto_item_add_subtree(te, ett_l2tp_avp_sub);
+ l2tp_avp_tree_sub = proto_tree_add_subtree(l2tp_avp_tree, tvb, idx, avp_len,
+ ett_l2tp_avp_sub, NULL, "Pseudowire Capabilities List");
while (avp_len >= 2) {
proto_tree_add_item(l2tp_avp_tree_sub, hf_l2tp_avp_pw_type, tvb, idx, 2, ENC_BIG_ENDIAN);
@@ -2230,8 +2218,8 @@ static void
process_l2tpv3_data_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
l2tpv3_conversation_t *l2tp_conv)
{
- proto_tree *l2tp_tree = NULL, *ctrl_tree;
- proto_item *l2tp_item = NULL, *ti;
+ proto_tree *l2tp_tree, *ctrl_tree;
+ proto_item *l2tp_item;
int idx = 0;
int control;
@@ -2242,16 +2230,16 @@ process_l2tpv3_data_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
idx += 2; /* Skip the reserved */
sid = tvb_get_ntohl(tvb, idx);
+ l2tp_item = proto_tree_add_item(tree, proto_l2tp, tvb, 0, -1, ENC_NA);
+ l2tp_tree = proto_item_add_subtree(l2tp_item, ett_l2tp);
+
if (tree) {
- l2tp_item = proto_tree_add_item(tree, proto_l2tp, tvb, 0, -1, ENC_NA);
- l2tp_tree = proto_item_add_subtree(l2tp_item, ett_l2tp);
proto_item_append_text(l2tp_item, " version 3");
- ti = proto_tree_add_text(l2tp_tree, tvb, 0, 2,
- "Packet Type: %s Session Id=%u",
+ ctrl_tree = proto_tree_add_subtree_format(l2tp_tree, tvb, 0, 2,
+ ett_l2tp_ctrl, NULL, "Packet Type: %s Session Id=%u",
data_msg, sid);
- ctrl_tree = proto_item_add_subtree(ti, ett_l2tp_ctrl);
proto_tree_add_uint(ctrl_tree, hf_l2tp_type, tvb, 0, 2, control);
proto_tree_add_boolean(ctrl_tree, hf_l2tp_length_bit, tvb, 0, 2, control);
proto_tree_add_boolean(ctrl_tree, hf_l2tp_seq_bit, tvb, 0, 2, control);
@@ -2303,7 +2291,7 @@ process_l2tpv3_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
l2tpv3_conversation_t *l2tp_conv)
{
proto_tree *l2tp_tree = NULL, *ctrl_tree;
- proto_item *l2tp_item = NULL, *ti;
+ proto_item *l2tp_item = NULL;
int idx = baseIdx;
int tmp_idx;
@@ -2391,11 +2379,10 @@ process_l2tpv3_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
if (baseIdx) {
proto_tree_add_item(l2tp_tree, hf_l2tp_sid, tvb, 0, 4, ENC_BIG_ENDIAN);
}
- ti = proto_tree_add_text(l2tp_tree, tvb, baseIdx, 2,
- "Packet Type: %s Control Connection Id=%d",
+ ctrl_tree = proto_tree_add_subtree_format(l2tp_tree, tvb, baseIdx, 2,
+ ett_l2tp_ctrl, NULL, "Packet Type: %s Control Connection Id=%d",
(CONTROL_BIT(control) ? control_msg : data_msg), ccid);
- ctrl_tree = proto_item_add_subtree(ti, ett_l2tp_ctrl);
proto_tree_add_uint(ctrl_tree, hf_l2tp_type, tvb, baseIdx, 2, control);
proto_tree_add_boolean(ctrl_tree, hf_l2tp_length_bit, tvb, baseIdx, 2, control);
proto_tree_add_boolean(ctrl_tree, hf_l2tp_seq_bit, tvb, baseIdx, 2, control);
@@ -2403,25 +2390,17 @@ process_l2tpv3_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
}
idx = baseIdx + 2;
if (LENGTH_BIT(control)) {
- if (tree) {
- proto_tree_add_item(l2tp_tree, hf_l2tp_length, tvb, idx, 2, ENC_BIG_ENDIAN);
- }
+ proto_tree_add_item(l2tp_tree, hf_l2tp_length, tvb, idx, 2, ENC_BIG_ENDIAN);
idx += 2;
}
- if (tree) {
- proto_tree_add_item(l2tp_tree, hf_l2tp_ccid, tvb, idx, 4, ENC_BIG_ENDIAN);
- }
+ proto_tree_add_item(l2tp_tree, hf_l2tp_ccid, tvb, idx, 4, ENC_BIG_ENDIAN);
idx += 4;
if (SEQUENCE_BIT(control)) {
- if (tree) {
- proto_tree_add_item(l2tp_tree, hf_l2tp_Ns, tvb, idx, 2, ENC_BIG_ENDIAN);
- }
+ proto_tree_add_item(l2tp_tree, hf_l2tp_Ns, tvb, idx, 2, ENC_BIG_ENDIAN);
idx += 2;
- if (tree) {
- proto_tree_add_item(l2tp_tree, hf_l2tp_Nr, tvb, idx, 2, ENC_BIG_ENDIAN);
- }
+ proto_tree_add_item(l2tp_tree, hf_l2tp_Nr, tvb, idx, 2, ENC_BIG_ENDIAN);
idx += 2;
}
@@ -2468,8 +2447,8 @@ process_l2tpv3_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
static int
dissect_l2tp_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
- proto_tree *l2tp_tree = NULL, *ctrl_tree;
- proto_item *l2tp_item = NULL, *ti;
+ proto_tree *l2tp_tree, *ctrl_tree;
+ proto_item *l2tp_item;
int idx = 0;
int tmp_idx;
guint16 length = 0; /* Length field */
@@ -2613,15 +2592,14 @@ dissect_l2tp_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
set_actual_length(tvb, length);
}
- if (tree) {
- l2tp_item = proto_tree_add_item(tree,proto_l2tp, tvb, 0, -1, ENC_NA);
- l2tp_tree = proto_item_add_subtree(l2tp_item, ett_l2tp);
+ l2tp_item = proto_tree_add_item(tree,proto_l2tp, tvb, 0, -1, ENC_NA);
+ l2tp_tree = proto_item_add_subtree(l2tp_item, ett_l2tp);
- ti = proto_tree_add_text(l2tp_tree, tvb, 0, 2,
+ if (tree) {
+ ctrl_tree = proto_tree_add_subtree_format(l2tp_tree, tvb, 0, 2, ett_l2tp_ctrl, NULL,
"Packet Type: %s Tunnel Id=%d Session Id=%d",
(CONTROL_BIT(control) ? control_msg : data_msg), tid, cid);
- ctrl_tree = proto_item_add_subtree(ti, ett_l2tp_ctrl);
proto_tree_add_uint(ctrl_tree, hf_l2tp_type, tvb, 0, 2, control);
proto_tree_add_boolean(ctrl_tree, hf_l2tp_length_bit, tvb, 0, 2, control);
proto_tree_add_boolean(ctrl_tree, hf_l2tp_seq_bit, tvb, 0, 2, control);
diff --git a/epan/dissectors/packet-ldp.c b/epan/dissectors/packet-ldp.c
index 1c58bcc98a..b7f47750e3 100644
--- a/epan/dissectors/packet-ldp.c
+++ b/epan/dissectors/packet-ldp.c
@@ -970,15 +970,14 @@ dissect_tlv_fec(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tre
const char *str;
guint8 gen_fec_id_len = 0;
- ti=proto_tree_add_text(tree, tvb, offset, rem, "FEC Elements");
- val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "FEC Elements");
while (rem > 0){
switch (tvb_get_guint8(tvb, offset)) {
case WILDCARD_FEC:
case CRLSP_FEC:
- ti = proto_tree_add_text(val_tree, tvb, offset, 1, "FEC Element %u", ix);
- fec_tree = proto_item_add_subtree(ti, ett_ldp_fec);
+ fec_tree = proto_tree_add_subtree_format(val_tree, tvb, offset, 1,
+ ett_ldp_fec, NULL, "FEC Element %u", ix);
proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_wc,tvb, offset, 1, ENC_BIG_ENDIAN);
rem -= 1;
offset += 1;
@@ -1024,8 +1023,8 @@ dissect_tlv_fec(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tre
}
/*Add a subtree for this*/
- ti = proto_tree_add_text(val_tree, tvb, offset, 4+MIN(addr_size, prefix_len_octets), "FEC Element %u", ix);
- fec_tree = proto_item_add_subtree(ti, ett_ldp_fec);
+ fec_tree = proto_tree_add_subtree_format(val_tree, tvb, offset, 4+MIN(addr_size, prefix_len_octets),
+ ett_ldp_fec, NULL, "FEC Element %u", ix);
proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_wc, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
@@ -1099,8 +1098,7 @@ dissect_tlv_fec(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tre
}
/*Add a subtree for this*/
- ti = proto_tree_add_text(val_tree, tvb, offset, 4+addr_size, "FEC Element %u", ix);
- fec_tree = proto_item_add_subtree(ti, ett_ldp_fec);
+ fec_tree = proto_tree_add_subtree_format(val_tree, tvb, offset, 4+addr_size, ett_ldp_fec, NULL, "FEC Element %u", ix);
proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_wc, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
@@ -1141,8 +1139,7 @@ dissect_tlv_fec(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tre
vc_len = tvb_get_guint8 (tvb, offset+3);
- ti = proto_tree_add_text(val_tree, tvb, offset, 8+vc_len, "FEC Element %u", ix);
- fec_tree = proto_item_add_subtree(ti, ett_ldp_fec);
+ fec_tree = proto_tree_add_subtree_format(val_tree, tvb, offset, 8+vc_len, ett_ldp_fec, &ti, "FEC Element %u", ix);
proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_wc, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_vc_controlword, tvb, offset+1, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_vc_vctype, tvb, offset+1, 2, ENC_BIG_ENDIAN);
@@ -1191,8 +1188,7 @@ dissect_tlv_fec(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tre
vc_len = tvb_get_guint8 (tvb, offset+3);
/* Add the FEC to the tree */
- ti = proto_tree_add_text(val_tree, tvb, offset, 8+vc_len, "FEC Element %u", ix);
- fec_tree = proto_item_add_subtree(ti, ett_ldp_fec);
+ fec_tree = proto_tree_add_subtree_format(val_tree, tvb, offset, 8+vc_len, ett_ldp_fec, NULL, "FEC Element %u", ix);
proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_wc, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_vc_controlword, tvb, offset+1, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_vc_vctype, tvb, offset+1, 2, ENC_BIG_ENDIAN);
@@ -1203,8 +1199,7 @@ dissect_tlv_fec(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tre
if ( (vc_len > 1) && ( rem > 1 ) ) { /* there is enough room for AGI */
gen_fec_id_len = tvb_get_guint8 (tvb, offset+1);
/* Add AGI to the tree */
- ti = proto_tree_add_text(fec_tree, tvb, offset, 2 + gen_fec_id_len, "AGI");
- agi_tree = proto_item_add_subtree(ti, ett_ldp_gen_agi);
+ agi_tree = proto_tree_add_subtree_format(fec_tree, tvb, offset, 2 + gen_fec_id_len, ett_ldp_gen_agi, NULL, "AGI");
proto_tree_add_item(agi_tree, hf_ldp_tlv_fec_gen_agi_type,tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(agi_tree, hf_ldp_tlv_fec_gen_agi_length,tvb, offset + 1, 1, ENC_BIG_ENDIAN);
if ( gen_fec_id_len > 0)
@@ -1231,8 +1226,7 @@ dissect_tlv_fec(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tre
}
else
{
- ti = proto_tree_add_text(fec_tree, tvb, offset, 2 + gen_fec_id_len, "SAII");
- saii_tree = proto_item_add_subtree(ti, ett_ldp_gen_saii);
+ saii_tree = proto_tree_add_subtree(fec_tree, tvb, offset, 2 + gen_fec_id_len, ett_ldp_gen_saii, NULL, "SAII");
proto_tree_add_item(saii_tree, hf_ldp_tlv_fec_gen_saii_type,tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(saii_tree, hf_ldp_tlv_fec_gen_saii_length,tvb, offset + 1, 1, ENC_BIG_ENDIAN);
if ( gen_fec_id_len > 0)
@@ -1287,8 +1281,7 @@ dissect_tlv_fec(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tre
}
else
{
- ti = proto_tree_add_text(fec_tree, tvb, offset, 2 + gen_fec_id_len, "TAII");
- taii_tree = proto_item_add_subtree(ti, ett_ldp_gen_taii);
+ taii_tree = proto_tree_add_subtree(fec_tree, tvb, offset, 2 + gen_fec_id_len, ett_ldp_gen_taii, NULL, "TAII");
proto_tree_add_item(taii_tree, hf_ldp_tlv_fec_gen_taii_type,tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(taii_tree, hf_ldp_tlv_fec_gen_taii_length,tvb, offset + 1, 1, ENC_BIG_ENDIAN);
if ( gen_fec_id_len > 0)
@@ -1331,15 +1324,16 @@ dissect_tlv_fec(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tre
break;
}
case P2MP_FEC:
- { if (rem < 4 ){/*not enough*/
- proto_item* inv_length;
- inv_length = proto_tree_add_item(val_tree, hf_ldp_tlv_inv_length, tvb, offset, rem, ENC_BIG_ENDIAN);
+ {
+ if (rem < 4 ){/*not enough*/
+ proto_item* inv_length;
+ inv_length = proto_tree_add_item(val_tree, hf_ldp_tlv_inv_length, tvb, offset, rem, ENC_BIG_ENDIAN);
expert_add_info(pinfo, inv_length, &ei_ldp_inv_length);
return;
}
- ti = proto_tree_add_text(val_tree, tvb, offset, 4+tvb_get_guint8 (tvb, offset+1), "FEC Element %u", ix);
- fec_tree = proto_item_add_subtree(ti, ett_ldp_fec);
+ fec_tree = proto_tree_add_subtree_format(val_tree, tvb, offset, 4+tvb_get_guint8 (tvb, offset+1),
+ ett_ldp_fec, NULL, "FEC Element %u", ix);
proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_wc, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
@@ -1361,8 +1355,7 @@ dissect_tlv_fec(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tre
/* XXX - do all FEC's have a length that's a multiple of 4? */
/* Hmmm, don't think so. Will check. RJS. */
/* If we don't know its structure, we have to exit */
- ti = proto_tree_add_text(val_tree, tvb, offset, 4, "FEC Element %u", ix);
- fec_tree = proto_item_add_subtree(ti, ett_ldp_fec);
+ fec_tree = proto_tree_add_subtree_format(val_tree, tvb, offset, 4, ett_ldp_fec, NULL, "FEC Element %u", ix);
proto_tree_add_expert(fec_tree, pinfo, &ei_ldp_tlv_fec_type, tvb, offset, rem);
return;
}
@@ -1375,7 +1368,7 @@ dissect_tlv_fec(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tre
static void
dissect_tlv_address_list(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
guint16 family, ix;
guint8 addr_size, *addr;
string_handler_func *str_handler = default_str_handler;
@@ -1406,8 +1399,7 @@ dissect_tlv_address_list(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_
}
offset+=2; rem-=2;
- ti=proto_tree_add_text(tree, tvb, offset, rem, "Addresses");
- val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Addresses");
addr=(guint8 *)wmem_alloc(wmem_packet_scope(), addr_size);
@@ -1431,12 +1423,11 @@ dissect_tlv_address_list(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_
static void
dissect_tlv_path_vector(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
guint8 ix;
guint32 addr;
- ti=proto_tree_add_text(tree, tvb, offset, rem, "LSR IDs");
- val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "LSR IDs");
for(ix=1; rem >= 4; ix++, offset += 4, rem -= 4) {
addr = tvb_get_ipv4(tvb, offset);
@@ -1454,14 +1445,13 @@ dissect_tlv_path_vector(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_t
static void
dissect_tlv_atm_label(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
if (rem != 4){
proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem, "Error processing ATM Label TLV: length is %d, should be 4", rem);
return;
}
- ti=proto_tree_add_text(tree, tvb, offset, rem, "ATM Label");
- val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "ATM Label");
proto_tree_add_item(val_tree, hf_ldp_tlv_atm_label_vbits, tvb, offset, 1, ENC_BIG_ENDIAN);
@@ -1475,7 +1465,7 @@ dissect_tlv_atm_label(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tre
static void
dissect_tlv_frame_label(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
guint8 len;
if (rem != 4){
@@ -1484,8 +1474,7 @@ dissect_tlv_frame_label(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_t
rem);
return;
}
- ti=proto_tree_add_text(tree, tvb, offset, rem, "Frame Relay Label");
- val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Frame Relay Label");
len=(guint8)(tvb_get_ntohs(tvb, offset)>>7) & 0x03;
proto_tree_add_uint_format_value(val_tree, hf_ldp_tlv_fr_label_len, tvb, offset, 2, len,
@@ -1500,7 +1489,7 @@ dissect_tlv_frame_label(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_t
static void
dissect_tlv_status(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
guint32 data;
if (rem != 10){
@@ -1510,8 +1499,7 @@ dissect_tlv_status(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *
return;
}
- ti=proto_tree_add_text(tree, tvb, offset, rem, "Status");
- val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Status");
proto_tree_add_item(val_tree, hf_ldp_tlv_status_ebit, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(val_tree, hf_ldp_tlv_status_fbit, tvb, offset, 1, ENC_BIG_ENDIAN);
@@ -1529,7 +1517,7 @@ dissect_tlv_status(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *
static void
dissect_tlv_returned_pdu(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
if (rem < 10){
proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
@@ -1537,8 +1525,7 @@ dissect_tlv_returned_pdu(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_
rem);
return;
}
- ti=proto_tree_add_text(tree, tvb, offset, rem, "Returned PDU");
- val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Returned PDU");
proto_tree_add_item(val_tree, hf_ldp_tlv_returned_version, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(val_tree, hf_ldp_tlv_returned_pdu_len, tvb, offset+2, 2, ENC_BIG_ENDIAN);
@@ -1558,7 +1545,7 @@ dissect_tlv_returned_pdu(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_
static void
dissect_tlv_returned_message(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
guint16 type;
if (rem < 4) {
@@ -1567,8 +1554,7 @@ dissect_tlv_returned_message(tvbuff_t *tvb, packet_info *pinfo, guint offset, pr
rem);
return;
}
- ti=proto_tree_add_text(tree, tvb, offset, rem, "Returned Message");
- val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Returned Message");
proto_tree_add_item(val_tree, hf_ldp_tlv_returned_msg_ubit, tvb, offset, 1, ENC_BIG_ENDIAN);
@@ -1652,11 +1638,10 @@ dissect_tlv_common_hello_parms(tvbuff_t *tvb, packet_info *pinfo, guint offset,
static void
dissect_tlv_mac(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
guint8 ix;
- ti = proto_tree_add_text(tree, tvb, offset, rem, "MAC addresses");
- val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "MAC addresses");
for(ix=1; rem >= 6; ix++, offset += 6, rem -= 6) {
proto_tree_add_item(val_tree, hf_ldp_tlv_mac, tvb, offset, 6, ENC_NA);
@@ -1672,14 +1657,13 @@ dissect_tlv_mac(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tre
static void
dissect_tlv_common_session_parms(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
if ( rem != 14) { /*length of Comm Sess Parms tlv*/
proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem, "Error processing Common Session Parameters TLV: length is %d, should be 14", rem);
return;
}
- ti = proto_tree_add_text(tree, tvb, offset, rem, "Parameters");
- val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Parameters");
/*Protocol Version*/
proto_tree_add_item(val_tree, hf_ldp_tlv_sess_ver, tvb,offset, 2, ENC_BIG_ENDIAN);
@@ -1711,7 +1695,7 @@ dissect_tlv_common_session_parms(tvbuff_t *tvb, packet_info *pinfo, guint offset
static void
dissect_tlv_atm_session_parms(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree, *lbl_tree;
+ proto_tree *val_tree, *lbl_tree;
guint8 numlr, ix;
if (rem < 4) {
@@ -1721,8 +1705,7 @@ dissect_tlv_atm_session_parms(tvbuff_t *tvb, packet_info *pinfo, guint offset, p
return;
}
- ti = proto_tree_add_text(tree, tvb, offset, rem,"ATM Parameters");
- val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "ATM Parameters");
proto_tree_add_item(val_tree, hf_ldp_tlv_sess_atm_merge,tvb, offset, 1, ENC_BIG_ENDIAN);
@@ -1737,17 +1720,12 @@ dissect_tlv_atm_session_parms(tvbuff_t *tvb, packet_info *pinfo, guint offset, p
/*move into range components*/
offset += 4;
rem -= 4;
- ti = proto_tree_add_text(val_tree, tvb, offset, rem,"ATM Label Range Components");
+ val_tree=proto_tree_add_subtree(val_tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "ATM Label Range Components");
- if (numlr) {
- val_tree=proto_item_add_subtree(ti,ett_ldp_tlv_val);
- if ( ! val_tree ) return;
- }
/*now dissect ranges*/
for(ix=1; numlr > 0 && rem >= 8; ix++, rem-=8, numlr--) {
- ti=proto_tree_add_text(val_tree, tvb, offset, 8,
- "ATM Label Range Component %u", ix);
- lbl_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ lbl_tree=proto_tree_add_subtree_format(val_tree, tvb, offset, 8,
+ ett_ldp_tlv_val, NULL, "ATM Label Range Component %u", ix);
proto_tree_add_item(lbl_tree,
hf_ldp_tlv_sess_atm_minvpi,
@@ -1776,7 +1754,7 @@ dissect_tlv_atm_session_parms(tvbuff_t *tvb, packet_info *pinfo, guint offset, p
static void
dissect_tlv_frame_relay_session_parms(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree, *lbl_tree;
+ proto_tree *val_tree, *lbl_tree;
guint8 numlr, ix, len;
if(rem < 4) {
@@ -1786,8 +1764,7 @@ dissect_tlv_frame_relay_session_parms(tvbuff_t *tvb, packet_info *pinfo, guint o
return;
}
- ti = proto_tree_add_text(tree, tvb, offset, rem, "Frame Relay Parameters");
- val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Frame Relay Parameters");
proto_tree_add_item(val_tree, hf_ldp_tlv_sess_fr_merge,
tvb, offset, 1, ENC_BIG_ENDIAN);
@@ -1804,20 +1781,13 @@ dissect_tlv_frame_relay_session_parms(tvbuff_t *tvb, packet_info *pinfo, guint o
/*move into range components*/
offset += 4;
rem -= 4;
- ti = proto_tree_add_text(val_tree, tvb, offset, rem,
+ val_tree=proto_tree_add_subtree(val_tree, tvb, offset, rem, ett_ldp_tlv_val, NULL,
"Frame Relay Label Range Components");
- if(numlr) {
- val_tree=proto_item_add_subtree(ti,
- ett_ldp_tlv_val);
- if( ! val_tree ) return;
- }
-
/*now dissect ranges*/
for(ix=1; numlr > 0 && rem >= 8; ix++, rem-=8, numlr--) {
- ti=proto_tree_add_text(val_tree, tvb, offset, 8,
- "Frame Relay Label Range Component %u", ix);
- lbl_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ lbl_tree=proto_tree_add_subtree_format(val_tree, tvb, offset, 8,
+ ett_ldp_tlv_val, NULL, "Frame Relay Label Range Component %u", ix);
len=(guint8)(tvb_get_ntohs(tvb, offset)>>7) & 0x03;
proto_tree_add_uint_format_value(lbl_tree, hf_ldp_tlv_sess_fr_len, tvb, offset, 2, len,
@@ -1850,8 +1820,7 @@ dissect_tlv_ft_session(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tr
return;
}
- ti = proto_tree_add_text(tree, tvb, offset, rem, "FT Session Parameters");
- val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "FT Session Parameters");
/* Flags */
ti = proto_tree_add_item(val_tree, hf_ldp_tlv_ft_sess_flags, tvb, offset, 2, ENC_BIG_ENDIAN);
@@ -1882,7 +1851,7 @@ dissect_tlv_ft_session(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tr
static void
dissect_tlv_lspid(tvbuff_t *tvb, packet_info *pinfo, guint offset,proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
if(rem != 8) {
proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
@@ -1891,8 +1860,7 @@ dissect_tlv_lspid(tvbuff_t *tvb, packet_info *pinfo, guint offset,proto_tree *tr
return;
}
- ti = proto_tree_add_text(tree, tvb, offset, rem, "LSP ID");
- val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "LSP ID");
proto_tree_add_item(val_tree, hf_ldp_tlv_lspid_act_flg,
tvb, offset, 2, ENC_BIG_ENDIAN);
@@ -1907,7 +1875,7 @@ dissect_tlv_lspid(tvbuff_t *tvb, packet_info *pinfo, guint offset,proto_tree *tr
static void
dissect_tlv_er_hop_ipv4(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
if(rem != 8) {
proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
@@ -1915,8 +1883,7 @@ dissect_tlv_er_hop_ipv4(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_t
rem);
return;
}
- ti = proto_tree_add_text(tree, tvb, offset, rem, "ER HOP IPv4");
- val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "ER HOP IPv4");
if(val_tree != NULL) {
proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_loose,
@@ -1933,7 +1900,7 @@ dissect_tlv_er_hop_ipv4(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_t
static void
dissect_tlv_er_hop_ipv6(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
if(rem != 20) {
proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
@@ -1941,8 +1908,7 @@ dissect_tlv_er_hop_ipv6(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_t
rem);
return;
}
- ti = proto_tree_add_text(tree, tvb, offset, rem, "ER HOP IPv6");
- val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "ER HOP IPv6");
if(val_tree != NULL) {
proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_loose,
@@ -1959,7 +1925,7 @@ dissect_tlv_er_hop_ipv6(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_t
static void
dissect_tlv_er_hop_as(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
if(rem != 4) {
proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
@@ -1967,8 +1933,7 @@ dissect_tlv_er_hop_as(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tre
rem);
return;
}
- ti = proto_tree_add_text(tree, tvb, offset, rem, "ER HOP AS");
- val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "ER HOP AS");
if(val_tree != NULL) {
proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_loose,
@@ -1982,7 +1947,7 @@ dissect_tlv_er_hop_as(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tre
static void
dissect_tlv_er_hop_lspid(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
if(rem != 8) {
proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
@@ -1990,8 +1955,7 @@ dissect_tlv_er_hop_lspid(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_
rem);
return;
}
- ti = proto_tree_add_text(tree, tvb, offset, rem, "ER HOP LSPID");
- val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "ER HOP LSPID");
if(val_tree != NULL) {
proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_loose,
@@ -2008,7 +1972,7 @@ dissect_tlv_er_hop_lspid(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_
static void
dissect_tlv_traffic(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
guint8 val_8;
float val_f;
proto_item *pi;
@@ -2019,8 +1983,7 @@ dissect_tlv_traffic(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree
rem);
return;
}
- ti = proto_tree_add_text(tree, tvb, offset, rem, "Traffic parameters");
- val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Traffic parameters");
if(val_tree != NULL) {
/* flags */
@@ -2081,7 +2044,7 @@ dissect_tlv_traffic(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree
static void
dissect_tlv_route_pinning(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
if(rem != 4) {
proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
@@ -2089,8 +2052,7 @@ dissect_tlv_route_pinning(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto
rem);
return;
}
- ti = proto_tree_add_text(tree, tvb, offset, rem, "Route Pinning");
- val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Route Pinning");
if(val_tree != NULL) {
proto_tree_add_item(val_tree, hf_ldp_tlv_route_pinning,
@@ -2102,7 +2064,7 @@ dissect_tlv_route_pinning(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto
static void
dissect_tlv_resource_class(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
if(rem != 4) {
proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
@@ -2110,8 +2072,7 @@ dissect_tlv_resource_class(tvbuff_t *tvb, packet_info *pinfo, guint offset, prot
rem);
return;
}
- ti = proto_tree_add_text(tree, tvb, offset, rem, "Resource Class");
- val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Resource Class");
if(val_tree != NULL) {
proto_tree_add_item(val_tree, hf_ldp_tlv_resource_class,
@@ -2123,7 +2084,7 @@ dissect_tlv_resource_class(tvbuff_t *tvb, packet_info *pinfo, guint offset, prot
static void
dissect_tlv_preemption(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
if(rem != 4) {
proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
@@ -2131,8 +2092,7 @@ dissect_tlv_preemption(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tr
rem);
return;
}
- ti = proto_tree_add_text(tree, tvb, offset, rem, "Preemption");
- val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Preemption");
if(val_tree != NULL) {
proto_tree_add_item(val_tree, hf_ldp_tlv_set_prio,
@@ -2194,11 +2154,10 @@ dissect_tlv(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, i
static void
dissect_tlv_er(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
int len;
- ti = proto_tree_add_text(tree, tvb, offset, rem, "Explicit route");
- val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Explicit route");
if(val_tree != NULL) {
while (rem > 0) {
@@ -2220,19 +2179,18 @@ dissect_tlv_pw_grouping(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem);
static void
dissect_tlv_upstrm_lbl_ass_cap(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
if ( rem != 1)
{
proto_item* inv_length;
- inv_length = proto_tree_add_item(tree, hf_ldp_tlv_inv_length, tvb, offset, rem, ENC_BIG_ENDIAN);
- expert_add_info(pinfo, inv_length, &ei_ldp_inv_length);
- return;
+ inv_length = proto_tree_add_item(tree, hf_ldp_tlv_inv_length, tvb, offset, rem, ENC_BIG_ENDIAN);
+ expert_add_info(pinfo, inv_length, &ei_ldp_inv_length);
+ return;
}
/*State bit*/
- ti = proto_tree_add_text(tree, tvb, offset, rem, "State Bit");
- val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "State Bit");
proto_tree_add_item(val_tree, hf_ldp_tlv_upstr_sbit, tvb,offset, 1, ENC_BIG_ENDIAN);
}
/*Dissect Upstream Assigned Label Request TLV*/
@@ -2242,9 +2200,9 @@ dissect_tlv_upstrm_ass_lbl_req(tvbuff_t *tvb, packet_info *pinfo, guint offset,
if ( rem != 4)
{
proto_item* inv_length;
- inv_length = proto_tree_add_item(tree, hf_ldp_tlv_inv_length, tvb, offset, rem, ENC_BIG_ENDIAN);
- expert_add_info(pinfo, inv_length, &ei_ldp_inv_length);
- return;
+ inv_length = proto_tree_add_item(tree, hf_ldp_tlv_inv_length, tvb, offset, rem, ENC_BIG_ENDIAN);
+ expert_add_info(pinfo, inv_length, &ei_ldp_inv_length);
+ return;
}
/*Reserved Bits*/
@@ -2255,33 +2213,31 @@ dissect_tlv_upstrm_ass_lbl_req(tvbuff_t *tvb, packet_info *pinfo, guint offset,
static void
dissect_tlv_upstrm_ass_lbl(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
if ( rem != 8)
{
proto_item* inv_length;
- inv_length = proto_tree_add_item(tree, hf_ldp_tlv_inv_length, tvb, offset, rem, ENC_BIG_ENDIAN);
- expert_add_info(pinfo, inv_length, &ei_ldp_inv_length);
- return;
+ inv_length = proto_tree_add_item(tree, hf_ldp_tlv_inv_length, tvb, offset, rem, ENC_BIG_ENDIAN);
+ expert_add_info(pinfo, inv_length, &ei_ldp_inv_length);
+ return;
}
/*Value Field starts here*/
- ti = proto_tree_add_text(tree, tvb, offset, rem, "Upstream-Assigned Label");
+ val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Upstream-Assigned Label");
/*Reserved bits*/
- val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
proto_tree_add_item(val_tree, hf_ldp_tlv_upstr_lbl_resvbit, tvb,offset, 4, ENC_BIG_ENDIAN);
/*The Upstream Label*/
- val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
proto_tree_add_item(val_tree, hf_ldp_tlv_upstr_ass_lbl, tvb,offset + 4, 4, ENC_BIG_ENDIAN);
}
/*Dissect IPv4 Interface ID TLV*/
static void
dissect_tlv_ipv4_interface_id(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree, *sub_tree = NULL;
- ti = proto_tree_add_text(tree, tvb, offset, rem, "IPv4 Interface ID");
- val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ proto_tree *val_tree, *sub_tree;
+
+ val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "IPv4 Interface ID");
/*Dissect IPv4 Next/Previous Hop Address*/
proto_tree_add_item(val_tree, hf_ldp_tlv_ipv4_intID_hop_addr, tvb,offset, 4, ENC_BIG_ENDIAN);
@@ -2289,8 +2245,7 @@ dissect_tlv_ipv4_interface_id(tvbuff_t *tvb, packet_info *pinfo, guint offset, p
/*Dissect Logical Interface ID*/
proto_tree_add_item(val_tree, hf_ldp_tlv_logical_intID, tvb,offset + 4, 4, ENC_BIG_ENDIAN);
- ti = proto_tree_add_text(val_tree, tvb, offset + 8, rem, "Sub TLV");
- sub_tree = proto_item_add_subtree(ti, ett_ldp_sub_tlv);
+ sub_tree = proto_tree_add_subtree(val_tree, tvb, offset + 8, rem, ett_ldp_sub_tlv, NULL, "Sub TLV");
if(rem != 20 && rem != 24 && rem != 28 && rem != 29)
{
@@ -2313,23 +2268,21 @@ dissect_tlv_ipv4_interface_id(tvbuff_t *tvb, packet_info *pinfo, guint offset, p
static void
dissect_tlv_ip_multicast_tunnel(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
+
+ val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "IP Multicast Label");
- ti = proto_tree_add_text(tree, tvb, offset, rem, "IP Multicast Label");
- val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
proto_tree_add_item(val_tree, hf_ldp_tlv_ip_multicast_srcaddr, tvb,offset, 4, ENC_BIG_ENDIAN);
- val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
proto_tree_add_item(val_tree, hf_ldp_tlv_ip_multicast_mltcstaddr, tvb,offset + 4, 4, ENC_BIG_ENDIAN);
}
static void
dissect_tlv_mpls_context_lbl(tvbuff_t *tvb,packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti, *val_tree;
+ proto_tree *val_tree;
proto_tree_add_item(tree, hf_ldp_tlv_ip_mpls_context_srcaddr, tvb,offset, 4, ENC_BIG_ENDIAN);
- ti = proto_tree_add_text(tree, tvb, offset, rem, "MPLS Context Label");
- val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
+ val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "MPLS Context Label");
dissect_tlv(tvb, pinfo, offset + 4, val_tree, rem);
}
@@ -2383,25 +2336,23 @@ dissect_tlv(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, i
length = MIN(length, rem); /* Don't go haywire if a problem ... */
if (tree) {
- proto_tree *ti = NULL, *tlv_tree;
+ proto_tree *tlv_tree;
/*chk for vendor-private*/
if(type>=TLV_VENDOR_PRIVATE_START && type<=TLV_VENDOR_PRIVATE_END){
typebak=type; /*keep type*/
type=TLV_VENDOR_PRIVATE_START;
- ti = proto_tree_add_text(tree, tvb, offset, length + 4, "Vendor Private TLV");
+ tlv_tree = proto_tree_add_subtree(tree, tvb, offset, length + 4, ett_ldp_tlv, NULL, "Vendor Private TLV");
/*chk for experimental*/
} else if(type>=TLV_EXPERIMENTAL_START && type<=TLV_EXPERIMENTAL_END){
typebak=type; /*keep type*/
type=TLV_EXPERIMENTAL_START;
- ti = proto_tree_add_text(tree, tvb, offset, length + 4, "Experimental TLV");
+ tlv_tree = proto_tree_add_subtree(tree, tvb, offset, length + 4, ett_ldp_tlv, NULL, "Experimental TLV");
} else {
typebak=0;
- ti = proto_tree_add_text(tree, tvb, offset, length + 4, "%s",
+ tlv_tree = proto_tree_add_subtree(tree, tvb, offset, length + 4, ett_ldp_tlv, NULL,
val_to_str(type, tlv_type_names, "Unknown TLV type (0x%04X)"));
}
- tlv_tree = proto_item_add_subtree(ti, ett_ldp_tlv);
-
proto_tree_add_item(tlv_tree, hf_ldp_tlv_unknown, tvb, offset, 1, ENC_BIG_ENDIAN);
switch (type) {
@@ -2819,22 +2770,19 @@ dissect_msg(tvbuff_t *tvb, guint offset, packet_info *pinfo, proto_tree *tree)
}
if (tree) {
- proto_tree *ti = NULL;
switch (type) {
case LDP_VENDOR_PRIVATE_START:
- ti = proto_tree_add_text(tree, tvb, offset, length + 4, "Vendor-Private Message");
+ msg_tree = proto_tree_add_subtree(tree, tvb, offset, length + 4, ett_ldp_message, NULL, "Vendor-Private Message");
break;
case LDP_EXPERIMENTAL_MESSAGE_START:
- ti = proto_tree_add_text(tree, tvb, offset, length + 4, "Experimental Message");
+ msg_tree = proto_tree_add_subtree(tree, tvb, offset, length + 4, ett_ldp_message, NULL, "Experimental Message");
break;
default:
- ti = proto_tree_add_text(tree, tvb, offset, length + 4, "%s",
+ msg_tree = proto_tree_add_subtree(tree, tvb, offset, length + 4, ett_ldp_message, NULL,
val_to_str(type, ldp_message_types, "Unknown Message type (0x%04X)"));
}
- msg_tree = proto_item_add_subtree(ti, ett_ldp_message);
-
proto_tree_add_item(msg_tree, hf_ldp_msg_ubit, tvb, offset, 1, ENC_BIG_ENDIAN);
switch (type) {
@@ -3020,9 +2968,9 @@ dissect_subtlv_interface_parameters(tvbuff_t *tvb, guint offset, proto_tree *tre
38 - hf_ldp_tlv_fec_vc_intparam_flowlabel_res
};
#endif
- proto_tree *ti = proto_tree_add_text(tree, tvb, offset, rem, "Interface Parameter");
+ proto_tree *ti;
proto_tree *cepopt_tree=NULL, *vccvtype_tree=NULL;
- proto_tree *vcintparam_tree = proto_item_add_subtree(ti, ett_ldp_fec_vc_interfaceparam);
+ proto_tree *vcintparam_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_fec_vc_interfaceparam, &ti, "Interface Parameter");
guint8 intparam_len = rem;
proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[3],tvb,offset,1,ENC_BIG_ENDIAN);
@@ -3053,8 +3001,7 @@ dissect_subtlv_interface_parameters(tvbuff_t *tvb, guint offset, proto_tree *tre
case FEC_VC_INTERFACEPARAM_CEPOPTIONS:
/* draft-ietf-pwe3-sonet-05.txt */
proto_item_append_text(ti,": CEP Options");
- ti = proto_tree_add_text(vcintparam_tree, tvb, offset + 2, 2, "CEP Options");
- cepopt_tree = proto_item_add_subtree(ti, ett_ldp_fec_vc_interfaceparam_cepopt);
+ cepopt_tree = proto_tree_add_subtree(vcintparam_tree, tvb, offset + 2, 2, ett_ldp_fec_vc_interfaceparam_cepopt, NULL, "CEP Options");
proto_tree_add_item(cepopt_tree, *interface_parameters_hf[7], tvb, offset + 2, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(cepopt_tree, *interface_parameters_hf[8], tvb, offset + 2, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(cepopt_tree, *interface_parameters_hf[9], tvb, offset + 2, 2, ENC_BIG_ENDIAN);
@@ -3101,13 +3048,11 @@ dissect_subtlv_interface_parameters(tvbuff_t *tvb, guint offset, proto_tree *tre
case FEC_VC_INTERFACEPARAM_VCCV:
/* draft-ietf-pwe3-vccv-03.txt */
proto_item_append_text(ti,": VCCV");
- ti = proto_tree_add_text(vcintparam_tree, tvb, offset + 2, 1, "CC Type");
- vccvtype_tree = proto_item_add_subtree(ti, ett_ldp_fec_vc_interfaceparam_vccvtype);
+ vccvtype_tree = proto_tree_add_subtree(vcintparam_tree, tvb, offset + 2, 1, ett_ldp_fec_vc_interfaceparam_vccvtype, NULL, "CC Type");
proto_tree_add_item(vccvtype_tree, *interface_parameters_hf[27], tvb, offset+2, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(vccvtype_tree, *interface_parameters_hf[28], tvb, offset+2, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(vccvtype_tree, *interface_parameters_hf[29], tvb, offset+2, 1, ENC_BIG_ENDIAN);
- ti = proto_tree_add_text(vcintparam_tree, tvb, offset + 3, 1, "CV Type");
- vccvtype_tree = proto_item_add_subtree(ti, ett_ldp_fec_vc_interfaceparam_vccvtype);
+ vccvtype_tree = proto_tree_add_subtree(vcintparam_tree, tvb, offset + 3, 1, ett_ldp_fec_vc_interfaceparam_vccvtype, NULL, "CV Type");
proto_tree_add_item(vccvtype_tree, *interface_parameters_hf[30], tvb, offset+3, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(vccvtype_tree, *interface_parameters_hf[31], tvb, offset+3, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(vccvtype_tree, *interface_parameters_hf[32], tvb, offset+3, 1, ENC_BIG_ENDIAN);
@@ -3129,8 +3074,7 @@ dissect_subtlv_interface_parameters(tvbuff_t *tvb, guint offset, proto_tree *tre
static void
dissect_genpwid_fec_aai_type2_parameter(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
- proto_tree *ti = proto_tree_add_text(tree, tvb, offset, rem, "AAI");
- proto_tree *aai_param_tree = proto_item_add_subtree(ti, ett_ldp_gen_aai_type2);
+ proto_tree *aai_param_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_gen_aai_type2, NULL, "AAI");
/* check if the remaining length is 12 bytes or not... */
if ( rem != 12)
{
diff --git a/epan/dissectors/packet-ldss.c b/epan/dissectors/packet-ldss.c
index 29b69e7274..b96a0599f9 100644
--- a/epan/dissectors/packet-ldss.c
+++ b/epan/dissectors/packet-ldss.c
@@ -527,12 +527,9 @@ dissect_ldss_transfer (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
/* Include new-line in line */
line = (guint8 *)tvb_memdup(NULL, tvb, offset, linelen+1); /* XXX - memory leak? */
- if (tree) {
- ti = proto_tree_add_text(ldss_tree, tvb, offset, linelen,
- "%s",
+ line_tree = proto_tree_add_subtree(ldss_tree, tvb, offset, linelen,
+ ett_ldss_transfer_req, NULL,
tvb_format_text(tvb, offset, next_offset-offset));
- line_tree = proto_item_add_subtree(ti, ett_ldss_transfer_req);
- }
/* Reduce code duplication processing digest lines.
* There are too many locals to pass to a function - the signature
diff --git a/epan/dissectors/packet-lg8979.c b/epan/dissectors/packet-lg8979.c
index 12c1aeb52a..3bc26828b7 100644
--- a/epan/dissectors/packet-lg8979.c
+++ b/epan/dissectors/packet-lg8979.c
@@ -496,7 +496,7 @@ static int
dissect_lg8979(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* Set up structures needed to add the protocol subtree and manage it */
- proto_item *lg8979_item=NULL, *lg8979_flags_item=NULL, *lg8979_fc_item=NULL, *lg8979_point_item=NULL, *lg8979_ts_item=NULL, *lg8979_slot_item=NULL, *lg8979_expparm_item=NULL;
+ proto_item *lg8979_item=NULL, *lg8979_flags_item=NULL, *lg8979_point_item=NULL, *lg8979_ts_item=NULL, *lg8979_slot_item=NULL, *lg8979_expparm_item=NULL;
proto_tree *lg8979_tree=NULL, *lg8979_flags_tree=NULL, *lg8979_fc_tree=NULL, *lg8979_point_tree=NULL, *lg8979_ts_tree=NULL;
int offset=0;
guint8 rtu_addr, func, packet_type, data_len, ptnum8, tripclose, rl, exp_code, exp_parm;
@@ -532,8 +532,8 @@ dissect_lg8979(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
shr = tvb_get_guint8(tvb, offset) & 0x80;
ack = tvb_get_guint8(tvb, offset) & 0x04;
- lg8979_flags_item = proto_tree_add_text(lg8979_tree, tvb, offset, 1, "Flags");
- lg8979_flags_tree = proto_item_add_subtree(lg8979_flags_item, ett_lg8979_flags);
+ lg8979_flags_tree = proto_tree_add_subtree(lg8979_tree, tvb, offset, 1,
+ ett_lg8979_flags, &lg8979_flags_item, "Flags");
proto_item_append_text(lg8979_flags_item, " (");
if (shr) comma_needed = add_item_text(lg8979_flags_item, "SHR", comma_needed);
@@ -559,9 +559,8 @@ dissect_lg8979(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%s", val_to_str_const(func, lg8979_funccode_vals, "Unknown Function Code"));
- lg8979_fc_item = proto_tree_add_text(lg8979_tree, tvb, offset, 1,
+ lg8979_fc_tree = proto_tree_add_subtree_format(lg8979_tree, tvb, offset, 1, ett_lg8979_funccode, NULL,
"Function Code: %s (%d)", val_to_str_const(func, lg8979_funccode_vals, "Unknown Function Code"), func);
- lg8979_fc_tree = proto_item_add_subtree(lg8979_fc_item, ett_lg8979_funccode);
proto_tree_add_item(lg8979_fc_tree, hf_lg8979_lastblock, tvb, offset, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(lg8979_fc_tree, hf_lg8979_funccode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
@@ -606,9 +605,9 @@ dissect_lg8979(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
ptnum = tvb_get_guint8(tvb, offset);
tripclose = (tvb_get_guint8(tvb, offset+1) & 0x80) >> 7;
- lg8979_point_item = proto_tree_add_text(lg8979_tree, tvb, offset, 2, "SBO Command, Pt.Num: %u, Code: %s",
+ lg8979_point_tree = proto_tree_add_subtree_format(lg8979_tree, tvb, offset, 2,
+ ett_lg8979_point, NULL, "SBO Command, Pt.Num: %u, Code: %s",
ptnum, val_to_str_const(tripclose, lg8979_sbo_tripclose_vals, "Unknown Control Code"));
- lg8979_point_tree = proto_item_add_subtree(lg8979_point_item, ett_lg8979_point);
/* Update the Information Column with Command Details */
col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "Output: %u, Code: %s",
@@ -650,9 +649,9 @@ dissect_lg8979(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
ptnum = tvb_get_guint8(tvb, offset);
rl = (tvb_get_guint8(tvb, offset+1) & 0x80) >> 7;
- lg8979_point_item = proto_tree_add_text(lg8979_tree, tvb, offset, 2, "Pulse Output, Pt.Num: %u, Code: %s",
+ lg8979_point_tree = proto_tree_add_subtree_format(lg8979_tree, tvb, offset, 2,
+ ett_lg8979_point, NULL, "Pulse Output, Pt.Num: %u, Code: %s",
ptnum, val_to_str_const(rl, lg8979_pul_output_rl_vals, "Unknown Control Code"));
- lg8979_point_tree = proto_item_add_subtree(lg8979_point_item, ett_lg8979_point);
/* Add Pulse Output Details to tree */
proto_tree_add_item(lg8979_point_tree, hf_lg8979_start_ptnum8, tvb, offset, 1, ENC_LITTLE_ENDIAN);
@@ -751,8 +750,7 @@ dissect_lg8979(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
sch = tvb_get_guint8(tvb, offset) & 0x08;
slg = tvb_get_guint8(tvb, offset) & 0x04;
- lg8979_flags_item = proto_tree_add_text(lg8979_tree, tvb, offset, 1, "Flags");
- lg8979_flags_tree = proto_item_add_subtree(lg8979_flags_item, ett_lg8979_flags);
+ lg8979_flags_tree = proto_tree_add_subtree(lg8979_tree, tvb, offset, 1, ett_lg8979_flags, &lg8979_flags_item, "Flags");
proto_item_append_text(lg8979_flags_item, " (");
if (shr) comma_needed = add_item_text(lg8979_flags_item, "SHR", comma_needed);
@@ -786,9 +784,8 @@ dissect_lg8979(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
func = tvb_get_guint8(tvb, offset) & 0x7f;
col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%s", val_to_str_const(func, lg8979_funccode_vals, "Unknown Function Code"));
- lg8979_fc_item = proto_tree_add_text(lg8979_tree, tvb, offset, 1,
+ lg8979_fc_tree = proto_tree_add_subtree_format(lg8979_tree, tvb, offset, 1, ett_lg8979_funccode, NULL,
"Function Code: %s (%d)", val_to_str_const(func, lg8979_funccode_vals, "Unknown Function Code"), func);
- lg8979_fc_tree = proto_item_add_subtree(lg8979_fc_item, ett_lg8979_funccode);
proto_tree_add_item(lg8979_fc_tree, hf_lg8979_lastblock, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(lg8979_fc_tree, hf_lg8979_funccode, tvb, offset, 1, ENC_BIG_ENDIAN);
@@ -895,9 +892,8 @@ dissect_lg8979(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
new_status = (tvb_get_guint8(tvb, offset+1) & 0x80) >> 7;
change = (tvb_get_guint8(tvb, offset+1) & 0x40) >> 6;
- lg8979_point_item = proto_tree_add_text(lg8979_tree, tvb, offset, 2,
+ lg8979_point_tree = proto_tree_add_subtree_format(lg8979_tree, tvb, offset, 2, ett_lg8979_point, NULL,
"Indication Change Report, Point Number: %u, Status: %u, Change %u", ptnum, new_status, change);
- lg8979_point_tree = proto_item_add_subtree(lg8979_point_item, ett_lg8979_point);
proto_tree_add_item(lg8979_point_tree, hf_lg8979_ind_chgrpt_ptnum, tvb, offset, 2, ENC_LITTLE_ENDIAN);
proto_tree_add_item(lg8979_point_tree, hf_lg8979_ind_chgrpt_status, tvb, offset, 2, ENC_LITTLE_ENDIAN);
@@ -918,8 +914,8 @@ dissect_lg8979(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
num_points = ((data_len - 2) / 2);
for (cnt=0; cnt<num_points; cnt++) {
- lg8979_point_item = proto_tree_add_text(lg8979_tree, tvb, offset, 1, "Indication Status, Base Point Num %d", ptnum);
- lg8979_point_tree = proto_item_add_subtree(lg8979_point_item, ett_lg8979_point);
+ lg8979_point_tree = proto_tree_add_subtree_format(lg8979_tree, tvb, offset, 1,
+ ett_lg8979_point, NULL, "Indication Status, Base Point Num %d", ptnum);
proto_tree_add_item(lg8979_point_tree, hf_lg8979_ind_frcrpt_status_b0, tvb, offset, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(lg8979_point_tree, hf_lg8979_ind_frcrpt_status_b1, tvb, offset, 1, ENC_LITTLE_ENDIAN);
@@ -931,8 +927,8 @@ dissect_lg8979(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
proto_tree_add_item(lg8979_point_tree, hf_lg8979_ind_frcrpt_status_b7, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
- lg8979_point_item = proto_tree_add_text(lg8979_tree, tvb, offset, 1, "Indication Change, Base Point Num %d", ptnum);
- lg8979_point_tree = proto_item_add_subtree(lg8979_point_item, ett_lg8979_point);
+ lg8979_point_tree = proto_tree_add_subtree_format(lg8979_tree, tvb, offset, 1,
+ ett_lg8979_point, NULL, "Indication Change, Base Point Num %d", ptnum);
proto_tree_add_item(lg8979_point_tree, hf_lg8979_ind_frcrpt_change_b0, tvb, offset, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(lg8979_point_tree, hf_lg8979_ind_frcrpt_change_b1, tvb, offset, 1, ENC_LITTLE_ENDIAN);
@@ -960,9 +956,8 @@ dissect_lg8979(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
new_status = (tvb_get_guint8(tvb, offset+1) & 0x80) >> 7;
change = (tvb_get_guint8(tvb, offset+1) & 0x40) >> 6;
- lg8979_point_item = proto_tree_add_text(lg8979_tree, tvb, offset, 2,
+ lg8979_point_tree = proto_tree_add_subtree_format(lg8979_tree, tvb, offset, 2, ett_lg8979_point, NULL,
"SOE Change Report, Point Number: %u, Status: %u, Change %u", ptnum, new_status, change);
- lg8979_point_tree = proto_item_add_subtree(lg8979_point_item, ett_lg8979_point);
proto_tree_add_item(lg8979_point_tree, hf_lg8979_soe_chgrpt_ptnum, tvb, offset, 2, ENC_LITTLE_ENDIAN);
proto_tree_add_item(lg8979_point_tree, hf_lg8979_soe_chgrpt_status, tvb, offset, 2, ENC_LITTLE_ENDIAN);
@@ -983,8 +978,8 @@ dissect_lg8979(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
num_points = ((data_len - 2) / 2);
for (cnt=0; cnt<num_points; cnt++) {
- lg8979_point_item = proto_tree_add_text(lg8979_tree, tvb, offset, 1, "SOE Status, Base Point Num %d", ptnum);
- lg8979_point_tree = proto_item_add_subtree(lg8979_point_item, ett_lg8979_point);
+ lg8979_point_tree = proto_tree_add_subtree_format(lg8979_tree, tvb, offset, 1,
+ ett_lg8979_point, NULL, "SOE Status, Base Point Num %d", ptnum);
proto_tree_add_item(lg8979_point_tree, hf_lg8979_soe_frcrpt_status_b0, tvb, offset, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(lg8979_point_tree, hf_lg8979_soe_frcrpt_status_b1, tvb, offset, 1, ENC_LITTLE_ENDIAN);
@@ -996,8 +991,8 @@ dissect_lg8979(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
proto_tree_add_item(lg8979_point_tree, hf_lg8979_soe_frcrpt_status_b7, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
- lg8979_point_item = proto_tree_add_text(lg8979_tree, tvb, offset, 1, "SOE Change, Base Point Num %d", ptnum);
- lg8979_point_tree = proto_item_add_subtree(lg8979_point_item, ett_lg8979_point);
+ lg8979_point_tree = proto_tree_add_subtree_format(lg8979_tree, tvb, offset, 1,
+ ett_lg8979_point, NULL, "SOE Change, Base Point Num %d", ptnum);
proto_tree_add_item(lg8979_point_tree, hf_lg8979_soe_frcrpt_change_b0, tvb, offset, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(lg8979_point_tree, hf_lg8979_soe_frcrpt_change_b1, tvb, offset, 1, ENC_LITTLE_ENDIAN);
@@ -1026,8 +1021,8 @@ dissect_lg8979(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
for (cnt=0; cnt<num_points; cnt++) {
- lg8979_point_item = proto_tree_add_text(lg8979_tree, tvb, offset, 2, "Digital Input Block %d", ptnum8);
- lg8979_point_tree = proto_item_add_subtree(lg8979_point_item, ett_lg8979_point);
+ lg8979_point_tree = proto_tree_add_subtree_format(lg8979_tree, tvb, offset, 2,
+ ett_lg8979_point, NULL, "Digital Input Block %d", ptnum8);
proto_tree_add_item(lg8979_point_tree, hf_lg8979_digin_b0, tvb, offset, 2, ENC_LITTLE_ENDIAN);
proto_tree_add_item(lg8979_point_tree, hf_lg8979_digin_b1, tvb, offset, 2, ENC_LITTLE_ENDIAN);
@@ -1089,9 +1084,8 @@ dissect_lg8979(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
ptnum = tvb_get_letohs(tvb, offset) & 0xFFF;
new_status = (tvb_get_guint8(tvb, offset+1) & 0x80) >> 7;
- lg8979_point_item = proto_tree_add_text(lg8979_tree, tvb, offset, 9,
+ lg8979_point_tree = proto_tree_add_subtree_format(lg8979_tree, tvb, offset, 9, ett_lg8979_point, NULL,
"SOE Log Change Report, Point Number: %u, New Status: %u", ptnum, new_status);
- lg8979_point_tree = proto_item_add_subtree(lg8979_point_item, ett_lg8979_point);
/* Add 12-bit point number and "new status" bit to tree */
proto_tree_add_item(lg8979_point_tree, hf_lg8979_soe_logchg_ptnum, tvb, offset, 2, ENC_LITTLE_ENDIAN);
diff --git a/epan/dissectors/packet-linx.c b/epan/dissectors/packet-linx.c
index d756d13e27..5bca88af71 100644
--- a/epan/dissectors/packet-linx.c
+++ b/epan/dissectors/packet-linx.c
@@ -285,7 +285,6 @@ dissect_linx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
int payloadsize;
int version;
int conntype;
- proto_item *item;
proto_tree *multicore_header_tree;
proto_tree *main_header_tree;
proto_tree *conn_header_tree;
@@ -314,8 +313,7 @@ dissect_linx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* check if we have multicore header*/
if (nexthdr == ETHCM_MAIN)
{
- item = proto_tree_add_text(linx_tree, tvb, 0, 4, "Multicore Header");
- multicore_header_tree = proto_item_add_subtree(item, ett_linx_multicore);
+ multicore_header_tree = proto_tree_add_subtree(linx_tree, tvb, 0, 4, ett_linx_multicore, NULL, "Multicore Header");
/* Multicore header */
/*
@@ -348,8 +346,7 @@ dissect_linx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
/* main header */
- item = proto_tree_add_text(linx_tree, linx_tvb, offset, 4, "Main Header");
- main_header_tree = proto_item_add_subtree(item, ett_linx_main);
+ main_header_tree = proto_tree_add_subtree(linx_tree, linx_tvb, offset, 4, ett_linx_main, NULL, "Main Header");
/* Main header */
/*
@@ -402,8 +399,7 @@ dissect_linx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
size = (dword >>21) & 0x7;
- item = proto_tree_add_text(linx_tree, linx_tvb, offset, (4+2*size), "Connection Header");
- conn_header_tree = proto_item_add_subtree(item, ett_linx_main);
+ conn_header_tree = proto_tree_add_subtree(linx_tree, linx_tvb, offset, (4+2*size), ett_linx_main, NULL, "Connection Header");
proto_tree_add_item(conn_header_tree, hf_linx_nexthdr , linx_tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(conn_header_tree, hf_linx_conn_cmd , linx_tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(conn_header_tree, hf_linx_conn_size , linx_tvb, offset, 4, ENC_BIG_ENDIAN);
@@ -442,8 +438,7 @@ dissect_linx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* guess there will be padding if the Seqno doesn't reach */
/* a 32bit boundary */
- item = proto_tree_add_text(linx_tree, linx_tvb, offset, 4, "NACK Header");
- nack_header_tree = proto_item_add_subtree(item, ett_linx_main);
+ nack_header_tree = proto_tree_add_subtree(linx_tree, linx_tvb, offset, 4, ett_linx_main, NULL, "NACK Header");
proto_tree_add_item(nack_header_tree, hf_linx_nexthdr , linx_tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(nack_header_tree, hf_linx_nack_reserv1, linx_tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(nack_header_tree, hf_linx_nack_count , linx_tvb, offset, 4, ENC_BIG_ENDIAN);
@@ -487,8 +482,7 @@ dissect_linx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
- item = proto_tree_add_text(linx_tree, linx_tvb, offset, 12, "Udata Header");
- udata_header_tree = proto_item_add_subtree(item, ett_linx_main);
+ udata_header_tree = proto_tree_add_subtree(linx_tree, linx_tvb, offset, 12, ett_linx_main, NULL, "Udata Header");
proto_tree_add_item(udata_header_tree, hf_linx_nexthdr, linx_tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(udata_header_tree, hf_linx_udata_reserved , linx_tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(udata_header_tree, hf_linx_udata_morefrags, linx_tvb, offset, 4, ENC_BIG_ENDIAN);
@@ -522,8 +516,7 @@ dissect_linx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_append_fstr(pinfo->cinfo, COL_INFO, "rlnh:%s ", val_to_str_const(dword, linx_short_rlnh_names, "unknown"));
/* create new paragraph for RLNH */
- item = proto_tree_add_text(linx_tree, linx_tvb, offset, 4, "RLNH");
- rlnh_header_tree = proto_item_add_subtree(item, ett_linx_main);
+ rlnh_header_tree = proto_tree_add_subtree(linx_tree, linx_tvb, offset, 4, ett_linx_main, NULL, "RLNH");
if(version == 1) {
proto_tree_add_item(rlnh_header_tree, hf_linx_rlnh_msg_type32, linx_tvb, offset, 4, ENC_BIG_ENDIAN);
@@ -604,8 +597,7 @@ dissect_linx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
| Next |R| Res.| Ackno | Seqno |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
- item = proto_tree_add_text(linx_tree, linx_tvb, offset, 4, "Ack Header");
- ack_header_tree = proto_item_add_subtree(item, ett_linx_main);
+ ack_header_tree = proto_tree_add_subtree(linx_tree, linx_tvb, offset, 4, ett_linx_main, NULL, "Ack Header");
proto_tree_add_item(ack_header_tree, hf_linx_nexthdr , linx_tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(ack_header_tree, hf_linx_ack_request , linx_tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(ack_header_tree, hf_linx_ack_reserved, linx_tvb, offset, 4, ENC_BIG_ENDIAN);
@@ -625,8 +617,7 @@ dissect_linx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
- item = proto_tree_add_text(linx_tree, linx_tvb, offset, 4, "Fragmentation Header");
- frag_header_tree = proto_item_add_subtree(item, ett_linx_main);
+ frag_header_tree = proto_tree_add_subtree(linx_tree, linx_tvb, offset, 4, ett_linx_main, NULL, "Fragmentation Header");
proto_tree_add_item(frag_header_tree, hf_linx_nexthdr , linx_tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(frag_header_tree, hf_linx_frag_reserved , linx_tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(frag_header_tree, hf_linx_frag_morefrags, linx_tvb, offset, 4, ENC_BIG_ENDIAN);
@@ -842,7 +833,6 @@ dissect_linx_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint32 dword;
tvbuff_t *linx_tcp_tvb;
int offset = 0;
- proto_item *item;
proto_item *ti;
proto_tree *linx_tcp_tree;
proto_tree *tcp_header_tree;
@@ -882,8 +872,7 @@ dissect_linx_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_text(linx_tcp_tree, linx_tcp_tvb, 0, 0, "Version %u not yet supported and might be dissected incorrectly!", version);
}
- item = proto_tree_add_text(linx_tcp_tree, linx_tcp_tvb, 0, 16, "TCP CM Header");
- tcp_header_tree = proto_item_add_subtree(item, ett_linx_tcp);
+ tcp_header_tree = proto_tree_add_subtree(linx_tcp_tree, linx_tcp_tvb, 0, 16, ett_linx_tcp, NULL, "TCP CM Header");
proto_tree_add_item(tcp_header_tree, hf_linx_tcp_type, linx_tcp_tvb, 0, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(tcp_header_tree, hf_linx_tcp_version, linx_tcp_tvb, 0, 4, ENC_BIG_ENDIAN);
@@ -904,8 +893,7 @@ dissect_linx_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_append_fstr(pinfo->cinfo, COL_INFO, "rlnh:%s ", val_to_str_const(dword, linx_short_rlnh_names, "unknown"));
/* create new paragraph for RLNH */
- item = proto_tree_add_text(linx_tcp_tree, linx_tcp_tvb, offset, 4, "RLNH");
- rlnh_header_tree = proto_item_add_subtree(item, ett_linx_tcp);
+ rlnh_header_tree = proto_tree_add_subtree(linx_tcp_tree, linx_tcp_tvb, offset, 4, ett_linx_tcp, NULL, "RLNH");
if(version == 1) {
proto_tree_add_item(rlnh_header_tree, hf_linx_tcp_rlnh_msg_type32, linx_tcp_tvb, offset, 4, ENC_BIG_ENDIAN);
diff --git a/epan/dissectors/packet-lldp.c b/epan/dissectors/packet-lldp.c
index dfcb1cc4cf..c1fd099157 100644
--- a/epan/dissectors/packet-lldp.c
+++ b/epan/dissectors/packet-lldp.c
@@ -971,10 +971,9 @@ dissect_lldp_chassis_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
tlvsubType = tvb_get_guint8(tvb, (offset+2));
/* Set chassis tree */
- tf = proto_tree_add_text(tree, tvb, offset, (dataLen + 2), "Chassis Subtype = %s",
+ chassis_tree = proto_tree_add_subtree_format(tree, tvb, offset, (dataLen + 2), ett_chassis_id, &tf, "Chassis Subtype = %s",
val_to_str_const(tlvsubType, chassis_id_subtypes, "Reserved" ));
- chassis_tree = proto_item_add_subtree(tf, ett_chassis_id);
proto_tree_add_item(chassis_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
lf = proto_tree_add_item(chassis_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN);
@@ -1131,10 +1130,9 @@ dissect_lldp_port_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint3
tlvsubType = tvb_get_guint8(tvb, (offset+2));
/* Set port tree */
- tf = proto_tree_add_text(tree, tvb, offset, (dataLen + 2), "Port Subtype = %s",
+ port_tree = proto_tree_add_subtree_format(tree, tvb, offset, (dataLen + 2), ett_port_id, &tf, "Port Subtype = %s",
val_to_str_const(tlvsubType, port_id_subtypes, "Unknown" ));
- port_tree = proto_item_add_subtree(tf, ett_port_id);
proto_tree_add_item(port_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
lf = proto_tree_add_item(port_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN);
@@ -1259,8 +1257,7 @@ dissect_lldp_time_to_live(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
guint16 tempShort;
guint32 dataLen = 0;
- proto_tree *time_to_live_tree = NULL;
- proto_item *tf = NULL;
+ proto_tree *time_to_live_tree;
/* Get tlv type */
tempShort = tvb_get_ntohs(tvb, offset);
@@ -1275,8 +1272,8 @@ dissect_lldp_time_to_live(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
col_append_fstr(pinfo->cinfo, COL_INFO, "TTL = %u ", tempShort);
/* Set port tree */
- tf = proto_tree_add_text(tree, tvb, offset, (dataLen + 2), "Time To Live = %u sec", tempShort);
- time_to_live_tree = proto_item_add_subtree(tf, ett_time_to_live);
+ time_to_live_tree = proto_tree_add_subtree_format(tree, tvb, offset, (dataLen + 2),
+ ett_time_to_live, NULL, "Time To Live = %u sec", tempShort);
proto_tree_add_item(time_to_live_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(time_to_live_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN);
@@ -1298,8 +1295,7 @@ dissect_lldp_end_of_lldpdu(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr
guint16 dataLen;
guint16 tempShort;
- proto_tree *end_of_lldpdu_tree = NULL;
- proto_item *tf = NULL;
+ proto_tree *end_of_lldpdu_tree;
/* Get tlv type and length */
tempShort = tvb_get_ntohs(tvb, offset);
@@ -1308,8 +1304,7 @@ dissect_lldp_end_of_lldpdu(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr
dataLen = TLV_INFO_LEN(tempShort);
/* Set port tree */
- tf = proto_tree_add_text(tree, tvb, offset, (dataLen + 2), "End of LLDPDU");
- end_of_lldpdu_tree = proto_item_add_subtree(tf, ett_end_of_lldpdu);
+ end_of_lldpdu_tree = proto_tree_add_subtree(tree, tvb, offset, (dataLen + 2), ett_end_of_lldpdu, NULL, "End of LLDPDU");
proto_tree_add_item(end_of_lldpdu_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(end_of_lldpdu_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN);
@@ -1325,8 +1320,7 @@ dissect_lldp_port_desc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
guint32 dataLen = 0;
const char *strPtr;
- proto_tree *port_desc_tree = NULL;
- proto_item *tf = NULL;
+ proto_tree *port_desc_tree;
/* Get tlv type and length */
tempShort = tvb_get_ntohs(tvb, offset);
@@ -1337,8 +1331,8 @@ dissect_lldp_port_desc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
strPtr = tvb_format_stringzpad(tvb, (offset+2), dataLen);
/* Set port tree */
- tf = proto_tree_add_text(tree, tvb, offset, (dataLen + 2), "Port Description = %s", strPtr);
- port_desc_tree = proto_item_add_subtree(tf, ett_port_description);
+ port_desc_tree = proto_tree_add_subtree_format(tree, tvb, offset, (dataLen + 2),
+ ett_port_description, NULL, "Port Description = %s", strPtr);
proto_tree_add_item(port_desc_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(port_desc_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN);
@@ -1361,8 +1355,7 @@ dissect_lldp_system_name(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree
guint8 tlvsubType;
const char *strPtr;
- proto_tree *system_subtree = NULL;
- proto_item *tf = NULL;
+ proto_tree *system_subtree;
/* Get tlv type and length */
tempShort = tvb_get_ntohs(tvb, offset);
@@ -1375,12 +1368,12 @@ dissect_lldp_system_name(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree
/* Set system name tree */
if (tlvsubType == SYSTEM_NAME_TLV_TYPE) {
- tf = proto_tree_add_text(tree, tvb, offset, (dataLen + 2), "System Name = %s", strPtr);
- system_subtree = proto_item_add_subtree(tf, ett_system_name);
+ system_subtree = proto_tree_add_subtree_format(tree, tvb, offset, (dataLen + 2),
+ ett_system_name, NULL, "System Name = %s", strPtr);
col_append_fstr(pinfo->cinfo, COL_INFO, "System Name = %s ", strPtr);
} else {
- tf = proto_tree_add_text(tree, tvb, offset, (dataLen + 2), "System Description = %s", strPtr);
- system_subtree = proto_item_add_subtree(tf, ett_system_desc);
+ system_subtree = proto_tree_add_subtree_format(tree, tvb, offset, (dataLen + 2),
+ ett_system_desc, NULL, "System Description = %s", strPtr);
col_append_fstr(pinfo->cinfo, COL_INFO, "System Description = %s ", strPtr);
}
@@ -1407,10 +1400,10 @@ dissect_lldp_system_capabilities(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr
guint16 tempShort;
guint32 dataLen = 0;
- proto_tree *system_capabilities_tree = NULL;
- proto_tree *capabilities_summary_tree = NULL;
- proto_tree *capabilities_enabled_tree = NULL;
- proto_item *tf = NULL;
+ proto_tree *system_capabilities_tree;
+ proto_tree *capabilities_summary_tree;
+ proto_tree *capabilities_enabled_tree;
+ proto_item *tf;
/* Get tlv type and length */
tempShort = tvb_get_ntohs(tvb, offset);
@@ -1419,8 +1412,7 @@ dissect_lldp_system_capabilities(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr
dataLen = TLV_INFO_LEN(tempShort);
/* Set system capabilities tree */
- tf = proto_tree_add_text(tree, tvb, offset, (dataLen + 2), "Capabilities");
- system_capabilities_tree = proto_item_add_subtree(tf, ett_system_cap);
+ system_capabilities_tree = proto_tree_add_subtree(tree, tvb, offset, (dataLen + 2), ett_system_cap, NULL, "Capabilities");
proto_tree_add_item(system_capabilities_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(system_capabilities_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN);
@@ -1469,8 +1461,7 @@ dissect_lldp_management_address(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre
guint8 subtypeByte;
guint8 stringLen = 0;
- proto_tree *system_mgm_addr = NULL;
- proto_item *tf = NULL;
+ proto_tree *system_mgm_addr;
/* Get tlv type and length */
tempShort = tvb_get_ntohs(tvb, offset);
@@ -1479,8 +1470,7 @@ dissect_lldp_management_address(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre
dataLen = TLV_INFO_LEN(tempShort);
/* Set system capabilities tree */
- tf = proto_tree_add_text(tree, tvb, offset, (dataLen + 2), "Management Address");
- system_mgm_addr = proto_item_add_subtree(tf, ett_management_address);
+ system_mgm_addr = proto_tree_add_subtree(tree, tvb, offset, (dataLen + 2), ett_management_address, NULL, "Management Address");
proto_tree_add_item(system_mgm_addr, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(system_mgm_addr, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN);
@@ -1709,9 +1699,9 @@ dissect_dcbx_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint3
while(appCount--) {
tempShort = tvb_get_ntohs(tvb, offset);
- tf = proto_tree_add_text(subtlv_tree, tvb, offset, 6, "%s Application",
+ apptlv_tree = proto_tree_add_subtree_format(subtlv_tree, tvb, offset, 6,
+ ett_org_spc_dcbx_cee_app, NULL, "%s Application",
val_to_str_const(tempShort, dcbx_app_types, "Unknown"));
- apptlv_tree = proto_item_add_subtree(tf, ett_org_spc_dcbx_cee_app);
proto_tree_add_item(apptlv_tree, hf_dcbx_feature_app_proto, tvb, offset, 2, ENC_BIG_ENDIAN);
@@ -2081,9 +2071,9 @@ dissect_ieee_802_1_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
while(appCount--) {
dcbApp = tvb_get_ntohs(tvb, offset + 1);
- tf = proto_tree_add_text(tree, tvb, offset, 3, "%s Application",
+ apptlv_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3,
+ ett_org_spc_ieee_dcbx_app, NULL, "%s Application",
val_to_str_const(dcbApp, dcbx_app_types, "Unknown"));
- apptlv_tree = proto_item_add_subtree(tf, ett_org_spc_ieee_dcbx_app);
proto_tree_add_item(apptlv_tree, hf_ieee_8021az_app_prio, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(apptlv_tree, hf_ieee_8021az_app_selector, tvb, offset, 1, ENC_BIG_ENDIAN);
@@ -2219,8 +2209,7 @@ dissect_ieee_802_3_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_10base_t, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_other, tvb, offset, 2, ENC_BIG_ENDIAN);
- tf = proto_tree_add_text(tree, tvb, offset, 2, "Same in inverse (wrong) bitorder");
- autoneg_advertised_subtree = proto_item_add_subtree(tf, ett_802_3_autoneg_advertised);
+ autoneg_advertised_subtree = proto_tree_add_subtree(tree, tvb, offset, 2, ett_802_3_autoneg_advertised, NULL, "Same in inverse (wrong) bitorder");
proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_1000base_tfd, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(autoneg_advertised_subtree, hf_ieee_802_3_pmd_auto_neg_advertised_caps_inv_1000base_t, tvb, offset, 2, ENC_BIG_ENDIAN);
@@ -2759,14 +2748,11 @@ dissect_profinet_period(tvbuff_t *tvb, proto_tree *tree, guint32 offset, const g
{
guint32 period;
proto_tree *period_tree;
- proto_item *period_item;
-
period = tvb_get_ntohl(tvb, offset);
- period_item = proto_tree_add_text(tree, tvb, offset, 4, "%s: %s, %uns",
+ period_tree = proto_tree_add_subtree_format(tree, tvb, offset, 4, ett_profinet_period, NULL, "%s: %s, %uns",
name, (period & 0x80000000) ? "Valid" : "Invalid", period & 0x7FFFFFFF);
- period_tree = proto_item_add_subtree(period_item, ett_profinet_period);
proto_tree_add_uint(period_tree, hf_valid, tvb, offset, 4, period);
proto_tree_add_uint(period_tree, hf_value, tvb, offset, 4, period);
@@ -2951,7 +2937,7 @@ dissect_organizational_specific_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tre
const char *subTypeStr;
proto_tree *org_tlv_tree = NULL;
- proto_item *tf = NULL, *lf = NULL;
+ proto_item *lf = NULL;
/* Get tlv type and length */
tempShort = tvb_get_ntohs(tvb, offset);
@@ -3081,8 +3067,7 @@ dissect_organizational_specific_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tre
break;
}
- tf = proto_tree_add_text(tree, tvb, offset, tLength, "%s - %s", ouiStr, subTypeStr);
- org_tlv_tree = proto_item_add_subtree(tf, tempTree); /* change to temp: ett_org_spc_tlv */
+ org_tlv_tree = proto_tree_add_subtree_format(tree, tvb, offset, tLength, tempTree, NULL, "%s - %s", ouiStr, subTypeStr);
proto_tree_add_item(org_tlv_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
lf = proto_tree_add_item(org_tlv_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN);
@@ -3133,8 +3118,7 @@ dissect_lldp_unknown_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree
guint16 dataLen;
guint16 tempShort;
- proto_tree *unknown_tlv_tree = NULL;
- proto_item *tf = NULL;
+ proto_tree *unknown_tlv_tree;
/* Get tlv type and length */
tempShort = tvb_get_ntohs(tvb, offset);
@@ -3142,8 +3126,7 @@ dissect_lldp_unknown_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree
/* Get tlv length */
dataLen = TLV_INFO_LEN(tempShort);
- tf = proto_tree_add_text(tree, tvb, offset, (dataLen + 2), "Unknown TLV");
- unknown_tlv_tree = proto_item_add_subtree(tf, ett_unknown_tlv);
+ unknown_tlv_tree = proto_tree_add_subtree(tree, tvb, offset, (dataLen + 2), ett_unknown_tlv, NULL, "Unknown TLV");
proto_tree_add_item(unknown_tlv_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(unknown_tlv_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN);
diff --git a/epan/dissectors/packet-lltd.c b/epan/dissectors/packet-lltd.c
index 7cfe9a27b6..ed914b92b7 100644
--- a/epan/dissectors/packet-lltd.c
+++ b/epan/dissectors/packet-lltd.c
@@ -330,17 +330,17 @@ dissect_lltd_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 of
if (type == 0)
{
/* End of Property type doesn't have length */
- tlv_item = proto_tree_add_text(tree, tvb, offset, 1, "TLV Item (End of Property List)");
+ tlv_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_tlv_item, &tlv_item, "TLV Item (End of Property List)");
*end = TRUE;
}
else
{
length = tvb_get_guint8(tvb, offset+1);
- tlv_item = proto_tree_add_text(tree, tvb, offset, length+2, "TLV Item (%s)", val_to_str(type, lltd_tlv_type_vals, "Unknown (0x%02x)"));
+ tlv_tree = proto_tree_add_subtree_format(tree, tvb, offset, length+2, ett_tlv_item, &tlv_item,
+ "TLV Item (%s)", val_to_str(type, lltd_tlv_type_vals, "Unknown (0x%02x)"));
*end = FALSE;
}
- tlv_tree = proto_item_add_subtree(tlv_item, ett_tlv_item);
proto_tree_add_item(tlv_tree, hf_lltd_tlv_type, tvb, offset, 1, ENC_NA);
if (type != 0)
proto_tree_add_item(tlv_tree, hf_lltd_tlv_length, tvb, offset+1, 1, ENC_NA);
@@ -373,8 +373,7 @@ dissect_lltd_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 of
}
else
{
- type_item = proto_tree_add_text(tree, tvb, offset+2, 4, "Characteristics");
- type_tree = proto_item_add_subtree(type_item, ett_characteristics);
+ type_tree = proto_tree_add_subtree(tree, tvb, offset+2, 4, ett_characteristics, &type_item, "Characteristics");
proto_tree_add_item(type_tree, hf_lltd_char_p, tvb, offset+2, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(type_tree, hf_lltd_char_x, tvb, offset+2, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(type_tree, hf_lltd_char_f, tvb, offset+2, 4, ENC_BIG_ENDIAN);
@@ -504,8 +503,7 @@ dissect_lltd_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 of
}
else
{
- type_item = proto_tree_add_text(tlv_tree, tvb, offset+2, 4, "QoS Characteristics");
- type_tree = proto_item_add_subtree(type_item, ett_qos_characteristics);
+ type_tree = proto_tree_add_subtree(tlv_tree, tvb, offset+2, 4, ett_qos_characteristics, &type_item, "QoS Characteristics");
proto_tree_add_item(type_tree, hf_lltd_qos_char_e, tvb, offset+2, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(type_tree, hf_lltd_qos_char_q, tvb, offset+2, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(type_tree, hf_lltd_qos_char_p, tvb, offset+2, 4, ENC_BIG_ENDIAN);
@@ -532,8 +530,7 @@ dissect_lltd_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 of
proto_tree_add_item(tlv_tree, hf_lltd_sees_list_working_set, tvb, offset+2, 2, ENC_BIG_ENDIAN);
break;
case 0x1B: /* Repeater AP Lineage */
- type_item = proto_tree_add_text(tree, tvb, offset+2, length, "Repeater AP Lineage");
- type_tree = proto_item_add_subtree(type_item, ett_repeater_ap_lineage);
+ type_tree = proto_tree_add_subtree(tree, tvb, offset+2, length, ett_repeater_ap_lineage, NULL, "Repeater AP Lineage");
for (i = 0; i < length; i += 6)
proto_tree_add_item(type_tree, hf_lltd_repeater_ap_lineage, tvb, offset+2+i, 6, ENC_NA);
@@ -559,7 +556,7 @@ dissect_lltd_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 of
static void
dissect_lltd_discovery(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_item *header_item, *func_item, *func_subitem;
+ proto_item *header_item, *func_item;
proto_tree *header_tree, *func_tree, *func_subtree;
guint8 func;
guint16 temp16;
@@ -572,8 +569,7 @@ dissect_lltd_discovery(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
offset++;
/* Demultiplex header */
- header_item = proto_tree_add_text(tree, tvb, offset, 14, "Base header");
- header_tree = proto_item_add_subtree(header_item, ett_base_header);
+ header_tree = proto_tree_add_subtree(tree, tvb, offset, 14, ett_base_header, &header_item, "Base header");
proto_tree_add_item(header_tree, hf_lltd_discovery_real_dest_addr, tvb, offset, 6, ENC_NA);
proto_tree_add_item(header_tree, hf_lltd_discovery_real_src_addr, tvb, offset+6, 6, ENC_NA);
@@ -590,8 +586,7 @@ dissect_lltd_discovery(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
temp16 = tvb_get_ntohs(tvb, offset+16);
if (temp16 > 0)
{
- func_item = proto_tree_add_text(tree, tvb, offset+18, temp16*6, "Stations");
- func_tree = proto_item_add_subtree(func_item, ett_discover_stations);
+ func_tree = proto_tree_add_subtree(tree, tvb, offset+18, temp16*6, ett_discover_stations, NULL, "Stations");
for (loop_offset = 0; loop_offset < temp16*6; loop_offset += 6)
proto_tree_add_item(func_tree, hf_lltd_discover_station, tvb, offset+18+loop_offset, 6, ENC_NA);
}
@@ -601,8 +596,7 @@ dissect_lltd_discovery(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
proto_tree_add_item(tree, hf_lltd_hello_current_address, tvb, offset+16, 6, ENC_NA);
proto_tree_add_item(tree, hf_lltd_hello_apparent_address, tvb, offset+22, 6, ENC_NA);
- func_item = proto_tree_add_text(tree, tvb, offset+28, 0, "TLVs");
- func_tree = proto_item_add_subtree(func_item, ett_tlv);
+ func_tree = proto_tree_add_subtree(tree, tvb, offset+28, 0, ett_tlv, &func_item, "TLVs");
start_offset = loop_offset = offset+28;
while ((end_tlv == FALSE) && (tvb_length_remaining(tvb, loop_offset) >= 1))
{
@@ -615,12 +609,10 @@ dissect_lltd_discovery(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
temp16 = tvb_get_ntohs(tvb, offset+14);
if (temp16 > 0)
{
- func_item = proto_tree_add_text(tree, tvb, offset+16, temp16*14, "EmiteeDescs");
- func_tree = proto_item_add_subtree(func_item, ett_emitee_descs);
+ func_tree = proto_tree_add_subtree(tree, tvb, offset+16, temp16*14, ett_emitee_descs, NULL, "EmiteeDescs");
for (loop_offset = 0; loop_offset < temp16*14; loop_offset += 14)
{
- func_subitem = proto_tree_add_text(func_tree, tvb, offset+16+loop_offset, 14, "EmiteeDescs Item");
- func_subtree = proto_item_add_subtree(func_subitem, ett_emitee_descs_item);
+ func_subtree = proto_tree_add_subtree(func_tree, tvb, offset+16+loop_offset, 14, ett_emitee_descs_item, NULL, "EmiteeDescs Item");
proto_tree_add_item(func_subtree, hf_lltd_emit_type, tvb, offset+16+loop_offset, 1, ENC_NA);
proto_tree_add_item(func_subtree, hf_lltd_emit_pause, tvb, offset+16+loop_offset+1, 1, ENC_NA);
@@ -636,12 +628,11 @@ dissect_lltd_discovery(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
temp16 = tvb_get_ntohs(tvb, offset+14) & LLTD_QUERY_RESP_NUM_DESCS_MASK;
if (temp16 > 0)
{
- func_item = proto_tree_add_text(tree, tvb, offset+16, temp16*20, "RecveeDescs");
- func_tree = proto_item_add_subtree(func_item, ett_recvee_descs);
+ func_tree = proto_tree_add_subtree(tree, tvb, offset+16, temp16*20, ett_recvee_descs, NULL, "RecveeDescs");
for (loop_offset = 0; loop_offset < temp16*14; loop_offset += 20)
{
- func_subitem = proto_tree_add_text(func_tree, tvb, offset+16+loop_offset, 20, "RecveeDescs Item");
- func_subtree = proto_item_add_subtree(func_subitem, ett_recvee_descs_item);
+ func_subtree = proto_tree_add_subtree(func_tree, tvb, offset+16+loop_offset, 20,
+ ett_recvee_descs_item, NULL, "RecveeDescs Item");
proto_tree_add_item(func_subtree, hf_lltd_queryresp_type, tvb, offset+16+loop_offset, 2, ENC_NA);
proto_tree_add_item(func_subtree, hf_lltd_queryresp_real_src_addr, tvb, offset+16+loop_offset+2, 6, ENC_NA);
@@ -683,7 +674,7 @@ dissect_lltd_discovery(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
static void
dissect_lltd_qos(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_item *header_item, *func_item, *func_subitem;
+ proto_item *header_item;
proto_tree *header_tree, *func_tree, *func_subtree;
guint8 func;
guint16 seq_num, temp16;
@@ -694,8 +685,7 @@ dissect_lltd_qos(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset
col_add_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str(func, lltd_qos_diag_vals, "Unknown (0x%02x)"));
offset++;
- header_item = proto_tree_add_text(tree, tvb, offset, 14, "Base header");
- header_tree = proto_item_add_subtree(header_item, ett_base_header);
+ header_tree = proto_tree_add_subtree(tree, tvb, offset, 14, ett_base_header, &header_item, "Base header");
proto_tree_add_item(header_tree, hf_lltd_qos_real_dest_addr, tvb, offset, 6, ENC_NA);
proto_tree_add_item(header_tree, hf_lltd_qos_real_src_addr, tvb, offset+6, 6, ENC_NA);
@@ -734,12 +724,10 @@ dissect_lltd_qos(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset
temp16 = tvb_get_ntohs(tvb, offset+14) & LLTD_QUERY_RESP_NUM_DESCS_MASK;
if (temp16 > 0)
{
- func_item = proto_tree_add_text(tree, tvb, offset+16, temp16*18, "QosEventDesc");
- func_tree = proto_item_add_subtree(func_item, ett_qos_event_descs);
+ func_tree = proto_tree_add_subtree(tree, tvb, offset+16, temp16*18, ett_qos_event_descs, NULL, "QosEventDesc");
for (loop_offset = 0; loop_offset < temp16*18; loop_offset += 18)
{
- func_subitem = proto_tree_add_text(func_tree, tvb, offset+16+loop_offset, 18, "Qos Event");
- func_subtree = proto_item_add_subtree(func_subitem, ett_qos_event_item);
+ func_subtree = proto_tree_add_subtree(func_tree, tvb, offset+16+loop_offset, 18, ett_qos_event_item, NULL, "Qos Event");
proto_tree_add_item(func_subtree, hf_lltd_qos_query_resp_controller_timestamp, tvb, offset+16+loop_offset, 8, ENC_BIG_ENDIAN);
proto_tree_add_item(func_subtree, hf_lltd_qos_query_resp_sink_timestamp, tvb, offset+16+loop_offset+8, 8, ENC_BIG_ENDIAN);
@@ -767,12 +755,10 @@ dissect_lltd_qos(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset
temp16 = tvb_get_guint8(tvb, offset+17);
if (temp16 > 0)
{
- func_item = proto_tree_add_text(tree, tvb, offset+18, temp16*4, "Snapshot List");
- func_tree = proto_item_add_subtree(func_item, ett_qos_snapshot_list);
+ func_tree = proto_tree_add_subtree(tree, tvb, offset+18, temp16*4, ett_qos_snapshot_list, NULL, "Snapshot List");
for (loop_offset = 0; loop_offset < temp16*4; loop_offset += 4)
{
- func_subitem = proto_tree_add_text(func_tree, tvb, offset+18+loop_offset, 4, "Snapshot");
- func_subtree = proto_item_add_subtree(func_subitem, ett_qos_snapshot_item);
+ func_subtree = proto_tree_add_subtree(func_tree, tvb, offset+18+loop_offset, 4, ett_qos_snapshot_item, NULL, "Snapshot");
proto_tree_add_item(func_subtree, hf_lltd_qos_snapshot_bytes_recv, tvb, offset+16+loop_offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(func_subtree, hf_lltd_qos_snapshot_packets_recv, tvb, offset+16+loop_offset+2, 2, ENC_BIG_ENDIAN);
diff --git a/epan/dissectors/packet-lmi.c b/epan/dissectors/packet-lmi.c
index 208b153f75..86adc78b9f 100644
--- a/epan/dissectors/packet-lmi.c
+++ b/epan/dissectors/packet-lmi.c
@@ -161,10 +161,9 @@ dissect_lmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ele_id = tvb_get_guint8( tvb, offset);
len = tvb_get_guint8( tvb, offset + 1);
- ti = proto_tree_add_text(lmi_tree, tvb, offset, len + 2,
- "Information Element: %s",
+ lmi_subtree = proto_tree_add_subtree_format(lmi_tree, tvb, offset, len + 2,
+ ett_lmi_ele, NULL, "Information Element: %s",
val_to_str(ele_id, element_type_str, "Unknown (%u)"));
- lmi_subtree = proto_item_add_subtree(ti, ett_lmi_ele);
proto_tree_add_uint(lmi_subtree, hf_lmi_inf_ele, tvb, offset, 1,
ele_id);
diff --git a/epan/dissectors/packet-lmp.c b/epan/dissectors/packet-lmp.c
index 8e96ad3b0e..9d4f43ea5d 100644
--- a/epan/dissectors/packet-lmp.c
+++ b/epan/dissectors/packet-lmp.c
@@ -703,11 +703,10 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
ti = proto_tree_add_item(tree, proto_lmp, tvb, offset, msg_length,
ENC_NA);
lmp_tree = proto_item_add_subtree(ti, lmp_subtree[LMP_TREE_MAIN]);
- ti = proto_tree_add_text(lmp_tree, tvb, offset, 12, "LMP Header. %s",
- val_to_str(message_type, message_type_vals,
- "Unknown Message (%u). "));
- lmp_header_tree = proto_item_add_subtree(ti, lmp_subtree[LMP_TREE_HEADER]);
- proto_tree_add_text(lmp_header_tree, tvb, offset, 1, "LMP Version: %u",
+ lmp_header_tree = proto_tree_add_subtree_format(lmp_tree, tvb, offset, 12,
+ lmp_subtree[LMP_TREE_HEADER], NULL, "LMP Header. %s",
+ val_to_str(message_type, message_type_vals, "Unknown Message (%u). "));
+ proto_tree_add_text(lmp_header_tree, tvb, offset, 1, "LMP Version: %u",
version);
ti = proto_tree_add_text(lmp_header_tree, tvb, offset+2, 1, "Flags: %02x",
flags);
@@ -785,14 +784,12 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
}
lmp_object_tree = proto_item_add_subtree(ti, lmp_class_to_subtree(lmp_class));
- ti2 = proto_tree_add_text(lmp_object_tree, tvb, offset, 4,
- "Header. Class %d, C-Type %d, Length %d, %s",
+ lmp_object_header_tree = proto_tree_add_subtree_format(lmp_object_tree, tvb, offset, 4,
+ lmp_subtree[LMP_TREE_OBJECT_HEADER], &ti2,
+ "Header. Class %d, C-Type %d, Length %d, %s",
lmp_class, type, obj_length,
negotiable ? "Negotiable" : "Not Negotiable");
- lmp_object_header_tree =
- proto_item_add_subtree(ti2, lmp_subtree[LMP_TREE_OBJECT_HEADER]);
-
proto_tree_add_text(lmp_object_header_tree, tvb, offset, 1,
negotiable ? "Negotiable" : "Not Negotiable");
proto_tree_add_text(lmp_object_header_tree, tvb, offset+2, 2,
@@ -1306,10 +1303,8 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
for (l=0; l<obj_length - 4; ) {
- ti2 = proto_tree_add_text(lmp_object_tree, tvb, offset2+l, k,
- "Interface-Id");
- lmp_subobj_tree = proto_item_add_subtree(ti2,
- lmp_subtree[LMP_TREE_CHANNEL_STATUS_ID]);
+ lmp_subobj_tree = proto_tree_add_subtree(lmp_object_tree, tvb, offset2+l, k,
+ lmp_subtree[LMP_TREE_CHANNEL_STATUS_ID], &ti2, "Interface-Id");
switch(type) {
case 1:
diff --git a/epan/dissectors/packet-lon.c b/epan/dissectors/packet-lon.c
index 37efb0b0e8..7182fc5664 100644
--- a/epan/dissectors/packet-lon.c
+++ b/epan/dissectors/packet-lon.c
@@ -202,7 +202,6 @@ dissect_lon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
gint addr_a;
proto_tree *ti;
- proto_item *pi;
proto_tree *lon_tree;
gint npdu, type;
@@ -252,16 +251,14 @@ dissect_lon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
switch(addr_fmt)
{
case 0: /* Broadcast */
- pi = proto_tree_add_text(lon_tree, tvb, offset, 3, "Address type 0 (broadcast)");
- ti = proto_item_add_subtree(pi, ett_address);
+ ti = proto_tree_add_subtree(lon_tree, tvb, offset, 3, ett_address, NULL, "Address type 0 (broadcast)");
proto_tree_add_item(ti, hf_lon_addr_srcsub, tvb, offset, 1, ENC_NA);
proto_tree_add_item(ti, hf_lon_addr_srcnode, tvb, offset+1, 1, ENC_NA);
proto_tree_add_item(ti, hf_lon_addr_dstsub, tvb, offset+2, 1, ENC_NA);
offset += 3;
break;
case 1: /* Multicast */
- pi = proto_tree_add_text(lon_tree, tvb, offset, 3, "Address type 1 (multicast)");
- ti = proto_item_add_subtree(pi, ett_address);
+ ti = proto_tree_add_subtree(lon_tree, tvb, offset, 3, ett_address, NULL, "Address type 1 (multicast)");
proto_tree_add_item(ti, hf_lon_addr_srcsub, tvb, offset, 1, ENC_NA);
proto_tree_add_item(ti, hf_lon_addr_srcnode, tvb, offset+1, 1, ENC_NA);
proto_tree_add_item(ti, hf_lon_addr_dstgrp, tvb, offset+2, 1, ENC_NA);
@@ -270,16 +267,14 @@ dissect_lon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
case 2: /* Unicast/Multicast */
addr_a = tvb_get_guint8(tvb, offset+1) >> 7;
if (addr_a) { /* Type 2a */
- pi = proto_tree_add_text(lon_tree, tvb, offset, 4, "Address type 2a (unicast)");
- ti = proto_item_add_subtree(pi, ett_address);
+ ti = proto_tree_add_subtree(lon_tree, tvb, offset, 4, ett_address, NULL, "Address type 2a (unicast)");
proto_tree_add_item(ti, hf_lon_addr_srcsub, tvb, offset, 1, ENC_NA);
proto_tree_add_item(ti, hf_lon_addr_srcnode, tvb, offset+1, 1, ENC_NA);
proto_tree_add_item(ti, hf_lon_addr_dstsub, tvb, offset+2, 1, ENC_NA);
proto_tree_add_item(ti, hf_lon_addr_dstnode, tvb, offset+3, 1, ENC_NA);
offset += 4;
} else { /* Type 2b */
- pi = proto_tree_add_text(lon_tree, tvb, offset, 6, "Address type 2b (multicast)");
- ti = proto_item_add_subtree(pi, ett_address);
+ ti = proto_tree_add_subtree(lon_tree, tvb, offset, 6, ett_address, NULL, "Address type 2b (multicast)");
proto_tree_add_item(ti, hf_lon_addr_srcsub, tvb, offset, 1, ENC_NA);
proto_tree_add_item(ti, hf_lon_addr_srcnode, tvb, offset+1, 1, ENC_NA);
proto_tree_add_item(ti, hf_lon_addr_dstgrp, tvb, offset+2, 1, ENC_NA);
@@ -290,8 +285,7 @@ dissect_lon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
}
break;
case 3: /* UID */
- pi = proto_tree_add_text(lon_tree, tvb, offset, 9, "Address type 3 (UID)");
- ti = proto_item_add_subtree(pi, ett_address);
+ ti = proto_tree_add_subtree(lon_tree, tvb, offset, 9, ett_address, NULL, "Address type 3 (UID)");
proto_tree_add_item(ti, hf_lon_addr_srcsub, tvb, offset, 1, ENC_NA);
proto_tree_add_item(ti, hf_lon_addr_srcnode, tvb, offset+1, 1, ENC_NA);
proto_tree_add_item(ti, hf_lon_addr_dstsub, tvb, offset+2, 1, ENC_NA);
diff --git a/epan/dissectors/packet-ltp.c b/epan/dissectors/packet-ltp.c
index 4738ab7813..ec33a46701 100644
--- a/epan/dissectors/packet-ltp.c
+++ b/epan/dissectors/packet-ltp.c
@@ -226,9 +226,6 @@ dissect_data_segment(proto_tree *ltp_tree, tvbuff_t *tvb,packet_info *pinfo,int
int dissected_data_size = 0;
int data_count = 1;
- proto_item *ltp_data_item;
- proto_item *ltp_data_data_item;
-
proto_tree *ltp_data_tree;
proto_tree *ltp_data_data_tree;
@@ -298,8 +295,7 @@ dissect_data_segment(proto_tree *ltp_tree, tvbuff_t *tvb,packet_info *pinfo,int
}
/* Create a subtree for data segment and add the other fields under it */
- ltp_data_item = proto_tree_add_text(ltp_tree, tvb,frame_offset, segment_offset, "Data Segment");
- ltp_data_tree = proto_item_add_subtree(ltp_data_item, ett_data_segm);
+ ltp_data_tree = proto_tree_add_subtree(ltp_tree, tvb,frame_offset, segment_offset, ett_data_segm, NULL, "Data Segment");
proto_tree_add_uint64(ltp_data_tree,hf_ltp_data_clid, tvb, frame_offset,client_id_size,client_id);
frame_offset += client_id_size;
@@ -357,8 +353,8 @@ dissect_data_segment(proto_tree *ltp_tree, tvbuff_t *tvb,packet_info *pinfo,int
data_length = tvb_length(new_tvb);
while(dissected_data_size < data_length)
{
- ltp_data_data_item = proto_tree_add_text(ltp_data_tree, tvb,frame_offset, 0, "Data[%d]",data_count);
- ltp_data_data_tree = proto_item_add_subtree(ltp_data_data_item, ett_data_data_segm);
+ ltp_data_data_tree = proto_tree_add_subtree_format(ltp_data_tree, tvb,frame_offset, 0,
+ ett_data_data_segm, NULL, "Data[%d]",data_count);
datatvb = tvb_new_subset(new_tvb, data_offset, (int)data_length - dissected_data_size, tvb_length(new_tvb));
bundle_size = call_dissector(bundle_handle, datatvb, pinfo, ltp_data_data_tree);
@@ -416,8 +412,7 @@ dissect_report_segment(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ltp_tree,
proto_tree *ltp_rpt_clm_tree;
/* Create the subtree for report segment under the main LTP tree and all the report segment fields under it */
- ltp_rpt_item = proto_tree_add_text(ltp_tree, tvb, frame_offset, -1, "Report Segment");
- ltp_rpt_tree = proto_item_add_subtree(ltp_rpt_item, ett_rpt_segm);
+ ltp_rpt_tree = proto_tree_add_subtree(ltp_tree, tvb, frame_offset, -1, ett_rpt_segm, &ltp_rpt_item, "Report Segment");
/* Extract the report segment info */
rpt_sno = evaluate_sdnv_64(tvb, frame_offset, &rpt_sno_size);
@@ -457,8 +452,7 @@ dissect_report_segment(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ltp_tree,
proto_tree_add_uint(ltp_rpt_tree, hf_ltp_rpt_clm_cnt, tvb, frame_offset + segment_offset, rcpt_clm_cnt_size, rcpt_clm_cnt);
segment_offset += rcpt_clm_cnt_size;
- ltp_rpt_clm_item = proto_tree_add_text(ltp_rpt_tree, tvb, frame_offset + segment_offset, -1, "Reception claims");
- ltp_rpt_clm_tree = proto_item_add_subtree(ltp_rpt_clm_item, ett_rpt_clm);
+ ltp_rpt_clm_tree = proto_tree_add_subtree(ltp_rpt_tree, tvb, frame_offset + segment_offset, -1, ett_rpt_clm, &ltp_rpt_clm_item, "Reception claims");
/* There can be multiple reception claims in the same report segment */
for(i = 0; i<rcpt_clm_cnt; i++){
@@ -485,7 +479,6 @@ dissect_report_ack_segment(proto_tree *ltp_tree, tvbuff_t *tvb,int frame_offset)
int rpt_sno_size;
int segment_offset = 0;
- proto_item *ltp_rpt_ack_item;
proto_tree *ltp_rpt_ack_tree;
/* Extracing receipt serial number info */
@@ -497,8 +490,8 @@ dissect_report_ack_segment(proto_tree *ltp_tree, tvbuff_t *tvb,int frame_offset)
}
/* Creating tree for the report ack segment */
- ltp_rpt_ack_item = proto_tree_add_text(ltp_tree, tvb,frame_offset, segment_offset, "Report Ack Segment");
- ltp_rpt_ack_tree = proto_item_add_subtree(ltp_rpt_ack_item, ett_rpt_ack_segm);
+ ltp_rpt_ack_tree = proto_tree_add_subtree(ltp_tree, tvb,frame_offset, segment_offset,
+ ett_rpt_ack_segm, NULL, "Report Ack Segment");
proto_tree_add_uint64(ltp_rpt_ack_tree, hf_ltp_rpt_ack_sno, tvb, frame_offset,rpt_sno_size, rpt_sno);
return segment_offset;
@@ -509,15 +502,13 @@ static int
dissect_cancel_segment(proto_tree * ltp_tree, tvbuff_t *tvb,int frame_offset){
guint8 reason_code;
- proto_item *ltp_cancel_item;
proto_tree *ltp_cancel_tree;
/* The cancel segment has only one byte, which contains the reason code. */
reason_code = tvb_get_guint8(tvb,frame_offset);
/* Creating tree for the cancel segment */
- ltp_cancel_item = proto_tree_add_text(ltp_tree, tvb,frame_offset, 1, "Cancel Segment");
- ltp_cancel_tree = proto_item_add_subtree(ltp_cancel_item, ett_session_mgmt);
+ ltp_cancel_tree = proto_tree_add_subtree(ltp_tree, tvb,frame_offset, 1, ett_session_mgmt, NULL, "Cancel Segment");
proto_tree_add_uint_format_value(ltp_cancel_tree, hf_ltp_cancel_code, tvb, frame_offset, 1, reason_code,
"%x (%s)", reason_code, val_to_str_const(reason_code,ltp_cancel_codes,"Reserved"));
@@ -536,7 +527,6 @@ dissect_header_extn(proto_tree *ltp_tree, tvbuff_t *tvb,int frame_offset,int hdr
int i;
int extn_offset = 0;
- proto_item *ltp_hdr_extn_item;
proto_tree *ltp_hdr_extn_tree;
/* There can be more than one header extensions */
@@ -558,8 +548,7 @@ dissect_header_extn(proto_tree *ltp_tree, tvbuff_t *tvb,int frame_offset,int hdr
return 0;
}
}
- ltp_hdr_extn_item = proto_tree_add_text(ltp_tree, tvb,frame_offset, extn_offset, "Header Extension");
- ltp_hdr_extn_tree = proto_item_add_subtree(ltp_hdr_extn_item, ett_hdr_extn);
+ ltp_hdr_extn_tree = proto_tree_add_subtree(ltp_tree, tvb,frame_offset, extn_offset, ett_hdr_extn, NULL, "Header Extension");
for(i = 0; i < hdr_extn_cnt; i++){
proto_tree_add_uint_format_value(ltp_hdr_extn_tree, hf_ltp_hdr_extn_tag, tvb, frame_offset, 1, extn_type[i], "%x (%s)", extn_type[i], val_to_str_const(extn_type[i],extn_tag_codes,"Unassigned/Reserved"));
@@ -585,7 +574,6 @@ dissect_trailer_extn(proto_tree *ltp_tree, tvbuff_t *tvb,int frame_offset,int tr
int i;
int extn_offset = 0;
- proto_item *ltp_trl_extn_item;
proto_tree *ltp_trl_extn_tree;
DISSECTOR_ASSERT(trl_extn_cnt < LTP_MAX_TRL_EXTN);
@@ -612,8 +600,7 @@ dissect_trailer_extn(proto_tree *ltp_tree, tvbuff_t *tvb,int frame_offset,int tr
return 0;
}
}
- ltp_trl_extn_item = proto_tree_add_text(ltp_tree, tvb,frame_offset, extn_offset, "Header Extension");
- ltp_trl_extn_tree = proto_item_add_subtree(ltp_trl_extn_item, ett_trl_extn);
+ ltp_trl_extn_tree = proto_tree_add_subtree(ltp_tree, tvb,frame_offset, extn_offset, ett_trl_extn, NULL, "Header Extension");
for(i = 0; i < trl_extn_cnt; i++){
proto_tree_add_uint_format_value(ltp_trl_extn_tree, hf_ltp_trl_extn_tag, tvb, frame_offset, 1, extn_type[i], "%x (%s)", extn_type[i], val_to_str_const(extn_type[i],extn_tag_codes,"Unassigned/Reserved"));
@@ -687,8 +674,7 @@ dissect_ltp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
ltp_tree = proto_item_add_subtree(ti, ett_ltp);
/* Adding Header Subtree */
- ltp_header_item = proto_tree_add_text(ltp_tree, tvb, frame_offset, header_offset+1, "LTP Header");
- ltp_header_tree = proto_item_add_subtree(ltp_header_item, ett_ltp_hdr);
+ ltp_header_tree = proto_tree_add_subtree(ltp_tree, tvb, frame_offset, header_offset+1, ett_ltp_hdr, NULL, "LTP Header");
proto_tree_add_uint(ltp_header_tree,hf_ltp_version,tvb,frame_offset,1,hi_nibble(ltp_hdr));
ltp_type = lo_nibble(ltp_hdr);
diff --git a/epan/dissectors/packet-lwm.c b/epan/dissectors/packet-lwm.c
index d00d93a0c5..90e99ec2ee 100644
--- a/epan/dissectors/packet-lwm.c
+++ b/epan/dissectors/packet-lwm.c
@@ -352,8 +352,7 @@ static int dissect_lwm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
guint16 lwm_multi_header;
lwm_multi_header = tvb_get_letohs(tvb, 7);
- ti = proto_tree_add_text(lwm_tree, tvb, 7, 2, "Multicast Header");
- multi_tree = proto_item_add_subtree(ti, ett_lwm_multi_tree);
+ multi_tree = proto_tree_add_subtree(lwm_tree, tvb, 7, 2, ett_lwm_multi_tree, NULL, "Multicast Header");
proto_tree_add_uint(multi_tree, hf_lwm_multi_nmrad, tvb, 7, 2,
(lwm_multi_header & LWM_MULTI_NON_MEM_RAD_MASK) >> LWM_MULTI_NON_MEM_RAD_OFFSET);
@@ -423,9 +422,8 @@ static int dissect_lwm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
col_add_fstr(pinfo->cinfo, COL_INFO, "%s",
val_to_str(lwm_cmd, lwm_cmd_names, LWM_CMD_UNKNOWN_VAL_STRING));
- ti = proto_tree_add_text(lwm_tree, new_tvb, 0, -1, "%s",
+ lwm_cmd_tree = proto_tree_add_subtree(lwm_tree, new_tvb, 0, -1, ett_lwm_cmd_tree, &ti,
val_to_str(lwm_cmd, lwm_cmd_names, LWM_CMD_UNKNOWN_VAL_STRING));
- lwm_cmd_tree = proto_item_add_subtree(ti, ett_lwm_cmd_tree);
proto_tree_add_uint(lwm_cmd_tree, hf_lwm_cmd, new_tvb, 0, 1, lwm_cmd);
diff --git a/epan/dissectors/packet-lwres.c b/epan/dissectors/packet-lwres.c
index 5cbf7a2dac..6a37802751 100644
--- a/epan/dissectors/packet-lwres.c
+++ b/epan/dissectors/packet-lwres.c
@@ -204,7 +204,6 @@ static void dissect_getnamebyaddr_request(tvbuff_t* tvb, proto_tree* lwres_tree)
guint16 addrlen, slen;
const char* addrs;
- proto_item* nba_request_item;
proto_tree* nba_request_tree;
flags = tvb_get_ntohl(tvb, LWRES_LWPACKET_LENGTH);
@@ -213,12 +212,11 @@ static void dissect_getnamebyaddr_request(tvbuff_t* tvb, proto_tree* lwres_tree)
addrs = tvb_ip_to_str(tvb, LWRES_LWPACKET_LENGTH + 10);
slen = (int)strlen(addrs);
- if(lwres_tree)
- {
- nba_request_item = proto_tree_add_text(lwres_tree,tvb,LWRES_LWPACKET_LENGTH,LWRES_LWPACKET_LENGTH+14,"getnamebyaddr parameters");
- nba_request_tree = proto_item_add_subtree(nba_request_item, ett_nba_request);
- }
- else return;
+ if (lwres_tree == NULL)
+ return;
+
+ nba_request_tree = proto_tree_add_subtree(lwres_tree,tvb,LWRES_LWPACKET_LENGTH,LWRES_LWPACKET_LENGTH+14,
+ ett_nba_request,NULL,"getnamebyaddr parameters");
proto_tree_add_uint(nba_request_tree, hf_adn_flags, tvb,
LWRES_LWPACKET_LENGTH, 4, flags);
@@ -240,19 +238,13 @@ static void dissect_getnamebyaddr_response(tvbuff_t* tvb, proto_tree* lwres_tree
guint16 naliases,realnamelen,aliaslen;
gchar *aliasname;
-
- proto_item* nba_resp_item;
proto_tree* nba_resp_tree;
-
- proto_item* alias_item;
proto_tree* alias_tree;
- if(lwres_tree)
- {
- nba_resp_item = proto_tree_add_text(lwres_tree, tvb, LWRES_LWPACKET_LENGTH, 10,"getnamebyaddr records");
- nba_resp_tree = proto_item_add_subtree(nba_resp_item, ett_nba_resp);
- }
- else return;
+ if(lwres_tree == NULL)
+ return;
+
+ nba_resp_tree = proto_tree_add_subtree(lwres_tree, tvb, LWRES_LWPACKET_LENGTH, 10, ett_nba_resp, NULL, "getnamebyaddr records");
naliases = tvb_get_ntohs(tvb, LWRES_LWPACKET_LENGTH + 4);
realnamelen = tvb_get_ntohs(tvb,LWRES_LWPACKET_LENGTH + 4 + 2);
@@ -293,8 +285,8 @@ static void dissect_getnamebyaddr_response(tvbuff_t* tvb, proto_tree* lwres_tree
aliaslen = tvb_get_ntohs(tvb, offset);
aliasname = tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 2, aliaslen, ENC_ASCII);
- alias_item = proto_tree_add_text(nba_resp_tree, tvb, offset, 2 + aliaslen, "Alias %s",aliasname);
- alias_tree = proto_item_add_subtree(alias_item, ett_adn_alias);
+ alias_tree = proto_tree_add_subtree_format(nba_resp_tree, tvb, offset, 2 + aliaslen,
+ ett_adn_alias, NULL, "Alias %s",aliasname);
proto_tree_add_item(alias_tree,
hf_adn_namelen,
@@ -319,21 +311,17 @@ static void dissect_getaddrsbyname_request(tvbuff_t* tvb, proto_tree* lwres_tree
{
guint16 namelen;
- proto_item* adn_request_item;
proto_tree* adn_request_tree;
namelen = tvb_get_ntohs(tvb, LWRES_LWPACKET_LENGTH + 8);
- if(lwres_tree)
- {
- adn_request_item = proto_tree_add_text(lwres_tree,tvb,
- LWRES_LWPACKET_LENGTH,10+namelen+1,
- "getaddrbyname parameters");
- adn_request_tree = proto_item_add_subtree(adn_request_item, ett_adn_request);
- }
- else
+ if(lwres_tree == NULL)
return;
+ adn_request_tree = proto_tree_add_subtree(lwres_tree,tvb,
+ LWRES_LWPACKET_LENGTH,10+namelen+1,
+ ett_adn_request, NULL,
+ "getaddrbyname parameters");
proto_tree_add_item(adn_request_tree,
hf_adn_flags,
@@ -374,21 +362,17 @@ static void dissect_getaddrsbyname_response(tvbuff_t* tvb, proto_tree* lwres_tre
guint slen;
gchar *aliasname;
- proto_item *adn_resp_item;
proto_tree *adn_resp_tree;
- proto_item *alias_item;
proto_tree *alias_tree;
- proto_item *addr_item;
proto_tree *addr_tree;
- if(lwres_tree)
- {
- adn_resp_item = proto_tree_add_text(lwres_tree, tvb, LWRES_LWPACKET_LENGTH, 10, "getaddrbyname records");
- adn_resp_tree = proto_item_add_subtree(adn_resp_item, ett_adn_resp);
- }
- else return;
+ if(lwres_tree == NULL)
+ return;
+
+ adn_resp_tree = proto_tree_add_subtree(lwres_tree, tvb, LWRES_LWPACKET_LENGTH, 10,
+ ett_adn_resp, NULL, "getaddrbyname records");
naliases = tvb_get_ntohs(tvb, LWRES_LWPACKET_LENGTH + 4);
naddrs = tvb_get_ntohs(tvb, LWRES_LWPACKET_LENGTH + 6);
@@ -419,8 +403,8 @@ static void dissect_getaddrsbyname_response(tvbuff_t* tvb, proto_tree* lwres_tre
aliaslen = tvb_get_ntohs(tvb, offset);
aliasname = tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 2, aliaslen, ENC_ASCII);
- alias_item = proto_tree_add_text(adn_resp_tree, tvb, offset, 2 + aliaslen, "Alias %s",aliasname);
- alias_tree = proto_item_add_subtree(alias_item, ett_adn_alias);
+ alias_tree = proto_tree_add_subtree_format(adn_resp_tree, tvb, offset, 2 + aliaslen,
+ ett_adn_alias, NULL, "Alias %s",aliasname);
proto_tree_add_uint(alias_tree, hf_adn_namelen, tvb,
offset, 2, aliaslen);
@@ -441,8 +425,7 @@ static void dissect_getaddrsbyname_response(tvbuff_t* tvb, proto_tree* lwres_tre
addrs = tvb_ip_to_str(tvb, offset + 6);
slen = (int)strlen(addrs);
- addr_item = proto_tree_add_text(adn_resp_tree,tvb, offset, 4+2+4, "Address %s", addrs);
- addr_tree = proto_item_add_subtree(addr_item, ett_adn_addr);
+ addr_tree = proto_tree_add_subtree_format(adn_resp_tree,tvb, offset, 4+2+4, ett_adn_addr, NULL, "Address %s", addrs);
proto_tree_add_uint(addr_tree, hf_adn_family, tvb,
offset, 4, family);
@@ -464,40 +447,28 @@ static void dissect_a_records(tvbuff_t* tvb, proto_tree* tree,guint32 nrec,int o
{
guint32 i, curr;
const gchar* addrs;
- guint16 len;
- proto_item* a_rec_item;
proto_tree* a_rec_tree;
- proto_item* addr_item;
proto_tree* addr_tree;
- if(tree)
- {
- a_rec_item = proto_tree_add_text(tree,tvb,offset,
- (int)((sizeof(guint32) + sizeof(guint16)) * nrec),"A records");
-
- a_rec_tree = proto_item_add_subtree(a_rec_item, ett_a_rec);
- }
- else
+ if(tree == NULL)
return;
+ a_rec_tree = proto_tree_add_subtree(tree,tvb,offset,
+ (int)((sizeof(guint32) + sizeof(guint16)) * nrec),
+ ett_a_rec, NULL, "A records");
+
for(i=0; i<nrec; i++)
{
curr = offset + (int)((sizeof(guint32)+sizeof(guint16)) * i);
- len = tvb_get_ntohs(tvb,curr);
-
addrs = tvb_ip_to_str(tvb, curr+2);
- if(a_rec_tree)
- {
- addr_item = proto_tree_add_text(a_rec_tree, tvb, curr,
- 6, "Address %s", addrs);
- addr_tree = proto_item_add_subtree(addr_item, ett_a_rec_addr);
- }
- else return;
- proto_tree_add_uint(addr_tree, hf_a_rec_len, tvb, curr,
- sizeof(guint16), len);
+ addr_tree = proto_tree_add_subtree_format(a_rec_tree, tvb, curr,
+ 6, ett_a_rec_addr, NULL, "Address %s", addrs);
+
+ proto_tree_add_item(addr_tree, hf_a_rec_len, tvb, curr,
+ sizeof(guint16), ENC_BIG_ENDIAN);
proto_tree_add_text(addr_tree, tvb, curr + 2, 4, "Addr: %s",
addrs);
@@ -512,16 +483,12 @@ static void dissect_srv_records(tvbuff_t* tvb, proto_tree* tree,guint32 nrec,int
guint16 /*len, namelen,*/ priority, weight, port, dlen;
const guchar *dname;
- proto_item* srv_rec_item, *rec_item;
proto_item* srv_rec_tree, *rec_tree;
- if(tree)
- {
- srv_rec_item = proto_tree_add_text(tree, tvb, offset, offset, "SRV records");
- srv_rec_tree = proto_item_add_subtree(srv_rec_item, ett_srv_rec);
- proto_item_set_text(srv_rec_item, "SRV records (%d)", nrec);
- }
- else return;
+ if(tree == NULL)
+ return;
+
+ srv_rec_tree = proto_tree_add_subtree_format(tree, tvb, offset, offset, ett_srv_rec, NULL, "SRV records (%d)", nrec);
curr = offset;
@@ -535,18 +502,10 @@ static void dissect_srv_records(tvbuff_t* tvb, proto_tree* tree,guint32 nrec,int
dlen = get_dns_name(tvb, curr + 8, 0, curr + 8, &dname);
- if(srv_rec_tree)
- {
- rec_item = proto_tree_add_text(srv_rec_tree, tvb, curr, 6," ");
- rec_tree = proto_item_add_subtree(rec_item, ett_srv_rec_item);
- proto_item_set_text(rec_item,
- "SRV record:pri=%d,w=%d,port=%d,dname=%s",
- priority,
- weight,
- port,
- dname);
- }
- else return;
+ rec_tree = proto_tree_add_subtree_format(srv_rec_tree, tvb, curr, 6,
+ ett_srv_rec_item, NULL,
+ "SRV record:pri=%d,w=%d,port=%d,dname=%s",
+ priority, weight, port, dname);
proto_tree_add_uint(rec_tree,
hf_srv_prio,
@@ -589,18 +548,14 @@ static void dissect_mx_records(tvbuff_t* tvb, proto_tree* tree, guint32 nrec, in
guint /*len, namelen,*/ priority, dlen;
const guchar *dname;
- proto_item* mx_rec_item, *rec_item;
proto_tree* mx_rec_tree, *rec_tree;
- if(tree)
- {
- mx_rec_item = proto_tree_add_text(tree, tvb, offset, offset, "MX records (%d)", nrec);
- mx_rec_tree = proto_item_add_subtree(mx_rec_item, ett_mx_rec);
- }
- else
+ if(tree == NULL)
return;
+ mx_rec_tree = proto_tree_add_subtree_format(tree, tvb, offset, offset, ett_mx_rec, NULL, "MX records (%d)", nrec);
+
curr = offset;
for(i=0; i < nrec; i++)
{
@@ -609,22 +564,17 @@ static void dissect_mx_records(tvbuff_t* tvb, proto_tree* tree, guint32 nrec, in
/*namelen = len - 4;*/
dlen = get_dns_name(tvb, curr + 4, 0, curr + 4, &dname);
- if(mx_rec_tree)
- {
- rec_item = proto_tree_add_text(mx_rec_tree, tvb, curr,6,"MX record: pri=%d,dname=%s",
- priority,dname);
- rec_tree = proto_item_add_subtree(rec_item, ett_mx_rec_item);
- }
- else
- return;
+ rec_tree = proto_tree_add_subtree_format(mx_rec_tree, tvb, curr,6,ett_mx_rec_item,NULL,
+ "MX record: pri=%d,dname=%s", priority,dname);
- proto_tree_add_uint(rec_tree,
+
+ proto_tree_add_item(rec_tree,
hf_srv_prio,
tvb,
curr + 2,
2,
- priority);
+ ENC_BIG_ENDIAN);
proto_tree_add_text(rec_tree,
tvb,
@@ -645,16 +595,13 @@ static void dissect_ns_records(tvbuff_t* tvb, proto_tree* tree, guint32 nrec, in
guint /*len, namelen,*/ dlen;
const guchar *dname;
- proto_item* ns_rec_item, *rec_item;
proto_tree* ns_rec_tree, *rec_tree;
- if(tree)
- {
- ns_rec_item = proto_tree_add_text(tree, tvb, offset, offset, "NS record (%d)", nrec);
- ns_rec_tree = proto_item_add_subtree(ns_rec_item, ett_ns_rec);
- }
- else
+ if(tree == NULL)
return;
+
+ ns_rec_tree = proto_tree_add_subtree_format(tree, tvb, offset, offset, ett_ns_rec, NULL, "NS record (%d)", nrec);
+
curr=offset;
for(i=0;i<nrec;i++)
@@ -663,13 +610,8 @@ static void dissect_ns_records(tvbuff_t* tvb, proto_tree* tree, guint32 nrec, in
/*namelen = len - 2;*/
dlen = get_dns_name(tvb, curr + 2, 0, curr + 2, &dname);
- if(ns_rec_tree)
- {
- rec_item = proto_tree_add_text(ns_rec_tree, tvb, curr,4, "NS record: dname=%s",dname);
- rec_tree = proto_item_add_subtree(rec_item, ett_ns_rec_item);
- }
- else
- return;
+
+ rec_tree = proto_tree_add_subtree_format(ns_rec_tree, tvb, curr,4, ett_ns_rec_item, NULL, "NS record: dname=%s",dname);
proto_tree_add_text(rec_tree,
tvb,
@@ -687,20 +629,16 @@ static void dissect_rdata_request(tvbuff_t* tvb, proto_tree* lwres_tree)
{
guint16 namelen;
- proto_item* rdata_request_item;
proto_tree* rdata_request_tree;
namelen = tvb_get_ntohs(tvb, LWRES_LWPACKET_LENGTH+8);
- if(lwres_tree)
- {
- rdata_request_item =
- proto_tree_add_text(lwres_tree,tvb,LWRES_LWPACKET_LENGTH,10+namelen+1,"RDATA request parameters");
- rdata_request_tree = proto_item_add_subtree(rdata_request_item, ett_rdata_req);
- }
- else
+ if(lwres_tree == NULL)
return;
+ rdata_request_tree =
+ proto_tree_add_subtree(lwres_tree,tvb,LWRES_LWPACKET_LENGTH,10+namelen+1,ett_rdata_req,NULL,"RDATA request parameters");
+
proto_tree_add_item(rdata_request_tree,
hf_rflags,
tvb,
@@ -743,7 +681,6 @@ static void dissect_rdata_response(tvbuff_t* tvb, proto_tree* lwres_tree)
guint offset;
guint rdtype, nrdatas, realnamelen;
- proto_item* rdata_resp_item;
proto_tree* rdata_resp_tree;
rdtype = tvb_get_ntohs(tvb, LWRES_LWPACKET_LENGTH+6);
@@ -752,14 +689,11 @@ static void dissect_rdata_response(tvbuff_t* tvb, proto_tree* lwres_tree)
offset = LWRES_LWPACKET_LENGTH + 18 + realnamelen + 1;
- if(lwres_tree)
- {
- rdata_resp_item = proto_tree_add_text(lwres_tree,tvb,LWRES_LWPACKET_LENGTH, 18+realnamelen+1,"RDATA response");
- rdata_resp_tree = proto_item_add_subtree(rdata_resp_item, ett_rdata_resp);
- }
- else
+ if(lwres_tree == NULL)
return;
+ rdata_resp_tree = proto_tree_add_subtree(lwres_tree,tvb,LWRES_LWPACKET_LENGTH, 18+realnamelen+1,ett_rdata_resp,NULL,"RDATA response");
+
proto_tree_add_item(rdata_resp_tree,
hf_rflags,
tvb,
@@ -841,19 +775,15 @@ static void dissect_noop(tvbuff_t* tvb, proto_tree* lwres_tree)
{
guint16 datalen;
- proto_item* noop_item;
proto_tree* noop_tree;
datalen = tvb_get_ntohs(tvb, LWRES_LWPACKET_LENGTH);
- if(lwres_tree)
- {
- noop_item = proto_tree_add_text(lwres_tree, tvb, LWRES_LWPACKET_LENGTH, 10, "Noop record");
- noop_tree = proto_item_add_subtree(noop_item, ett_noop);
- }
- else
+ if(lwres_tree == NULL)
return;
+ noop_tree = proto_tree_add_subtree(lwres_tree, tvb, LWRES_LWPACKET_LENGTH, 10, ett_noop, NULL, "Noop record");
+
proto_tree_add_uint(noop_tree, hf_length, tvb,
LWRES_LWPACKET_LENGTH, sizeof(guint16), datalen);
@@ -926,13 +856,11 @@ dissect_lwres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
serial);
}
- if(tree)
- {
- lwres_item = proto_tree_add_item(tree,proto_lwres, tvb,0, -1, ENC_NA);
- lwres_tree = proto_item_add_subtree(lwres_item, ett_lwres);
- }
- else return;
+ if(tree == NULL)
+ return;
+ lwres_item = proto_tree_add_item(tree,proto_lwres, tvb,0, -1, ENC_NA);
+ lwres_tree = proto_item_add_subtree(lwres_item, ett_lwres);
proto_tree_add_uint(lwres_tree,
hf_length,