aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-06-23 20:39:28 -0400
committerMichael Mann <mmann78@netscape.net>2014-06-24 23:42:13 +0000
commit29ecd114bfd3ba01ee340ffa084eeeafb886f750 (patch)
tree7eddcc9b3c8c7d41294be2aaf60c86befbd49a0b
parent83da877fffaa3de727809918070dafb4d590e1fd (diff)
convert to proto_tree_add_subtree[_format]
Change-Id: I5f573dffabb8685a8e5a334ff2bfb24d9838daa6 Reviewed-on: https://code.wireshark.org/review/2601 Tested-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--epan/dissectors/packet-canopen.c8
-rw-r--r--epan/dissectors/packet-cast.c95
-rw-r--r--epan/dissectors/packet-ccsds.c8
-rw-r--r--epan/dissectors/packet-cdp.c227
-rw-r--r--epan/dissectors/packet-cell_broadcast.c12
-rw-r--r--epan/dissectors/packet-cfdp.c51
-rw-r--r--epan/dissectors/packet-cfm.c6
-rw-r--r--epan/dissectors/packet-cimd.c18
-rw-r--r--epan/dissectors/packet-cip.c164
-rw-r--r--epan/dissectors/packet-cipmotion.c75
-rw-r--r--epan/dissectors/packet-cipsafety.c48
-rw-r--r--epan/dissectors/packet-classicstun.c5
-rw-r--r--epan/dissectors/packet-clip.c4
-rw-r--r--epan/dissectors/packet-clique-rm.c13
-rw-r--r--epan/dissectors/packet-clnp.c5
-rw-r--r--epan/dissectors/packet-collectd.c139
-rw-r--r--epan/dissectors/packet-componentstatus.c19
-rw-r--r--epan/dissectors/packet-cops.c237
-rw-r--r--epan/dissectors/packet-csn1.c30
-rw-r--r--epan/dissectors/packet-dcc.c15
20 files changed, 443 insertions, 736 deletions
diff --git a/epan/dissectors/packet-canopen.c b/epan/dissectors/packet-canopen.c
index e560efb359..d37407c457 100644
--- a/epan/dissectors/packet-canopen.c
+++ b/epan/dissectors/packet-canopen.c
@@ -232,7 +232,7 @@ dissect_canopen(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
tvb_bytes_to_ep_str_punct(tvb, offset, can_data_len, ' '));
if (tree) {
- proto_item *ti, *cob_ti, *type_ti;
+ proto_item *ti, *cob_ti;
proto_tree *canopen_tree;
proto_tree *canopen_cob_tree;
proto_tree *canopen_type_tree;
@@ -254,11 +254,9 @@ dissect_canopen(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
/* add CANopen frame type */
- type_ti = proto_tree_add_text(canopen_tree, tvb, 0,
+ canopen_type_tree = proto_tree_add_subtree_format(canopen_tree, tvb, 0,
(msg_type_id != MT_SYNC) ? -1 : 0,
- "Type: %s", function_code_str);
- canopen_type_tree = proto_item_add_subtree(type_ti, ett_canopen);
-
+ ett_canopen, NULL, "Type: %s", function_code_str);
switch(msg_type_id)
{
case MT_NMT_CTRL:
diff --git a/epan/dissectors/packet-cast.c b/epan/dissectors/packet-cast.c
index e6a2943ca3..b48d03f693 100644
--- a/epan/dissectors/packet-cast.c
+++ b/epan/dissectors/packet-cast.c
@@ -416,7 +416,6 @@ dissect_cast_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
/* Set up structures we will need to add the protocol subtree and manage it */
proto_item *ti;
proto_tree *cast_tree = NULL;
- proto_item *ti_sub;
proto_tree *cast_sub_tree;
proto_tree *cast_sub_tree_sav;
proto_tree *cast_sub_tree_sav_sav;
@@ -467,8 +466,7 @@ dissect_cast_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
count = offset+28;
/* total of 120 bytes */
for ( i = 0; i < MAX_CUSTOM_PICTURES; i++ ) {
- ti_sub = proto_tree_add_text(cast_tree, tvb, offset, 20, "customPictureFormat[%d]", i);
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree_format(cast_tree, tvb, offset, 20, ett_cast_tree, NULL, "customPictureFormat[%d]", i);
proto_tree_add_item(cast_sub_tree, hf_cast_pictureWidth, tvb, count, 4, ENC_LITTLE_ENDIAN);
count+= 4;
proto_tree_add_item(cast_sub_tree, hf_cast_pictureHeight, tvb, count, 4, ENC_LITTLE_ENDIAN);
@@ -480,8 +478,7 @@ dissect_cast_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
proto_tree_add_item(cast_sub_tree, hf_cast_clockDivisor, tvb, count, 4, ENC_LITTLE_ENDIAN);
count+= 4;
}
- ti_sub = proto_tree_add_text(cast_tree, tvb, offset, 8, "confResources");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_tree, tvb, offset, 8, ett_cast_tree, NULL, "confResources");
proto_tree_add_item(cast_sub_tree, hf_cast_activeStreamsOnRegistration, tvb, count, 4, ENC_LITTLE_ENDIAN);
count+= 4;
proto_tree_add_item(cast_sub_tree, hf_cast_maxBW, tvb, count, 4, ENC_LITTLE_ENDIAN);
@@ -491,14 +488,12 @@ dissect_cast_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
cast_sub_tree_sav = cast_sub_tree;
/* total of 160 bytes */
for ( i = 0; i < MAX_SERVICE_TYPE; i++ ) {
- ti_sub = proto_tree_add_text(cast_sub_tree_sav, tvb, offset, 20, "serviceResource[%d]", i);
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree_format(cast_sub_tree_sav, tvb, offset, 20, ett_cast_tree, NULL, "serviceResource[%d]", i);
proto_tree_add_item(cast_sub_tree, hf_cast_layoutCount, tvb, count, 4, ENC_LITTLE_ENDIAN);
count+= 4;
cast_sub_tree_sav_sav = cast_sub_tree_sav;
for ( t = 0; t < MAX_LAYOUT_WITH_SAME_SERVICE; t++ ) {
- ti_sub = proto_tree_add_text(cast_sub_tree_sav, tvb, offset, 20, "layouts[%d]", t);
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree_format(cast_sub_tree_sav, tvb, offset, 20, ett_cast_tree, NULL, "layouts[%d]", t);
proto_tree_add_item(cast_sub_tree, hf_cast_layout, tvb, count, 4, ENC_LITTLE_ENDIAN);
count+= 4;
}
@@ -514,8 +509,7 @@ dissect_cast_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
}
/* total of 176 bytes */
for ( i = 0; i < StationMaxVideoCapabilities; i++ ) {
- ti_sub = proto_tree_add_text(cast_tree, tvb, offset, 20, "vidCaps[%d]", i);
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree_format(cast_tree, tvb, offset, 20, ett_cast_tree, NULL, "vidCaps[%d]", i);
proto_tree_add_item(cast_sub_tree, hf_cast_payloadCapability, tvb, count, 4, ENC_LITTLE_ENDIAN);
count+= 4;
proto_tree_add_item(cast_sub_tree, hf_cast_transmitOrReceive, tvb, count, 4, ENC_LITTLE_ENDIAN);
@@ -524,8 +518,7 @@ dissect_cast_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
count+= 4;
cast_sub_tree_sav = cast_sub_tree;
for ( t = 0; t < MAX_LEVEL_PREFERENCE; t++ ) {
- ti_sub = proto_tree_add_text(cast_sub_tree_sav, tvb, offset, 20, "levelPreference[%d]", t);
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree_format(cast_sub_tree_sav, tvb, offset, 20, ett_cast_tree, NULL, "levelPreference[%d]", t);
proto_tree_add_item(cast_sub_tree, hf_cast_transmitPreference, tvb, count, 4, ENC_LITTLE_ENDIAN);
count+= 4;
proto_tree_add_item(cast_sub_tree, hf_cast_format, tvb, count, 4, ENC_LITTLE_ENDIAN);
@@ -541,20 +534,17 @@ dissect_cast_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
}
/* H.261 */
- ti_sub = proto_tree_add_text(cast_sub_tree_sav, tvb, offset, 8, "h261VideoCapability");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_sub_tree_sav, tvb, offset, 8, ett_cast_tree, NULL, "h261VideoCapability");
proto_tree_add_item(cast_sub_tree, hf_cast_temporalSpatialTradeOffCapability, tvb, count, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(cast_sub_tree, hf_cast_stillImageTransmission, tvb, count+4, 4, ENC_LITTLE_ENDIAN);
/* H.263 */
- ti_sub = proto_tree_add_text(cast_sub_tree_sav, tvb, offset, 8, "h263VideoCapability");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_sub_tree_sav, tvb, offset, 8, ett_cast_tree, NULL, "h263VideoCapability");
proto_tree_add_item(cast_sub_tree, hf_cast_h263_capability_bitfield, tvb, count, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(cast_sub_tree, hf_cast_annexNandWFutureUse, tvb, count+4, 4, ENC_LITTLE_ENDIAN);
/* Vieo */
- ti_sub = proto_tree_add_text(cast_sub_tree_sav, tvb, offset, 8, "vieoVideoCapability");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_sub_tree_sav, tvb, offset, 8, ett_cast_tree, NULL, "vieoVideoCapability");
proto_tree_add_item(cast_sub_tree, hf_cast_modelNumber, tvb, count, 4, ENC_LITTLE_ENDIAN);
count+= 4;
proto_tree_add_item(cast_sub_tree, hf_cast_bandwidth, tvb, count, 4, ENC_LITTLE_ENDIAN);
@@ -562,8 +552,7 @@ dissect_cast_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
}
/* total 80 bytes */
for ( i = 0; i < StationMaxDataCapabilities; i++ ) {
- ti_sub = proto_tree_add_text(cast_tree, tvb, offset, 20, "dataCaps[%d]", i);
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree_format(cast_tree, tvb, offset, 20, ett_cast_tree, NULL, "dataCaps[%d]", i);
proto_tree_add_item(cast_sub_tree, hf_cast_payloadCapability, tvb, count, 4, ENC_LITTLE_ENDIAN);
count+= 4;
proto_tree_add_item(cast_sub_tree, hf_cast_transmitOrReceive, tvb, count, 4, ENC_LITTLE_ENDIAN);
@@ -589,22 +578,19 @@ dissect_cast_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
proto_tree_add_item(cast_tree, hf_cast_isConferenceCreator, tvb, offset+40, 4, ENC_LITTLE_ENDIAN);
/* add audio part of union */
- ti_sub = proto_tree_add_text(cast_tree, tvb, offset, 12, "audioParameters");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_tree, tvb, offset, 12, ett_cast_tree, NULL, "audioParameters");
proto_tree_add_item(cast_sub_tree, hf_cast_millisecondPacketSize, tvb, offset+44, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(cast_sub_tree, hf_cast_echoCancelType, tvb, offset+48, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(cast_sub_tree, hf_cast_g723BitRate, tvb, offset+52, 4, ENC_LITTLE_ENDIAN);
/* add video part of union */
- ti_sub = proto_tree_add_text(cast_tree, tvb, offset, 30, "videoParameters");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_tree, tvb, offset, 30, ett_cast_tree, NULL, "videoParameters");
proto_tree_add_item(cast_sub_tree, hf_cast_bitRate, tvb, offset+44, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(cast_sub_tree, hf_cast_pictureFormatCount, tvb, offset+48, 4, ENC_LITTLE_ENDIAN);
cast_sub_tree_sav = cast_sub_tree;
count = offset+52;
for ( i = 0; i < MAX_PICTURE_FORMAT; i++ ) {
- ti_sub = proto_tree_add_text(cast_sub_tree_sav, tvb, offset, 8 * MAX_PICTURE_FORMAT, "pictureFormat[%d]", i);
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree_format(cast_sub_tree_sav, tvb, offset, 8 * MAX_PICTURE_FORMAT, ett_cast_tree, NULL, "pictureFormat[%d]", i);
proto_tree_add_item(cast_sub_tree, hf_cast_format, tvb, count, 4, ENC_LITTLE_ENDIAN);
count += 4;
proto_tree_add_item(cast_sub_tree, hf_cast_MPI, tvb, count, 4, ENC_LITTLE_ENDIAN);
@@ -615,27 +601,23 @@ dissect_cast_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
count += 4;
/* add H261 part of union */
- ti_sub = proto_tree_add_text(cast_sub_tree_sav, tvb, offset, 8, "h261VideoCapability");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_sub_tree_sav, tvb, offset, 8, ett_cast_tree, NULL, "h261VideoCapability");
proto_tree_add_item(cast_sub_tree, hf_cast_temporalSpatialTradeOffCapability, tvb, count, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(cast_sub_tree, hf_cast_stillImageTransmission, tvb, count+4, 4, ENC_LITTLE_ENDIAN);
/* add H263 part of union */
- ti_sub = proto_tree_add_text(cast_sub_tree_sav, tvb, offset, 8, "h263VideoCapability");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_sub_tree_sav, tvb, offset, 8, ett_cast_tree, NULL, "h263VideoCapability");
proto_tree_add_item(cast_sub_tree, hf_cast_h263_capability_bitfield, tvb, count, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(cast_sub_tree, hf_cast_annexNandWFutureUse, tvb, count+4, 4, ENC_LITTLE_ENDIAN);
/* add Vieo part of union */
- ti_sub = proto_tree_add_text(cast_sub_tree_sav, tvb, offset, 8, "vieoVideoCapability");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_sub_tree_sav, tvb, offset, 8, ett_cast_tree, NULL, "vieoVideoCapability");
proto_tree_add_item(cast_sub_tree, hf_cast_modelNumber, tvb, count, 4, ENC_LITTLE_ENDIAN);
count += 4;
proto_tree_add_item(cast_sub_tree, hf_cast_bandwidth, tvb, count, 4, ENC_LITTLE_ENDIAN);
/* add data part of union */
- ti_sub = proto_tree_add_text(cast_tree, tvb, offset, 8, "dataParameters");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_tree, tvb, offset, 8, ett_cast_tree, NULL, "dataParameters");
proto_tree_add_item(cast_sub_tree, hf_cast_protocolDependentData, tvb, offset+44, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(cast_sub_tree, hf_cast_maxBitRate, tvb, offset+48, 4, ENC_LITTLE_ENDIAN);
break;
@@ -666,15 +648,14 @@ dissect_cast_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
proto_tree_add_item(cast_tree, hf_cast_DSCPValue, tvb, offset+44, 4, ENC_LITTLE_ENDIAN);
/* add video part of union */
- ti_sub = proto_tree_add_text(cast_tree, tvb, offset, 30, "videoParameters");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_tree, tvb, offset, 30, ett_cast_tree, NULL, "videoParameters");
proto_tree_add_item(cast_sub_tree, hf_cast_bitRate, tvb, offset+48, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(cast_sub_tree, hf_cast_pictureFormatCount, tvb, offset+52, 4, ENC_LITTLE_ENDIAN);
cast_sub_tree_sav = cast_sub_tree;
count = offset+56;
for ( i = 0; i < MAX_PICTURE_FORMAT; i++ ) {
- ti_sub = proto_tree_add_text(cast_sub_tree_sav, tvb, offset, 8 * MAX_PICTURE_FORMAT, "pictureFormat[%d]", i);
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree_format(cast_sub_tree_sav, tvb, offset, 8 * MAX_PICTURE_FORMAT,
+ ett_cast_tree, NULL, "pictureFormat[%d]", i);
proto_tree_add_item(cast_sub_tree, hf_cast_format, tvb, count, 4, ENC_LITTLE_ENDIAN);
count += 4;
proto_tree_add_item(cast_sub_tree, hf_cast_MPI, tvb, count, 4, ENC_LITTLE_ENDIAN);
@@ -686,31 +667,27 @@ dissect_cast_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
val = count;
/* add H261 part of union */
- ti_sub = proto_tree_add_text(cast_sub_tree_sav, tvb, offset, 8, "h261VideoCapability");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_sub_tree_sav, tvb, offset, 8, ett_cast_tree, NULL, "h261VideoCapability");
proto_tree_add_item(cast_sub_tree, hf_cast_temporalSpatialTradeOffCapability, tvb, count, 4, ENC_LITTLE_ENDIAN);
count += 4;
proto_tree_add_item(cast_sub_tree, hf_cast_stillImageTransmission, tvb, count, 4, ENC_LITTLE_ENDIAN);
/* add H263 part of union */
count = val;
- ti_sub = proto_tree_add_text(cast_sub_tree_sav, tvb, offset, 8, "h263VideoCapability");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_sub_tree_sav, tvb, offset, 8, ett_cast_tree, NULL, "h263VideoCapability");
proto_tree_add_item(cast_sub_tree, hf_cast_h263_capability_bitfield, tvb, count, 4, ENC_LITTLE_ENDIAN);
count += 4;
proto_tree_add_item(cast_sub_tree, hf_cast_annexNandWFutureUse, tvb, count, 4, ENC_LITTLE_ENDIAN);
/* add Vieo part of union */
count = val;
- ti_sub = proto_tree_add_text(cast_sub_tree_sav, tvb, offset, 8, "vieoVideoCapability");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_sub_tree_sav, tvb, offset, 8, ett_cast_tree, NULL, "vieoVideoCapability");
proto_tree_add_item(cast_sub_tree, hf_cast_modelNumber, tvb, count, 4, ENC_LITTLE_ENDIAN);
count += 4;
proto_tree_add_item(cast_sub_tree, hf_cast_bandwidth, tvb, count, 4, ENC_LITTLE_ENDIAN);
/* add data part of union */
- ti_sub = proto_tree_add_text(cast_tree, tvb, offset, 8, "dataParameters");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_tree, tvb, offset, 8, ett_cast_tree, NULL, "dataParameters");
proto_tree_add_item(cast_sub_tree, hf_cast_protocolDependentData, tvb, offset+48, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(cast_sub_tree, hf_cast_maxBitRate, tvb, offset+52, 4, ENC_LITTLE_ENDIAN);
break;
@@ -734,47 +711,40 @@ dissect_cast_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
/* not sure of format */
/* show videoFastUpdateGOB */
- ti_sub = proto_tree_add_text(cast_tree, tvb, offset, 8, "videoFastUpdateGOB");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_tree, tvb, offset, 8, ett_cast_tree, NULL, "videoFastUpdateGOB");
proto_tree_add_item(cast_sub_tree, hf_cast_firstGOB, tvb, offset+28, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(cast_sub_tree, hf_cast_numberOfGOBs, tvb, offset+32, 4, ENC_LITTLE_ENDIAN);
/* show videoFastUpdateMB */
- ti_sub = proto_tree_add_text(cast_tree, tvb, offset, 8, "videoFastUpdateGOB");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_tree, tvb, offset, 8, ett_cast_tree, NULL, "videoFastUpdateGOB");
proto_tree_add_item(cast_sub_tree, hf_cast_firstGOB, tvb, offset+28, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(cast_sub_tree, hf_cast_firstMB, tvb, offset+32, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(cast_sub_tree, hf_cast_numberOfMBs, tvb, offset+36, 4, ENC_LITTLE_ENDIAN);
/* show lostPicture */
- ti_sub = proto_tree_add_text(cast_tree, tvb, offset, 8, "lostPicture");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_tree, tvb, offset, 8, ett_cast_tree, NULL, "lostPicture");
proto_tree_add_item(cast_sub_tree, hf_cast_pictureNumber, tvb, offset+28, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(cast_sub_tree, hf_cast_longTermPictureIndex, tvb, offset+32, 4, ENC_LITTLE_ENDIAN);
/* show lostPartialPicture */
- ti_sub = proto_tree_add_text(cast_tree, tvb, offset, 8, "lostPartialPicture");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_tree, tvb, offset, 8, ett_cast_tree, NULL, "lostPartialPicture");
proto_tree_add_item(cast_sub_tree, hf_cast_pictureNumber, tvb, offset+28, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(cast_sub_tree, hf_cast_longTermPictureIndex, tvb, offset+32, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(cast_sub_tree, hf_cast_firstMB, tvb, offset+36, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(cast_sub_tree, hf_cast_numberOfMBs, tvb, offset+40, 4, ENC_LITTLE_ENDIAN);
/* show recoveryReferencePicture */
- ti_sub = proto_tree_add_text(cast_tree, tvb, offset, 8, "recoveryReferencePicture");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_tree, tvb, offset, 8, ett_cast_tree, NULL, "recoveryReferencePicture");
proto_tree_add_item(cast_sub_tree, hf_cast_recoveryReferencePictureCount, tvb, offset+28, 4, ENC_LITTLE_ENDIAN);
cast_sub_tree_sav = cast_sub_tree;
for ( i = 0; i < MAX_REFERENCE_PICTURE; i++ ) {
- ti_sub = proto_tree_add_text(cast_sub_tree_sav, tvb, offset, 8, "recoveryReferencePicture[%d]", i);
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree_format(cast_sub_tree_sav, tvb, offset, 8, ett_cast_tree, NULL, "recoveryReferencePicture[%d]", i);
proto_tree_add_item(cast_sub_tree, hf_cast_pictureNumber, tvb, offset+32+(i*8), 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(cast_sub_tree, hf_cast_longTermPictureIndex, tvb, offset+36+(i*8), 4, ENC_LITTLE_ENDIAN);
}
/* show temporalSpatialTradeOff */
- ti_sub = proto_tree_add_text(cast_tree, tvb, offset, 4, "temporalSpatialTradeOff");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_tree, tvb, offset, 4, ett_cast_tree, NULL, "temporalSpatialTradeOff");
proto_tree_add_item(cast_sub_tree, hf_cast_temporalSpatialTradeOff, tvb, offset+28, 4, ENC_LITTLE_ENDIAN);
break;
@@ -847,8 +817,7 @@ dissect_cast_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
i += 4;
proto_tree_add_item(cast_tree, hf_cast_callSecurityStatus, tvb, i, 4, ENC_LITTLE_ENDIAN);
i += 4;
- ti_sub = proto_tree_add_text(cast_tree, tvb, offset, 8, "partyPIRestrictionBits");
- cast_sub_tree = proto_item_add_subtree(ti_sub, ett_cast_tree);
+ cast_sub_tree = proto_tree_add_subtree(cast_tree, tvb, offset, 8, ett_cast_tree, NULL, "partyPIRestrictionBits");
proto_tree_add_item(cast_sub_tree, hf_cast_partyPIRestrictionBits_CallingPartyName, tvb, i, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(cast_sub_tree, hf_cast_partyPIRestrictionBits_CallingPartyNumber, tvb, i, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(cast_sub_tree, hf_cast_partyPIRestrictionBits_CalledPartyName, tvb, i, 4, ENC_LITTLE_ENDIAN);
diff --git a/epan/dissectors/packet-ccsds.c b/epan/dissectors/packet-ccsds.c
index 02e71ea43a..daf27d4f3a 100644
--- a/epan/dissectors/packet-ccsds.c
+++ b/epan/dissectors/packet-ccsds.c
@@ -346,8 +346,8 @@ dissect_ccsds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ccsds_tree = proto_item_add_subtree(ccsds_packet, ett_ccsds);
/* build the ccsds primary header tree */
- primary_header = proto_tree_add_text(ccsds_tree, tvb, offset, CCSDS_PRIMARY_HEADER_LENGTH, "Primary CCSDS Header");
- primary_header_tree = proto_item_add_subtree(primary_header, ett_ccsds_primary_header);
+ primary_header_tree = proto_tree_add_subtree(ccsds_tree, tvb, offset, CCSDS_PRIMARY_HEADER_LENGTH,
+ ett_ccsds_primary_header, &primary_header, "Primary CCSDS Header");
proto_tree_add_uint(primary_header_tree, hf_ccsds_version, tvb, offset, 2, first_word);
proto_tree_add_uint(primary_header_tree, hf_ccsds_type, tvb, offset, 2, first_word);
@@ -371,8 +371,8 @@ dissect_ccsds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* build the ccsds secondary header tree */
if ( first_word & HDR_SECHDR )
{
- secondary_header = proto_tree_add_text(ccsds_tree, tvb, offset, CCSDS_SECONDARY_HEADER_LENGTH, "Secondary CCSDS Header");
- secondary_header_tree = proto_item_add_subtree(secondary_header, ett_ccsds_secondary_header);
+ secondary_header_tree = proto_tree_add_subtree(ccsds_tree, tvb, offset, CCSDS_SECONDARY_HEADER_LENGTH,
+ ett_ccsds_secondary_header, &secondary_header, "Secondary CCSDS Header");
/* command ccsds secondary header flags */
coarse_time = tvb_get_ntohl(tvb, offset);
diff --git a/epan/dissectors/packet-cdp.c b/epan/dissectors/packet-cdp.c
index de920e3ae0..3fb19913d6 100644
--- a/epan/dissectors/packet-cdp.c
+++ b/epan/dissectors/packet-cdp.c
@@ -320,10 +320,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
length = tvb_get_ntohs(tvb, offset + TLV_LENGTH);
if (length < 4) {
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb, offset, 4,
- "TLV with invalid length %u (< 4)",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb, offset, 4,
+ ett_cdp_tlv, NULL, "TLV with invalid length %u (< 4)",
length);
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
}
@@ -341,10 +340,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb_format_stringzpad(tvb, offset + 4, length - 4));
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb, offset,
- length, "Device ID: %s",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb, offset,
+ length, ett_cdp_tlv, NULL, "Device ID: %s",
tvb_format_stringzpad(tvb, offset + 4, length - 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_deviceid, tvb, offset + 4, length - 4, ENC_ASCII|ENC_NA);
@@ -370,10 +368,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
length - 4));
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb, offset,
- real_length, "Port ID: %s",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb, offset,
+ real_length, ett_cdp_tlv, NULL, "Port ID: %s",
tvb_format_text(tvb, offset + 4, real_length - 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_portid, tvb, offset + 4, real_length - 4, ENC_ASCII|ENC_NA);
@@ -384,9 +381,8 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_ADDRESS:
/* Addresses */
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb, offset,
- length, "Addresses");
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
+ tlv_tree = proto_tree_add_subtree(cdp_tree, tvb, offset,
+ length, ett_cdp_tlv, NULL, "Addresses");
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
}
@@ -414,9 +410,8 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_CAPABILITIES:
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb, offset,
- length, "Capabilities");
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
+ tlv_tree = proto_tree_add_subtree(cdp_tree, tvb, offset,
+ length, ett_cdp_tlv, NULL, "Capabilities");
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
}
@@ -428,9 +423,8 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_IOS_VERSION:
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb, offset,
- length, "Software Version");
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
+ tlv_tree = proto_tree_add_subtree(cdp_tree, tvb, offset,
+ length, ett_cdp_tlv, NULL, "Software Version");
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
add_multi_line_string_to_tree(tlv_tree, tvb, offset + 4,
@@ -442,10 +436,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_PLATFORM:
/* ??? platform */
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "Platform: %s",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "Platform: %s",
tvb_format_text(tvb, offset + 4, length - 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_platform, tvb, offset + 4, length - 4, ENC_ASCII|ENC_NA);
@@ -457,10 +450,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (length == 8) {
/* if length is 8 then this is default gw not prefix */
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb, offset,
- length, "ODR Default gateway: %s",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb, offset,
+ length, ett_cdp_tlv, NULL, "ODR Default gateway: %s",
tvb_ip_to_str(tvb, offset+4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_text(tlv_tree, tvb, offset+4, 4,
@@ -470,14 +462,13 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += 8;
} else {
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb, offset,
- length, "IP Prefixes: %d",length/5);
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb, offset,
+ length, ett_cdp_tlv, NULL, "IP Prefixes: %d",length/5);
/* the actual number of prefixes is (length-4)/5
but if the variable is not a "float" but "integer"
then length/5=(length-4)/5 :) */
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
}
@@ -498,10 +489,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_PROTOCOL_HELLO:
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset,length, "Protocol Hello: %s",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset,length, ett_cdp_tlv, NULL, "Protocol Hello: %s",
val_to_str(tvb_get_ntohs(tvb, offset+7), type_hello_vals, "Unknown (0x%04x)"));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_text(tlv_tree, tvb, offset+4, 3,
@@ -562,10 +552,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_VTP_MGMT_DOMAIN:
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "VTP Management Domain: %s",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "VTP Management Domain: %s",
tvb_format_text(tvb, offset + 4, length - 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_text(tlv_tree, tvb, offset + 4,
@@ -577,10 +566,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_NATIVE_VLAN:
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "Native VLAN: %u",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "Native VLAN: %u",
tvb_get_ntohs(tvb, offset + 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_text(tlv_tree, tvb, offset + 4,
@@ -592,11 +580,10 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_DUPLEX:
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "Duplex: %s",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "Duplex: %s",
tvb_get_guint8(tvb, offset + 4) ?
"Full" : "Half" );
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_text(tlv_tree, tvb, offset + 4,
@@ -610,7 +597,7 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_VOIP_VLAN_REPLY:
if (tree) {
if (length >= 7) {
- tlvi = proto_tree_add_text(cdp_tree, tvb, offset, length,
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb, offset, length, ett_cdp_tlv, NULL,
"VoIP VLAN Reply: %u", tvb_get_ntohs(tvb, offset + 5));
} else {
/*
@@ -620,10 +607,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* we dissect the 7-byte ones, we report a malformed
* frame.
*/
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "VoIP VLAN Reply");
+ tlv_tree = proto_tree_add_subtree(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "VoIP VLAN Reply");
}
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_text(tlv_tree, tvb, offset + 4,
@@ -640,8 +626,8 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_VOIP_VLAN_QUERY:
if (tree) {
if (length >= 7) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "VoIP VLAN Query: %u", tvb_get_ntohs(tvb, offset + 5));
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb, offset, length,
+ ett_cdp_tlv, NULL, "VoIP VLAN Query: %u", tvb_get_ntohs(tvb, offset + 5));
} else {
/*
* XXX - what are these? I've seen them in some captures;
@@ -650,10 +636,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* we dissect the 7-byte ones, we report a malformed
* frame.
*/
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "VoIP VLAN Query");
+ tlv_tree = proto_tree_add_subtree(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "VoIP VLAN Query");
}
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_text(tlv_tree, tvb, offset + 4,
@@ -669,10 +654,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_POWER:
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "Power Consumption: %u mW",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "Power Consumption: %u mW",
tvb_get_ntohs(tvb, offset + 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_text(tlv_tree, tvb, offset + 4,
@@ -684,10 +668,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_MTU:
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "MTU: %u",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "MTU: %u",
tvb_get_ntohl(tvb,offset + 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_text(tlv_tree, tvb, offset + 4,
@@ -699,10 +682,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_TRUST_BITMAP:
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "Trust Bitmap: 0x%02X",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "Trust Bitmap: 0x%02X",
tvb_get_guint8(tvb, offset + 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_text(tlv_tree, tvb, offset + 4,
@@ -714,10 +696,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_UNTRUSTED_COS:
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "Untrusted port CoS: 0x%02X",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "Untrusted port CoS: 0x%02X",
tvb_get_guint8(tvb, offset + 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_text(tlv_tree, tvb, offset + 4,
@@ -729,10 +710,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_SYSTEM_NAME:
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "System Name: %s",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "System Name: %s",
tvb_format_text(tvb, offset + 4, length - 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_text(tlv_tree, tvb, offset + 4,
@@ -744,9 +724,8 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_SYSTEM_OID:
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "System Object Identifier");
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
+ tlv_tree = proto_tree_add_subtree(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "System Object Identifier");
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_text(tlv_tree, tvb, offset + 4,
@@ -758,9 +737,8 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_MANAGEMENT_ADDR:
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "Management Addresses");
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
+ tlv_tree = proto_tree_add_subtree(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "Management Addresses");
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
}
@@ -788,10 +766,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_LOCATION:
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "Location: %s",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "Location: %s",
tvb_format_text(tvb, offset + 5, length - 5));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_text(tlv_tree, tvb, offset + 4,
@@ -806,9 +783,8 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_POWER_REQUESTED:
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "Power Request: ");
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
+ tlv_tree = proto_tree_add_subtree(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "Power Request: ");
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_text(tlv_tree, tvb, offset + 4,
@@ -848,9 +824,8 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_POWER_AVAILABLE:
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "Power Available: ");
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
+ tlv_tree = proto_tree_add_subtree(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "Power Available: ");
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_text(tlv_tree, tvb, offset + 4,
@@ -882,9 +857,8 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_NRGYZ:
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "EnergyWise");
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
+ tlv_tree = proto_tree_add_subtree(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "EnergyWise");
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_text(tlv_tree, tvb, offset + 4,
@@ -932,9 +906,8 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_SPARE_POE:
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb, offset, length,
- "Spare Pair PoE");
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
+ tlv_tree = proto_tree_add_subtree(cdp_tree, tvb, offset, length,
+ ett_cdp_tlv, NULL, "Spare Pair PoE");
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
@@ -948,10 +921,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_HP_BSSID:
/* BSSID */
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "BSSID: %s",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "BSSID: %s",
tvb_format_text(tvb, offset + 4, length - 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_platform, tvb, offset + 4, length - 4, ENC_ASCII|ENC_NA);
@@ -962,10 +934,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_HP_SERIAL:
/* Serial number */
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "Serial: %s",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "Serial: %s",
tvb_format_text(tvb, offset + 4, length - 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_platform, tvb, offset + 4, length - 4, ENC_ASCII|ENC_NA);
@@ -977,16 +948,14 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* SSID */
if (tree) {
if (length == 4) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "SSID: [Empty]");
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
+ tlv_tree = proto_tree_add_subtree(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "SSID: [Empty]");
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
} else {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "SSID: %s",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "SSID: %s",
tvb_format_text(tvb, offset + 4, length - 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_platform, tvb, offset + 4, length - 4, ENC_ASCII|ENC_NA);
@@ -998,10 +967,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_HP_RADIO1_CH:
/* Radio1 channel */
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "Radio 1 channel: %s",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "Radio 1 channel: %s",
tvb_format_text(tvb, offset + 4, length - 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_platform, tvb, offset + 4, length - 4, ENC_ASCII|ENC_NA);
@@ -1012,10 +980,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_HP_SNMP_PORT:
/* SNMP listening UDP port */
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "SNMP port: %s",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "SNMP port: %s",
tvb_format_text(tvb, offset + 4, length - 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_platform, tvb, offset + 4, length - 4, ENC_ASCII|ENC_NA);
@@ -1026,10 +993,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_HP_MGMT_PORT:
/* Web interface TCP port */
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "Web mgmt port: %s",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "Web mgmt port: %s",
tvb_format_text(tvb, offset + 4, length - 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_platform, tvb, offset + 4, length - 4, ENC_ASCII|ENC_NA);
@@ -1040,10 +1006,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_HP_SOURCE_MAC:
/* Sender MAC address for the AP, bouth wired and wireless */
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "Source MAC: %s",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "Source MAC: %s",
tvb_format_text(tvb, offset + 4, length - 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_platform, tvb, offset + 4, length - 4, ENC_ASCII|ENC_NA);
@@ -1054,10 +1019,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_HP_RADIO2_CH:
/* Radio2 channel */
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "Radio 2 channel: %s",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "Radio 2 channel: %s",
tvb_format_text(tvb, offset + 4, length - 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_platform, tvb, offset + 4, length - 4, ENC_ASCII|ENC_NA);
@@ -1068,10 +1032,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_HP_RADIO1_OMODE:
/* Radio1 Operating mode */
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "Radio 1 operating mode: %s",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "Radio 1 operating mode: %s",
tvb_format_text(tvb, offset + 4, length - 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_platform, tvb, offset + 4, length - 4, ENC_ASCII|ENC_NA);
@@ -1082,10 +1045,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_HP_RADIO2_OMODE:
/* Radio2 Operating mode */
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "Radio 2 operating mode: %s",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "Radio 2 operating mode: %s",
tvb_format_text(tvb, offset + 4, length - 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_platform, tvb, offset + 4, length - 4, ENC_ASCII|ENC_NA);
@@ -1096,10 +1058,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_HP_RADIO1_RMODE:
/* Radio1 Radio mode */
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "Radio 1 radio mode: %s",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "Radio 1 radio mode: %s",
tvb_format_text(tvb, offset + 4, length - 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_platform, tvb, offset + 4, length - 4, ENC_ASCII|ENC_NA);
@@ -1110,10 +1071,9 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_HP_RADIO2_RMODE:
/* Radio2 Radio mode */
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb,
- offset, length, "Radio 2 radio mode: %s",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb,
+ offset, length, ett_cdp_tlv, NULL, "Radio 2 radio mode: %s",
tvb_format_text(tvb, offset + 4, length - 4));
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_platform, tvb, offset + 4, length - 4, ENC_ASCII|ENC_NA);
@@ -1123,11 +1083,10 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
default:
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb, offset,
- length, "Type: %s, length: %u",
+ tlv_tree = proto_tree_add_subtree_format(cdp_tree, tvb, offset,
+ length, ett_cdp_tlv, NULL, "Type: %s, length: %u",
val_to_str(type, type_vals, "Unknown (0x%04x)"),
length);
- tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN);
if (length > 4) {
@@ -1167,8 +1126,7 @@ dissect_address_tlv(tvbuff_t *tvb, int offset, int length, proto_tree *tree)
if (length < 1)
return -1;
- ti = proto_tree_add_text(tree, tvb, offset, length, "Truncated address");
- address_tree = proto_item_add_subtree(ti, ett_cdp_address);
+ address_tree = proto_tree_add_subtree(tree, tvb, offset, length, ett_cdp_address, &ti, "Truncated address");
protocol_type = tvb_get_guint8(tvb, offset);
proto_tree_add_text(address_tree, tvb, offset, 1, "Protocol type: %s",
val_to_str(protocol_type, proto_type_vals, "Unknown (0x%02x)"));
@@ -1299,25 +1257,24 @@ dissect_nrgyz_tlv(tvbuff_t *tvb, int offset, guint16 length, guint16 num,
case TYPE_NRGYZ_ROLE:
case TYPE_NRGYZ_DOMAIN:
case TYPE_NRGYZ_NAME:
- it = proto_tree_add_text(tree, tvb, offset,
- tlvl, "EnergyWise %s: %s", ttext,
+ etree = proto_tree_add_subtree_format(tree, tvb, offset,
+ tlvl, ett_cdp_nrgyz_tlv, NULL, "EnergyWise %s: %s", ttext,
tvb_format_stringzpad(tvb, offset + 8, tlvl - 8)
);
break;
case TYPE_NRGYZ_REPLYTO:
ip_addr = tvb_get_ipv4(tvb, offset + 12);
- it = proto_tree_add_text(tree, tvb, offset,
- tlvl, "EnergyWise %s: %s port %u",
+ etree = proto_tree_add_subtree_format(tree, tvb, offset,
+ tlvl, ett_cdp_nrgyz_tlv, NULL, "EnergyWise %s: %s port %u",
ttext,
ip_to_str((guint8 *)&ip_addr),
tvb_get_ntohs(tvb, offset + 10)
);
break;
default:
- it = proto_tree_add_text(tree, tvb, offset,
- tlvl, "EnergyWise %s TLV", ttext);
+ etree = proto_tree_add_subtree_format(tree, tvb, offset,
+ tlvl, ett_cdp_nrgyz_tlv, NULL, "EnergyWise %s TLV", ttext);
}
- etree = proto_item_add_subtree(it, ett_cdp_nrgyz_tlv);
proto_tree_add_text(etree, tvb, offset, 4,
"TLV Type: %x (%s)", tlvt, ttext);
proto_tree_add_text(etree, tvb, offset + 4, 4,
diff --git a/epan/dissectors/packet-cell_broadcast.c b/epan/dissectors/packet-cell_broadcast.c
index fb67f32f15..cd59cdd3ca 100644
--- a/epan/dissectors/packet-cell_broadcast.c
+++ b/epan/dissectors/packet-cell_broadcast.c
@@ -336,8 +336,8 @@ dissect_gsm_cell_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
if (tree != NULL)
{
- proto_item *item = proto_tree_add_text(cbs_page_tree, tvb, offset, -1, "Cell Broadcast Page Contents");
- proto_tree *cbs_page_subtree = proto_item_add_subtree(item, ett_gsm_cbs_page_content);
+ proto_tree *cbs_page_subtree = proto_tree_add_subtree(cbs_page_tree, tvb, offset, -1,
+ ett_gsm_cbs_page_content, NULL, "Cell Broadcast Page Contents");
len = tvb_length(cbs_page_tvb);
proto_tree_add_string(cbs_page_subtree, hf_gsm_cbs_page_content, cbs_page_tvb, 0,
text_len, tvb_get_string_enc(wmem_packet_scope(), cbs_page_tvb, 0, text_len, ENC_ASCII));
@@ -390,8 +390,8 @@ void dissect_umts_cell_broadcast_message(tvbuff_t *tvb, packet_info *pinfo, prot
guint8 sms_encoding;
guint32 offset = 0;
guint32 len;
- proto_item *cbs_item = NULL, *cbs_item2 = NULL;
- proto_tree *cbs_tree = NULL, *cbs_subtree = NULL;
+ proto_item *cbs_item;
+ proto_tree *cbs_tree, *cbs_subtree;
guint msg_len;
tvbuff_t * cbs_msg_tvb = NULL;
@@ -408,8 +408,8 @@ void dissect_umts_cell_broadcast_message(tvbuff_t *tvb, packet_info *pinfo, prot
cbs_msg_tvb = dissect_cbs_data(sms_encoding, tvb, cbs_tree, pinfo, offset );
msg_len = tvb_length(cbs_msg_tvb);
- cbs_item2 = proto_tree_add_text(cbs_tree, tvb, offset, -1, "Cell Broadcast Message Contents (length: %d)", msg_len);
- cbs_subtree = proto_item_add_subtree(cbs_item2, ett_cbs_msg);
+ cbs_subtree = proto_tree_add_subtree_format(cbs_tree, tvb, offset, -1,
+ ett_cbs_msg, NULL, "Cell Broadcast Message Contents (length: %d)", msg_len);
proto_tree_add_text(cbs_subtree, cbs_msg_tvb , 0, tvb_length(cbs_msg_tvb), "%s", tvb_get_string_enc(wmem_packet_scope(), cbs_msg_tvb, 0, msg_len, ENC_ASCII));
}
diff --git a/epan/dissectors/packet-cfdp.c b/epan/dissectors/packet-cfdp.c
index 570ca626f7..369a55bcfa 100644
--- a/epan/dissectors/packet-cfdp.c
+++ b/epan/dissectors/packet-cfdp.c
@@ -476,13 +476,12 @@ static guint32 dissect_cfdp_filestore_req_tlv(tvbuff_t *tvb, proto_tree *tree, g
tlv_len = tvb_get_guint8(tvb, offset);
offset += 1;
if(tlv_len > 0){
- proto_item *cfdp_filestore_req;
proto_tree *cfdp_filestore_req_tree;
guint8 aux_byte;
/* Create a TLV subtree */
- cfdp_filestore_req = proto_tree_add_text(tree, tvb, offset-2, tlv_len+2, "Filestore Request TLV");
- cfdp_filestore_req_tree = proto_item_add_subtree(cfdp_filestore_req, ett_cfdp_filestore_req);
+ cfdp_filestore_req_tree = proto_tree_add_subtree(tree, tvb, offset-2, tlv_len+2,
+ ett_cfdp_filestore_req, NULL, "Filestore Request TLV");
proto_tree_add_uint(cfdp_filestore_req_tree, hf_cfdp_tlv_len, tvb, offset-1, 1, tlv_len);
@@ -518,13 +517,12 @@ static guint32 dissect_cfdp_filestore_resp_tlv(tvbuff_t *tvb, proto_tree *tree,
tlv_len = tvb_get_guint8(tvb, offset);
offset += 1;
if(tlv_len > 0){
- proto_item *cfdp_filestore_resp;
proto_tree *cfdp_filestore_resp_tree;
guint8 aux_byte;
/* Create a subtree */
- cfdp_filestore_resp = proto_tree_add_text(tree, tvb, offset-2, tlv_len+2, "Filestore Response TLV");
- cfdp_filestore_resp_tree = proto_item_add_subtree(cfdp_filestore_resp, ett_cfdp_filestore_resp);
+ cfdp_filestore_resp_tree = proto_tree_add_subtree(tree, tvb, offset-2, tlv_len+2,
+ ett_cfdp_filestore_resp, NULL, "Filestore Response TLV");
proto_tree_add_uint(cfdp_filestore_resp_tree, hf_cfdp_tlv_len, tvb, offset-1, 1, tlv_len);
@@ -595,12 +593,11 @@ static guint32 dissect_cfdp_fault_location_tlv(tvbuff_t *tvb, proto_tree *tree,
tlv_len = tvb_get_guint8(tvb, offset);
offset += 1;
if(tlv_len > 0){
- proto_item *cfdp_fault_location;
proto_tree *cfdp_fault_location_tree;
/* Create a subtree */
- cfdp_fault_location = proto_tree_add_text(tree, tvb, offset-2, tlv_len+2, "Fault location TLV");
- cfdp_fault_location_tree = proto_item_add_subtree(cfdp_fault_location, ett_cfdp_fault_location);
+ cfdp_fault_location_tree = proto_tree_add_subtree(tree, tvb, offset-2, tlv_len+2,
+ ett_cfdp_fault_location, NULL, "Fault location TLV");
proto_tree_add_uint(cfdp_fault_location_tree, hf_cfdp_tlv_len, tvb, offset-1, 1, tlv_len);
@@ -615,7 +612,6 @@ static guint32 dissect_cfdp_fault_location_tlv(tvbuff_t *tvb, proto_tree *tree,
static guint32 dissect_cfdp_msg_to_user_tlv(tvbuff_t *tvb, proto_tree *tree, guint32 ext_offset){
guint8 aux_byte, tlv_type, tlv_len;
- proto_item *cfdp_msg_to_user;
proto_tree *cfdp_msg_to_user_tree;
guint32 offset = ext_offset;
@@ -628,8 +624,8 @@ static guint32 dissect_cfdp_msg_to_user_tlv(tvbuff_t *tvb, proto_tree *tree, gui
offset += 1;
/* Create a subtree */
- cfdp_msg_to_user = proto_tree_add_text(tree, tvb, offset-2, tlv_len+2, "Message To User TLV");
- cfdp_msg_to_user_tree = proto_item_add_subtree(cfdp_msg_to_user, ett_cfdp_filestore_resp);
+ cfdp_msg_to_user_tree = proto_tree_add_subtree(tree, tvb, offset-2, tlv_len+2,
+ ett_cfdp_filestore_resp, NULL, "Message To User TLV");
proto_tree_add_uint(cfdp_msg_to_user_tree, hf_cfdp_tlv_len, tvb, offset-1, 1, tlv_len);
@@ -863,7 +859,6 @@ static guint32 dissect_cfdp_msg_to_user_tlv(tvbuff_t *tvb, proto_tree *tree, gui
static guint32 dissect_cfdp_fault_handler_overr_tlv(tvbuff_t *tvb, proto_tree *tree, guint32 ext_offset){
guint8 aux_byte, tlv_len;
- proto_item *cfdp_fault_hdl_overr;
proto_tree *cfdp_fault_hdl_overr_tree;
guint32 offset = ext_offset;
@@ -873,8 +868,8 @@ static guint32 dissect_cfdp_fault_handler_overr_tlv(tvbuff_t *tvb, proto_tree *t
offset += 1;
/* Create a subtree */
- cfdp_fault_hdl_overr = proto_tree_add_text(tree, tvb, offset-2, tlv_len+2, "Fault Handler Override TLV");
- cfdp_fault_hdl_overr_tree = proto_item_add_subtree(cfdp_fault_hdl_overr, ett_cfdp_fault_hdl_overr);
+ cfdp_fault_hdl_overr_tree = proto_tree_add_subtree(tree, tvb, offset-2, tlv_len+2,
+ ett_cfdp_fault_hdl_overr, NULL, "Fault Handler Override TLV");
proto_tree_add_uint(cfdp_fault_hdl_overr_tree, hf_cfdp_tlv_len, tvb, offset-1, 1, tlv_len);
@@ -890,7 +885,6 @@ static guint32 dissect_cfdp_fault_handler_overr_tlv(tvbuff_t *tvb, proto_tree *t
static guint32 dissect_cfdp_flow_label_tlv(tvbuff_t *tvb, proto_tree *tree, guint32 ext_offset){
guint8 tlv_len;
- proto_item *cfdp_flow_label;
proto_tree *cfdp_flow_label_tree;
guint32 offset = ext_offset;
@@ -900,8 +894,8 @@ static guint32 dissect_cfdp_flow_label_tlv(tvbuff_t *tvb, proto_tree *tree, guin
offset += 1;
/* Create a subtree */
- cfdp_flow_label = proto_tree_add_text(tree, tvb, offset-2, tlv_len+2, "Flow Label TLV");
- cfdp_flow_label_tree = proto_item_add_subtree(cfdp_flow_label, ett_cfdp_flow_label);
+ cfdp_flow_label_tree = proto_tree_add_subtree(tree, tvb, offset-2, tlv_len+2,
+ ett_cfdp_flow_label, NULL, "Flow Label TLV");
/* It is undefined, so no specific encoding */
proto_tree_add_text(cfdp_flow_label_tree, tvb, offset, tlv_len, "Flow label");
@@ -913,7 +907,6 @@ static guint32 dissect_cfdp_flow_label_tlv(tvbuff_t *tvb, proto_tree *tree, guin
static guint32 dissect_cfdp_eof_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ext_offset, guint ext_packet_len){
guint8 aux_byte, tlv_type, tlv_len;
- proto_item *cfdp_fault_location;
proto_tree *cfdp_fault_location_tree;
guint32 offset = ext_offset;
@@ -938,8 +931,8 @@ static guint32 dissect_cfdp_eof_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tre
if(tlv_type == FAULT_LOCATION){
tlv_len = tvb_get_guint8(tvb, offset);
offset += 1;
- cfdp_fault_location = proto_tree_add_text(tree, tvb, offset-2, tlv_len+2, "Fault location TLV");
- cfdp_fault_location_tree = proto_item_add_subtree(cfdp_fault_location, ett_cfdp_fault_location);
+ cfdp_fault_location_tree = proto_tree_add_subtree(tree, tvb, offset-2, tlv_len+2,
+ ett_cfdp_fault_location, NULL, "Fault location TLV");
proto_tree_add_text(cfdp_fault_location_tree, tvb, offset, tlv_len, "Entity");
offset += tlv_len;
@@ -1147,8 +1140,8 @@ dissect_cfdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
cfdp_packet = proto_tree_add_item(tree, proto_cfdp, tvb, 0, length, ENC_NA);
cfdp_tree = proto_item_add_subtree(cfdp_packet, ett_cfdp);
- cfdp_header = proto_tree_add_text(cfdp_tree, tvb, offset, cfdp_packet_header_length, "CFDP Header");
- cfdp_header_tree = proto_item_add_subtree(cfdp_header, ett_cfdp_header);
+ cfdp_header_tree = proto_tree_add_subtree(cfdp_tree, tvb, offset, cfdp_packet_header_length,
+ ett_cfdp_header, &cfdp_header, "CFDP Header");
first_byte = tvb_get_guint8(tvb, offset);
@@ -1194,8 +1187,8 @@ dissect_cfdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree *cfdp_file_directive_header_tree;
guint8 directive_code;
- cfdp_file_directive_header = proto_tree_add_text(cfdp_tree, tvb, offset, cfdp_packet_data_length, "CFDP File Directive");
- cfdp_file_directive_header_tree = proto_item_add_subtree(cfdp_file_directive_header, ett_cfdp_file_directive_header);
+ cfdp_file_directive_header_tree = proto_tree_add_subtree(cfdp_tree, tvb, offset, cfdp_packet_data_length,
+ ett_cfdp_file_directive_header, &cfdp_file_directive_header, "CFDP File Directive");
directive_code = tvb_get_guint8(tvb, offset);
proto_tree_add_uint(cfdp_file_directive_header_tree, hf_cfdp_file_directive_type, tvb, offset, 1, directive_code);
@@ -1240,13 +1233,12 @@ dissect_cfdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item_set_end(cfdp_file_directive_header, tvb, offset);
}else{
- proto_item *cfdp_file_data_header;
proto_tree *cfdp_file_data_header_tree;
col_add_fstr(pinfo->cinfo, COL_INFO, "File Data PDU");
- cfdp_file_data_header = proto_tree_add_text(cfdp_tree, tvb, offset, cfdp_packet_data_length, "CFDP File Data");
- cfdp_file_data_header_tree = proto_item_add_subtree(cfdp_file_data_header, ett_cfdp_file_data_header);
+ cfdp_file_data_header_tree = proto_tree_add_subtree(cfdp_tree, tvb, offset, cfdp_packet_data_length,
+ ett_cfdp_file_data_header, NULL, "CFDP File Data");
proto_tree_add_item(cfdp_file_data_header_tree, hf_cfdp_file_data_offset, tvb, offset, 4, ENC_BIG_ENDIAN);
@@ -1260,8 +1252,7 @@ dissect_cfdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item *cfdp_crc;
proto_tree *cfdp_crc_tree;
- cfdp_crc = proto_tree_add_text(cfdp_tree, tvb, offset, 2, "CRC");
- cfdp_crc_tree = proto_item_add_subtree(cfdp_crc, ett_cfdp_crc);
+ cfdp_crc_tree = proto_tree_add_subtree(cfdp_tree, tvb, offset, 2, ett_cfdp_crc, &cfdp_crc, "CRC");
proto_tree_add_item(cfdp_crc_tree, hf_cfdp_crc, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
diff --git a/epan/dissectors/packet-cfm.c b/epan/dissectors/packet-cfm.c
index f3c35039a5..460c538ff6 100644
--- a/epan/dissectors/packet-cfm.c
+++ b/epan/dissectors/packet-cfm.c
@@ -1329,7 +1329,6 @@ static void dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint16 cfm_tlv_length;
gint tlv_header_modifier;
- proto_item *fi;
proto_tree *cfm_tlv_tree;
cfm_tlv_type = tvb_get_guint8(tvb, cfm_tlv_offset);
@@ -1341,10 +1340,9 @@ static void dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
cfm_tlv_length = tvb_get_ntohs(tvb, cfm_tlv_offset+1);
}
- fi = proto_tree_add_text(cfm_all_tlvs_tree, tvb, cfm_tlv_offset, cfm_tlv_length+tlv_header_modifier,
- "TLV: %s (t=%d,l=%d)", val_to_str(cfm_tlv_type, tlvtypefieldvalues, "Unknown (0x%02x)"),
+ cfm_tlv_tree = proto_tree_add_subtree_format(cfm_all_tlvs_tree, tvb, cfm_tlv_offset, cfm_tlv_length+tlv_header_modifier,
+ ett_cfm_tlv, NULL, "TLV: %s (t=%d,l=%d)", val_to_str(cfm_tlv_type, tlvtypefieldvalues, "Unknown (0x%02x)"),
cfm_tlv_type, cfm_tlv_length);
- cfm_tlv_tree = proto_item_add_subtree(fi, ett_cfm_tlv);
proto_tree_add_item(cfm_tlv_tree, hf_cfm_tlv_type, tvb, cfm_tlv_offset, 1, ENC_BIG_ENDIAN);
cfm_tlv_offset += 1;
diff --git a/epan/dissectors/packet-cimd.c b/epan/dissectors/packet-cimd.c
index 13609bed1e..3eb9171a64 100644
--- a/epan/dissectors/packet-cimd.c
+++ b/epan/dissectors/packet-cimd.c
@@ -452,12 +452,10 @@ static gint hf_index[MAXPARAMSCOUNT];
static void dissect_cimd_parameter(tvbuff_t *tvb, proto_tree *tree, gint pindex, gint startOffset, gint endOffset)
{
/* Set up structures needed to add the param subtree and manage it */
- proto_item *param_item;
proto_tree *param_tree;
- param_item = proto_tree_add_text(tree, tvb, startOffset + 1, endOffset - (startOffset + 1),
- "%s", cimd_vals_PC[pindex].strptr);
- param_tree = proto_item_add_subtree(param_item, (*vals_hdr_PC[pindex].ett_p));
+ param_tree = proto_tree_add_subtree(tree, tvb, startOffset + 1, endOffset - (startOffset + 1),
+ (*vals_hdr_PC[pindex].ett_p), NULL, cimd_vals_PC[pindex].strptr);
proto_tree_add_item(param_tree, hf_cimd_pcode_indicator, tvb,
startOffset + 1, CIMD_PC_LENGTH, ENC_ASCII|ENC_NA);
@@ -468,7 +466,6 @@ static void dissect_cimd_parameter(tvbuff_t *tvb, proto_tree *tree, gint pindex,
static void dissect_cimd_ud(tvbuff_t *tvb, proto_tree *tree, gint pindex, gint startOffset, gint endOffset)
{
/* Set up structures needed to add the param subtree and manage it */
- proto_item *param_item;
proto_tree *param_tree;
gchar *payloadText, *tmpBuffer, *tmpBuffer1;
@@ -489,11 +486,10 @@ static void dissect_cimd_ud(tvbuff_t *tvb, proto_tree *tree, gint pindex, gint s
"_o\"", "_n~", "_n\"","_a`"
};
- param_item = proto_tree_add_text(tree, tvb,
+ param_tree = proto_tree_add_subtree(tree, tvb,
startOffset + 1, endOffset - (startOffset + 1),
- "%s", cimd_vals_PC[pindex].strptr
+ (*vals_hdr_PC[pindex].ett_p), NULL, cimd_vals_PC[pindex].strptr
);
- param_tree = proto_item_add_subtree(param_item, (*vals_hdr_PC[pindex].ett_p));
proto_tree_add_item(param_tree, hf_cimd_pcode_indicator, tvb,
startOffset + 1, CIMD_PC_LENGTH, ENC_ASCII|ENC_NA);
@@ -744,13 +740,11 @@ static void dissect_cimd_dcs(tvbuff_t *tvb, proto_tree *tree, gint pindex, gint
static void dissect_cimd_error_code( tvbuff_t *tvb, proto_tree *tree, gint pindex, gint startOffset, gint endOffset )
{
/* Same routine can be used to dissect CIMD Error,Status and Status Error Codes */
- proto_item *param_item;
proto_tree *param_tree;
guint32 err_code;
- param_item = proto_tree_add_text(tree, tvb, startOffset + 1, endOffset - (startOffset + 1),
- "%s", cimd_vals_PC[pindex].strptr);
- param_tree = proto_item_add_subtree(param_item, (*vals_hdr_PC[pindex].ett_p));
+ param_tree = proto_tree_add_subtree(tree, tvb, startOffset + 1, endOffset - (startOffset + 1),
+ (*vals_hdr_PC[pindex].ett_p), NULL, cimd_vals_PC[pindex].strptr);
proto_tree_add_item(param_tree, hf_cimd_pcode_indicator, tvb, startOffset + 1, CIMD_PC_LENGTH, ENC_ASCII|ENC_NA);
diff --git a/epan/dissectors/packet-cip.c b/epan/dissectors/packet-cip.c
index 303ef7dce1..79dfef3a47 100644
--- a/epan/dissectors/packet-cip.c
+++ b/epan/dissectors/packet-cip.c
@@ -2672,7 +2672,6 @@ static int dissect_time_sync_port_state_info(packet_info *pinfo, proto_tree *tre
int offset, int total_len)
{
guint16 i, num_ports;
- proto_item* ti;
proto_tree* port_tree;
if (total_len < 2)
@@ -2692,8 +2691,7 @@ static int dissect_time_sync_port_state_info(packet_info *pinfo, proto_tree *tre
for (i = 0; i < num_ports; i++)
{
- ti = proto_tree_add_text(tree, tvb, offset+2+i*4, 4, "Port #%d", i+1);
- port_tree = proto_item_add_subtree(ti, ett_time_sync_port_state_info);
+ port_tree = proto_tree_add_subtree_format(tree, tvb, offset+2+i*4, 4, ett_time_sync_port_state_info, NULL, "Port #%d", i+1);
proto_tree_add_item(port_tree, hf_time_sync_port_state_info_port_num, tvb, offset+2+i*4, 2, ENC_LITTLE_ENDIAN);
proto_tree_add_item(port_tree, hf_time_sync_port_state_info_port_state, tvb, offset+4+i*4, 2, ENC_LITTLE_ENDIAN);
}
@@ -2705,7 +2703,6 @@ static int dissect_time_sync_port_enable_cfg(packet_info *pinfo, proto_tree *tre
int offset, int total_len)
{
guint16 i, num_ports;
- proto_item* ti;
proto_tree* port_tree;
if (total_len < 2)
@@ -2725,8 +2722,7 @@ static int dissect_time_sync_port_enable_cfg(packet_info *pinfo, proto_tree *tre
for (i = 0; i < num_ports; i++)
{
- ti = proto_tree_add_text(tree, tvb, offset+2+i*4, 4, "Port #%d", i+1);
- port_tree = proto_item_add_subtree(ti, ett_time_sync_port_enable_cfg);
+ port_tree = proto_tree_add_subtree_format(tree, tvb, offset+2+i*4, 4, ett_time_sync_port_enable_cfg, NULL, "Port #%d", i+1);
proto_tree_add_item(port_tree, hf_time_sync_port_enable_cfg_port_num, tvb, offset+2+i*4, 2, ENC_LITTLE_ENDIAN);
proto_tree_add_item(port_tree, hf_time_sync_port_enable_cfg_port_enable, tvb, offset+4+i*4, 2, ENC_LITTLE_ENDIAN);
}
@@ -2738,7 +2734,6 @@ static int dissect_time_sync_port_log_announce(packet_info *pinfo, proto_tree *t
int offset, int total_len)
{
guint16 i, num_ports;
- proto_item* ti;
proto_tree* port_tree;
if (total_len < 2)
@@ -2758,8 +2753,7 @@ static int dissect_time_sync_port_log_announce(packet_info *pinfo, proto_tree *t
for (i = 0; i < num_ports; i++)
{
- ti = proto_tree_add_text(tree, tvb, offset+2+i*4, 4, "Port #%d", i+1);
- port_tree = proto_item_add_subtree(ti, ett_time_sync_port_log_announce);
+ port_tree = proto_tree_add_subtree_format(tree, tvb, offset+2+i*4, 4, ett_time_sync_port_log_announce, NULL, "Port #%d", i+1);
proto_tree_add_item(port_tree, hf_time_sync_port_log_announce_port_num, tvb, offset+2+i*4, 2, ENC_LITTLE_ENDIAN);
proto_tree_add_item(port_tree, hf_time_sync_port_log_announce_interval, tvb, offset+4+i*4, 2, ENC_LITTLE_ENDIAN);
}
@@ -2771,7 +2765,6 @@ static int dissect_time_sync_port_log_sync(packet_info *pinfo, proto_tree *tree,
int offset, int total_len)
{
guint16 i, num_ports;
- proto_item* ti;
proto_tree* port_tree;
if (total_len < 2)
@@ -2791,8 +2784,7 @@ static int dissect_time_sync_port_log_sync(packet_info *pinfo, proto_tree *tree,
for (i = 0; i < num_ports; i++)
{
- ti = proto_tree_add_text(tree, tvb, offset+2+i*4, 4, "Port #%d", i+1);
- port_tree = proto_item_add_subtree(ti, ett_time_sync_port_log_sync);
+ port_tree = proto_tree_add_subtree_format(tree, tvb, offset+2+i*4, 4, ett_time_sync_port_log_sync, NULL, "Port #%d", i+1);
proto_tree_add_item(port_tree, hf_time_sync_port_log_sync_port_num, tvb, offset+2+i*4, 2, ENC_LITTLE_ENDIAN);
proto_tree_add_item(port_tree, hf_time_sync_port_log_sync_port_log_sync_interval, tvb, offset+4+i*4, 2, ENC_LITTLE_ENDIAN);
}
@@ -2931,7 +2923,6 @@ static int dissect_time_sync_port_profile_id_info(packet_info *pinfo, proto_tree
int offset, int total_len)
{
guint16 i, num_ports;
- proto_item* ti;
proto_tree* port_tree;
if (total_len < 2)
@@ -2951,8 +2942,7 @@ static int dissect_time_sync_port_profile_id_info(packet_info *pinfo, proto_tree
for (i = 0; i < num_ports; i++)
{
- ti = proto_tree_add_text(tree, tvb, offset+2+i*10, 10, "Port #%d", i+1);
- port_tree = proto_item_add_subtree(ti, ett_time_sync_port_profile_id_info);
+ port_tree = proto_tree_add_subtree_format(tree, tvb, offset+2+i*10, 10, ett_time_sync_port_profile_id_info, NULL, "Port #%d", i+1);
proto_tree_add_item(port_tree, hf_time_sync_port_profile_id_info_port_num, tvb, offset+2+i*10, 2, ENC_LITTLE_ENDIAN);
proto_tree_add_item(port_tree, hf_time_sync_port_profile_id_info_profile_id, tvb, offset+4+i*10, 8, ENC_NA);
}
@@ -2964,7 +2954,6 @@ static int dissect_time_sync_port_phys_addr_info(packet_info *pinfo, proto_tree
int offset, int total_len)
{
guint16 i, num_ports;
- proto_item* ti;
proto_tree* port_tree;
if (total_len < 2)
@@ -2984,8 +2973,7 @@ static int dissect_time_sync_port_phys_addr_info(packet_info *pinfo, proto_tree
for (i = 0; i < num_ports; i++)
{
- ti = proto_tree_add_text(tree, tvb, offset+2+i*36, 36, "Port #%d", i+1);
- port_tree = proto_item_add_subtree(ti, ett_time_sync_port_phys_addr_info);
+ port_tree = proto_tree_add_subtree_format(tree, tvb, offset+2+i*36, 36, ett_time_sync_port_phys_addr_info, NULL, "Port #%d", i+1);
proto_tree_add_item(port_tree, hf_time_sync_port_phys_addr_info_port_num, tvb, offset+2+i*36, 2, ENC_LITTLE_ENDIAN);
proto_tree_add_item(port_tree, hf_time_sync_port_phys_addr_info_phys_proto, tvb, offset+4+i*36, 16, ENC_NA);
proto_tree_add_item(port_tree, hf_time_sync_port_phys_addr_info_addr_size, tvb, offset+20+i*36, 2, ENC_LITTLE_ENDIAN);
@@ -2999,7 +2987,6 @@ static int dissect_time_sync_port_proto_addr_info(packet_info *pinfo, proto_tree
int offset, int total_len)
{
guint16 i, num_ports;
- proto_item* ti;
proto_tree* port_tree;
if (total_len < 2)
@@ -3019,8 +3006,7 @@ static int dissect_time_sync_port_proto_addr_info(packet_info *pinfo, proto_tree
for (i = 0; i < num_ports; i++)
{
- ti = proto_tree_add_text(tree, tvb, offset+2+i*22, 22, "Port #%d", i+1);
- port_tree = proto_item_add_subtree(ti, ett_time_sync_port_proto_addr_info);
+ port_tree = proto_tree_add_subtree_format(tree, tvb, offset+2+i*22, 22, ett_time_sync_port_proto_addr_info, NULL, "Port #%d", i+1);
proto_tree_add_item(port_tree, hf_time_sync_port_proto_addr_info_port_num, tvb, offset+2+i*22, 2, ENC_LITTLE_ENDIAN);
proto_tree_add_item(port_tree, hf_time_sync_port_proto_addr_info_network_proto, tvb, offset+4+i*22, 2, ENC_LITTLE_ENDIAN);
proto_tree_add_item(port_tree, hf_time_sync_port_proto_addr_info_addr_size, tvb, offset+6+i*22, 2, ENC_LITTLE_ENDIAN);
@@ -3396,7 +3382,7 @@ void dissect_epath( tvbuff_t *tvb, packet_info *pinfo, proto_item *epath_item, i
proto_tree *path_tree, *port_tree, *net_tree;
proto_tree *cia_tree, *ds_tree, *ds_data_tree, *path_seg_tree, *safety_tree;
proto_item *it, *cia_item, *cia_ret_item, *port_item, *ds_item, *ds_data_item;
- proto_item *net_item, *hidden_item, *path_seg_item, *safety_item;
+ proto_item *net_item, *hidden_item, *path_seg_item;
attribute_info_t* att_info;
@@ -3694,8 +3680,7 @@ void dissect_epath( tvbuff_t *tvb, packet_info *pinfo, proto_item *epath_item, i
/* Segment data */
if( seg_size != 0 )
{
- ds_data_item = proto_tree_add_text( ds_tree, tvb, offset + pathpos+2, 0, "Data" );
- ds_data_tree = proto_item_add_subtree( ds_data_item, ett_data_seg_data );
+ ds_data_tree = proto_tree_add_subtree( ds_tree, tvb, offset + pathpos+2, 0, ett_data_seg_data, &ds_data_item, "Data" );
for( i=0; i < seg_size/2; i ++ )
proto_tree_add_item(ds_data_tree, hf_cip_data_seg_item, tvb, offset + pathpos+2+(i*2), 2, ENC_LITTLE_ENDIAN );
@@ -3820,8 +3805,8 @@ void dissect_epath( tvbuff_t *tvb, packet_info *pinfo, proto_item *epath_item, i
temp_data = tvb_get_guint8( tvb, offset + pathpos + 2 );
if (temp_data < 3)
{
- safety_item = proto_tree_add_text(net_tree, tvb, offset + pathpos+3, seg_size-1, "%s", val_to_str_const(temp_data, cip_safety_segment_format_type_vals, "Reserved"));
- safety_tree = proto_item_add_subtree( safety_item, ett_network_seg_safety );
+ safety_tree = proto_tree_add_subtree(net_tree, tvb, offset + pathpos+3, seg_size-1,
+ ett_network_seg_safety, NULL, val_to_str_const(temp_data, cip_safety_segment_format_type_vals, "Reserved"));
switch (temp_data)
{
case 0:
@@ -4088,7 +4073,6 @@ dissect_cip_attribute(packet_info *pinfo, proto_tree *tree, proto_item *item, tv
static void
dissect_cip_generic_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_length, packet_info *pinfo, proto_item *ti )
{
- proto_item *pi;
proto_tree *cmd_data_tree;
int req_path_size;
unsigned char add_stat_size;
@@ -4102,8 +4086,8 @@ dissect_cip_generic_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int
/* If there is any command specific data create a sub-tree for it */
if( ( item_length-4-add_stat_size ) != 0 )
{
- pi = proto_tree_add_text( item_tree, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, "Command Specific Data" );
- cmd_data_tree = proto_item_add_subtree( pi, ett_cmd_data );
+ cmd_data_tree = proto_tree_add_subtree( item_tree, tvb, offset+4+add_stat_size, item_length-4-add_stat_size,
+ ett_cmd_data, NULL, "Command Specific Data" );
/* Add data */
proto_tree_add_item(cmd_data_tree, hf_cip_data, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, ENC_NA);
@@ -4125,8 +4109,8 @@ dissect_cip_generic_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int
/* If there is any command specific data creat a sub-tree for it */
if( (item_length-req_path_size-2) != 0 )
{
- pi = proto_tree_add_text( item_tree, tvb, offset+2+req_path_size, item_length-req_path_size-2, "Command Specific Data" );
- cmd_data_tree = proto_item_add_subtree( pi, ett_cmd_data );
+ cmd_data_tree = proto_tree_add_subtree( item_tree, tvb, offset+2+req_path_size, item_length-req_path_size-2,
+ ett_cmd_data, NULL, "Command Specific Data" );
proto_tree_add_item(cmd_data_tree, hf_cip_data, tvb, offset+2+req_path_size, item_length-req_path_size-2, ENC_NA);
}
@@ -4192,8 +4176,7 @@ dissect_cip_get_attribute_list_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree
proto_tree_add_item(tree, hf_cip_sc_get_attr_list_attr_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
/* Add Attribute List */
- att_list = proto_tree_add_text(tree, tvb, offset+2, att_count*2, "Attribute List" );
- att_tree = proto_item_add_subtree( att_list, ett_cip_get_attribute_list);
+ att_tree = proto_tree_add_subtree(tree, tvb, offset+2, att_count*2, ett_cip_get_attribute_list, &att_list, "Attribute List" );
for( i=0; i < att_count; i++ )
{
@@ -4234,8 +4217,7 @@ dissect_cip_set_attribute_list_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree
proto_tree_add_item(tree, hf_cip_sc_set_attr_list_attr_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
/* Add Attribute List */
- att_list = proto_tree_add_text(tree, tvb, offset+2, att_count*4, "Attribute List" );
- att_list_tree = proto_item_add_subtree( att_list, ett_cip_set_attribute_list);
+ att_list_tree = proto_tree_add_subtree(tree, tvb, offset+2, att_count*4, ett_cip_set_attribute_list, &att_list, "Attribute List" );
offset += 2;
start_offset = offset;
@@ -4335,8 +4317,8 @@ dissect_cip_multiple_service_packet_req(tvbuff_t *tvb, packet_info *pinfo, proto
serv_length = tvb_get_letohs( tvb, offset+2+((i+1)*2) ) - serv_offset;
}
- mult_serv_item = proto_tree_add_text(tree, tvb, offset+serv_offset, serv_length, "Service Packet #%d", i+1 );
- mult_serv_tree = proto_item_add_subtree(mult_serv_item, ett_cip_mult_service_packet );
+ mult_serv_tree = proto_tree_add_subtree_format(tree, tvb, offset+serv_offset, serv_length,
+ ett_cip_mult_service_packet, &mult_serv_item, "Service Packet #%d", i+1 );
proto_tree_add_item(mult_serv_tree, hf_cip_sc_mult_serv_pack_offset, tvb, offset+2+(i*2) , 2, ENC_LITTLE_ENDIAN);
/* Make sure the offset is valid */
@@ -4384,10 +4366,9 @@ dissect_cip_generic_service_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
add_cip_service_to_info_column(pinfo, service, cip_sc_vals);
/* Create service tree */
- cmd_data_item = proto_tree_add_text(tree, tvb, 0, tvb_length(tvb), "%s",
+ cmd_data_tree = proto_tree_add_subtree(tree, tvb, 0, -1, ett_cmd_data, &cmd_data_item,
val_to_str(service, cip_sc_vals , "Unknown Service (0x%02x)"));
proto_item_append_text(cmd_data_item, " (Request)");
- cmd_data_tree = proto_item_add_subtree( cmd_data_item, ett_cmd_data );
req_path_size = tvb_get_guint8( tvb, offset+1);
offset += ((req_path_size*2)+2);
@@ -4491,8 +4472,7 @@ dissect_cip_get_attribute_list_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree
proto_tree_add_item(tree, hf_cip_sc_get_attr_list_attr_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
/* Add Attribute List */
- att_list = proto_tree_add_text(tree, tvb, offset+2, att_count*4, "Attribute List" );
- att_list_tree = proto_item_add_subtree( att_list, ett_cip_get_attribute_list);
+ att_list_tree = proto_tree_add_subtree(tree, tvb, offset+2, att_count*4, ett_cip_get_attribute_list, &att_list, "Attribute List" );
offset += 2;
start_offset = offset;
@@ -4558,8 +4538,7 @@ dissect_cip_set_attribute_list_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree
proto_tree_add_item(tree, hf_cip_sc_set_attr_list_attr_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
/* Add Attribute List */
- att_list = proto_tree_add_text(tree, tvb, offset+2, att_count*4, "Attribute List" );
- att_list_tree = proto_item_add_subtree( att_list, ett_cip_get_attribute_list);
+ att_list_tree = proto_tree_add_subtree(tree, tvb, offset+2, att_count*4, ett_cip_get_attribute_list, &att_list, "Attribute List" );
offset += 2;
start_offset = offset;
@@ -4608,7 +4587,6 @@ dissect_cip_get_attribute_single_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tr
static void
dissect_cip_multiple_service_packet_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item * item, int offset)
{
- proto_item *mult_serv_item;
proto_tree *mult_serv_tree;
int i, num_services, serv_offset;
cip_req_info_t *cip_req_info, *mr_single_req_info;
@@ -4666,8 +4644,8 @@ dissect_cip_multiple_service_packet_rsp(tvbuff_t *tvb, packet_info *pinfo, proto
serv_length = tvb_get_letohs( tvb, offset+2+((i+1)*2) ) - serv_offset;
}
- mult_serv_item = proto_tree_add_text( tree, tvb, offset+serv_offset, serv_length, "Service Reply #%d", i+1 );
- mult_serv_tree = proto_item_add_subtree( mult_serv_item, ett_cip_mult_service_packet );
+ mult_serv_tree = proto_tree_add_subtree_format( tree, tvb, offset+serv_offset, serv_length,
+ ett_cip_mult_service_packet, NULL, "Service Reply #%d", i+1 );
proto_tree_add_item(mult_serv_tree, hf_cip_sc_mult_serv_pack_offset, tvb, offset+2+(i*2) , 2, ENC_LITTLE_ENDIAN);
/*
@@ -4732,10 +4710,9 @@ dissect_cip_generic_service_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
/* If there is any command specific data create a sub-tree for it */
if( (item_length-4-add_stat_size ) != 0 )
{
- cmd_data_item = proto_tree_add_text(tree, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, "%s",
- val_to_str(service, cip_sc_vals , "Unknown Service (0x%02x)"));
+ cmd_data_tree = proto_tree_add_subtree(tree, tvb, offset+4+add_stat_size, item_length-4-add_stat_size,
+ ett_cmd_data, &cmd_data_item, val_to_str(service, cip_sc_vals , "Unknown Service (0x%02x)"));
proto_item_append_text(cmd_data_item, " (Response)");
- cmd_data_tree = proto_item_add_subtree( cmd_data_item, ett_cmd_data );
}
else
{
@@ -4978,7 +4955,6 @@ dissect_cip_cm_fwd_open_rsp_success(cip_req_info_t *preq_info, proto_tree *tree,
unsigned char app_rep_size;
guint32 O2TConnID, T2OConnID, DeviceSerialNumber;
guint16 ConnSerialNumber, VendorID;
- proto_item *ti;
proto_tree *pid_tree, *safety_tree;
/* Display originator to target connection ID */
@@ -5024,11 +5000,9 @@ dissect_cip_cm_fwd_open_rsp_success(cip_req_info_t *preq_info, proto_tree *tree,
}
else if (preq_info->connInfo->safety.format == CIP_SAFETY_BASE_FORMAT)
{
- ti = proto_tree_add_text( tree, tvb, offset+28, 10, "Safety Application Reply Data");
- safety_tree = proto_item_add_subtree( ti, ett_cip_cm_safety );
+ safety_tree = proto_tree_add_subtree( tree, tvb, offset+28, 10, ett_cip_cm_safety, NULL, "Safety Application Reply Data");
proto_tree_add_item( safety_tree, hf_cip_cm_consumer_number, tvb, offset+26, 2, ENC_LITTLE_ENDIAN);
- ti = proto_tree_add_text( safety_tree, tvb, offset+28, 8, "PID/CID");
- pid_tree = proto_item_add_subtree( ti, ett_cip_cm_pid );
+ pid_tree = proto_tree_add_subtree( safety_tree, tvb, offset+28, 8, ett_cip_cm_pid, NULL, "PID/CID");
proto_tree_add_item( pid_tree, hf_cip_cm_targ_vendor_id, tvb, offset+28, 2, ENC_LITTLE_ENDIAN);
proto_tree_add_item( pid_tree, hf_cip_cm_targ_dev_serial_num, tvb, offset+30, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item( pid_tree, hf_cip_cm_targ_conn_serial_num, tvb, offset+34, 2, ENC_LITTLE_ENDIAN);
@@ -5038,11 +5012,9 @@ dissect_cip_cm_fwd_open_rsp_success(cip_req_info_t *preq_info, proto_tree *tree,
}
else if (preq_info->connInfo->safety.format == CIP_SAFETY_EXTENDED_FORMAT)
{
- ti = proto_tree_add_text( tree, tvb, offset+28, 14, "Safety Application Reply Data");
- safety_tree = proto_item_add_subtree( ti, ett_cip_cm_safety );
+ safety_tree = proto_tree_add_subtree( tree, tvb, offset+28, 14, ett_cip_cm_safety, NULL, "Safety Application Reply Data");
proto_tree_add_item( safety_tree, hf_cip_cm_consumer_number, tvb, offset+26, 2, ENC_LITTLE_ENDIAN);
- ti = proto_tree_add_text( safety_tree, tvb, offset+28, 12, "PID/CID");
- pid_tree = proto_item_add_subtree( ti, ett_cip_cm_pid );
+ pid_tree = proto_tree_add_subtree( safety_tree, tvb, offset+28, 12, ett_cip_cm_pid, NULL, "PID/CID");
proto_tree_add_item( pid_tree, hf_cip_cm_targ_vendor_id, tvb, offset+28, 2, ENC_LITTLE_ENDIAN);
proto_tree_add_item( pid_tree, hf_cip_cm_targ_dev_serial_num, tvb, offset+30, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item( pid_tree, hf_cip_cm_targ_conn_serial_num, tvb, offset+34, 2, ENC_LITTLE_ENDIAN);
@@ -5077,7 +5049,7 @@ dissect_cip_cm_fwd_open_rsp_success(cip_req_info_t *preq_info, proto_tree *tree,
static void
dissect_cip_cm_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_length, packet_info *pinfo )
{
- proto_item *pi, *rrsc_item, *status_item, *add_status_item, *temp_item;
+ proto_item *pi, *rrsc_item, *status_item, *temp_item;
proto_tree *rrsc_tree, *cmd_data_tree, *status_tree, *add_status_tree, *temp_tree;
int req_path_size, conn_path_size, temp_data;
unsigned char service, gen_status, add_stat_size;
@@ -5143,8 +5115,7 @@ dissect_cip_cm_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_
col_set_str(pinfo->cinfo, COL_PROTOCOL, "CIP CM");
/* Add Service code & Request/Response tree */
- rrsc_item = proto_tree_add_text( item_tree, tvb, offset, 1, "Service: " );
- rrsc_tree = proto_item_add_subtree( rrsc_item, ett_cm_rrsc );
+ rrsc_tree = proto_tree_add_subtree( item_tree, tvb, offset, 1, ett_cm_rrsc, &rrsc_item, "Service: " );
/* Add Request/Response */
proto_tree_add_item( rrsc_tree, hf_cip_reqrsp, tvb, offset, 1, ENC_LITTLE_ENDIAN );
@@ -5168,8 +5139,7 @@ dissect_cip_cm_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_
if (gen_status == CI_GRC_FAILURE)
{
/* Dissect object specific error codes */
- status_item = proto_tree_add_text(item_tree, tvb, offset+2, 1, "Status: " );
- status_tree = proto_item_add_subtree( status_item, ett_status_item );
+ status_tree = proto_tree_add_subtree(item_tree, tvb, offset+2, 1, ett_status_item, &status_item, "Status: " );
/* Add general status */
proto_tree_add_item(status_tree, hf_cip_cm_genstat, tvb, offset+2, 1, ENC_LITTLE_ENDIAN );
@@ -5237,8 +5207,7 @@ dissect_cip_cm_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_
/* Add additional status */
if (add_stat_size > 1)
{
- add_status_item = proto_tree_add_text( status_tree, tvb, offset+4, add_stat_size, "Additional Status" );
- add_status_tree = proto_item_add_subtree( add_status_item, ett_cm_add_status_item );
+ add_status_tree = proto_tree_add_subtree( status_tree, tvb, offset+4, add_stat_size, ett_cm_add_status_item, NULL, "Additional Status" );
for( i=0; i < add_stat_size-2; i += 2 )
proto_tree_add_item(add_status_tree, hf_cip_cm_add_status, tvb, offset+4+i, 2, ENC_LITTLE_ENDIAN );
@@ -5250,8 +5219,8 @@ dissect_cip_cm_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_
/* If there is any command specific data create a sub-tree for it */
if( ( item_length-4-add_stat_size ) != 0 )
{
- pi = proto_tree_add_text( item_tree, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, "Command Specific Data" );
- cmd_data_tree = proto_item_add_subtree( pi, ett_cm_cmd_data );
+ cmd_data_tree = proto_tree_add_subtree( item_tree, tvb, offset+4+add_stat_size, item_length-4-add_stat_size,
+ ett_cm_cmd_data, NULL, "Command Specific Data" );
if( gen_status == CI_GRC_SUCCESS || gen_status == CI_GRC_SERVICE_ERROR )
{
@@ -5371,8 +5340,8 @@ dissect_cip_cm_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_
if( (item_length-req_path_size-2) != 0 )
{
- pi = proto_tree_add_text( item_tree, tvb, offset+2+req_path_size, item_length-req_path_size-2, "Command Specific Data" );
- cmd_data_tree = proto_item_add_subtree( pi, ett_cm_cmd_data );
+ cmd_data_tree = proto_tree_add_subtree( item_tree, tvb, offset+2+req_path_size, item_length-req_path_size-2,
+ ett_cm_cmd_data, NULL, "Command Specific Data" );
/* Check what service code that received */
switch (service)
@@ -5423,8 +5392,7 @@ dissect_cip_cm_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_
proto_tree_add_item(cmd_data_tree, hf_cip_cm_msg_req_size, tvb, offset+2+req_path_size+2, 2, ENC_LITTLE_ENDIAN);
/* Message Request */
- temp_item = proto_tree_add_text( cmd_data_tree, tvb, offset+2+req_path_size+4, msg_req_siz, "Message Request" );
- temp_tree = proto_item_add_subtree(temp_item, ett_cm_mes_req );
+ temp_tree = proto_tree_add_subtree( cmd_data_tree, tvb, offset+2+req_path_size+4, msg_req_siz, ett_cm_mes_req, NULL, "Message Request" );
/*
** We call our selves again to disect embedded packet
@@ -5518,7 +5486,7 @@ dissect_cip_class_cm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
static void
dissect_cip_mb_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_length, packet_info *pinfo )
{
- proto_item *pi, *rrsc_item;
+ proto_item *rrsc_item;
proto_tree *rrsc_tree, *cmd_data_tree;
tvbuff_t *next_tvb;
int req_path_size;
@@ -5529,8 +5497,7 @@ dissect_cip_mb_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_
/* Add Service code & Request/Response tree */
service = tvb_get_guint8( tvb, offset );
- rrsc_item = proto_tree_add_text( item_tree, tvb, offset, 1, "Service: " );
- rrsc_tree = proto_item_add_subtree( rrsc_item, ett_mb_rrsc );
+ rrsc_tree = proto_tree_add_subtree( item_tree, tvb, offset, 1, ett_mb_rrsc, &rrsc_item, "Service: " );
/* Add Request/Response */
proto_tree_add_item( rrsc_tree, hf_cip_reqrsp, tvb, offset, 1, ENC_LITTLE_ENDIAN );
@@ -5553,8 +5520,8 @@ dissect_cip_mb_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_
/* If there is any command specific data create a sub-tree for it */
if( ( item_length-4-add_stat_size ) != 0 )
{
- pi = proto_tree_add_text( item_tree, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, "Command Specific Data" );
- cmd_data_tree = proto_item_add_subtree( pi, ett_mb_cmd_data );
+ cmd_data_tree = proto_tree_add_subtree( item_tree, tvb, offset+4+add_stat_size, item_length-4-add_stat_size,
+ ett_mb_cmd_data, NULL, "Command Specific Data" );
if( gen_status == CI_GRC_SUCCESS || gen_status == CI_GRC_SERVICE_ERROR )
{
@@ -5629,8 +5596,8 @@ dissect_cip_mb_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_
/* If there is any command specific data creat a sub-tree for it */
if( (item_length-req_path_size-2) != 0 )
{
- pi = proto_tree_add_text( item_tree, tvb, offset+2+req_path_size, item_length-req_path_size-2, "Command Specific Data" );
- cmd_data_tree = proto_item_add_subtree( pi, ett_mb_cmd_data );
+ cmd_data_tree = proto_tree_add_subtree( item_tree, tvb, offset+2+req_path_size, item_length-req_path_size-2,
+ ett_mb_cmd_data, NULL, "Command Specific Data" );
/* Check what service code that received */
switch (service)
@@ -5729,7 +5696,7 @@ dissect_cip_class_mb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
static int
dissect_cip_cco_all_attribute_common( proto_tree *cmd_tree, tvbuff_t *tvb, int offset, int item_length, packet_info *pinfo)
{
- proto_item *pi, *tdii, *ncpi, *iomapi, *confgi;
+ proto_item *pi, *confgi;
proto_tree *tdi_tree, *iomap_tree;
proto_tree *ncp_tree, *confg_tree;
int conn_path_size, variable_data_size = 0, config_data_size;
@@ -5750,8 +5717,7 @@ dissect_cip_cco_all_attribute_common( proto_tree *cmd_tree, tvbuff_t *tvb, int o
proto_tree_add_item(confg_tree, hf_cip_cco_to_rtf, tvb, offset, 2, ENC_LITTLE_ENDIAN );
/* Target device id */
- tdii = proto_tree_add_text( cmd_tree, tvb, offset+2, 10, "Target Device ID");
- tdi_tree = proto_item_add_subtree(tdii, ett_cco_tdi);
+ tdi_tree = proto_tree_add_subtree( cmd_tree, tvb, offset+2, 10, ett_cco_tdi, NULL, "Target Device ID");
dissect_deviceid(tvb, offset+2, tdi_tree,
hf_cip_cco_tdi_vendor, hf_cip_cco_tdi_devtype, hf_cip_cco_tdi_prodcode,
@@ -5761,8 +5727,7 @@ dissect_cip_cco_all_attribute_common( proto_tree *cmd_tree, tvbuff_t *tvb, int o
proto_tree_add_item(cmd_tree, hf_cip_cco_cs_data_index, tvb, offset+10, 4, ENC_LITTLE_ENDIAN );
/* Net Connection Parameters */
- ncpi = proto_tree_add_text( cmd_tree, tvb, offset+14, 14, "Net Connection Parameters");
- ncp_tree = proto_item_add_subtree(ncpi, ett_cco_ncp);
+ ncp_tree = proto_tree_add_subtree( cmd_tree, tvb, offset+14, 14, ett_cco_ncp, NULL, "Net Connection Parameters");
/* Timeout multiplier */
proto_tree_add_item(ncp_tree, hf_cip_cco_timeout_multiplier, tvb, offset+14, 1, ENC_LITTLE_ENDIAN );
@@ -5825,8 +5790,7 @@ dissect_cip_cco_all_attribute_common( proto_tree *cmd_tree, tvbuff_t *tvb, int o
/* I/O Mapping */
iomap_size = tvb_get_letohs( tvb, offset+variable_data_size+2);
- iomapi = proto_tree_add_text( cmd_tree, tvb, offset+variable_data_size, iomap_size+2, "I/O Mapping");
- iomap_tree = proto_item_add_subtree(iomapi, ett_cco_iomap);
+ iomap_tree = proto_tree_add_subtree( cmd_tree, tvb, offset+variable_data_size, iomap_size+2, ett_cco_iomap, NULL, "I/O Mapping");
proto_tree_add_item(iomap_tree, hf_cip_cco_iomap_format_number, tvb, offset+variable_data_size, 2, ENC_LITTLE_ENDIAN );
proto_tree_add_uint_format_value(iomap_tree, hf_cip_cco_iomap_size, tvb, offset+variable_data_size+2, 2, iomap_size, "%d (bytes)", iomap_size);
@@ -5838,8 +5802,7 @@ dissect_cip_cco_all_attribute_common( proto_tree *cmd_tree, tvbuff_t *tvb, int o
variable_data_size += (iomap_size+4);
/* Proxy device id */
- tdii = proto_tree_add_text( cmd_tree, tvb, offset+variable_data_size, 10, "Proxy Device ID");
- tdi_tree = proto_item_add_subtree(tdii, ett_cco_pdi);
+ tdi_tree = proto_tree_add_subtree( cmd_tree, tvb, offset+variable_data_size, 10, ett_cco_pdi, NULL, "Proxy Device ID");
dissect_deviceid(tvb, offset+variable_data_size, tdi_tree,
hf_cip_cco_pdi_vendor, hf_cip_cco_pdi_devtype, hf_cip_cco_pdi_prodcode,
@@ -5871,8 +5834,7 @@ dissect_cip_cco_all_attribute_common( proto_tree *cmd_tree, tvbuff_t *tvb, int o
if (offset+variable_data_size < item_length)
{
/* Large Net Connection Parameter */
- ncpi = proto_tree_add_text( cmd_tree, tvb, offset+variable_data_size, 18, "Large Net Connection Parameters");
- ncp_tree = proto_item_add_subtree(ncpi, ett_cco_ncp);
+ ncp_tree = proto_tree_add_subtree( cmd_tree, tvb, offset+variable_data_size, 18, ett_cco_ncp, NULL, "Large Net Connection Parameters");
proto_tree_add_item(ncp_tree, hf_cip_cco_timeout_multiplier, tvb, offset+variable_data_size, 1, ENC_LITTLE_ENDIAN );
dissect_transport_type_trigger(tvb, offset+variable_data_size+1, ncp_tree, hf_cip_cco_transport_type_trigger,
@@ -5902,7 +5864,7 @@ return variable_data_size;
static void
dissect_cip_cco_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_length, packet_info *pinfo )
{
- proto_item *pi, *rrsc_item, *con_sti;
+ proto_item *rrsc_item;
proto_tree *rrsc_tree, *cmd_data_tree, *con_st_tree;
int req_path_size;
int temp_data;
@@ -5914,8 +5876,7 @@ dissect_cip_cco_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item
/* Add Service code & Request/Response tree */
service = tvb_get_guint8( tvb, offset );
- rrsc_item = proto_tree_add_text( item_tree, tvb, offset, 1, "Service: " );
- rrsc_tree = proto_item_add_subtree( rrsc_item, ett_cco_rrsc );
+ rrsc_tree = proto_tree_add_subtree( item_tree, tvb, offset, 1, ett_cco_rrsc, &rrsc_item, "Service: " );
/* Add Request/Response */
proto_tree_add_item( rrsc_tree, hf_cip_reqrsp, tvb, offset, 1, ENC_LITTLE_ENDIAN );
@@ -5954,8 +5915,8 @@ dissect_cip_cco_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item
/* If there is any command specific data create a sub-tree for it */
if( ( item_length-4-add_stat_size ) != 0 )
{
- pi = proto_tree_add_text( item_tree, tvb, offset+4+add_stat_size, item_length-4-add_stat_size, "Command Specific Data" );
- cmd_data_tree = proto_item_add_subtree( pi, ett_cco_cmd_data );
+ cmd_data_tree = proto_tree_add_subtree( item_tree, tvb, offset+4+add_stat_size, item_length-4-add_stat_size,
+ ett_cco_cmd_data, NULL, "Command Specific Data" );
if( gen_status == CI_GRC_SUCCESS || gen_status == CI_GRC_SERVICE_ERROR )
{
@@ -5978,8 +5939,7 @@ dissect_cip_cco_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item
/* Get Attribute All (instance) request */
/* Connection status */
- con_sti = proto_tree_add_text( cmd_data_tree, tvb, offset+4+add_stat_size, 4, "Connection Status");
- con_st_tree = proto_item_add_subtree(con_sti, ett_cco_con_status);
+ con_st_tree = proto_tree_add_subtree( cmd_data_tree, tvb, offset+4+add_stat_size, 4, ett_cco_con_status, NULL, "Connection Status");
proto_tree_add_item(con_st_tree, hf_cip_genstat, tvb, offset+4+add_stat_size, 1, ENC_LITTLE_ENDIAN );
proto_tree_add_item(con_st_tree, hf_cip_pad8, tvb, offset+4+add_stat_size+1, 1, ENC_LITTLE_ENDIAN);
@@ -6020,8 +5980,8 @@ dissect_cip_cco_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item
if( (item_length-req_path_size-2) != 0 )
{
- pi = proto_tree_add_text( item_tree, tvb, offset+2+req_path_size, item_length-req_path_size-2, "Command Specific Data" );
- cmd_data_tree = proto_item_add_subtree( pi, ett_cco_cmd_data );
+ cmd_data_tree = proto_tree_add_subtree( item_tree, tvb, offset+2+req_path_size, item_length-req_path_size-2,
+ ett_cco_cmd_data, NULL, "Command Specific Data" );
/* Check what service code that received */
@@ -6151,7 +6111,7 @@ dissect_cip_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, packet_info
{
proto_item *ti;
proto_tree *cip_tree;
- proto_item *pi, *rrsc_item, *status_item, *add_status_item;
+ proto_item *pi, *rrsc_item, *status_item;
proto_tree *rrsc_tree, *status_tree, *add_status_tree;
int req_path_size;
unsigned char i, gen_status, add_stat_size;
@@ -6186,8 +6146,7 @@ dissect_cip_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, packet_info
if( service & CIP_SC_RESPONSE_MASK )
{
/* Response message */
- status_item = proto_tree_add_text( cip_tree, tvb, offset+2, 1, "Status: " );
- status_tree = proto_item_add_subtree( status_item, ett_status_item );
+ status_tree = proto_tree_add_subtree( cip_tree, tvb, offset+2, 1, ett_status_item, &status_item, "Status: " );
/* Add general status */
gen_status = tvb_get_guint8( tvb, offset+2 );
@@ -6208,8 +6167,7 @@ dissect_cip_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, packet_info
if( add_stat_size )
{
/* Add additional status */
- add_status_item = proto_tree_add_text( status_tree, tvb, offset+4, add_stat_size*2, "Additional Status" );
- add_status_tree = proto_item_add_subtree( add_status_item, ett_add_status_item );
+ add_status_tree = proto_tree_add_subtree( status_tree, tvb, offset+4, add_stat_size*2, ett_add_status_item, NULL, "Additional Status" );
for( i=0; i < add_stat_size; i ++ )
proto_tree_add_item(add_status_tree, hf_cip_add_stat, tvb, offset+4+(i*2), 2, ENC_LITTLE_ENDIAN );
diff --git a/epan/dissectors/packet-cipmotion.c b/epan/dissectors/packet-cipmotion.c
index caa6513e1a..ce7bffe4a3 100644
--- a/epan/dissectors/packet-cipmotion.c
+++ b/epan/dissectors/packet-cipmotion.c
@@ -718,15 +718,14 @@ dissect_status_data_set(guint32 status_data_set, proto_tree* tree, tvbuff_t* tvb
static guint32
dissect_cntr_cyclic(guint32 con_format _U_, tvbuff_t* tvb, proto_tree* tree, guint32 offset, guint32 size, guint32 instance _U_)
{
- proto_item *header_item, *temp_proto_item;
+ proto_item *temp_proto_item;
proto_tree *header_tree, *temp_proto_tree;
guint32 temp_data;
gboolean lreal_pos;
guint32 bytes_used = 0;
/* Create the tree for the entire instance data header */
- header_item = proto_tree_add_text(tree, tvb, offset, size, "Cyclic Data Block");
- header_tree = proto_item_add_subtree(header_item, ett_cyclic_data_block);
+ header_tree = proto_tree_add_subtree(tree, tvb, offset, size, ett_cyclic_data_block, NULL, "Cyclic Data Block");
/* Add the control mode header field to the tree */
proto_tree_add_item(header_tree, hf_cip_motor_cntrl, tvb, offset, 1, ENC_LITTLE_ENDIAN);
@@ -808,14 +807,13 @@ dissect_cntr_cyclic(guint32 con_format _U_, tvbuff_t* tvb, proto_tree* tree, gui
static guint32
dissect_devce_cyclic(guint32 con_format _U_, tvbuff_t* tvb, proto_tree* tree, guint32 offset, guint32 size, guint32 instance _U_)
{
- proto_item *header_item, *temp_proto_item;
+ proto_item *temp_proto_item;
proto_tree *header_tree, *temp_proto_tree;
guint32 temp_data;
guint32 bytes_used = 0;
/* Create the tree for the entire instance data header */
- header_item = proto_tree_add_text(tree, tvb, offset, size, "Cyclic Data Block");
- header_tree = proto_item_add_subtree(header_item, ett_cyclic_data_block);
+ header_tree = proto_tree_add_subtree(tree, tvb, offset, size, ett_cyclic_data_block, NULL, "Cyclic Data Block");
/* Add the control mode header field to the tree */
proto_tree_add_item(header_tree, hf_cip_motor_cntrl, tvb, offset, 1, ENC_LITTLE_ENDIAN);
@@ -883,12 +881,10 @@ dissect_devce_cyclic(guint32 con_format _U_, tvbuff_t* tvb, proto_tree* tree, gu
static guint32
dissect_cyclic_wt(tvbuff_t* tvb, proto_tree* tree, guint32 offset, guint32 size)
{
- proto_item *header_item;
proto_tree *header_tree;
/* Create the tree for the entire cyclic write data block */
- header_item = proto_tree_add_text(tree, tvb, offset, size, "Cyclic Write Data Block");
- header_tree = proto_item_add_subtree(header_item, ett_cyclic_rd_wt);
+ header_tree = proto_tree_add_subtree(tree, tvb, offset, size, ett_cyclic_rd_wt, NULL, "Cyclic Write Data Block");
/* Display the cyclic write block id value */
proto_tree_add_item(header_tree, hf_cip_cyclic_write_blk, tvb, offset, 1, ENC_LITTLE_ENDIAN);
@@ -916,12 +912,10 @@ dissect_cyclic_wt(tvbuff_t* tvb, proto_tree* tree, guint32 offset, guint32 size)
static guint32
dissect_cyclic_rd(tvbuff_t* tvb, proto_tree* tree, guint32 offset, guint32 size)
{
- proto_item *header_item;
proto_tree *header_tree;
/* Create the tree for the entire cyclic write data block */
- header_item = proto_tree_add_text(tree, tvb, offset, size, "Cyclic Read Data Block");
- header_tree = proto_item_add_subtree(header_item, ett_cyclic_rd_wt);
+ header_tree = proto_tree_add_subtree(tree, tvb, offset, size, ett_cyclic_rd_wt, NULL, "Cyclic Read Data Block");
/* Display the cyclic write block id value */
proto_tree_add_item(header_tree, hf_cip_cyclic_write_blk, tvb, offset, 1, ENC_LITTLE_ENDIAN);
@@ -955,15 +949,14 @@ dissect_cyclic_rd(tvbuff_t* tvb, proto_tree* tree, guint32 offset, guint32 size)
static guint32
dissect_cntr_event(tvbuff_t* tvb, proto_tree* tree, guint32 offset, guint32 size)
{
- proto_item *header_item, *temp_proto_item;
+ proto_item *temp_proto_item;
proto_tree *header_tree, *temp_proto_tree;
guint32 temp_data;
guint32 acks, cur_ack;
guint32 bytes_used = 0;
/* Create the tree for the entire cyclic write data block */
- header_item = proto_tree_add_text(tree, tvb, offset, size, "Event Data Block");
- header_tree = proto_item_add_subtree(header_item, ett_event);
+ header_tree = proto_tree_add_subtree(tree, tvb, offset, size, ett_event, NULL, "Event Data Block");
/* Read the event checking control header field from the packet into memory */
temp_data = tvb_get_letohl(tvb, offset);
@@ -1026,15 +1019,14 @@ dissect_cntr_event(tvbuff_t* tvb, proto_tree* tree, guint32 offset, guint32 size
static guint32
dissect_devce_event(tvbuff_t* tvb, proto_tree* tree, guint32 offset, guint32 size)
{
- proto_item *header_item, *temp_proto_item;
+ proto_item *temp_proto_item;
proto_tree *header_tree, *temp_proto_tree;
guint64 temp_data;
guint64 nots, cur_not;
guint32 bytes_used = 0;
/* Create the tree for the entire cyclic write data block */
- header_item = proto_tree_add_text(tree, tvb, offset, size, "Event Data Block");
- header_tree = proto_item_add_subtree(header_item, ett_event);
+ header_tree = proto_tree_add_subtree(tree, tvb, offset, size, ett_event, NULL, "Event Data Block");
/* Read the event checking control header field from the packet into memory */
temp_data = tvb_get_letohl(tvb, offset);
@@ -1108,15 +1100,14 @@ dissect_devce_event(tvbuff_t* tvb, proto_tree* tree, guint32 offset, guint32 siz
static void
dissect_get_axis_attr_list_request (tvbuff_t* tvb, proto_tree* tree, guint32 offset, guint32 size)
{
- proto_item *header_item, *attr_item;
+ proto_item *attr_item;
proto_tree *header_tree, *attr_tree;
guint16 attribute, attribute_cnt;
guint32 local_offset;
guint8 increment_size, dimension;
/* Create the tree for the get axis attribute list request */
- header_item = proto_tree_add_text(tree, tvb, offset, size, "Get Axis Attribute List Request");
- header_tree = proto_item_add_subtree(header_item, ett_get_axis_attribute);
+ header_tree = proto_tree_add_subtree(tree, tvb, offset, size, ett_get_axis_attribute, NULL, "Get Axis Attribute List Request");
/* Read the number of attributes that are contained within the request */
attribute_cnt = tvb_get_letohs(tvb, offset);
@@ -1167,7 +1158,7 @@ dissect_get_axis_attr_list_request (tvbuff_t* tvb, proto_tree* tree, guint32 off
static void
dissect_set_axis_attr_list_request (tvbuff_t* tvb, proto_tree* tree, guint32 offset, guint32 size)
{
- proto_item *header_item, *attr_item;
+ proto_item *attr_item;
proto_tree *header_tree, *attr_tree;
guint16 attribute, attribute_cnt, data_elements;
guint32 local_offset;
@@ -1175,8 +1166,7 @@ dissect_set_axis_attr_list_request (tvbuff_t* tvb, proto_tree* tree, guint32 off
guint8 dimension, attribute_start, increment_size;
/* Create the tree for the set axis attribute list request */
- header_item = proto_tree_add_text(tree, tvb, offset, size, "Set Axis Attribute List Request");
- header_tree = proto_item_add_subtree(header_item, ett_set_axis_attribute);
+ header_tree = proto_tree_add_subtree(tree, tvb, offset, size, ett_set_axis_attribute, NULL, "Set Axis Attribute List Request");
/* Read the number of attributes that are contained within the request */
attribute_cnt = tvb_get_letohs(tvb, offset);
@@ -1247,12 +1237,10 @@ dissect_set_axis_attr_list_request (tvbuff_t* tvb, proto_tree* tree, guint32 off
static void
dissect_group_sync_request (tvbuff_t* tvb, proto_tree* tree, guint32 offset, guint32 size)
{
- proto_item *header_item;
proto_tree *header_tree;
/* Create the tree for the group sync request */
- header_item = proto_tree_add_text(tree, tvb, offset, size, "Group Sync Request");
- header_tree = proto_item_add_subtree(header_item, ett_group_sync);
+ header_tree = proto_tree_add_subtree(tree, tvb, offset, size, ett_group_sync, NULL, "Group Sync Request");
/* Read the grandmaster id from the payload */
proto_tree_add_item(header_tree, hf_cip_ptp_grandmaster, tvb, offset, 8, ENC_LITTLE_ENDIAN);
@@ -1270,13 +1258,11 @@ dissect_group_sync_request (tvbuff_t* tvb, proto_tree* tree, guint32 offset, gui
static guint32
dissect_cntr_service(tvbuff_t* tvb, proto_tree* tree, guint32 offset, guint32 size)
{
- proto_item *header_item;
proto_tree *header_tree;
guint8 service;
/* Create the tree for the entire service data block */
- header_item = proto_tree_add_text(tree, tvb, offset, size, "Service Data Block");
- header_tree = proto_item_add_subtree(header_item, ett_service);
+ header_tree = proto_tree_add_subtree(tree, tvb, offset, size, ett_service, NULL, "Service Data Block");
/* Display the transaction id value */
proto_tree_add_item(header_tree, hf_cip_svc_transction, tvb, offset, 1, ENC_LITTLE_ENDIAN);
@@ -1315,14 +1301,13 @@ dissect_cntr_service(tvbuff_t* tvb, proto_tree* tree, guint32 offset, guint32 si
static void
dissect_set_axis_attr_list_response (tvbuff_t* tvb, proto_tree* tree, guint32 offset, guint32 size)
{
- proto_item *header_item, *attr_item;
+ proto_item *attr_item;
proto_tree *header_tree, *attr_tree;
guint16 attribute, attribute_cnt;
guint32 local_offset;
/* Create the tree for the set axis attribute list response */
- header_item = proto_tree_add_text(tree, tvb, offset, size, "Set Axis Attribute List Response");
- header_tree = proto_item_add_subtree(header_item, ett_get_axis_attribute);
+ header_tree = proto_tree_add_subtree(tree, tvb, offset, size, ett_get_axis_attribute, NULL, "Set Axis Attribute List Response");
/* Read the number of attributes that are contained within the response */
attribute_cnt = tvb_get_letohs(tvb, offset);
@@ -1356,7 +1341,7 @@ dissect_set_axis_attr_list_response (tvbuff_t* tvb, proto_tree* tree, guint32 of
static void
dissect_get_axis_attr_list_response (tvbuff_t* tvb, proto_tree* tree, guint32 offset, guint32 size)
{
- proto_item *header_item, *attr_item;
+ proto_item *attr_item;
proto_tree *header_tree, *attr_tree;
guint16 attribute, attribute_cnt, data_elements;
guint32 attribute_size;
@@ -1364,8 +1349,7 @@ dissect_get_axis_attr_list_response (tvbuff_t* tvb, proto_tree* tree, guint32 of
guint32 local_offset;
/* Create the tree for the get axis attribute list response */
- header_item = proto_tree_add_text(tree, tvb, offset, size, "Get Axis Attribute List Response");
- header_tree = proto_item_add_subtree(header_item, ett_get_axis_attribute);
+ header_tree = proto_tree_add_subtree(tree, tvb, offset, size, ett_get_axis_attribute, NULL, "Get Axis Attribute List Response");
/* Read the number of attributes that are contained within the request */
attribute_cnt = tvb_get_letohs(tvb, offset);
@@ -1461,12 +1445,10 @@ dissect_group_sync_response (tvbuff_t* tvb, proto_tree* tree, guint32 offset, gu
static guint32
dissect_devce_service(tvbuff_t* tvb, proto_tree* tree, guint32 offset, guint32 size)
{
- proto_item *header_item;
proto_tree *header_tree;
/* Create the tree for the entire service data block */
- header_item = proto_tree_add_text(tree, tvb, offset, size, "Service Data Block");
- header_tree = proto_item_add_subtree(header_item, ett_service);
+ header_tree = proto_tree_add_subtree(tree, tvb, offset, size, ett_service, NULL, "Service Data Block");
/* Display the transaction id value */
proto_tree_add_item(header_tree, hf_cip_svc_transction, tvb, offset, 1, ENC_LITTLE_ENDIAN);
@@ -1513,14 +1495,13 @@ dissect_var_inst_header(tvbuff_t* tvb, proto_tree* tree, guint32 offset, guint8*
guint32* cyc_blk_size, guint32* evnt_size, guint32* servc_size)
{
guint8 temp_data;
- proto_item *header_item;
proto_tree *header_tree;
/* Create the tree for the entire instance data header */
*inst_number = tvb_get_guint8(tvb, offset);
- header_item = proto_tree_add_text(tree, tvb, offset, 8, "Instance Data Header - Instance: %d", *inst_number);
- header_tree = proto_item_add_subtree(header_item, ett_inst_data_header);
+ header_tree = proto_tree_add_subtree_format(tree, tvb, offset, 8, ett_inst_data_header, NULL,
+ "Instance Data Header - Instance: %d", *inst_number);
/* Read the instance number field from the instance data header */
proto_tree_add_item(header_tree, hf_var_devce_instance, tvb, offset, 1, ENC_LITTLE_ENDIAN);
@@ -1571,7 +1552,7 @@ dissect_var_cont_conn_header(tvbuff_t* tvb, proto_tree* tree, guint32* inst_coun
{
guint32 header_size;
guint32 temp_data;
- proto_item *header_item, *temp_proto_item;
+ proto_item *temp_proto_item;
proto_tree *header_tree, *temp_proto_tree;
/* Calculate the header size, start with the basic header size */
@@ -1591,8 +1572,7 @@ dissect_var_cont_conn_header(tvbuff_t* tvb, proto_tree* tree, guint32* inst_coun
}
/* Create the tree for the entire connection header */
- header_item = proto_tree_add_text(tree, tvb, offset, header_size, "Connection Header");
- header_tree = proto_item_add_subtree(header_item, ett_cont_dev_header);
+ header_tree = proto_tree_add_subtree(tree, tvb, offset, header_size, ett_cont_dev_header, NULL, "Connection Header");
/* Add the connection header fields that are common to all types of messages */
proto_tree_add_item(header_tree, hf_cip_format, tvb, offset, 1, ENC_LITTLE_ENDIAN);
@@ -1661,7 +1641,7 @@ dissect_var_devce_conn_header(tvbuff_t* tvb, proto_tree* tree, guint32* inst_cou
{
guint32 header_size;
guint32 temp_data;
- proto_item *header_item, *temp_proto_item;
+ proto_item *temp_proto_item;
proto_tree *header_tree, *temp_proto_tree;
/* Calculate the header size, start with the basic header size */
@@ -1686,8 +1666,7 @@ dissect_var_devce_conn_header(tvbuff_t* tvb, proto_tree* tree, guint32* inst_cou
}
/* Create the tree for the entire connection header */
- header_item = proto_tree_add_text(tree, tvb, offset, header_size, "Connection Header");
- header_tree = proto_item_add_subtree(header_item, ett_cont_dev_header);
+ header_tree = proto_tree_add_subtree(tree, tvb, offset, header_size, ett_cont_dev_header, NULL, "Connection Header");
/* Add the connection header fields that are common to all types of messages */
proto_tree_add_item(header_tree, hf_cip_format, tvb, offset, 1, ENC_LITTLE_ENDIAN);
diff --git a/epan/dissectors/packet-cipsafety.c b/epan/dissectors/packet-cipsafety.c
index b94beebf84..e96f1cba6e 100644
--- a/epan/dissectors/packet-cipsafety.c
+++ b/epan/dissectors/packet-cipsafety.c
@@ -438,12 +438,10 @@ dissect_unid(tvbuff_t *tvb, packet_info *pinfo _U_, int offset, proto_item *pi,
int hf_ssn_date, int hf_ssn_time, int hf_macid, gint ett, gint ett_ssn)
{
proto_tree *tree, *ssn_tree;
- proto_item *ssn_item;
tree = proto_item_add_subtree(pi, ett);
- ssn_item = proto_tree_add_text(tree, tvb, offset, 6, "%s", ssn_name);
- ssn_tree = proto_item_add_subtree(ssn_item, ett_ssn);
+ ssn_tree = proto_tree_add_subtree(tree, tvb, offset, 6, ett_ssn, NULL, ssn_name);
dissect_cipsafety_ssn(ssn_tree, tvb, pinfo, offset, hf_ssn_timestamp, hf_ssn_date, hf_ssn_time);
proto_tree_add_item(tree, hf_macid, tvb, offset+6, 4, ENC_LITTLE_ENDIAN);
@@ -490,8 +488,7 @@ dissect_cip_s_supervisor_data( proto_tree *item_tree,
/* Add Service code & Request/Response tree */
service = tvb_get_guint8( tvb, offset );
- rrsc_item = proto_tree_add_text( item_tree, tvb, offset, 1, "Service: " );
- rrsc_tree = proto_item_add_subtree( rrsc_item, ett_ssupervisor_rrsc );
+ rrsc_tree = proto_tree_add_subtree( item_tree, tvb, offset, 1, ett_ssupervisor_rrsc, &rrsc_item, "Service: " );
/* Add Request/Response */
proto_tree_add_item( rrsc_tree, hf_cip_reqrsp, tvb, offset, 1, ENC_LITTLE_ENDIAN );
@@ -528,9 +525,8 @@ dissect_cip_s_supervisor_data( proto_tree *item_tree,
/* If there is any command specific data create a sub-tree for it */
if( ( item_length-4-add_stat_size ) != 0 )
{
- pi = proto_tree_add_text( item_tree,
- tvb, offset+4+add_stat_size, item_length-4-add_stat_size, "Command Specific Data" );
- cmd_data_tree = proto_item_add_subtree( pi, ett_ssupervisor_cmd_data );
+ cmd_data_tree = proto_tree_add_subtree( item_tree, tvb, offset+4+add_stat_size,
+ item_length-4-add_stat_size, ett_ssupervisor_cmd_data, NULL, "Command Specific Data" );
if( gen_status == CI_GRC_SUCCESS || gen_status == CI_GRC_SERVICE_ERROR )
{
@@ -579,9 +575,8 @@ dissect_cip_s_supervisor_data( proto_tree *item_tree,
/* If there is any command specific data create a sub-tree for it */
if( (item_length-req_path_size-2) != 0 )
{
- pi = proto_tree_add_text( item_tree, tvb, offset+2+req_path_size, item_length-req_path_size-2,
- "Command Specific Data" );
- cmd_data_tree = proto_item_add_subtree( pi, ett_ssupervisor_cmd_data );
+ cmd_data_tree = proto_tree_add_subtree( item_tree, tvb, offset+2+req_path_size, item_length-req_path_size-2,
+ ett_ssupervisor_cmd_data, NULL, "Command Specific Data" );
/* Check what service code that received */
switch (service)
@@ -764,8 +759,7 @@ static int dissect_s_supervisor_exception_detail_alarm(packet_info *pinfo, proto
proto_tree *item_tree;
int total_size = 0, size;
- pi = proto_tree_add_text(tree, tvb, offset, 1, "Common Exception Detail");
- item_tree = proto_item_add_subtree(pi, ett_exception_detail_alarm_common);
+ item_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_exception_detail_alarm_common, &pi, "Common Exception Detail");
size = dissect_s_supervisor_exception_detail(item_tree, pi, tvb, offset,
hf_cip_ssupervisor_exception_detail_alarm_ced_size,
hf_cip_ssupervisor_exception_detail_alarm_ced_detail);
@@ -776,8 +770,7 @@ static int dissect_s_supervisor_exception_detail_alarm(packet_info *pinfo, proto
}
total_size += size;
- pi = proto_tree_add_text(tree, tvb, offset, 1, "Device Exception Detail");
- item_tree = proto_item_add_subtree(pi, ett_exception_detail_alarm_device);
+ item_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_exception_detail_alarm_device, &pi, "Device Exception Detail");
size = dissect_s_supervisor_exception_detail(item_tree, pi, tvb, offset,
hf_cip_ssupervisor_exception_detail_alarm_ded_size,
hf_cip_ssupervisor_exception_detail_alarm_ded_detail);
@@ -788,8 +781,7 @@ static int dissect_s_supervisor_exception_detail_alarm(packet_info *pinfo, proto
}
total_size += size;
- pi = proto_tree_add_text(tree, tvb, offset, 1, "Manufacturer Exception Detail");
- item_tree = proto_item_add_subtree(pi, ett_exception_detail_alarm_manufacturer);
+ item_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_exception_detail_alarm_manufacturer, &pi, "Manufacturer Exception Detail");
size = dissect_s_supervisor_exception_detail(item_tree, pi, tvb, offset,
hf_cip_ssupervisor_exception_detail_alarm_med_size,
hf_cip_ssupervisor_exception_detail_alarm_med_detail);
@@ -810,8 +802,7 @@ static int dissect_s_supervisor_exception_detail_warning(packet_info *pinfo, pro
proto_tree *item_tree;
int total_size = 0, size;
- pi = proto_tree_add_text(tree, tvb, offset, 1, "Common Exception Detail");
- item_tree = proto_item_add_subtree(pi, ett_exception_detail_warning_common);
+ item_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_exception_detail_warning_common, &pi, "Common Exception Detail");
size = dissect_s_supervisor_exception_detail(item_tree, pi, tvb, offset,
hf_cip_ssupervisor_exception_detail_warning_ced_size,
hf_cip_ssupervisor_exception_detail_warning_ced_detail);
@@ -822,8 +813,7 @@ static int dissect_s_supervisor_exception_detail_warning(packet_info *pinfo, pro
}
total_size += size;
- pi = proto_tree_add_text(tree, tvb, offset, 1, "Device Exception Detail");
- item_tree = proto_item_add_subtree(pi, ett_exception_detail_warning_device);
+ item_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_exception_detail_warning_device, &pi, "Device Exception Detail");
size = dissect_s_supervisor_exception_detail(item_tree, pi, tvb, offset,
hf_cip_ssupervisor_exception_detail_warning_ded_size,
hf_cip_ssupervisor_exception_detail_warning_ded_detail);
@@ -834,8 +824,7 @@ static int dissect_s_supervisor_exception_detail_warning(packet_info *pinfo, pro
}
total_size += size;
- pi = proto_tree_add_text(tree, tvb, offset, 1, "Manufacturer Exception Detail");
- item_tree = proto_item_add_subtree(pi, ett_exception_detail_warning_manufacturer);
+ item_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_exception_detail_warning_manufacturer, &pi, "Manufacturer Exception Detail");
size = dissect_s_supervisor_exception_detail(item_tree, pi, tvb, offset,
hf_cip_ssupervisor_exception_detail_warning_med_size,
hf_cip_ssupervisor_exception_detail_warning_med_detail);
@@ -1152,8 +1141,7 @@ dissect_cip_s_validator_data( proto_tree *item_tree,
/* Add Service code & Request/Response tree */
service = tvb_get_guint8( tvb, offset );
- rrsc_item = proto_tree_add_text( item_tree, tvb, offset, 1, "Service: " );
- rrsc_tree = proto_item_add_subtree( rrsc_item, ett_svalidator_rrsc );
+ rrsc_tree = proto_tree_add_subtree( item_tree, tvb, offset, 1, ett_svalidator_rrsc, &rrsc_item, "Service: " );
/* Add Request/Response */
proto_tree_add_item( rrsc_tree, hf_cip_reqrsp, tvb, offset, 1, ENC_LITTLE_ENDIAN );
@@ -1192,9 +1180,8 @@ dissect_cip_s_validator_data( proto_tree *item_tree,
/* If there is any command specific data create a sub-tree for it */
if( ( item_length-4-add_stat_size ) != 0 )
{
- pi = proto_tree_add_text( item_tree,
- tvb, offset+4+add_stat_size, item_length-4-add_stat_size, "Command Specific Data" );
- cmd_data_tree = proto_item_add_subtree( pi, ett_ssupervisor_cmd_data );
+ cmd_data_tree = proto_tree_add_subtree( item_tree, tvb, offset+4+add_stat_size, item_length-4-add_stat_size,
+ ett_ssupervisor_cmd_data, &pi, "Command Specific Data" );
if( gen_status == CI_GRC_SUCCESS || gen_status == CI_GRC_SERVICE_ERROR )
{
@@ -1278,9 +1265,8 @@ dissect_cip_s_validator_data( proto_tree *item_tree,
/* If there is any command specific data create a sub-tree for it */
if( (item_length-req_path_size-2) != 0 )
{
- pi = proto_tree_add_text( item_tree,
- tvb, offset+2+req_path_size, item_length-req_path_size-2, "Command Specific Data" );
- cmd_data_tree = proto_item_add_subtree( pi, ett_ssupervisor_cmd_data );
+ cmd_data_tree = proto_tree_add_subtree( item_tree, tvb, offset+2+req_path_size, item_length-req_path_size-2,
+ ett_ssupervisor_cmd_data, NULL, "Command Specific Data" );
proto_tree_add_item(cmd_data_tree, hf_cip_data,
tvb, offset+2+req_path_size, item_length-req_path_size-2, ENC_NA);
}
diff --git a/epan/dissectors/packet-classicstun.c b/epan/dissectors/packet-classicstun.c
index 4ed9e6ecb8..fbd1d96a61 100644
--- a/epan/dissectors/packet-classicstun.c
+++ b/epan/dissectors/packet-classicstun.c
@@ -373,11 +373,10 @@ dissect_classicstun(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d
att_type = tvb_get_ntohs(tvb, offset); /* Type field in attribute header */
att_length = tvb_get_ntohs(tvb, offset+2); /* Length field in attribute header */
- ta = proto_tree_add_text(att_type_tree, tvb, offset,
- ATTR_HDR_LEN+att_length,
+ att_tree = proto_tree_add_subtree_format(att_type_tree, tvb, offset,
+ ATTR_HDR_LEN+att_length, ett_classicstun_att, NULL,
"Attribute: %s",
val_to_str(att_type, attributes, "Unknown (0x%04x)"));
- att_tree = proto_item_add_subtree(ta, ett_classicstun_att);
proto_tree_add_uint(att_tree, classicstun_att_type, tvb,
offset, 2, att_type);
diff --git a/epan/dissectors/packet-clip.c b/epan/dissectors/packet-clip.c
index e34ae4c3b0..8def9fb6df 100644
--- a/epan/dissectors/packet-clip.c
+++ b/epan/dissectors/packet-clip.c
@@ -50,7 +50,6 @@ static void
dissect_clip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree *fh_tree;
- proto_item *ti;
pinfo->current_proto = "CLIP";
@@ -85,8 +84,7 @@ dissect_clip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
for both of those cases, to avoid the headache of having to
generate capture-filter code to handle both of those cases. */
if(tree) {
- ti = proto_tree_add_text(tree, tvb, 0, 0, "Classical IP frame" );
- fh_tree = proto_item_add_subtree(ti, ett_clip);
+ fh_tree = proto_tree_add_subtree(tree, tvb, 0, 0, ett_clip, NULL, "Classical IP frame" );
proto_tree_add_text(fh_tree, tvb, 0, 0, "No link information available");
}
call_dissector(ip_handle, tvb, pinfo, tree);
diff --git a/epan/dissectors/packet-clique-rm.c b/epan/dissectors/packet-clique-rm.c
index a30c5566d8..795c5a9658 100644
--- a/epan/dissectors/packet-clique-rm.c
+++ b/epan/dissectors/packet-clique-rm.c
@@ -135,11 +135,9 @@ dissect_sender_array(proto_tree *clique_rm_tree, int hf_header, gint ett_header,
static void
dissect_data_packet(proto_tree *clique_rm_tree, tvbuff_t *tvb, int offset)
{
- proto_item *ti;
proto_tree *tree;
- ti = proto_tree_add_text(clique_rm_tree, tvb, offset, -1, "Data");
- tree = proto_item_add_subtree(ti, ett_clique_rm_data);
+ tree = proto_tree_add_subtree(clique_rm_tree, tvb, offset, -1, ett_clique_rm_data, NULL, "Data");
proto_tree_add_item(tree, hf_clique_rm_data_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
@@ -152,14 +150,13 @@ dissect_data_packet(proto_tree *clique_rm_tree, tvbuff_t *tvb, int offset)
offset += 4;
- proto_tree_add_item(tree, hf_clique_rm_data_data, tvb, offset,
- tvb_length_remaining(tvb, offset), ENC_NA);
+ proto_tree_add_item(tree, hf_clique_rm_data_data, tvb, offset, -1, ENC_NA);
}
static int
dissect_depends(proto_tree *clique_rm_tree, tvbuff_t *tvb, int offset)
{
- proto_item *ti, *depend_item;
+ proto_item *ti;
proto_tree *tree, *depend_tree;
guint ii, count;
int len;
@@ -175,8 +172,8 @@ dissect_depends(proto_tree *clique_rm_tree, tvbuff_t *tvb, int offset)
tree = proto_item_add_subtree(ti, ett_clique_rm_depends);
for (ii = 0; ii < count; ii++)
{
- depend_item = proto_tree_add_text(tree, tvb, offset, 8, "Depend item %d", ii+1);
- depend_tree = proto_item_add_subtree(depend_item, ett_clique_rm_depends_item);
+ depend_tree = proto_tree_add_subtree_format(tree, tvb, offset, 8,
+ ett_clique_rm_depends_item, NULL, "Depend item %d", ii+1);
proto_tree_add_item(depend_tree, hf_clique_rm_depend_sender,
tvb, offset, 4, ENC_BIG_ENDIAN);
diff --git a/epan/dissectors/packet-clnp.c b/epan/dissectors/packet-clnp.c
index d03ed621f0..032e1d550c 100644
--- a/epan/dissectors/packet-clnp.c
+++ b/epan/dissectors/packet-clnp.c
@@ -580,9 +580,8 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
next_length = tvb_length_remaining(tvb, offset);
if (next_length != 0) {
/* We have payload; dissect it. */
- ti = proto_tree_add_text(clnp_tree, tvb, offset, next_length,
- "Discarded PDU");
- discpdu_tree = proto_item_add_subtree(ti, ett_clnp_disc_pdu);
+ discpdu_tree = proto_tree_add_subtree(clnp_tree, tvb, offset, next_length,
+ ett_clnp_disc_pdu, NULL, "Discarded PDU");
/* Save the current value of the "we're inside an error packet"
flag, and set that flag; subdissectors may treat packets
diff --git a/epan/dissectors/packet-collectd.c b/epan/dissectors/packet-collectd.c
index 843c4b7992..08d90cf004 100644
--- a/epan/dissectors/packet-collectd.c
+++ b/epan/dissectors/packet-collectd.c
@@ -284,12 +284,10 @@ collectd_proto_tree_add_assembled_metric (tvbuff_t *tvb,
proto_tree *subtree;
nstime_t nstime;
- root_item = proto_tree_add_text (root, tvb, offset + 6, length - 6,
- "Assembled metric");
+ subtree = proto_tree_add_subtree(root, tvb, offset + 6, length - 6,
+ ett_collectd_dispatch, &root_item, "Assembled metric");
PROTO_ITEM_SET_GENERATED (root_item);
- subtree = proto_item_add_subtree (root_item, ett_collectd_dispatch);
-
proto_tree_add_string (subtree, hf_collectd_data_host, tvb,
vdispatch->host_off, vdispatch->host_len,
STR_NONNULL (vdispatch->host));
@@ -334,12 +332,10 @@ collectd_proto_tree_add_assembled_notification (tvbuff_t *tvb,
proto_tree *subtree;
nstime_t nstime;
- root_item = proto_tree_add_text (root, tvb, offset + 6, length - 6,
- "Assembled notification");
+ subtree = proto_tree_add_subtree(root, tvb, offset + 6, length - 6,
+ ett_collectd_dispatch, &root_item, "Assembled notification");
PROTO_ITEM_SET_GENERATED (root_item);
- subtree = proto_item_add_subtree (root_item, ett_collectd_dispatch);
-
proto_tree_add_string (subtree, hf_collectd_data_host, tvb,
ndispatch->host_off, ndispatch->host_len,
STR_NONNULL (ndispatch->host));
@@ -397,15 +393,14 @@ dissect_collectd_string (tvbuff_t *tvb, packet_info *pinfo, gint type_hf,
*ret_string = tvb_get_string_enc(wmem_packet_scope(), tvb, *ret_offset, *ret_length, ENC_ASCII);
- pi = proto_tree_add_text (tree_root, tvb, offset, length,
- "collectd %s segment: \"%s\"",
+ pt = proto_tree_add_subtree_format(tree_root, tvb, offset, length,
+ ett_collectd_string, &pi, "collectd %s segment: \"%s\"",
val_to_str_const (type, part_names, "UNKNOWN"),
*ret_string);
if (ret_item != NULL)
*ret_item = pi;
- pt = proto_item_add_subtree (pi, ett_collectd_string);
proto_tree_add_uint (pt, hf_collectd_type, tvb, offset, 2, type);
proto_tree_add_uint (pt, hf_collectd_length, tvb, offset + 2, 2, length);
proto_tree_add_item (pt, type_hf, tvb, *ret_offset, *ret_length, ENC_ASCII|ENC_NA);
@@ -437,11 +432,10 @@ dissect_collectd_integer (tvbuff_t *tvb, packet_info *pinfo, gint type_hf,
if (size < 12)
{
- pi = proto_tree_add_text (tree_root, tvb, offset, -1,
- "collectd %s segment: <BAD>",
+ pt = proto_tree_add_subtree_format(tree_root, tvb, offset, -1,
+ ett_collectd_integer, NULL, "collectd %s segment: <BAD>",
val_to_str_const (type, part_names, "UNKNOWN"));
- pt = proto_item_add_subtree (pi, ett_collectd_integer);
proto_tree_add_uint (pt, hf_collectd_type, tvb, offset, 2,
type);
proto_tree_add_uint (pt, hf_collectd_length, tvb, offset + 2, 2,
@@ -455,11 +449,10 @@ dissect_collectd_integer (tvbuff_t *tvb, packet_info *pinfo, gint type_hf,
if (length != 12)
{
- pi = proto_tree_add_text (tree_root, tvb, offset, -1,
- "collectd %s segment: <BAD>",
+ pt = proto_tree_add_subtree_format(tree_root, tvb, offset, -1,
+ ett_collectd_integer, &pi, "collectd %s segment: <BAD>",
val_to_str_const (type, part_names, "UNKNOWN"));
- pt = proto_item_add_subtree (pi, ett_collectd_integer);
proto_tree_add_uint (pt, hf_collectd_type, tvb, offset, 2,
type);
pi = proto_tree_add_uint (pt, hf_collectd_length, tvb,
@@ -487,8 +480,8 @@ dissect_collectd_integer (tvbuff_t *tvb, packet_info *pinfo, gint type_hf,
nstime = collectd_time_to_nstime (*ret_value);
strtime = abs_time_to_str (wmem_packet_scope(), &nstime, ABSOLUTE_TIME_LOCAL, /* show_zone = */ TRUE);
- pi = proto_tree_add_text (tree_root, tvb, offset, length,
- "collectd %s segment: %s",
+ pt = proto_tree_add_subtree_format(tree_root, tvb, offset, length,
+ ett_collectd_integer, &pi, "collectd %s segment: %s",
val_to_str_const (type, part_names, "UNKNOWN"),
STR_NONNULL (strtime));
}
@@ -499,15 +492,15 @@ dissect_collectd_integer (tvbuff_t *tvb, packet_info *pinfo, gint type_hf,
nstime = collectd_time_to_nstime (*ret_value);
strtime = rel_time_to_str (wmem_packet_scope(), &nstime);
- pi = proto_tree_add_text (tree_root, tvb, offset, length,
- "collectd %s segment: %s",
+ pt = proto_tree_add_subtree_format(tree_root, tvb, offset, length,
+ ett_collectd_integer, &pi, "collectd %s segment: %s",
val_to_str_const (type, part_names, "UNKNOWN"),
strtime);
}
else
{
- pi = proto_tree_add_text (tree_root, tvb, offset, length,
- "collectd %s segment: %"G_GINT64_MODIFIER"u",
+ pt = proto_tree_add_subtree_format(tree_root, tvb, offset, length,
+ ett_collectd_integer, &pi, "collectd %s segment: %"G_GINT64_MODIFIER"u",
val_to_str_const (type, part_names, "UNKNOWN"),
*ret_value);
}
@@ -515,7 +508,6 @@ dissect_collectd_integer (tvbuff_t *tvb, packet_info *pinfo, gint type_hf,
if (ret_item != NULL)
*ret_item = pi;
- pt = proto_item_add_subtree (pi, ett_collectd_integer);
proto_tree_add_uint (pt, hf_collectd_type, tvb, offset, 2, type);
proto_tree_add_uint (pt, hf_collectd_length, tvb, offset + 2, 2,
length);
@@ -539,16 +531,13 @@ static void
dissect_collectd_values(tvbuff_t *tvb, gint msg_off, gint val_cnt,
proto_tree *collectd_tree)
{
- proto_item *pi;
proto_tree *values_tree, *value_tree;
gint i;
- pi = proto_tree_add_text (collectd_tree, tvb, msg_off + 6, val_cnt * 9,
- "%d value%s", val_cnt,
+ values_tree = proto_tree_add_subtree_format(collectd_tree, tvb, msg_off + 6, val_cnt * 9,
+ ett_collectd_value, NULL, "%d value%s", val_cnt,
plurality (val_cnt, "", "s"));
- values_tree = proto_item_add_subtree (pi, ett_collectd_value);
-
for (i = 0; i < val_cnt; i++)
{
gint value_offset;
@@ -570,12 +559,10 @@ dissect_collectd_values(tvbuff_t *tvb, gint msg_off, gint val_cnt,
guint64 val64;
val64 = tvb_get_ntoh64 (tvb, value_offset);
- pi = proto_tree_add_text (values_tree, tvb, msg_off + 6,
- val_cnt * 9,
+ value_tree = proto_tree_add_subtree_format(values_tree, tvb, msg_off + 6,
+ val_cnt * 9, ett_collectd_valinfo, NULL,
"Counter: %"G_GINT64_MODIFIER"u", val64);
- value_tree = proto_item_add_subtree (pi,
- ett_collectd_valinfo);
proto_tree_add_item (value_tree, hf_collectd_val_type,
tvb, value_type_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (value_tree,
@@ -589,12 +576,10 @@ dissect_collectd_values(tvbuff_t *tvb, gint msg_off, gint val_cnt,
gdouble val;
val = tvb_get_letohieee_double (tvb, value_offset);
- pi = proto_tree_add_text (values_tree, tvb, msg_off + 6,
- val_cnt * 9,
+ value_tree = proto_tree_add_subtree_format(values_tree, tvb, msg_off + 6,
+ val_cnt * 9, ett_collectd_valinfo, NULL,
"Gauge: %g", val);
- value_tree = proto_item_add_subtree (pi,
- ett_collectd_valinfo);
proto_tree_add_item (value_tree, hf_collectd_val_type,
tvb, value_type_offset, 1, ENC_BIG_ENDIAN);
/* Set the `little endian' flag to TRUE here, because
@@ -609,12 +594,10 @@ dissect_collectd_values(tvbuff_t *tvb, gint msg_off, gint val_cnt,
gint64 val64;
val64 = tvb_get_ntoh64 (tvb, value_offset);
- pi = proto_tree_add_text (values_tree, tvb, msg_off + 6,
- val_cnt * 9,
+ value_tree = proto_tree_add_subtree_format(values_tree, tvb, msg_off + 6,
+ val_cnt * 9, ett_collectd_valinfo, NULL,
"Derive: %"G_GINT64_MODIFIER"i", val64);
- value_tree = proto_item_add_subtree (pi,
- ett_collectd_valinfo);
proto_tree_add_item (value_tree, hf_collectd_val_type,
tvb, value_type_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (value_tree,
@@ -628,12 +611,10 @@ dissect_collectd_values(tvbuff_t *tvb, gint msg_off, gint val_cnt,
guint64 val64;
val64 = tvb_get_ntoh64 (tvb, value_offset);
- pi = proto_tree_add_text (values_tree, tvb, msg_off + 6,
- val_cnt * 9,
+ value_tree = proto_tree_add_subtree_format(values_tree, tvb, msg_off + 6,
+ val_cnt * 9, ett_collectd_valinfo, NULL,
"Absolute: %"G_GINT64_MODIFIER"u", val64);
- value_tree = proto_item_add_subtree (pi,
- ett_collectd_valinfo);
proto_tree_add_item (value_tree, hf_collectd_val_type,
tvb, value_type_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (value_tree,
@@ -647,13 +628,11 @@ dissect_collectd_values(tvbuff_t *tvb, gint msg_off, gint val_cnt,
guint64 val64;
val64 = tvb_get_ntoh64 (tvb, value_offset);
- pi = proto_tree_add_text (values_tree, tvb, msg_off + 6,
- val_cnt * 9,
+ value_tree = proto_tree_add_subtree_format(values_tree, tvb, msg_off + 6,
+ val_cnt * 9, ett_collectd_valinfo, NULL,
"Unknown: %"G_GINT64_MODIFIER"x",
val64);
- value_tree = proto_item_add_subtree (pi,
- ett_collectd_valinfo);
proto_tree_add_item (value_tree, hf_collectd_val_type,
tvb, value_type_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (value_tree, hf_collectd_val_unknown,
@@ -689,11 +668,10 @@ dissect_collectd_part_values (tvbuff_t *tvb, packet_info *pinfo, gint offset,
if (size < 15)
{
- pi = proto_tree_add_text (tree_root, tvb, offset, -1,
- "collectd %s segment: <BAD>",
+ pt = proto_tree_add_subtree_format(tree_root, tvb, offset, -1,
+ ett_collectd_part_value, NULL, "collectd %s segment: <BAD>",
val_to_str_const (type, part_names, "UNKNOWN"));
- pt = proto_item_add_subtree (pi, ett_collectd_part_value);
proto_tree_add_uint (pt, hf_collectd_type, tvb, offset, 2, type);
proto_tree_add_uint (pt, hf_collectd_length, tvb, offset + 2, 2,
length);
@@ -705,11 +683,10 @@ dissect_collectd_part_values (tvbuff_t *tvb, packet_info *pinfo, gint offset,
if ((length < 15) || ((length % 9) != 6))
{
- pi = proto_tree_add_text (tree_root, tvb, offset, -1,
- "collectd %s segment: <BAD>",
+ pt = proto_tree_add_subtree_format(tree_root, tvb, offset, -1,
+ ett_collectd_part_value, &pi, "collectd %s segment: <BAD>",
val_to_str_const (type, part_names, "UNKNOWN"));
- pt = proto_item_add_subtree (pi, ett_collectd_part_value);
proto_tree_add_uint (pt, hf_collectd_type, tvb, offset, 2, type);
pi = proto_tree_add_uint (pt, hf_collectd_length, tvb,
offset + 2, 2, length);
@@ -724,7 +701,8 @@ dissect_collectd_part_values (tvbuff_t *tvb, packet_info *pinfo, gint offset,
if (values_count != corrected_values_count)
{
- pi = proto_tree_add_text (tree_root, tvb, offset, length,
+ pt = proto_tree_add_subtree_format(tree_root, tvb, offset, length,
+ ett_collectd_part_value, NULL,
"collectd %s segment: %d (%d) value%s <BAD>",
val_to_str_const (type, part_names, "UNKNOWN"),
values_count, corrected_values_count,
@@ -732,14 +710,14 @@ dissect_collectd_part_values (tvbuff_t *tvb, packet_info *pinfo, gint offset,
}
else
{
- pi = proto_tree_add_text (tree_root, tvb, offset, length,
+ pt = proto_tree_add_subtree_format(tree_root, tvb, offset, length,
+ ett_collectd_part_value, NULL,
"collectd %s segment: %d value%s",
val_to_str_const (type, part_names, "UNKNOWN"),
values_count,
plurality(values_count, "", "s"));
}
- pt = proto_item_add_subtree (pi, ett_collectd_part_value);
proto_tree_add_uint (pt, hf_collectd_type, tvb, offset, 2, type);
proto_tree_add_uint (pt, hf_collectd_length, tvb, offset + 2, 2, length);
@@ -780,11 +758,10 @@ dissect_collectd_signature (tvbuff_t *tvb, packet_info *pinfo,
if (size < 36) /* remaining packet size too small for signature */
{
- pi = proto_tree_add_text (tree_root, tvb, offset, -1,
- "collectd %s segment: <BAD>",
+ pt = proto_tree_add_subtree_format(tree_root, tvb, offset, -1,
+ ett_collectd_signature, NULL, "collectd %s segment: <BAD>",
val_to_str_const (type, part_names, "UNKNOWN"));
- pt = proto_item_add_subtree (pi, ett_collectd_signature);
proto_tree_add_uint (pt, hf_collectd_type, tvb, offset, 2, type);
proto_tree_add_uint (pt, hf_collectd_length, tvb, offset + 2, 2,
length);
@@ -796,11 +773,10 @@ dissect_collectd_signature (tvbuff_t *tvb, packet_info *pinfo,
if (length < 36)
{
- pi = proto_tree_add_text (tree_root, tvb, offset, -1,
- "collectd %s segment: <BAD>",
+ pt = proto_tree_add_subtree_format(tree_root, tvb, offset, -1,
+ ett_collectd_signature, NULL, "collectd %s segment: <BAD>",
val_to_str_const (type, part_names, "UNKNOWN"));
- pt = proto_item_add_subtree (pi, ett_collectd_signature);
proto_tree_add_uint (pt, hf_collectd_type, tvb, offset, 2, type);
pi = proto_tree_add_uint (pt, hf_collectd_length, tvb,
offset + 2, 2, length);
@@ -810,11 +786,10 @@ dissect_collectd_signature (tvbuff_t *tvb, packet_info *pinfo,
return (-1);
}
- pi = proto_tree_add_text (tree_root, tvb, offset, length,
- "collectd %s segment: HMAC-SHA-256",
+ pt = proto_tree_add_subtree_format(tree_root, tvb, offset, length,
+ ett_collectd_signature, NULL, "collectd %s segment: HMAC-SHA-256",
val_to_str_const (type, part_names, "UNKNOWN"));
- pt = proto_item_add_subtree (pi, ett_collectd_signature);
proto_tree_add_uint (pt, hf_collectd_type, tvb, offset, 2, type);
proto_tree_add_uint (pt, hf_collectd_length, tvb, offset + 2, 2,
length);
@@ -848,11 +823,10 @@ dissect_collectd_encrypted (tvbuff_t *tvb, packet_info *pinfo,
if (size < 42) /* remaining packet size too small for signature */
{
- pi = proto_tree_add_text (tree_root, tvb, offset, -1,
- "collectd %s segment: <BAD>",
+ pt = proto_tree_add_subtree_format(tree_root, tvb, offset, -1,
+ ett_collectd_encryption, NULL, "collectd %s segment: <BAD>",
val_to_str_const (type, part_names, "UNKNOWN"));
- pt = proto_item_add_subtree (pi, ett_collectd_encryption);
proto_tree_add_uint (pt, hf_collectd_type, tvb, offset, 2, type);
proto_tree_add_uint (pt, hf_collectd_length, tvb, offset + 2, 2,
length);
@@ -864,11 +838,10 @@ dissect_collectd_encrypted (tvbuff_t *tvb, packet_info *pinfo,
if (length < 42)
{
- pi = proto_tree_add_text (tree_root, tvb, offset, -1,
- "collectd %s segment: <BAD>",
+ pt = proto_tree_add_subtree_format(tree_root, tvb, offset, -1,
+ ett_collectd_encryption, NULL, "collectd %s segment: <BAD>",
val_to_str_const (type, part_names, "UNKNOWN"));
- pt = proto_item_add_subtree (pi, ett_collectd_encryption);
proto_tree_add_uint (pt, hf_collectd_type, tvb, offset, 2, type);
pi = proto_tree_add_uint (pt, hf_collectd_length, tvb,
offset + 2, 2, length);
@@ -881,11 +854,10 @@ dissect_collectd_encrypted (tvbuff_t *tvb, packet_info *pinfo,
username_length = tvb_get_ntohs (tvb, offset + 4);
if (username_length > (length - 42))
{
- pi = proto_tree_add_text (tree_root, tvb, offset, -1,
- "collectd %s segment: <BAD>",
+ pt = proto_tree_add_subtree_format(tree_root, tvb, offset, -1,
+ ett_collectd_encryption, NULL, "collectd %s segment: <BAD>",
val_to_str_const (type, part_names, "UNKNOWN"));
- pt = proto_item_add_subtree (pi, ett_collectd_encryption);
proto_tree_add_uint (pt, hf_collectd_type, tvb, offset, 2, type);
proto_tree_add_uint (pt, hf_collectd_length, tvb,
offset + 2, 2, length);
@@ -897,11 +869,10 @@ dissect_collectd_encrypted (tvbuff_t *tvb, packet_info *pinfo,
return (-1);
}
- pi = proto_tree_add_text (tree_root, tvb, offset, length,
- "collectd %s segment: AES-256",
+ pt = proto_tree_add_subtree_format(tree_root, tvb, offset, length,
+ ett_collectd_encryption, NULL, "collectd %s segment: AES-256",
val_to_str_const (type, part_names, "UNKNOWN"));
- pt = proto_item_add_subtree (pi, ett_collectd_encryption);
proto_tree_add_uint (pt, hf_collectd_type, tvb, offset, 2, type);
proto_tree_add_uint (pt, hf_collectd_length, tvb, offset + 2, 2, length);
proto_tree_add_uint (pt, hf_collectd_data_username_len, tvb, offset + 4, 2, username_length);
@@ -1084,13 +1055,12 @@ dissect_collectd (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* provided in the packet.. */
if ((part_length < 4) || (part_length > size))
{
- pi = proto_tree_add_text (collectd_tree, tvb,
- offset, part_length,
+ pt = proto_tree_add_subtree_format(collectd_tree, tvb,
+ offset, part_length, ett_collectd_invalid_length, NULL,
"collectd %s segment: Length = %i <BAD>",
val_to_str_const (part_type, part_names, "UNKNOWN"),
part_length);
- pt = proto_item_add_subtree (pi, ett_collectd_invalid_length);
proto_tree_add_uint (pt, hf_collectd_type, tvb, offset,
2, part_type);
pi = proto_tree_add_uint (pt, hf_collectd_length, tvb,
@@ -1322,13 +1292,12 @@ dissect_collectd (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
default:
{
pkt_unknown++;
- pi = proto_tree_add_text (collectd_tree, tvb,
- offset, part_length,
+ pt = proto_tree_add_subtree_format(collectd_tree, tvb,
+ offset, part_length, ett_collectd_unknown, NULL,
"collectd %s segment: %i bytes",
val_to_str_const(part_type, part_names, "UNKNOWN"),
part_length);
- pt = proto_item_add_subtree(pi, ett_collectd_unknown);
pi = proto_tree_add_uint (pt, hf_collectd_type, tvb,
offset, 2, part_type);
proto_tree_add_uint (pt, hf_collectd_length, tvb,
diff --git a/epan/dissectors/packet-componentstatus.c b/epan/dissectors/packet-componentstatus.c
index da18b24fba..8de35bc6d8 100644
--- a/epan/dissectors/packet-componentstatus.c
+++ b/epan/dissectors/packet-componentstatus.c
@@ -157,7 +157,6 @@ static void
dissect_componentstatusprotocol_componentstatusreport_message(tvbuff_t *message_tvb, proto_tree *message_tree)
{
tvbuff_t *association_tvb;
- proto_item *association_item;
proto_tree *association_tree;
/* gint associations; - variable set but not used, so commented out */
int i;
@@ -173,9 +172,8 @@ dissect_componentstatusprotocol_componentstatusreport_message(tvbuff_t *message_
offset = COMPONENTSTATUSREPORT_ASSOCIATIONARRAY_OFFSET;
i = 1;
while(tvb_reported_length_remaining(message_tvb, offset) >= COMPONENTASSOCIATION_LENGTH) {
- association_item = proto_tree_add_text(message_tree, message_tvb, offset, COMPONENTASSOCIATION_LENGTH,
- "Association #%d", i++);
- association_tree = proto_item_add_subtree(association_item, ett_association);
+ association_tree = proto_tree_add_subtree_format(message_tree, message_tvb, offset, COMPONENTASSOCIATION_LENGTH,
+ ett_association, NULL, "Association #%d", i++);
association_tvb = tvb_new_subset(message_tvb, offset,
MIN(COMPONENTASSOCIATION_LENGTH, tvb_length_remaining(message_tvb, offset)),
COMPONENTASSOCIATION_LENGTH);
@@ -234,15 +232,10 @@ dissect_componentstatusprotocol(tvbuff_t *message_tvb, packet_info *pinfo, proto
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ComponentStatusProtocol");
- /* In the interest of speed, if "tree" is NULL, don't do any work not
- necessary to generate protocol tree items. */
- if (tree) {
- /* create the componentstatusprotocol protocol tree */
- componentstatusprotocol_item = proto_tree_add_item(tree, proto_componentstatusprotocol, message_tvb, 0, -1, ENC_NA);
- componentstatusprotocol_tree = proto_item_add_subtree(componentstatusprotocol_item, ett_componentstatusprotocol);
- } else {
- componentstatusprotocol_tree = NULL;
- };
+ /* create the componentstatusprotocol protocol tree */
+ componentstatusprotocol_item = proto_tree_add_item(tree, proto_componentstatusprotocol, message_tvb, 0, -1, ENC_NA);
+ componentstatusprotocol_tree = proto_item_add_subtree(componentstatusprotocol_item, ett_componentstatusprotocol);
+
/* dissect the message */
dissect_componentstatusprotocol_message(message_tvb, pinfo, componentstatusprotocol_tree);
return(tvb_length(message_tvb));
diff --git a/epan/dissectors/packet-cops.c b/epan/dissectors/packet-cops.c
index 75f02ab57b..b7bb09aee7 100644
--- a/epan/dissectors/packet-cops.c
+++ b/epan/dissectors/packet-cops.c
@@ -1309,7 +1309,7 @@ static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32
proto_tree *r_type_tree, *itf_tree, *reason_tree, *dec_tree, *error_tree, *clientsi_tree, *pdp_tree;
guint16 r_type, m_type, reason, reason_sub, cmd_code, cmd_flags, error, error_sub,
tcp_port, katimer, accttimer;
- guint32 ipv4addr, ifindex;
+ guint32 ifindex;
struct e_in6_addr ipv6addr;
oid_info_t* oid_info = NULL;
guint32* pprid_subids = NULL;
@@ -1326,11 +1326,10 @@ static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32
case COPS_OBJ_CONTEXT:
r_type = tvb_get_ntohs(tvb, offset);
m_type = tvb_get_ntohs(tvb, offset + 2);
- ti = proto_tree_add_text(tree, tvb, offset, 4, "Contents: R-Type: %s, M-Type: %u",
- val_to_str_const(r_type, cops_r_type_vals, "Unknown"),
- m_type);
+ r_type_tree = proto_tree_add_subtree_format(tree, tvb, offset, 4, ett_cops_r_type_flags, NULL,
+ "Contents: R-Type: %s, M-Type: %u",
+ val_to_str_const(r_type, cops_r_type_vals, "Unknown"), m_type);
- r_type_tree = proto_item_add_subtree(ti, ett_cops_r_type_flags);
proto_tree_add_uint(r_type_tree, hf_cops_r_type_flags, tvb, offset, 2, r_type);
offset += 2;
proto_tree_add_uint(r_type_tree, hf_cops_m_type_flags, tvb, offset, 2, m_type);
@@ -1339,24 +1338,22 @@ static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32
case COPS_OBJ_IN_INT:
case COPS_OBJ_OUT_INT:
if (c_type == 1) { /* IPv4 */
- ipv4addr = tvb_get_ipv4(tvb, offset);
ifindex = tvb_get_ntohl(tvb, offset + 4);
- ti = proto_tree_add_text(tree, tvb, offset, 8, "Contents: IPv4 address %s, ifIndex: %u",
- ip_to_str((guint8 *)&ipv4addr), ifindex);
- itf_tree = proto_item_add_subtree(ti, ett_cops_itf);
- proto_tree_add_ipv4(itf_tree,
+ itf_tree = proto_tree_add_subtree_format(tree, tvb, offset, 8, ett_cops_itf, NULL,
+ "Contents: IPv4 address %s, ifIndex: %u",
+ tvb_ip_to_str(tvb, offset), ifindex);
+ proto_tree_add_item(itf_tree,
(c_num == COPS_OBJ_IN_INT) ? hf_cops_in_int_ipv4 : hf_cops_out_int_ipv4,
- tvb, offset, 4, ipv4addr);
+ tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
} else if (c_type == 2) { /* IPv6 */
- tvb_get_ipv6(tvb, offset, &ipv6addr);
ifindex = tvb_get_ntohl(tvb, offset + (int)sizeof ipv6addr);
- ti = proto_tree_add_text(tree, tvb, offset, 20, "Contents: IPv6 address %s, ifIndex: %u",
- ip6_to_str(&ipv6addr), ifindex);
- itf_tree = proto_item_add_subtree(ti, ett_cops_itf);
- proto_tree_add_ipv6(itf_tree,
+ itf_tree = proto_tree_add_subtree_format(tree, tvb, offset, 20, ett_cops_itf, NULL,
+ "Contents: IPv6 address %s, ifIndex: %u",
+ tvb_ip6_to_str(tvb, offset), ifindex);
+ proto_tree_add_item(itf_tree,
(c_num == COPS_OBJ_IN_INT) ? hf_cops_in_int_ipv6 : hf_cops_out_int_ipv6,
- tvb, offset, 16, (guint8 *)&ipv6addr);
+ tvb, offset, 16, ENC_NA);
offset += 16;
} else {
break;
@@ -1367,14 +1364,14 @@ static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32
case COPS_OBJ_REASON:
reason = tvb_get_ntohs(tvb, offset);
reason_sub = tvb_get_ntohs(tvb, offset + 2);
- ti = proto_tree_add_text(tree, tvb, offset, 4, "Contents: Reason-Code: %s, Reason Sub-code: 0x%04x",
+ reason_tree = proto_tree_add_subtree_format(tree, tvb, offset, 4, ett_cops_reason, NULL,
+ "Contents: Reason-Code: %s, Reason Sub-code: 0x%04x",
val_to_str_const(reason, cops_reason_vals, "<Unknown value>"), reason_sub);
- reason_tree = proto_item_add_subtree(ti, ett_cops_reason);
proto_tree_add_uint(reason_tree, hf_cops_reason, tvb, offset, 2, reason);
offset += 2;
if (reason == 13) { /* RFC 2748 2.2.5 */
- proto_tree_add_text(reason_tree, tvb, offset, 2, "Reason Sub-code: "
- "Unknown object's C-Num %u, C-Type %u",
+ proto_tree_add_uint_format_value(reason_tree, hf_cops_reason_sub, tvb, offset, 2,
+ reason_sub, "Unknown object's C-Num %u, C-Type %u",
tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset + 1));
} else
proto_tree_add_uint(reason_tree, hf_cops_reason_sub, tvb, offset, 2, reason_sub);
@@ -1385,16 +1382,14 @@ static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32
if (c_type == 1) {
cmd_code = tvb_get_ntohs(tvb, offset);
cmd_flags = tvb_get_ntohs(tvb, offset + 2);
- ti = proto_tree_add_text(tree, tvb, offset, 4, "Contents: Command-Code: %s, Flags: %s",
+ dec_tree = proto_tree_add_subtree_format(tree, tvb, offset, 4, ett_cops_decision, NULL, "Contents: Command-Code: %s, Flags: %s",
val_to_str_const(cmd_code, cops_dec_cmd_code_vals, "<Unknown value>"),
val_to_str_const(cmd_flags, cops_dec_cmd_flag_vals, "<Unknown flag>"));
- dec_tree = proto_item_add_subtree(ti, ett_cops_decision);
proto_tree_add_uint(dec_tree, hf_cops_dec_cmd_code, tvb, offset, 2, cmd_code);
offset += 2;
proto_tree_add_uint(dec_tree, hf_cops_dec_flags, tvb, offset, 2, cmd_flags);
} else if (c_type == 5) { /*COPS-PR Data*/
- ti = proto_tree_add_text(tree, tvb, offset, len, "Contents: %d bytes", len);
- dec_tree = proto_item_add_subtree(ti, ett_cops_decision);
+ dec_tree = proto_tree_add_subtree_format(tree, tvb, offset, len, ett_cops_decision, NULL, "Contents: %d bytes", len);
dissect_cops_pr_objects(tvb, pinfo, offset, dec_tree, len, &oid_info, &pprid_subids, &pprid_subids_len);
}
@@ -1412,14 +1407,14 @@ static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32
error = tvb_get_ntohs(tvb, offset);
error_sub = tvb_get_ntohs(tvb, offset + 2);
- ti = proto_tree_add_text(tree, tvb, offset, 4, "Contents: Error-Code: %s, Error Sub-code: 0x%04x",
+ error_tree = proto_tree_add_subtree_format(tree, tvb, offset, 4, ett_cops_error, NULL,
+ "Contents: Error-Code: %s, Error Sub-code: 0x%04x",
val_to_str_const(error, cops_error_vals, "<Unknown value>"), error_sub);
- error_tree = proto_item_add_subtree(ti, ett_cops_error);
proto_tree_add_uint(error_tree, hf_cops_error, tvb, offset, 2, error);
offset += 2;
if (error == 13) { /* RFC 2748 2.2.8 */
- proto_tree_add_text(error_tree, tvb, offset, 2, "Error Sub-code: "
- "Unknown object's C-Num %u, C-Type %u",
+ proto_tree_add_uint_format_value(error_tree, hf_cops_error_sub, tvb, offset, 2,
+ error_sub, "Unknown object's C-Num %u, C-Type %u",
tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset + 1));
} else
proto_tree_add_uint(error_tree, hf_cops_error_sub, tvb, offset, 2, error_sub);
@@ -1439,8 +1434,7 @@ static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32
if (c_type != 2) /*Not COPS-PR data*/
break;
- ti = proto_tree_add_text(tree, tvb, offset, 4, "Contents: %d bytes", len);
- clientsi_tree = proto_item_add_subtree(ti, ett_cops_clientsi);
+ clientsi_tree = proto_tree_add_subtree_format(tree, tvb, offset, 4, ett_cops_clientsi, NULL, "Contents: %d bytes", len);
dissect_cops_pr_objects(tvb, pinfo, offset, clientsi_tree, len, &oid_info, &pprid_subids, &pprid_subids_len);
@@ -1479,24 +1473,22 @@ static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32
case COPS_OBJ_PDPREDIRADDR:
case COPS_OBJ_LASTPDPADDR:
if (c_type == 1) { /* IPv4 */
- ipv4addr = tvb_get_ipv4(tvb, offset);
tcp_port = tvb_get_ntohs(tvb, offset + 4 + 2);
- ti = proto_tree_add_text(tree, tvb, offset, 8, "Contents: IPv4 address %s, TCP Port Number: %u",
- ip_to_str((guint8 *)&ipv4addr), tcp_port);
- pdp_tree = proto_item_add_subtree(ti, ett_cops_pdp);
- proto_tree_add_ipv4(pdp_tree,
+ pdp_tree = proto_tree_add_subtree_format(tree, tvb, offset, 8, ett_cops_pdp, NULL,
+ "Contents: IPv4 address %s, TCP Port Number: %u",
+ tvb_ip_to_str(tvb, offset), tcp_port);
+ proto_tree_add_item(pdp_tree,
(c_num == COPS_OBJ_PDPREDIRADDR) ? hf_cops_pdprediraddr_ipv4 : hf_cops_lastpdpaddr_ipv4,
- tvb, offset, 4, ipv4addr);
+ tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
} else if (c_type == 2) { /* IPv6 */
- tvb_get_ipv6(tvb, offset, &ipv6addr);
tcp_port = tvb_get_ntohs(tvb, offset + (int)sizeof ipv6addr + 2);
- ti = proto_tree_add_text(tree, tvb, offset, 20, "Contents: IPv6 address %s, TCP Port Number: %u",
- ip6_to_str(&ipv6addr), tcp_port);
- pdp_tree = proto_item_add_subtree(ti, ett_cops_pdp);
- proto_tree_add_ipv6(pdp_tree,
+ pdp_tree = proto_tree_add_subtree_format(tree, tvb, offset, 20, ett_cops_pdp, NULL,
+ "Contents: IPv6 address %s, TCP Port Number: %u",
+ tvb_ip6_to_str(tvb, offset), tcp_port);
+ proto_tree_add_item(pdp_tree,
(c_num == COPS_OBJ_PDPREDIRADDR) ? hf_cops_pdprediraddr_ipv6 : hf_cops_lastpdpaddr_ipv6,
- tvb, offset, 16, (guint8 *)&ipv6addr);
+ tvb, offset, 16, ENC_NA);
offset += 16;
} else {
break;
@@ -1570,7 +1562,6 @@ static guint redecode_oid(guint32* pprid_subids, guint pprid_subids_len, guint8*
static int dissect_cops_pr_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32 offset, proto_tree *tree,
guint8 s_num, guint8 s_type, int len,
oid_info_t** oid_info_p, guint32** pprid_subids, guint* pprid_subids_len) {
- proto_item *ti;
proto_tree *asn_tree, *gperror_tree, *cperror_tree;
guint16 gperror=0, gperror_sub=0, cperror=0, cperror_sub=0;
asn1_ctx_t actx;
@@ -1585,8 +1576,7 @@ static int dissect_cops_pr_object_data(tvbuff_t *tvb, packet_info *pinfo, guint3
if (s_type != 1) /* Not Prefix Provisioning Instance Identifier (PPRID) */
break;
/* Never tested this branch */
- ti = proto_tree_add_text(tree, tvb, offset, len, "Contents:");
- asn_tree = proto_item_add_subtree(ti, ett_cops_asn1);
+ asn_tree = proto_tree_add_subtree(tree, tvb, offset, len, ett_cops_asn1, NULL, "Contents:");
dissect_ber_object_identifier(FALSE, &actx, asn_tree, tvb, offset, hf_cops_pprid_oid, &oid_tvb);
@@ -1616,8 +1606,7 @@ static int dissect_cops_pr_object_data(tvbuff_t *tvb, packet_info *pinfo, guint3
if (s_type != 1) break; /* Not Provisioning Instance Identifier (PRID) */
- ti=proto_tree_add_text(tree, tvb, offset, len, "Contents:");
- asn_tree = proto_item_add_subtree(ti, ett_cops_asn1);
+ asn_tree = proto_tree_add_subtree(tree, tvb, offset, len, ett_cops_asn1, NULL, "Contents:");
offset = get_ber_identifier(tvb, offset, &ber_class, &ber_pc, &ber_tag);
offset = get_ber_length(tvb, offset, &encoid_len, NULL);
@@ -1658,8 +1647,7 @@ static int dissect_cops_pr_object_data(tvbuff_t *tvb, packet_info *pinfo, guint3
if (s_type != 1) break;/* Not Encoded Provisioning Instance Data (EPD) */
- ti = proto_tree_add_text(tree, tvb, offset, len, "Contents:");
- asn_tree = proto_item_add_subtree(ti, ett_cops_asn1);
+ asn_tree = proto_tree_add_subtree(tree, tvb, offset, len, ett_cops_asn1, NULL, "Contents:");
/*
* XXX: LAZYNESS WARNING:
@@ -1745,8 +1733,7 @@ static int dissect_cops_pr_object_data(tvbuff_t *tvb, packet_info *pinfo, guint3
case COPS_OBJ_ERRPRID: {
if (s_type != 1) break; /*Not Error Provisioning Instance Identifier (ErrorPRID)*/
- ti = proto_tree_add_text(tree, tvb, offset, len, "Contents:");
- asn_tree = proto_item_add_subtree(ti, ett_cops_asn1);
+ asn_tree = proto_tree_add_subtree(tree, tvb, offset, len, ett_cops_asn1, NULL, "Contents:");
dissect_ber_object_identifier(FALSE, &actx, asn_tree, tvb, offset, hf_cops_errprid_oid, NULL);
@@ -1758,14 +1745,14 @@ static int dissect_cops_pr_object_data(tvbuff_t *tvb, packet_info *pinfo, guint3
gperror = tvb_get_ntohs(tvb, offset);
gperror_sub = tvb_get_ntohs(tvb, offset + 2);
- ti = proto_tree_add_text(tree, tvb, offset, 4, "Contents: Error-Code: %s, Error Sub-code: 0x%04x",
+ gperror_tree = proto_tree_add_subtree_format(tree, tvb, offset, 4, ett_cops_gperror, NULL,
+ "Contents: Error-Code: %s, Error Sub-code: 0x%04x",
val_to_str_const(gperror, cops_gperror_vals, "<Unknown value>"), gperror_sub);
- gperror_tree = proto_item_add_subtree(ti, ett_cops_gperror);
proto_tree_add_uint(gperror_tree, hf_cops_gperror, tvb, offset, 2, gperror);
offset += 2;
if (gperror == 13) { /* RFC 3084 4.4 */
- proto_tree_add_text(gperror_tree, tvb, offset, 2, "Error Sub-code: "
- "Unknown object's C-Num %u, C-Type %u",
+ proto_tree_add_uint_format_value(gperror_tree, hf_cops_gperror_sub, tvb, offset, 2,
+ gperror_sub, "Unknown object's C-Num %u, C-Type %u",
tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset + 1));
} else
proto_tree_add_uint(gperror_tree, hf_cops_gperror_sub, tvb, offset, 2, gperror_sub);
@@ -1777,13 +1764,13 @@ static int dissect_cops_pr_object_data(tvbuff_t *tvb, packet_info *pinfo, guint3
cperror = tvb_get_ntohs(tvb, offset);
cperror_sub = tvb_get_ntohs(tvb, offset + 2);
- ti = proto_tree_add_text(tree, tvb, offset, 4, "Contents: Error-Code: %s, Error Sub-code: 0x%04x",
- val_to_str_const(cperror, cops_cperror_vals, "<Unknown value>"), cperror_sub);
- cperror_tree = proto_item_add_subtree(ti, ett_cops_cperror);
+ cperror_tree = proto_tree_add_subtree_format(tree, tvb, offset, 4, ett_cops_gperror, NULL,
+ "Contents: Error-Code: %s, Error Sub-code: 0x%04x",
+ val_to_str_const(gperror, cops_gperror_vals, "<Unknown value>"), gperror_sub);
proto_tree_add_uint(cperror_tree, hf_cops_cperror, tvb, offset, 2, cperror);
offset += 2;
if (cperror == 13) { /* RFC 3084 4.5 */
- proto_tree_add_text(cperror_tree, tvb, offset, 2, "Error Sub-code: "
+ proto_tree_add_uint_format_value(cperror_tree, hf_cops_cperror_sub, tvb, offset, 2, cperror_sub,
"Unknown object's S-Num %u, C-Type %u",
tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset + 1));
} else
@@ -3666,7 +3653,6 @@ cops_ipv6_classifier(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
/* Cops - Section : Gate Specifications */
static int
cops_flow_spec(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
- proto_item *ti;
proto_tree *stt, *object_tree;
/* Create a subtree */
@@ -3686,8 +3672,7 @@ cops_flow_spec(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
offset += 2;
/* Authorized Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, 28, "Authorized Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, 28, ett_cops_subtree, NULL, "Authorized Envelope");
/* Token Bucket Rate */
info_to_display(tvb,object_tree,offset,4,"Token Bucket Rate",NULL,FMT_FLT,&hf_cops_pc_token_bucket_rate);
@@ -3720,8 +3705,7 @@ cops_flow_spec(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
if (n < 64) return offset;
/* Reserved Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, 28, "Reserved Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, 28, ett_cops_subtree, NULL, "Reserved Envelope");
/* Token Bucket Rate */
info_to_display(tvb,object_tree,offset,4,"Token Bucket Rate",NULL,FMT_FLT,&hf_cops_pc_token_bucket_rate);
@@ -3754,8 +3738,7 @@ cops_flow_spec(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
if (n < 92) return offset;
/* Committed Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, 28, "Committed Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, 28, ett_cops_subtree, NULL, "Committed Envelope");
/* Token Bucket Rate */
info_to_display(tvb,object_tree,offset,4,"Token Bucket Rate",NULL,FMT_FLT,&hf_cops_pc_token_bucket_rate);
@@ -3824,7 +3807,6 @@ cops_docsis_service_class_name(tvbuff_t *tvb, proto_tree *st, guint object_len,
/* Cops - Section : Best Effort Service */
static int
cops_best_effort_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset, gboolean i05) {
- proto_item *ti;
proto_tree *stt, *object_tree;
/* Create a subtree */
@@ -3839,8 +3821,7 @@ cops_best_effort_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n, guint32
offset += 3;
/* Authorized Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, i05 ? 36 : 32, "Authorized Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, i05 ? 36 : 32, ett_cops_subtree, NULL, "Authorized Envelope");
/* Traffic Priority */
info_to_display(tvb,object_tree,offset,1,"Traffic Priority",NULL,FMT_HEX,&hf_cops_pcmm_traffic_priority);
@@ -3890,8 +3871,7 @@ cops_best_effort_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n, guint32
if (n < 56) return offset;
/* Reserved Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, i05 ? 36 : 32, "Reserved Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, i05 ? 36 : 32, ett_cops_subtree, NULL, "Reserved Envelope");
/* Traffic Priority */
info_to_display(tvb,object_tree,offset,1,"Traffic Priority",NULL,FMT_HEX,&hf_cops_pcmm_traffic_priority);
@@ -3941,8 +3921,7 @@ cops_best_effort_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n, guint32
if (n < 80) return offset;
/* Committed Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, i05 ? 36 : 32, "Committed Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, i05 ? 36 : 32, ett_cops_subtree, NULL, "Committed Envelope");
/* Traffic Priority */
info_to_display(tvb,object_tree,offset,1,"Traffic Priority",NULL,FMT_HEX,&hf_cops_pcmm_traffic_priority);
@@ -3995,7 +3974,6 @@ cops_best_effort_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n, guint32
/* Cops - Section : Non-Real-Time Polling Service */
static int
cops_non_real_time_polling_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset, gboolean i05) {
- proto_item *ti;
proto_tree *stt, *object_tree;
/* Create a subtree */
@@ -4010,8 +3988,7 @@ cops_non_real_time_polling_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint
offset += 3;
/* Authorized Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, i05 ? 40 : 36, "Authorized Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, i05 ? 40 : 36, ett_cops_subtree, NULL, "Authorized Envelope");
/* Traffic Priority */
info_to_display(tvb,object_tree,offset,1,"Traffic Priority",NULL,FMT_HEX,&hf_cops_pcmm_traffic_priority);
@@ -4065,8 +4042,7 @@ cops_non_real_time_polling_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint
if (n < 64) return offset;
/* Reserved Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, i05 ? 40 : 36, "Reserved Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, i05 ? 40 : 36, ett_cops_subtree, NULL, "Reserved Envelope");
/* Traffic Priority */
info_to_display(tvb,object_tree,offset,1,"Traffic Priority",NULL,FMT_HEX,&hf_cops_pcmm_traffic_priority);
@@ -4120,8 +4096,7 @@ cops_non_real_time_polling_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint
if (n < 92) return offset;
/* Committed Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, i05 ? 40 : 36, "Committed Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, i05 ? 40 : 36, ett_cops_subtree, NULL, "Committed Envelope");
/* Traffic Priority */
info_to_display(tvb,object_tree,offset,1,"Traffic Priority",NULL,FMT_HEX,&hf_cops_pcmm_traffic_priority);
@@ -4178,7 +4153,6 @@ cops_non_real_time_polling_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint
/* Cops - Section : Real-Time Polling Service */
static int
cops_real_time_polling_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset, gboolean i05) {
- proto_item *ti;
proto_tree *stt, *object_tree;
/* Create a subtree */
@@ -4193,8 +4167,7 @@ cops_real_time_polling_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n, g
offset += 3;
/* Authorized Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, i05 ? 40 : 36, "Authorized Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, i05 ? 40 : 36, ett_cops_subtree, NULL, "Authorized Envelope");
/* Request Transmission Policy */
decode_docsis_request_transmission_policy(tvb, offset, object_tree, hf_cops_pcmm_request_transmission_policy);
@@ -4245,8 +4218,7 @@ cops_real_time_polling_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n, g
if (n < 64) return offset;
/* Reserved Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, i05 ? 40 : 36, "Reserved Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, i05 ? 40 : 36, ett_cops_subtree, NULL, "Reserved Envelope");
/* Request Transmission Policy */
decode_docsis_request_transmission_policy(tvb, offset, object_tree, hf_cops_pcmm_request_transmission_policy);
@@ -4297,8 +4269,7 @@ cops_real_time_polling_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n, g
if (n < 92) return offset;
/* Committed Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, i05 ? 40 : 36, "Committed Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, i05 ? 40 : 36, ett_cops_subtree, NULL, "Committed Envelope");
/* Request Transmission Policy */
decode_docsis_request_transmission_policy(tvb, offset, object_tree, hf_cops_pcmm_request_transmission_policy);
@@ -4352,7 +4323,6 @@ cops_real_time_polling_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n, g
/* Cops - Section : Unsolicited Grant Service */
static int
cops_unsolicited_grant_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset, gboolean i05) {
- proto_item *ti;
proto_tree *stt, *object_tree;
/* Create a subtree */
@@ -4367,8 +4337,7 @@ cops_unsolicited_grant_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n, g
offset += 3;
/* Authorized Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, i05 ? 28 : 24, "Authorized Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, i05 ? 28 : 24, ett_cops_subtree, NULL, "Authorized Envelope");
/* Request Transmission Policy */
decode_docsis_request_transmission_policy(tvb, offset, object_tree, hf_cops_pcmm_request_transmission_policy);
@@ -4410,8 +4379,7 @@ cops_unsolicited_grant_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n, g
if (n < 40) return offset;
/* Reserved Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, i05 ? 28 : 24, "Reserved Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, i05 ? 28 : 24, ett_cops_subtree, NULL, "Reserved Envelope");
/* Request Transmission Policy */
decode_docsis_request_transmission_policy(tvb, offset, object_tree, hf_cops_pcmm_request_transmission_policy);
@@ -4453,8 +4421,7 @@ cops_unsolicited_grant_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n, g
if (n < 56) return offset;
/* Committed Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, i05 ? 28 : 24, "Committed Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, i05 ? 28 : 24, ett_cops_subtree, NULL, "Committed Envelope");
/* Request Transmission Policy */
decode_docsis_request_transmission_policy(tvb, offset, object_tree, hf_cops_pcmm_request_transmission_policy);
@@ -4499,7 +4466,6 @@ cops_unsolicited_grant_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n, g
/* Cops - Section : Unsolicited Grant Service with Activity Detection */
static int
cops_ugs_with_activity_detection_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset, gboolean i05) {
- proto_item *ti;
proto_tree *stt, *object_tree;
/* Create a subtree */
@@ -4514,8 +4480,7 @@ cops_ugs_with_activity_detection_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n,
offset += 3;
/* Authorized Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, i05 ? 36 : 32, "Authorized Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, i05 ? 36 : 32, ett_cops_subtree, NULL, "Authorized Envelope");
/* Request Transmission Policy */
decode_docsis_request_transmission_policy(tvb, offset, object_tree, hf_cops_pcmm_request_transmission_policy);
@@ -4565,8 +4530,7 @@ cops_ugs_with_activity_detection_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n,
if (n < 56) return offset;
/* Reserved Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, i05 ? 36 : 32, "Reserved Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, i05 ? 36 : 32, ett_cops_subtree, NULL, "Reserved Envelope");
/* Request Transmission Policy */
decode_docsis_request_transmission_policy(tvb, offset, object_tree, hf_cops_pcmm_request_transmission_policy);
@@ -4616,8 +4580,7 @@ cops_ugs_with_activity_detection_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n,
if (n < 80) return offset;
/* Committed Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, i05 ? 36 : 32, "Committed Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, i05 ? 36 : 32, ett_cops_subtree, NULL, "Committed Envelope");
/* Request Transmission Policy */
decode_docsis_request_transmission_policy(tvb, offset, object_tree, hf_cops_pcmm_request_transmission_policy);
@@ -4670,7 +4633,6 @@ cops_ugs_with_activity_detection_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n,
/* Cops - Section : Downstream Service */
static int
cops_downstream_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset, gboolean i05) {
- proto_item *ti;
proto_tree *stt, *object_tree;
/* Create a subtree */
@@ -4685,8 +4647,7 @@ cops_downstream_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n, guint32
offset += 3;
/* Authorized Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, i05 ? 40 : 36, "Authorized Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, i05 ? 40 : 36, ett_cops_subtree, NULL, "Authorized Envelope");
/* Traffic Priority */
info_to_display(tvb,object_tree,offset,1,"Traffic Priority",NULL,FMT_HEX,&hf_cops_pcmm_traffic_priority);
@@ -4744,8 +4705,7 @@ cops_downstream_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n, guint32
if (n < 56) return offset;
/* Reserved Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, i05 ? 40 : 36, "Reserved Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, i05 ? 40 : 36, ett_cops_subtree, NULL, "Reserved Envelope");
/* Traffic Priority */
info_to_display(tvb,object_tree,offset,1,"Traffic Priority",NULL,FMT_HEX,&hf_cops_pcmm_traffic_priority);
@@ -4803,8 +4763,7 @@ cops_downstream_service_i04_i05(tvbuff_t *tvb, proto_tree *st, guint n, guint32
if (n < 80) return offset;
/* Committed Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, i05 ? 40 : 36, "Committed Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, i05 ? 40 : 36, ett_cops_subtree, NULL, "Committed Envelope");
/* Traffic Priority */
info_to_display(tvb,object_tree,offset,1,"Traffic Priority",NULL,FMT_HEX,&hf_cops_pcmm_traffic_priority);
@@ -4886,7 +4845,6 @@ cops_upstream_drop_i04(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
/* Cops - Section : Best Effort Service */
static int
cops_best_effort_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
- proto_item *ti;
proto_tree *stt, *object_tree;
/* Create a subtree */
@@ -4901,8 +4859,7 @@ cops_best_effort_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset)
offset += 3;
/* Authorized Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, 24, "Authorized Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, 24, ett_cops_subtree, NULL, "Authorized Envelope");
/* Traffic Priority */
info_to_display(tvb,object_tree,offset,1,"Traffic Priority",NULL,FMT_HEX,&hf_cops_pcmm_traffic_priority);
@@ -4938,8 +4895,7 @@ cops_best_effort_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset)
if (n < 56) return offset;
/* Reserved Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, 24, "Reserved Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, 24, ett_cops_subtree, NULL, "Reserved Envelope");
/* Traffic Priority */
info_to_display(tvb,object_tree,offset,1,"Traffic Priority",NULL,FMT_HEX,&hf_cops_pcmm_traffic_priority);
@@ -4975,8 +4931,7 @@ cops_best_effort_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset)
if (n < 80) return offset;
/* Committed Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, 24, "Committed Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, 24, ett_cops_subtree, NULL, "Committed Envelope");
/* Traffic Priority */
info_to_display(tvb,object_tree,offset,1,"Traffic Priority",NULL,FMT_HEX,&hf_cops_pcmm_traffic_priority);
@@ -5015,7 +4970,6 @@ cops_best_effort_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset)
/* Cops - Section : Non-Real-Time Polling Service */
static int
cops_non_real_time_polling_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
- proto_item *ti;
proto_tree *stt, *object_tree;
/* Create a subtree */
@@ -5030,8 +4984,7 @@ cops_non_real_time_polling_service(tvbuff_t *tvb, proto_tree *st, guint n, guint
offset += 3;
/* Authorized Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, 28, "Authorized Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, 28, ett_cops_subtree, NULL, "Authorized Envelope");
/* Traffic Priority */
info_to_display(tvb,object_tree,offset,1,"Traffic Priority",NULL,FMT_HEX,&hf_cops_pcmm_traffic_priority);
@@ -5071,8 +5024,7 @@ cops_non_real_time_polling_service(tvbuff_t *tvb, proto_tree *st, guint n, guint
if (n < 64) return offset;
/* Reserved Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, 24, "Reserved Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, 24, ett_cops_subtree, NULL, "Reserved Envelope");
/* Traffic Priority */
info_to_display(tvb,object_tree,offset,1,"Traffic Priority",NULL,FMT_HEX,&hf_cops_pcmm_traffic_priority);
@@ -5112,8 +5064,7 @@ cops_non_real_time_polling_service(tvbuff_t *tvb, proto_tree *st, guint n, guint
if (n < 92) return offset;
/* Committed Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, 24, "Committed Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, 24, ett_cops_subtree, NULL, "Committed Envelope");
/* Traffic Priority */
info_to_display(tvb,object_tree,offset,1,"Traffic Priority",NULL,FMT_HEX,&hf_cops_pcmm_traffic_priority);
@@ -5156,7 +5107,6 @@ cops_non_real_time_polling_service(tvbuff_t *tvb, proto_tree *st, guint n, guint
/* Cops - Section : Real-Time Polling Service */
static int
cops_real_time_polling_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
- proto_item *ti;
proto_tree *stt, *object_tree;
/* Create a subtree */
@@ -5171,8 +5121,7 @@ cops_real_time_polling_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 o
offset += 3;
/* Authorized Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, 28, "Authorized Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, 28, ett_cops_subtree, NULL, "Authorized Envelope");
/* Request Transmission Policy */
decode_docsis_request_transmission_policy(tvb, offset, object_tree, hf_cops_pcmm_request_transmission_policy);
@@ -5209,8 +5158,7 @@ cops_real_time_polling_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 o
if (n < 64) return offset;
/* Reserved Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, 24, "Reserved Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, 24, ett_cops_subtree, NULL, "Reserved Envelope");
/* Request Transmission Policy */
decode_docsis_request_transmission_policy(tvb, offset, object_tree, hf_cops_pcmm_request_transmission_policy);
@@ -5247,8 +5195,7 @@ cops_real_time_polling_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 o
if (n < 92) return offset;
/* Committed Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, 24, "Committed Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, 24, ett_cops_subtree, NULL, "Committed Envelope");
/* Request Transmission Policy */
decode_docsis_request_transmission_policy(tvb, offset, object_tree, hf_cops_pcmm_request_transmission_policy);
@@ -5288,7 +5235,6 @@ cops_real_time_polling_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 o
/* Cops - Section : Unsolicited Grant Service */
static int
cops_unsolicited_grant_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
- proto_item *ti;
proto_tree *stt, *object_tree;
/* Create a subtree */
@@ -5303,8 +5249,7 @@ cops_unsolicited_grant_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 o
offset += 3;
/* Authorized Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, 16, "Authorized Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, 16, ett_cops_subtree, NULL, "Authorized Envelope");
/* Request Transmission Policy */
decode_docsis_request_transmission_policy(tvb, offset, object_tree, hf_cops_pcmm_request_transmission_policy);
@@ -5332,8 +5277,7 @@ cops_unsolicited_grant_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 o
if (n < 40) return offset;
/* Reserved Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, 16, "Reserved Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, 16, ett_cops_subtree, NULL, "Reserved Envelope");
/* Request Transmission Policy */
decode_docsis_request_transmission_policy(tvb, offset, object_tree, hf_cops_pcmm_request_transmission_policy);
@@ -5361,8 +5305,7 @@ cops_unsolicited_grant_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 o
if (n < 56) return offset;
/* Committed Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, 16, "Committed Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, 16, ett_cops_subtree, NULL, "Committed Envelope");
/* Request Transmission Policy */
decode_docsis_request_transmission_policy(tvb, offset, object_tree, hf_cops_pcmm_request_transmission_policy);
@@ -5393,7 +5336,6 @@ cops_unsolicited_grant_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 o
/* Cops - Section : Unsolicited Grant Service with Activity Detection */
static int
cops_ugs_with_activity_detection(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
- proto_item *ti;
proto_tree *stt, *object_tree;
/* Create a subtree */
@@ -5408,8 +5350,7 @@ cops_ugs_with_activity_detection(tvbuff_t *tvb, proto_tree *st, guint n, guint32
offset += 3;
/* Authorized Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, 24, "Authorized Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, 24, ett_cops_subtree, NULL, "Authorized Envelope");
/* Request Transmission Policy */
decode_docsis_request_transmission_policy(tvb, offset, object_tree, hf_cops_pcmm_request_transmission_policy);
@@ -5445,8 +5386,7 @@ cops_ugs_with_activity_detection(tvbuff_t *tvb, proto_tree *st, guint n, guint32
if (n < 56) return offset;
/* Reserved Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, 24, "Reserved Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, 24, ett_cops_subtree, NULL, "Reserved Envelope");
/* Request Transmission Policy */
decode_docsis_request_transmission_policy(tvb, offset, object_tree, hf_cops_pcmm_request_transmission_policy);
@@ -5482,8 +5422,7 @@ cops_ugs_with_activity_detection(tvbuff_t *tvb, proto_tree *st, guint n, guint32
if (n < 80) return offset;
/* Committed Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, 24, "Committed Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, 24, ett_cops_subtree, NULL, "Committed Envelope");
/* Request Transmission Policy */
decode_docsis_request_transmission_policy(tvb, offset, object_tree, hf_cops_pcmm_request_transmission_policy);
@@ -5522,7 +5461,6 @@ cops_ugs_with_activity_detection(tvbuff_t *tvb, proto_tree *st, guint n, guint32
/* Cops - Section : Downstream Service */
static int
cops_downstream_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
- proto_item *ti;
proto_tree *stt, *object_tree;
/* Create a subtree */
@@ -5537,8 +5475,7 @@ cops_downstream_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset)
offset += 3;
/* Authorized Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, 24, "Authorized Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, 24, ett_cops_subtree, NULL, "Authorized Envelope");
/* Traffic Priority */
info_to_display(tvb,object_tree,offset,1,"Traffic Priority",NULL,FMT_HEX,&hf_cops_pcmm_traffic_priority);
@@ -5574,8 +5511,7 @@ cops_downstream_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset)
if (n < 56) return offset;
/* Reserved Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, 24, "Reserved Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, 24, ett_cops_subtree, NULL, "Reserved Envelope");
/* Traffic Priority */
info_to_display(tvb,object_tree,offset,1,"Traffic Priority",NULL,FMT_HEX,&hf_cops_pcmm_traffic_priority);
@@ -5611,8 +5547,7 @@ cops_downstream_service(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset)
if (n < 80) return offset;
/* Committed Envelope */
- ti = proto_tree_add_text(stt, tvb, offset, 24, "Committed Envelope");
- object_tree = proto_item_add_subtree(ti, ett_cops_subtree);
+ object_tree = proto_tree_add_subtree(stt, tvb, offset, 24, ett_cops_subtree, NULL, "Committed Envelope");
/* Traffic Priority */
info_to_display(tvb,object_tree,offset,1,"Traffic Priority",NULL,FMT_HEX,&hf_cops_pcmm_traffic_priority);
diff --git a/epan/dissectors/packet-csn1.c b/epan/dissectors/packet-csn1.c
index 4033bab122..10dbbb1a05 100644
--- a/epan/dissectors/packet-csn1.c
+++ b/epan/dissectors/packet-csn1.c
@@ -495,8 +495,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
proto_item *ti;
proto_tree *test_tree;
- ti = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s[%d]",pDescr->sz, i++);
- test_tree = proto_item_add_subtree(ti, ett_csn1);
+ test_tree = proto_tree_add_subtree_format(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, "%s[%d]",pDescr->sz, i++);
csnStreamInit(&arT, bit_offset, remaining_bits_len);
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR*)pDescr->descr.ptr, tvb, pui8, ett_csn1);
@@ -560,8 +559,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
proto_item *ti;
proto_tree *test_tree;
- ti = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s", pDescr->sz);
- test_tree = proto_item_add_subtree(ti, ett_csn1);
+ test_tree = proto_tree_add_subtree_format(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, "%s", pDescr->sz);
csnStreamInit(&arT, bit_offset, remaining_bits_len);
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR*)pDescr->descr.ptr, tvb, pvDATA(data, pDescr->offset), ett_csn1);
@@ -619,8 +617,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
}
if (pDescr->sz) {
- ti = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s", pDescr->sz);
- test_tree = proto_item_add_subtree(ti, ett_csn1);
+ test_tree = proto_tree_add_subtree(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, pDescr->sz);
} else {
test_tree = tree;
}
@@ -671,13 +668,11 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
bit_offset += length_len;
remaining_bits_len -= length_len;
- ti = proto_tree_add_text(tree, tvb, bit_offset>>3, ((bit_offset+length-1)>>3)-(bit_offset>>3) + 1, "%s", pDescr->sz);
+ test_tree = proto_tree_add_subtree(tree, tvb, bit_offset>>3, ((bit_offset+length-1)>>3)-(bit_offset>>3) + 1, ett_csn1, &ti, pDescr->sz);
} else {
- ti = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s", pDescr->sz);
+ test_tree = proto_tree_add_subtree(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, pDescr->sz);
}
- test_tree = proto_item_add_subtree(ti, ett_csn1);
-
csnStreamInit(&arT, bit_offset, length > 0 ? length : remaining_bits_len);
Status = serialize(test_tree, &arT, tvb, pvDATA(data, pDescr->offset), ett_csn1);
@@ -992,8 +987,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
proto_item *ti;
proto_tree *test_tree;
- ti = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s[%d]",pDescr->sz, i++);
- test_tree = proto_item_add_subtree(ti, ett_csn1);
+ test_tree = proto_tree_add_subtree_format(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, "%s[%d]",pDescr->sz, i++);
csnStreamInit(&arT, bit_offset, remaining_bits_len);
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR *)pDescr->descr.ptr, tvb, pui8, ett_csn1);
@@ -1045,8 +1039,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
proto_item *ti;
proto_tree *test_tree;
- ti = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s",pDescr->sz);
- test_tree = proto_item_add_subtree(ti, ett_csn1);
+ test_tree = proto_tree_add_subtree(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, pDescr->sz);
csnStreamInit(&arT, bit_offset, remaining_bits_len);
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR *)pDescr->descr.ptr, tvb, pvDATA(data, pDescr->offset), ett_csn1);
@@ -1301,8 +1294,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
if (remaining_bits_len > 0)
{
- proto_item *ti = proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "Padding Bits");
- proto_tree *padding_tree = proto_item_add_subtree(ti, ett_csn1);
+ proto_tree *padding_tree = proto_tree_add_subtree(tree, tvb, bit_offset>>3, -1, ett_csn1, NULL, "Padding Bits");
while (remaining_bits_len > 0)
{
gint bits_to_handle = remaining_bits_len + (bit_offset%8);
@@ -1446,8 +1438,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
proto_item *ti;
proto_tree *test_tree;
- ti = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s",pDescr->sz);
- test_tree = proto_item_add_subtree(ti, ett_csn1);
+ test_tree = proto_tree_add_subtree(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, pDescr->sz);
csnStreamInit(&arT, bit_offset, remaining_bits_len);
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR *)pDescr->descr.ptr, tvb, pvDATA(data, pDescr->offset), ett_csn1);
@@ -1510,8 +1501,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
{ /* get data element */
ElementCount++;
- ti = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s[%d]",pDescr->sz, ElementCount-1);
- test_tree = proto_item_add_subtree(ti, ett_csn1);
+ test_tree = proto_tree_add_subtree_format(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, "%s[%d]", pDescr->sz, ElementCount-1);
csnStreamInit(&arT, bit_offset, remaining_bits_len);
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR *)pDescr->descr.ptr, tvb, pvDATA(data, pDescr->offset), ett_csn1);
diff --git a/epan/dissectors/packet-dcc.c b/epan/dissectors/packet-dcc.c
index 7208a9d10c..ca6a7f8212 100644
--- a/epan/dissectors/packet-dcc.c
+++ b/epan/dissectors/packet-dcc.c
@@ -115,12 +115,11 @@ static gint ett_dcc_trace = -1;
#define D_CHECKSUM() { \
- proto_tree *cktree, *ckti; \
- ckti = proto_tree_add_text(dcc_optree, tvb, offset, (int)sizeof(DCC_CK), \
- "Checksum - %s", val_to_str(tvb_get_guint8(tvb,offset), \
+ proto_tree *cktree; \
+ cktree = proto_tree_add_subtree_format(dcc_optree, tvb, offset, (int)sizeof(DCC_CK), \
+ ett_dcc_ck, NULL, "Checksum - %s", val_to_str(tvb_get_guint8(tvb,offset), \
dcc_cktype_vals, \
"Unknown Type: %u")); \
- cktree = proto_item_add_subtree(ckti, ett_dcc_ck); \
proto_tree_add_item(cktree, hf_dcc_ck_type, tvb, offset, 1, ENC_BIG_ENDIAN); \
offset += 1; \
proto_tree_add_item(cktree, hf_dcc_ck_len, tvb, offset, 1, ENC_BIG_ENDIAN); \
@@ -259,8 +258,7 @@ dissect_dcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
- ti = proto_tree_add_text(dcc_tree, tvb, offset, -1, "Operation Numbers (Opaque to Server)");
- dcc_opnumtree = proto_item_add_subtree(ti, ett_dcc_opnums);
+ dcc_opnumtree = proto_tree_add_subtree(dcc_tree, tvb, offset, -1, ett_dcc_opnums, NULL, "Operation Numbers (Opaque to Server)");
/* Note - these are indeterminate - they are sortof considered opaque to the client */
/* Make some attempt to figure out if this data is little endian, not guaranteed to be
@@ -289,9 +287,8 @@ dissect_dcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
offset, 4, client_is_le);
offset += 4;
- ti = proto_tree_add_text(dcc_tree, tvb, offset, -1, "Operation: %s",
- val_to_str(op, dcc_op_vals, "Unknown Op: %u"));
- dcc_optree = proto_item_add_subtree(ti, ett_dcc_op);
+ dcc_optree = proto_tree_add_subtree_format(dcc_tree, tvb, offset, -1, ett_dcc_op, NULL,
+ "Operation: %s", val_to_str(op, dcc_op_vals, "Unknown Op: %u"));
switch(op) {
case DCC_OP_NOP: