summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-07-06 14:21:40 -0400
committerMichael Mann <mmann78@netscape.net>2014-07-06 18:26:48 +0000
commitc71e88e4a9ad00600627b27ec6bd68cd3a929c58 (patch)
tree9a02a0c5a8dffff4d95504eb1f627c817c814400
parentbe4d42c6ab54169c8c027d3b1871a282fd9d0a9d (diff)
downloadwireshark-c71e88e4a9ad00600627b27ec6bd68cd3a929c58.tar.gz
convert to proto_tree_add_subtree[_format]
Change-Id: I3efa2a81ab2685cde6eae0a00b24520478a545ce Reviewed-on: https://code.wireshark.org/review/2900 Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--epan/dissectors/packet-v52.c548
-rw-r--r--epan/dissectors/packet-v5ua.c10
-rw-r--r--epan/dissectors/packet-vcdu.c13
-rw-r--r--epan/dissectors/packet-vnc.c54
-rw-r--r--epan/dissectors/packet-vp8.c14
-rw-r--r--epan/dissectors/packet-vtp.c15
-rw-r--r--epan/dissectors/packet-wassp.c7
-rw-r--r--epan/dissectors/packet-wbxml.c5
-rw-r--r--epan/dissectors/packet-wccp.c92
-rw-r--r--epan/dissectors/packet-wifi-display.c10
-rw-r--r--epan/dissectors/packet-wifi-p2p.c13
-rw-r--r--epan/dissectors/packet-windows-common.c49
-rw-r--r--epan/dissectors/packet-winsrepl.c82
-rw-r--r--epan/dissectors/packet-wol.c5
-rw-r--r--epan/dissectors/packet-wow.c5
-rw-r--r--epan/dissectors/packet-wps.c12
-rw-r--r--epan/dissectors/packet-wsmp.c7
-rw-r--r--epan/dissectors/packet-wsp.c15
18 files changed, 360 insertions, 596 deletions
diff --git a/epan/dissectors/packet-v52.c b/epan/dissectors/packet-v52.c
index e8d9f926cf..df854f1398 100644
--- a/epan/dissectors/packet-v52.c
+++ b/epan/dissectors/packet-v52.c
@@ -681,7 +681,7 @@ static const value_string info_element_values_short [] = {
static void
dissect_pstn_sequence_number(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -696,27 +696,23 @@ dissect_pstn_sequence_number(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
- if (info_tree != NULL) {
- pstn_sequence_number_tmp = tvb_get_guint8(info_tvb, info_offset+2)-0x80;
+ pstn_sequence_number_tmp = tvb_get_guint8(info_tvb, info_offset+2)-0x80;
+ col_append_fstr(pinfo->cinfo, COL_INFO, " | SN: %u", pstn_sequence_number_tmp);
+ if (info_tree != NULL) {
proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_pstn_sequence_number, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
-
- col_append_fstr(pinfo->cinfo, COL_INFO, " | SN: %u", pstn_sequence_number_tmp);
}
}
static void
dissect_cadenced_ring(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -730,22 +726,20 @@ dissect_cadenced_ring(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ cadenced_ring_tmp = tvb_get_guint8(info_tvb, info_offset+2)-0x80;
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
+
+ col_append_fstr(pinfo->cinfo, COL_INFO, ": %u", cadenced_ring_tmp);
if (info_tree != NULL) {
- cadenced_ring_tmp = tvb_get_guint8(info_tvb, info_offset+2)-0x80;
proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_cadenced_ring, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
-
- col_append_fstr(pinfo->cinfo, COL_INFO, ": %u", cadenced_ring_tmp);
}
}
@@ -753,7 +747,7 @@ dissect_cadenced_ring(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o
static void
dissect_pulsed_signal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -767,10 +761,13 @@ dissect_pulsed_signal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
+
+ col_append_str(pinfo->cinfo, COL_INFO, ": ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2), pulse_type_values, "Unknown element"));
if (info_tree != NULL) {
proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
@@ -787,20 +784,13 @@ dissect_pulsed_signal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o
proto_tree_add_item(info_tree, hf_v52_ack_request_indicator, info_tvb, info_offset+4, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(info_tree, hf_v52_number_of_pulses, info_tvb, info_offset+4, 1, ENC_BIG_ENDIAN);
}
-
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
-
- col_append_str(pinfo->cinfo, COL_INFO, ": ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2), pulse_type_values, "Unknown element"));
-
}
}
static void
dissect_steady_signal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -814,29 +804,26 @@ dissect_steady_signal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
+
+ col_append_str(pinfo->cinfo, COL_INFO, ": ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2)-0x80, steady_signal_values, "Unknown element"));
if (info_tree != NULL) {
proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_steady_signal, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
-
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
-
- col_append_str(pinfo->cinfo, COL_INFO, ": ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2)-0x80, steady_signal_values, "Unknown element"));
}
}
static void
dissect_digit_signal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 buffer = 0;
@@ -851,37 +838,30 @@ dissect_digit_signal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
- if (info_tree != NULL) {
- proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
- proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
- proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
+ proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
+ proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
+ proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
- proto_tree_add_item(info_tree, hf_v52_digit_ack, info_tvb, info_offset+2, 1, ENC_NA);
+ proto_tree_add_item(info_tree, hf_v52_digit_ack, info_tvb, info_offset+2, 1, ENC_NA);
- buffer = tvb_get_guint8(info_tvb, info_offset+2)>>4;
- buffer = buffer&0x03;
+ buffer = tvb_get_guint8(info_tvb, info_offset+2)>>4;
+ buffer = buffer&0x03;
- proto_tree_add_item(info_tree, hf_v52_digit_spare, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
- proto_tree_add_item(info_tree, hf_v52_digit_info, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
-
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
-
- col_append_fstr(pinfo->cinfo, COL_INFO, ": %u", buffer);
+ proto_tree_add_item(info_tree, hf_v52_digit_spare, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
+ proto_tree_add_item(info_tree, hf_v52_digit_info, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
- }
+ col_append_fstr(pinfo->cinfo, COL_INFO, ": %u", buffer);
}
static void
dissect_recognition_time(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 buffer = 0;
@@ -896,10 +876,10 @@ dissect_recognition_time(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
if (info_tree != NULL) {
proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
@@ -915,16 +895,13 @@ dissect_recognition_time(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in
proto_tree_add_item(info_tree, hf_v52_steady_signal, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(info_tree, hf_v52_duration_type, info_tvb, info_offset+3, 1, ENC_BIG_ENDIAN);
-
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
}
}
static void
dissect_enable_auto_ack(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 buffer = 0;
@@ -939,10 +916,10 @@ dissect_enable_auto_ack(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
if (info_tree != NULL) {
proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
@@ -971,16 +948,13 @@ dissect_enable_auto_ack(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
proto_tree_add_item(info_tree, hf_v52_ack_request_indicator, info_tvb, info_offset+5,1,ENC_BIG_ENDIAN);
proto_tree_add_item(info_tree, hf_v52_number_of_pulses, info_tvb, info_offset+5,1,ENC_BIG_ENDIAN);
}
-
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
}
}
static void
dissect_disable_auto_ack(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 buffer = 0;
@@ -995,10 +969,10 @@ dissect_disable_auto_ack(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
if (info_tree != NULL) {
proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
@@ -1011,16 +985,13 @@ dissect_disable_auto_ack(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in
proto_tree_add_item(info_tree, hf_v52_pulse_type, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
else if(buffer<=0x1a)
proto_tree_add_item(info_tree, hf_v52_steady_signal, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
-
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
}
}
static void
dissect_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1034,10 +1005,13 @@ dissect_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
+
+ col_append_str(pinfo->cinfo, COL_INFO, ": ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2)-0x80, cause_type_values, "Unknown element"));
if (info_tree != NULL) {
proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
@@ -1048,19 +1022,13 @@ dissect_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
if(tvb_length_remaining(info_tvb, info_offset+3))
proto_tree_add_uint_format(info_tree, hf_v52_msg_type, info_tvb, info_offset+3, 1, tvb_get_guint8(info_tvb, info_offset+3),
"Diagnostic: %s",val_to_str_const(tvb_get_guint8(info_tvb, info_offset+3), msg_type_values,"unknown"));
-
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
-
- col_append_str(pinfo->cinfo, COL_INFO, ": ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2)-0x80, cause_type_values, "Unknown element"));
}
}
static void
dissect_resource_unavailable(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1074,26 +1042,23 @@ dissect_resource_unavailable(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
if (info_tree != NULL) {
proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_res_unavailable, info_tvb, info_offset+2, info_element_length, ENC_ASCII|ENC_NA);
-
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
}
}
static void
dissect_pulse_notification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1107,24 +1072,21 @@ dissect_pulse_notification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
data_length = 1;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
if (info_tree != NULL) {
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_pulse_notification, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
-
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
}
}
static void
dissect_line_information(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1138,24 +1100,21 @@ dissect_line_information(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in
data_length = 1;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
if (info_tree != NULL) {
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_line_info, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
-
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
}
}
static void
dissect_state(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1169,24 +1128,21 @@ dissect_state(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
data_length = 1;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
if (info_tree != NULL) {
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_state, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
-
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
}
}
static void
dissect_auto_sig_sequence(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1200,24 +1156,21 @@ dissect_auto_sig_sequence(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i
data_length = 1;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
if (info_tree != NULL) {
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_auto_signalling_sequence, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
-
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
}
}
static void
dissect_sequence_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1231,24 +1184,21 @@ dissect_sequence_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i
data_length = 1;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
if (info_tree != NULL) {
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_sequence_response, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
-
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
}
}
static void
dissect_control_function_element(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1262,9 +1212,11 @@ dissect_control_function_element(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ if (message_type_tmp != 0x11) {
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2)-0x80, control_function_element_values, "Unknown element"));
}
if (info_tree != NULL) {
@@ -1272,19 +1224,13 @@ dissect_control_function_element(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_control_function_element, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
-
- if (message_type_tmp == 0x11) {}
- else {
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2)-0x80, control_function_element_values, "Unknown element"));
- }
}
}
static void
dissect_control_function_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1298,9 +1244,11 @@ dissect_control_function_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ if (message_type_tmp != 0x13) {
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2)-0x80, control_function_id_values_short, "Unknown layer3 element"));
}
if (info_tree != NULL) {
@@ -1308,19 +1256,13 @@ dissect_control_function_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_control_function_id, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
-
- if (message_type_tmp == 0x13) {}
- else {
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2)-0x80, control_function_id_values_short, "Unknown layer3 element"));
- }
}
}
static void
dissect_variant(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1335,26 +1277,23 @@ dissect_variant(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ variantValue = tvb_get_guint8(info_tvb, info_offset+2)-0x80;
+ col_append_fstr(pinfo->cinfo, COL_INFO, " | Var: %u", variantValue);
if (info_tree != NULL) {
proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_variant, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
-
- variantValue = tvb_get_guint8(info_tvb, info_offset+2)-0x80;
- col_append_fstr(pinfo->cinfo, COL_INFO, " | Var: %u", variantValue);
}
}
static void
dissect_interface_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1369,10 +1308,10 @@ dissect_interface_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ interfaceAllIdValue = (tvb_get_guint8(info_tvb, info_offset+2)<<16)+(tvb_get_guint8(info_tvb, info_offset+3)<<8)+(tvb_get_guint8(info_tvb, info_offset+4));
+ col_append_fstr(pinfo->cinfo, COL_INFO, " | Intf. ID: %u", interfaceAllIdValue);
if (info_tree != NULL) {
proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
@@ -1382,17 +1321,13 @@ dissect_interface_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of
proto_tree_add_item(info_tree, hf_v52_if_id, info_tvb, info_offset+3, info_element_length, ENC_BIG_ENDIAN);
proto_tree_add_item(info_tree, hf_v52_if_low_id, info_tvb, info_offset+4, info_element_length, ENC_BIG_ENDIAN);
proto_tree_add_item(info_tree, hf_v52_if_all_id, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
-
- interfaceAllIdValue = (tvb_get_guint8(info_tvb, info_offset+2)<<16)+(tvb_get_guint8(info_tvb, info_offset+3)<<8)+(tvb_get_guint8(info_tvb, info_offset+4));
-
- col_append_fstr(pinfo->cinfo, COL_INFO, " | Intf. ID: %u", interfaceAllIdValue);
}
}
static void
dissect_sequence_number(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1406,10 +1341,12 @@ dissect_sequence_number(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
+
+ col_append_fstr(pinfo->cinfo, COL_INFO, ": %u", hf_v52_sequence_number_tmp);
if (info_tree != NULL) {
hf_v52_sequence_number_tmp = tvb_get_guint8(info_tvb, info_offset+2)-0x80;
@@ -1417,25 +1354,16 @@ dissect_sequence_number(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_sequence_number, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
-
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
-
- col_append_fstr(pinfo->cinfo, COL_INFO, ": %u", hf_v52_sequence_number_tmp);
-
-
}
}
static void
dissect_physical_c_channel_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
- guint8 hf_v52_v5_link_id_cc_tmp = 0;
- guint8 hf_v52_v5_time_slot_cc_tmp = 0;
guint16 data_length;
tvbuff_t *info_tvb;
@@ -1446,10 +1374,9 @@ dissect_physical_c_channel_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_fstr(pinfo->cinfo, COL_INFO, " | Phy C-ch: %u, %u", tvb_get_guint8(info_tvb, info_offset+2), tvb_get_guint8(info_tvb, info_offset+3));
if (info_tree != NULL) {
proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
@@ -1457,18 +1384,13 @@ dissect_physical_c_channel_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_v5_link_id, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
proto_tree_add_item(info_tree, hf_v52_v5_time_slot, info_tvb, info_offset+3, info_element_length, ENC_BIG_ENDIAN);
-
- hf_v52_v5_link_id_cc_tmp = tvb_get_guint8(info_tvb, info_offset+2);
- hf_v52_v5_time_slot_cc_tmp =tvb_get_guint8(info_tvb, info_offset+3);
-
- col_append_fstr(pinfo->cinfo, COL_INFO, " | Phy C-ch: %u, %u", hf_v52_v5_link_id_cc_tmp, hf_v52_v5_time_slot_cc_tmp);
}
}
static void
dissect_pp_rejection_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1482,26 +1404,23 @@ dissect_pp_rejection_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2)-0x80, rejection_cause_values, "Unknown element"));
if (info_tree != NULL) {
proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_rejection_cause, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
-
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2)-0x80, rejection_cause_values, "Unknown element"));
}
}
static void
dissect_protocol_error(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1515,10 +1434,10 @@ dissect_protocol_error(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2)-0x80, error_cause_values, "Unknown element"));
if (info_tree != NULL) {
proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
@@ -1527,17 +1446,13 @@ dissect_protocol_error(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
proto_tree_add_item(info_tree, hf_v52_error_cause, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
proto_tree_add_item(info_tree, hf_v52_diagnostic_msg, info_tvb, info_offset+3, info_element_length, ENC_BIG_ENDIAN);
proto_tree_add_item(info_tree, hf_v52_diagnostic_element, info_tvb, info_offset+4, info_element_length, ENC_BIG_ENDIAN);
-
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2)-0x80, error_cause_values, "Unknown element"));
-
}
}
static void
dissect_performance_grading(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1551,25 +1466,21 @@ dissect_performance_grading(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
data_length = 1;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset)-0xe0, performance_grading_values, "Unknown element"));
if (info_tree != NULL) {
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_performance_grading, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
-
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset)-0xe0, performance_grading_values, "Unknown element"));
-
}
}
static void
dissect_cp_rejection_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1583,27 +1494,22 @@ dissect_cp_rejection_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
data_length = 1;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset)-0xe0, cp_rejection_cause_values, "Unknown element"));
if (info_tree != NULL) {
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_cp_rejection_cause, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
-
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset)-0xe0, cp_rejection_cause_values, "Unknown element"));
}
}
static void
dissect_user_port_identification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
- int hf_v52_pstn_user_port_tmp = 0;
- int hf_v52_isdn_user_port_tmp = 0;
guint8 info_element_length = 1;
guint8 buffer = 0;
guint8 info_element = 0;
@@ -1617,41 +1523,30 @@ dissect_user_port_identification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
-
- if (info_tree != NULL) {
- proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
- proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
- proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
-
- buffer = tvb_get_guint8(info_tvb, info_offset+2)&0x01;
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
- if(buffer==0x01){
- proto_tree_add_item(info_tree, hf_v52_pstn_user_port_id, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(info_tree, hf_v52_pstn_user_port_id_lower, info_tvb, info_offset+3, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
+ proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
+ proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
- hf_v52_pstn_user_port_tmp = (((tvb_get_guint8(info_tvb, info_offset+2)>>1)<<8)+(tvb_get_guint8(info_tvb, info_offset+3)));
+ if(buffer==0x01){
+ proto_tree_add_item(info_tree, hf_v52_pstn_user_port_id, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(info_tree, hf_v52_pstn_user_port_id_lower, info_tvb, info_offset+3, 1, ENC_BIG_ENDIAN);
- col_append_fstr(pinfo->cinfo, COL_INFO, " | PSTN port: %u", hf_v52_pstn_user_port_tmp);
- }
- else if(buffer == 0x00){
- proto_tree_add_item(info_tree, hf_v52_isdn_user_port_id, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(info_tree, hf_v52_isdn_user_port_id_lower, info_tvb, info_offset+3, 1, ENC_BIG_ENDIAN);
-
- hf_v52_isdn_user_port_tmp = (((tvb_get_guint8(info_tvb, info_offset+2)>>2)<<7)+((tvb_get_guint8( info_tvb, info_offset+3)>>1)));
+ col_append_fstr(pinfo->cinfo, COL_INFO, " | PSTN port: %u", (((tvb_get_guint8(info_tvb, info_offset+2)>>1)<<8)+(tvb_get_guint8(info_tvb, info_offset+3))));
+ }
+ else if(buffer == 0x00){
+ proto_tree_add_item(info_tree, hf_v52_isdn_user_port_id, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(info_tree, hf_v52_isdn_user_port_id_lower, info_tvb, info_offset+3, 1, ENC_BIG_ENDIAN);
- col_append_fstr(pinfo->cinfo, COL_INFO, " | ISDN: %u", hf_v52_isdn_user_port_tmp);
- }
+ col_append_fstr(pinfo->cinfo, COL_INFO, " | ISDN: %u", (((tvb_get_guint8(info_tvb, info_offset+2)>>2)<<7)+((tvb_get_guint8( info_tvb, info_offset+3)>>1))));
}
}
static void
dissect_isdn_port_time_slot_identification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1666,27 +1561,24 @@ dissect_isdn_port_time_slot_identification(tvbuff_t *tvb, packet_info *pinfo, pr
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ isdn_user_port_ts_num_tmp = (tvb_get_guint8(info_tvb, info_offset+2)) - 128;
+ col_append_str(pinfo->cinfo, COL_INFO, ", ");
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%x", isdn_user_port_ts_num_tmp);
if (info_tree != NULL) {
proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_isdn_user_port_ts_num, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
-
- isdn_user_port_ts_num_tmp = (tvb_get_guint8(info_tvb, info_offset+2)) - 128;
- col_append_str(pinfo->cinfo, COL_INFO, ", ");
- col_append_fstr(pinfo->cinfo, COL_INFO, "%x", isdn_user_port_ts_num_tmp);
}
}
static void
dissect_v5_time_slot_identification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1702,11 +1594,21 @@ dissect_v5_time_slot_identification(tvbuff_t *tvb, packet_info *pinfo, proto_tre
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ v5_link_id_tmp = tvb_get_guint8(info_tvb, info_offset+2);
+ v5_time_slot_tmp = tvb_get_guint8(info_tvb, info_offset+3);
+
+ if (v5_time_slot_tmp >= 64) {
+ v5_time_slot_tmp = v5_time_slot_tmp - 64;
+ }
+
+ if (v5_time_slot_tmp >= 32) {
+ v5_time_slot_tmp = v5_time_slot_tmp - 32;
}
+ col_append_fstr(pinfo->cinfo, COL_INFO, " | V5 Link: %u, %u ", v5_link_id_tmp, v5_time_slot_tmp);
+
if (info_tree != NULL) {
proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
@@ -1714,26 +1616,13 @@ dissect_v5_time_slot_identification(tvbuff_t *tvb, packet_info *pinfo, proto_tre
proto_tree_add_item(info_tree, hf_v52_v5_link_id, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
proto_tree_add_item(info_tree, hf_v52_override, info_tvb, info_offset+3, info_element_length, ENC_BIG_ENDIAN);
proto_tree_add_item(info_tree, hf_v52_v5_time_slot, info_tvb, info_offset+3, info_element_length, ENC_BIG_ENDIAN);
-
- v5_link_id_tmp = tvb_get_guint8(info_tvb, info_offset+2);
- v5_time_slot_tmp = tvb_get_guint8(info_tvb, info_offset+3);
-
- if (v5_time_slot_tmp >= 64) {
- v5_time_slot_tmp = v5_time_slot_tmp - 64;
- } else {};
-
- if (v5_time_slot_tmp >= 32) {
- v5_time_slot_tmp = v5_time_slot_tmp - 32;
- } else {};
-
- col_append_fstr(pinfo->cinfo, COL_INFO, " | V5 Link: %u, %u ", v5_link_id_tmp, v5_time_slot_tmp);
}
}
static void
dissect_multi_slot_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1747,10 +1636,9 @@ dissect_multi_slot_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_fstr(pinfo->cinfo, COL_INFO, " | V5MSlink ID:%u",tvb_get_guint8(info_tvb, info_offset+2));
if (info_tree != NULL) {
proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
@@ -1758,8 +1646,6 @@ dissect_multi_slot_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_v5_link_id, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
- col_append_fstr(pinfo->cinfo, COL_INFO, " | V5MSlink ID:%u",tvb_get_guint8(info_tvb, info_offset+2));
-
if(tvb_length_remaining(info_tvb, info_offset+3))
proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+3, info_element_length, ENC_BIG_ENDIAN);
if(tvb_length_remaining(info_tvb, info_offset+4))
@@ -1782,7 +1668,7 @@ dissect_multi_slot_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
static void
dissect_bcc_rejct_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1796,26 +1682,23 @@ dissect_bcc_rejct_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2)-0x80, reject_cause_type_values, "Unknown element"));
if (info_tree != NULL) {
proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_reject_cause_type, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
-
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2)-0x80, reject_cause_type_values, "Unknown element"));
}
}
static void
dissect_bcc_protocol_error_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1829,10 +1712,10 @@ dissect_bcc_protocol_error_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2)-0x80, bcc_protocol_error_cause_type_values, "Unknown element"));
if (info_tree != NULL) {
proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
@@ -1840,9 +1723,6 @@ dissect_bcc_protocol_error_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_bcc_protocol_error_cause, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2)-0x80, bcc_protocol_error_cause_type_values, "Unknown element"));
-
if(tvb_length_remaining(info_tvb, info_offset+3))
proto_tree_add_item(info_tree, hf_v52_diagnostic_message, info_tvb, info_offset+3, info_element_length, ENC_BIG_ENDIAN);
if(tvb_length_remaining(info_tvb, info_offset+4))
@@ -1853,7 +1733,7 @@ dissect_bcc_protocol_error_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
static void
dissect_connection_incomplete(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1867,33 +1747,23 @@ dissect_connection_incomplete(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
- }
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2) & 0x80, connection_incomplete_reason_values, "Unknown element"));
if (info_tree != NULL) {
proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_connection_incomplete_reason, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
-
-
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- if ((tvb_get_guint8(info_tvb, info_offset+2) < 0x80)) {
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2), connection_incomplete_reason_values, "Unknown element"));
- }
- else {
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2)-0x80, connection_incomplete_reason_values, "Unknown element"));
- }
-
}
}
static void
dissect_link_control_function(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
- proto_tree *info_tree = NULL;
+ proto_tree *info_tree;
proto_item *ti_info;
guint8 info_element_length = 1;
guint8 info_element = 0;
@@ -1907,9 +1777,11 @@ dissect_link_control_function(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
data_length = tvb_get_guint8(tvb, offset+1)+2;
info_tvb = tvb_new_subset_length(tvb, offset, data_length);
- if (tree) {
- ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
- info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
+ info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
+
+ if (message_type_tmp != 0x31) {
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2)-0x80, link_control_function_values, "Unknown element"));
}
if (info_tree != NULL) {
@@ -1917,12 +1789,6 @@ dissect_link_control_function(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
proto_item_append_text(ti_info, " %s (0x%x)",val_to_str_const(info_element, info_element_values, "unknown info element"),info_element);
proto_tree_add_item(info_tree, hf_v52_link_control_function, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
-
- if (message_type_tmp == 0x31) {}
- else {
- col_append_str(pinfo->cinfo, COL_INFO, " | ");
- col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(info_tvb, info_offset+2)-0x80, link_control_function_values, "Unknown element"));
- }
}
}
diff --git a/epan/dissectors/packet-v5ua.c b/epan/dissectors/packet-v5ua.c
index a50ef51f78..1851b5d1ec 100644
--- a/epan/dissectors/packet-v5ua.c
+++ b/epan/dissectors/packet-v5ua.c
@@ -909,17 +909,15 @@ dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *v5ua_
/* create proto_tree stuff */
switch(iua_version){
case RFC:
- parameter_item = proto_tree_add_text(v5ua_tree, parameter_tvb, PARAMETER_HEADER_OFFSET, tvb_length(parameter_tvb), "%s",
+ parameter_tree = proto_tree_add_subtree(v5ua_tree, parameter_tvb, PARAMETER_HEADER_OFFSET, -1, ett_v5ua_parameter, &parameter_item,
val_to_str_const(tag, parameter_tag_values, "Unknown parameter"));
- parameter_tree = proto_item_add_subtree(parameter_item, ett_v5ua_parameter);
/* add tag to the v5ua tree */
proto_tree_add_item(parameter_tree, hf_parameter_tag, parameter_tvb, PARAMETER_TAG_OFFSET, PARAMETER_TAG_LENGTH, ENC_BIG_ENDIAN);
break;
case DRAFT:
default:
- parameter_item = proto_tree_add_text(v5ua_tree, parameter_tvb, PARAMETER_HEADER_OFFSET, tvb_length(parameter_tvb), "%s",
+ parameter_tree = proto_tree_add_subtree(v5ua_tree, parameter_tvb, PARAMETER_HEADER_OFFSET, -1, ett_v5ua_parameter, &parameter_item,
val_to_str_const(tag, parameter_tag_draft_values, "Unknown parameter"));
- parameter_tree = proto_item_add_subtree(parameter_item, ett_v5ua_parameter);
/* add tag to the v5ua tree */
proto_tree_add_item(parameter_tree, hf_parameter_tag_draft, parameter_tvb, PARAMETER_TAG_OFFSET, PARAMETER_TAG_LENGTH, ENC_BIG_ENDIAN);
@@ -1318,8 +1316,8 @@ dissect_common_header(tvbuff_t *common_header_tvb, packet_info *pinfo, proto_tre
if (v5ua_tree) {
/* create proto_tree stuff */
- common_header_item = proto_tree_add_text(v5ua_tree, common_header_tvb, COMMON_HEADER_OFFSET, tvb_length(common_header_tvb),"Common Msg-Header");
- common_header_tree = proto_item_add_subtree(common_header_item, ett_v5ua_common_header);
+ common_header_tree = proto_tree_add_subtree(v5ua_tree, common_header_tvb, COMMON_HEADER_OFFSET, -1,
+ ett_v5ua_common_header, &common_header_item, "Common Msg-Header");
/* add the components of the common header to the protocol tree */
proto_tree_add_item(common_header_tree, hf_version, common_header_tvb, COMMON_HEADER_VERSION_OFFSET, COMMON_HEADER_VERSION_LENGTH, ENC_BIG_ENDIAN);
diff --git a/epan/dissectors/packet-vcdu.c b/epan/dissectors/packet-vcdu.c
index 3615063639..03b7b00d54 100644
--- a/epan/dissectors/packet-vcdu.c
+++ b/epan/dissectors/packet-vcdu.c
@@ -257,11 +257,10 @@ dissect_vcdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
int ccsds_tree_added = 0;
int ccsds_len = 0;
- proto_item *smex_header = NULL;
- proto_tree *smex_tree = NULL;
+ proto_item *smex_header;
+ proto_tree *smex_tree;
- proto_item *vcdu_header = NULL;
- proto_tree *vcdu_tree = NULL;
+ proto_tree *vcdu_tree;
guint16 first_word = 0;
guint32 long_word = 0;
@@ -277,8 +276,7 @@ dissect_vcdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
/* build the smex header tree */
- smex_header = proto_tree_add_text(tree, tvb, offset, SMEX_HEADER_LENGTH, "SMEX Header");
- smex_tree = proto_item_add_subtree(smex_header, ett_smex);
+ smex_tree = proto_tree_add_subtree(tree, tvb, offset, SMEX_HEADER_LENGTH, ett_smex, &smex_header, "SMEX Header");
proto_tree_add_item(smex_tree, hf_smex_gsc, tvb, offset, 8, ENC_BIG_ENDIAN);
offset += 8;
@@ -330,8 +328,7 @@ dissect_vcdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* build the vcdu header tree */
- vcdu_header = proto_tree_add_text(tree, tvb, offset, VCDU_HEADER_LENGTH, "VCDU Header");
- vcdu_tree = proto_item_add_subtree(vcdu_header, ett_vcdu);
+ vcdu_tree = proto_tree_add_subtree(tree, tvb, offset, VCDU_HEADER_LENGTH, ett_vcdu, NULL, "VCDU Header");
/* extract the virtual channel for use later on */
first_word = tvb_get_ntohs(tvb, offset);
diff --git a/epan/dissectors/packet-vnc.c b/epan/dissectors/packet-vnc.c
index 32cd87397f..0e3696ac93 100644
--- a/epan/dissectors/packet-vnc.c
+++ b/epan/dissectors/packet-vnc.c
@@ -2020,11 +2020,9 @@ vnc_server_framebuffer_update(tvbuff_t *tvb, packet_info *pinfo, gint *offset,
}
VNC_BYTES_NEEDED(12);
- ti = proto_tree_add_text(tree, tvb, *offset, 12,
- "Rectangle #%d", ii+1);
+ vnc_rect_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 12,
+ ett_vnc_rect, NULL, "Rectangle #%d", ii+1);
- vnc_rect_tree =
- proto_item_add_subtree(ti, ett_vnc_rect);
ti_x = proto_tree_add_item(vnc_rect_tree, hf_vnc_fb_update_x_pos,
tvb, *offset, 2, ENC_BIG_ENDIAN);
@@ -2190,7 +2188,6 @@ vnc_extended_desktop_size(tvbuff_t *tvb, gint *offset, proto_tree *tree)
{
guint8 i, num_of_screens;
- proto_item *ti;
proto_tree *screen_tree;
num_of_screens = tvb_get_guint8(tvb, *offset);
@@ -2201,8 +2198,7 @@ vnc_extended_desktop_size(tvbuff_t *tvb, gint *offset, proto_tree *tree)
VNC_BYTES_NEEDED((guint32)(3 + (num_of_screens * 16)));
*offset += 3;
for(i = 0; i < num_of_screens; i++) {
- ti = proto_tree_add_text(tree, tvb, *offset, 16, "Screen #%u", i+1);
- screen_tree = proto_item_add_subtree(ti, ett_vnc_desktop_screen);
+ screen_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 16, ett_vnc_desktop_screen, NULL, "Screen #%u", i+1);
proto_tree_add_item(screen_tree, hf_vnc_desktop_screen_id, tvb, *offset, 4, ENC_BIG_ENDIAN);
*offset += 4;
@@ -2290,10 +2286,8 @@ vnc_rre_encoding(tvbuff_t *tvb, packet_info *pinfo, gint *offset,
VNC_BYTES_NEEDED(bytes_needed * num_subrects);
for(i = 0; i < num_subrects; i++) {
- ti = proto_tree_add_text(tree, tvb, *offset, bytes_per_pixel +
- 8, "Subrectangle #%d", i+1);
- subrect_tree =
- proto_item_add_subtree(ti, ett_vnc_rre_subrect);
+ subrect_tree = proto_tree_add_subtree_format(tree, tvb, *offset, bytes_per_pixel +
+ 8, ett_vnc_rre_subrect, NULL, "Subrectangle #%d", i+1);
proto_tree_add_item(subrect_tree, hf_vnc_rre_subrect_pixel,
tvb, *offset, bytes_per_pixel, ENC_NA);
@@ -2328,7 +2322,7 @@ vnc_hextile_encoding(tvbuff_t *tvb, packet_info *pinfo, gint *offset,
guint8 i, subencoding_mask, num_subrects, subrect_len, tile_height, tile_width;
guint32 raw_length;
proto_tree *tile_tree, *subencoding_mask_tree, *subrect_tree, *num_subrects_tree;
- proto_item *ti, *tile_item;
+ proto_item *ti;
guint16 current_height = 0, current_width;
while(current_height != height) {
@@ -2349,8 +2343,8 @@ vnc_hextile_encoding(tvbuff_t *tvb, packet_info *pinfo, gint *offset,
VNC_BYTES_NEEDED(1);
subencoding_mask = tvb_get_guint8(tvb, *offset);
- tile_item = proto_tree_add_text(tree, tvb, *offset, 1, "Tile {%d:%d}, sub encoding mask %u", current_width, current_height, subencoding_mask);
- tile_tree = proto_item_add_subtree(tile_item, ett_vnc_hextile_tile);
+ tile_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 1, ett_vnc_hextile_tile, NULL,
+ "Tile {%d:%d}, sub encoding mask %u", current_width, current_height, subencoding_mask);
ti = proto_tree_add_item(tile_tree, hf_vnc_hextile_subencoding_mask, tvb,
*offset, 1, ENC_BIG_ENDIAN);
@@ -2418,11 +2412,9 @@ vnc_hextile_encoding(tvbuff_t *tvb, packet_info *pinfo, gint *offset,
proto_item_add_subtree(ti, ett_vnc_hextile_num_subrects);
for(i = 0; i < num_subrects; i++) {
- ti = proto_tree_add_text(num_subrects_tree, tvb,
- *offset, subrect_len,
+ subrect_tree = proto_tree_add_subtree_format(num_subrects_tree, tvb,
+ *offset, subrect_len, ett_vnc_hextile_subrect, NULL,
"Subrectangle #%d", i+1);
- subrect_tree =
- proto_item_add_subtree(ti, ett_vnc_hextile_subrect);
if(subencoding_mask & 0x10) {
/* Subrects Colored */
@@ -2513,7 +2505,6 @@ vnc_mirrorlink(tvbuff_t *tvb, packet_info *pinfo, gint *offset,
guint16 length;
guint16 num, i;
gint end;
- proto_item *ti;
proto_tree *sub_tree;
/* Header */
@@ -2651,9 +2642,8 @@ vnc_mirrorlink(tvbuff_t *tvb, packet_info *pinfo, gint *offset,
tvb, *offset, 2, ENC_BIG_ENDIAN);
*offset += 2;
VNC_BYTES_NEEDED((guint)(4 * num));
- ti = proto_tree_add_text(tree, tvb, *offset, 4 * num,
- "Key Event List");
- sub_tree = proto_item_add_subtree(ti, ett_vnc_key_events);
+ sub_tree = proto_tree_add_subtree(tree, tvb, *offset, 4 * num,
+ ett_vnc_key_events, NULL, "Key Event List");
for (; num > 0; num--) {
proto_tree_add_item(sub_tree,
hf_vnc_mirrorlink_key_symbol_value,
@@ -2759,10 +2749,8 @@ vnc_mirrorlink(tvbuff_t *tvb, packet_info *pinfo, gint *offset,
VNC_BYTES_NEEDED((guint)(6 * num));
/*sub_tree = proto_item_add_subtree(tree, ett_vnc_touch_events);*/
for (i = 0; i < num; i++) {
- ti = proto_tree_add_text(tree, tvb, *offset, 6,
- "Touch Event #%d", i + 1);
- sub_tree = proto_item_add_subtree(ti,
- ett_vnc_touch_events);
+ sub_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 6,
+ ett_vnc_touch_events, NULL, "Touch Event #%d", i + 1);
proto_tree_add_item(sub_tree, hf_vnc_mirrorlink_touch_x,
tvb, *offset, 2, ENC_BIG_ENDIAN);
@@ -2892,7 +2880,6 @@ vnc_slrle_encoding(tvbuff_t *tvb, packet_info *pinfo, gint *offset,
guint8 bytes_per_run;
guint16 num_runs, i;
guint length;
- proto_item *ti;
proto_tree *sub_tree;
if (depth_mod <= 4)
@@ -2906,9 +2893,8 @@ vnc_slrle_encoding(tvbuff_t *tvb, packet_info *pinfo, gint *offset,
length = num_runs * bytes_per_run;
- ti = proto_tree_add_text(tree, tvb, *offset, 2 + length,
- "Scanline #%d", i+1);
- sub_tree = proto_item_add_subtree(ti, ett_vnc_slrle_subline);
+ sub_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 2 + length,
+ ett_vnc_slrle_subline, NULL, "Scanline #%d", i+1);
proto_tree_add_item(sub_tree, hf_vnc_slrle_run_num,
tvb, *offset, 2, ENC_BIG_ENDIAN);
@@ -3373,14 +3359,10 @@ vnc_server_set_colormap_entries(tvbuff_t *tvb, packet_info *pinfo, gint *offset,
proto_item_add_subtree(ti, ett_vnc_colormap_num_groups);
for(counter = 0; counter < number_of_colors; counter++) {
- ti = proto_tree_add_text(vnc_colormap_num_groups, tvb,
- *offset, 6,
+ vnc_colormap_color_group = proto_tree_add_subtree_format(vnc_colormap_num_groups, tvb,
+ *offset, 6, ett_vnc_colormap_color_group, NULL,
"Color group #%d", counter+1);
- vnc_colormap_color_group =
- proto_item_add_subtree(ti,
- ett_vnc_colormap_color_group);
-
proto_tree_add_item(vnc_colormap_color_group,
hf_vnc_colormap_red, tvb,
*offset, 2, ENC_BIG_ENDIAN);
diff --git a/epan/dissectors/packet-vp8.c b/epan/dissectors/packet-vp8.c
index 4b10384c45..35ac6a3a50 100644
--- a/epan/dissectors/packet-vp8.c
+++ b/epan/dissectors/packet-vp8.c
@@ -218,8 +218,7 @@ The first octets after the RTP header are the VP8 payload descriptor,
+-+-+-+-+-+-+-+-+
*/
- item_descriptor = proto_tree_add_text(vp8_tree, tvb, *offset, -1, "Payload descriptor");
- vp8_payload_descriptor_tree = proto_item_add_subtree(item_descriptor, ett_vp8_payload_descriptor);
+ vp8_payload_descriptor_tree = proto_tree_add_subtree(vp8_tree, tvb, *offset, -1, ett_vp8_payload_descriptor, &item_descriptor, "Payload descriptor");
proto_tree_add_item(vp8_payload_descriptor_tree, hf_vp8_pld_x_bit, tvb, *offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(vp8_payload_descriptor_tree, hf_vp8_pld_r_bit, tvb, *offset, 1, ENC_BIG_ENDIAN);
@@ -320,8 +319,7 @@ The first three octets of an encoded VP8 frame are referred to as an
*/
- item_header = proto_tree_add_text(vp8_tree, tvb, *offset, 3, "Payload header");
- vp8_payload_header_tree = proto_item_add_subtree(item_header, ett_vp8_payload_header);
+ vp8_payload_header_tree = proto_tree_add_subtree(vp8_tree, tvb, *offset, 3, ett_vp8_payload_header, &item_header, "Payload header");
proto_tree_add_item(vp8_payload_header_tree, hf_vp8_hdr_frametype, tvb, *offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(vp8_payload_header_tree, hf_vp8_hdr_version, tvb, *offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(vp8_payload_header_tree, hf_vp8_hdr_show_bit, tvb, *offset, 1, ENC_BIG_ENDIAN);
@@ -342,22 +340,18 @@ The first three octets of an encoded VP8 frame are referred to as an
static void
dissect_vp8_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *vp8_tree, gint *offset, gint *frametype, gint *partition1_size)
{
- proto_item *item_payload;
proto_tree *vp8_payload_tree;
gint remainder;
- item_payload = proto_tree_add_text(vp8_tree, tvb, *offset, -1, "Payload");
- vp8_payload_tree = proto_item_add_subtree(item_payload, ett_vp8_payload);
+ vp8_payload_tree = proto_tree_add_subtree(vp8_tree, tvb, *offset, -1, ett_vp8_payload, NULL, "Payload");
if (*frametype==0)
{
guint16 width, height;
gint start1, start2, start3, horizontal_scale, vertical_scale;
proto_tree *vp8_keyframe_tree;
- proto_item *item_keyframe;
- item_keyframe = proto_tree_add_text(vp8_payload_tree, tvb, *offset, -1, "Keyframe header");
- vp8_keyframe_tree = proto_item_add_subtree(item_keyframe, ett_vp8_keyframe);
+ vp8_keyframe_tree = proto_tree_add_subtree(vp8_payload_tree, tvb, *offset, -1, ett_vp8_keyframe, NULL, "Keyframe header");
proto_tree_add_item(vp8_keyframe_tree, hf_vp8_keyframe_start_code, tvb, *offset, 3, ENC_BIG_ENDIAN);
start1 = tvb_get_guint8(tvb, *offset);
diff --git a/epan/dissectors/packet-vtp.c b/epan/dissectors/packet-vtp.c
index 01b0e8a4bc..e76b271599 100644
--- a/epan/dissectors/packet-vtp.c
+++ b/epan/dissectors/packet-vtp.c
@@ -240,9 +240,8 @@ dissect_vtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2, ENC_BIG_ENDIAN);
offset += 2;
- ti = proto_tree_add_text (vtp_tree, tvb, offset, -1,
- "Advertised active (i.e. not pruned) VLANs");
- vtp_pruning_tree = proto_item_add_subtree(ti, ett_vtp_pruning);
+ vtp_pruning_tree = proto_tree_add_subtree(vtp_tree, tvb, offset, -1,
+ ett_vtp_pruning, NULL, "Advertised active (i.e. not pruned) VLANs");
while (tvb_reported_length_remaining(tvb, offset) > 0) {
guint8 vlan_usage_bitmap;
@@ -318,9 +317,8 @@ dissect_vlan_info(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tre
proto_tree *tlv_tree;
vlan_info_len = tvb_get_guint8(tvb, offset);
- ti = proto_tree_add_text(tree, tvb, offset, vlan_info_len,
- "VLAN Information");
- vlan_info_tree = proto_item_add_subtree(ti, ett_vtp_vlan_info);
+ vlan_info_tree = proto_tree_add_subtree(tree, tvb, offset, vlan_info_len,
+ ett_vtp_vlan_info, NULL, "VLAN Information");
vlan_info_left = vlan_info_len;
proto_tree_add_uint(vlan_info_tree, hf_vtp_vlan_info_len, tvb, offset, 1,
@@ -369,11 +367,10 @@ dissect_vlan_info(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tre
type = tvb_get_guint8(tvb, offset + 0);
length = tvb_get_guint8(tvb, offset + 1);
- ti = proto_tree_add_text(vlan_info_tree, tvb, offset,
- 2 + length*2, "%s",
+ tlv_tree = proto_tree_add_subtree(vlan_info_tree, tvb, offset,
+ 2 + length*2, ett_vtp_tlv, &ti,
val_to_str(type, vlan_tlv_type_vals,
"Unknown TLV type: 0x%02x"));
- tlv_tree = proto_item_add_subtree(ti, ett_vtp_tlv);
proto_tree_add_item(tlv_tree, hf_vtp_vlan_tlvtype, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_tree, hf_vtp_vlan_tlvlength, tvb, offset+1, 1, ENC_BIG_ENDIAN);
offset += 2;
diff --git a/epan/dissectors/packet-wassp.c b/epan/dissectors/packet-wassp.c
index aa0b7e8d76..608c05b79e 100644
--- a/epan/dissectors/packet-wassp.c
+++ b/epan/dissectors/packet-wassp.c
@@ -825,7 +825,6 @@ dissect_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *wassp_tree,
{
guint32 tlv_type;
guint32 tlv_length;
- proto_item *tlv_item;
proto_item *tlv_tree;
proto_item *type_item;
int type_index;
@@ -834,14 +833,12 @@ dissect_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *wassp_tree,
tlv_type = tvb_get_ntohs(tvb, offset);
tlv_length = tvb_get_ntohs(tvb, offset + 2);
DISSECTOR_ASSERT(tlv_length >= 4);
- tlv_item = proto_tree_add_text(wassp_tree, tvb,
- offset, tlv_length,
+ tlv_tree = proto_tree_add_subtree_format(wassp_tree, tvb,
+ offset, tlv_length, ett_wassp_tlv_header, NULL,
"T %d, L %d: %s",
tlv_type,
tlv_length,
extval_to_str_idx(tlv_type, value_array, NULL, "Unknown"));
- tlv_tree = proto_item_add_subtree(tlv_item,
- ett_wassp_tlv_header);
type_item = proto_tree_add_item(tlv_tree, hf_wassp_tlv_type,
tvb, offset, 2, ENC_BIG_ENDIAN);
proto_item_append_text(type_item, " = %s",
diff --git a/epan/dissectors/packet-wbxml.c b/epan/dissectors/packet-wbxml.c
index 095677758e..db64214255 100644
--- a/epan/dissectors/packet-wbxml.c
+++ b/epan/dissectors/packet-wbxml.c
@@ -7139,9 +7139,8 @@ dissect_wbxml_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
"(edit WBXML preferences to show)");
return;
} /* Else: render the WBXML tokens */
- ti = proto_tree_add_text (wbxml_tree, tvb, offset, -1,
- "Data representation");
- wbxml_content_tree = proto_item_add_subtree (ti, ett_wbxml_content);
+ wbxml_content_tree = proto_tree_add_subtree(wbxml_tree, tvb, offset, -1,
+ ett_wbxml_content, &ti, "Data representation");
/* The parse_wbxml_X() functions will process the content correctly,
* irrespective of the WBXML version used. For the WBXML body, this
diff --git a/epan/dissectors/packet-wccp.c b/epan/dissectors/packet-wccp.c
index 07e8fed675..5c6127a06a 100644
--- a/epan/dissectors/packet-wccp.c
+++ b/epan/dissectors/packet-wccp.c
@@ -770,7 +770,6 @@ dissect_wccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
static guint
dissect_hash_data(tvbuff_t *tvb, int offset, proto_tree *wccp_tree)
{
- proto_item *bucket_item;
proto_tree *bucket_tree;
proto_item *tf;
proto_tree *field_tree;
@@ -782,9 +781,8 @@ dissect_hash_data(tvbuff_t *tvb, int offset, proto_tree *wccp_tree)
ENC_BIG_ENDIAN);
offset += 4;
- bucket_item = proto_tree_add_text(wccp_tree, tvb, offset, 32,
- "Hash information");
- bucket_tree = proto_item_add_subtree(bucket_item, ett_buckets);
+ bucket_tree = proto_tree_add_subtree(wccp_tree, tvb, offset, 32,
+ ett_buckets, NULL, "Hash information");
for (i = 0, n = 0; i < 32; i++) {
bucket_info = tvb_get_guint8(tvb, offset);
@@ -802,12 +800,10 @@ static guint
dissect_web_cache_list_entry(tvbuff_t *tvb, int offset, int idx,
proto_tree *wccp_tree)
{
- proto_item *tl;
proto_tree *list_entry_tree;
- tl = proto_tree_add_text(wccp_tree, tvb, offset, 4 + HASH_INFO_SIZE,
- "Web-Cache List Entry(%d)", idx);
- list_entry_tree = proto_item_add_subtree(tl, ett_cache_info);
+ list_entry_tree = proto_tree_add_subtree_format(wccp_tree, tvb, offset, 4 + HASH_INFO_SIZE,
+ ett_cache_info, NULL, "Web-Cache List Entry(%d)", idx);
proto_tree_add_item(list_entry_tree, hf_cache_ip, tvb, offset, 4,
ENC_BIG_ENDIAN);
offset += 4;
@@ -1019,9 +1015,8 @@ dissect_wccp2_info(tvbuff_t *tvb, int offset, guint16 length,
break;
}
- tf = proto_tree_add_text(wccp_tree, tvb, offset, item_length + 4, "%s",
+ info_tree = proto_tree_add_subtree(wccp_tree, tvb, offset, item_length + 4, ett, &tf,
val_to_str(type, info_type_vals, "Unknown info type (%u)"));
- info_tree = proto_item_add_subtree(tf, ett);
proto_tree_add_item(info_tree, hf_item_type, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(info_tree, hf_item_length, tvb, offset+2, 2, ENC_BIG_ENDIAN);
@@ -1334,9 +1329,8 @@ dissect_wccp2_service_info(tvbuff_t *tvb, int offset, gint length,
offset += 4;
if (flags & WCCP2_SI_PORTS_DEFINED) {
- tf = proto_tree_add_text(info_tree, tvb, offset, 2*8,
- "Ports list: ");
- ports_tree = proto_item_add_subtree(tf, ett_service_info_ports);
+ ports_tree = proto_tree_add_subtree(info_tree, tvb, offset, 2*8,
+ ett_service_info_ports, &tf, "Ports list: ");
for (i = 0; i < 8; i++) {
guint16 port = tvb_get_ntohs(tvb, offset);
@@ -2114,16 +2108,14 @@ dissect_wccp2_hash_assignment_data_element(tvbuff_t *tvb, int offset, gint lengt
proto_tree *info_tree)
{
- proto_item *bucket_item;
proto_tree *bucket_tree;
int i;
guint8 bucket_info;
int n;
- bucket_item = proto_tree_add_text(info_tree, tvb, offset, 8*4,
- "Hash Assignment Data");
- bucket_tree = proto_item_add_subtree(bucket_item, ett_hash_assignment_buckets);
+ bucket_tree = proto_tree_add_subtree(info_tree, tvb, offset, 8*4,
+ ett_hash_assignment_buckets, NULL, "Hash Assignment Data");
for (i = 0, n = 0; i < 32; i++) {
if (length == 0) {
@@ -2153,9 +2145,8 @@ dissect_wccp2_mask_assignment_data_element(tvbuff_t *tvb, int offset, gint lengt
gint new_length,start;
- mask_item = proto_tree_add_text(info_tree, tvb, offset, 4,
- "Mask Assignment Data");
- mask_tree = proto_item_add_subtree(mask_item, ett_mask_assignment_data_element);
+ mask_tree = proto_tree_add_subtree(info_tree, tvb, offset, 4,
+ ett_mask_assignment_data_element, &mask_item, "Mask Assignment Data");
start = offset;
new_length=dissect_wccp2_mask_value_set_list(tvb, offset, length, pinfo, mask_tree);
@@ -2178,12 +2169,10 @@ static gint
dissect_wccp2_alternate_mask_assignment_data_element(tvbuff_t *tvb, int offset, gint length, packet_info *pinfo,
proto_tree *info_tree)
{
- proto_item *mask_item;
proto_tree *mask_tree;
- mask_item = proto_tree_add_text(info_tree, tvb, offset, length,
- "Alternate Mask Assignment Data");
- mask_tree = proto_item_add_subtree(mask_item, ett_alternate_mask_assignment_data_element);
+ mask_tree = proto_tree_add_subtree(info_tree, tvb, offset, length,
+ ett_alternate_mask_assignment_data_element, NULL, "Alternate Mask Assignment Data");
if (length < 4)
return length-4;
@@ -2240,10 +2229,8 @@ dissect_wccp2_extended_assignment_data_element(tvbuff_t *tvb, int offset, gint l
return length-4;
- header = proto_tree_add_text(info_tree, tvb, offset, length,
- "Extended Assignment Data Element");
-
- item_tree = proto_item_add_subtree(header, ett_extended_assigment_data_element);
+ item_tree = proto_tree_add_subtree(info_tree, tvb, offset, length,
+ ett_extended_assigment_data_element, &header, "Extended Assignment Data Element");
type_of_assignment = tvb_get_ntohs(tvb, offset);
proto_tree_add_item(item_tree, hf_extended_assignment_data_type, tvb, offset, 2, ENC_BIG_ENDIAN);
@@ -2391,8 +2378,7 @@ dissect_wccp2_mask_value_set_list(tvbuff_t *tvb, int offset,
if (length < 4)
return length - 4;
- te = proto_tree_add_text(info_tree, tvb, offset, 4, "Mask/Value Set List");
- element_tree = proto_item_add_subtree(te, ett_mv_set_list);
+ element_tree = proto_tree_add_subtree(info_tree, tvb, offset, 4, ett_mv_set_list, &te, "Mask/Value Set List");
start = offset;
@@ -2448,7 +2434,6 @@ dissect_wccp2_mask_element(tvbuff_t *tvb, int offset, gint length, packet_info *
static gint dissect_wccp2_alternate_mask_value_set_list(tvbuff_t *tvb, int offset,
int length, packet_info *pinfo, proto_tree *info_tree)
{
- proto_item *header;
proto_tree *list_tree;
guint num_of_val_elements;
guint i;
@@ -2456,9 +2441,8 @@ static gint dissect_wccp2_alternate_mask_value_set_list(tvbuff_t *tvb, int offse
if (length < 4)
return length - 4;
- header = proto_tree_add_text(info_tree, tvb, offset, length,
- "Alternate Mask/Value Set List");
- list_tree = proto_item_add_subtree(header, ett_alternate_mask_value_set);
+ list_tree = proto_tree_add_subtree(info_tree, tvb, offset, length,
+ ett_alternate_mask_value_set, NULL, "Alternate Mask/Value Set List");
num_of_val_elements = tvb_get_ntohl(tvb, offset);
proto_tree_add_uint(list_tree, hf_alt_assignment_mask_value_set_list_num_elements, tvb, offset, 4, num_of_val_elements);
@@ -2485,9 +2469,9 @@ dissect_wccp2_alternate_mask_value_set_element(tvbuff_t *tvb, int offset, gint l
gint new_length, total_length;
guint i;
- header = proto_tree_add_text(info_tree, tvb, offset, 0,
+ element_tree = proto_tree_add_subtree_format(info_tree, tvb, offset, 0,
+ ett_alternate_mask_value_set_element, &header,
"Alternate Mask/Value Set Element(%d)", el_index);
- element_tree = proto_item_add_subtree(header, ett_alternate_mask_value_set_element);
total_length = 0;
@@ -2600,7 +2584,6 @@ dissect_transmit_t_capability(tvbuff_t *tvb, proto_item *te, int curr_offset,
guint16 capability_val_len, gint ett, proto_tree *element_tree)
{
guint16 upper_limit, lower_limit;
- proto_item *tm;
proto_tree *method_tree;
DISSECTOR_ASSERT(capability_val_len == 4);
@@ -2609,18 +2592,16 @@ dissect_transmit_t_capability(tvbuff_t *tvb, proto_item *te, int curr_offset,
lower_limit = tvb_get_ntohs(tvb, curr_offset + 2);
if ( upper_limit == 0) {
- tm = proto_tree_add_text(element_tree, tvb, curr_offset, 2,
- "Only accepting one value");
- method_tree = proto_item_add_subtree(tm, ett);
+ method_tree = proto_tree_add_subtree(element_tree, tvb, curr_offset, 2,
+ ett, NULL, "Only accepting one value");
proto_tree_add_text(method_tree, tvb, curr_offset, 2,
"Reserved, must be 0: %d", upper_limit);
proto_tree_add_item(method_tree, hf_capability_transmit_t , tvb, curr_offset+2, 2, ENC_BIG_ENDIAN);
proto_item_append_text(te, " %d ms", lower_limit);
} else {
- tm = proto_tree_add_text(element_tree, tvb, curr_offset, 2,
- "Accepting a range");
- method_tree = proto_item_add_subtree(tm, ett);
+ method_tree = proto_tree_add_subtree(element_tree, tvb, curr_offset, 2,
+ ett, NULL, "Accepting a range");
proto_tree_add_item(method_tree, hf_capability_transmit_t_upper_limit,
tvb, curr_offset, 2, ENC_BIG_ENDIAN);
@@ -2636,7 +2617,6 @@ dissect_timer_scale_capability(tvbuff_t *tvb, int curr_offset,
guint16 capability_val_len, gint ett, proto_tree *element_tree)
{
guint8 a,c;
- proto_item *tm;
proto_tree *method_tree;
DISSECTOR_ASSERT(capability_val_len == 4);
@@ -2646,10 +2626,9 @@ dissect_timer_scale_capability(tvbuff_t *tvb, int curr_offset,
if ( a == 0) {
if ( c == 0) {
- tm = proto_tree_add_text(element_tree, tvb, curr_offset, 2,
- "Only accepting one value");
+ method_tree = proto_tree_add_subtree(element_tree, tvb, curr_offset, 2,
+ ett, NULL, "Only accepting one value");
- method_tree = proto_item_add_subtree(tm, ett);
proto_tree_add_text(method_tree, tvb, curr_offset, 1,
"Reserved, must be 0: %d", a);
@@ -2668,9 +2647,8 @@ dissect_timer_scale_capability(tvbuff_t *tvb, int curr_offset,
proto_tree_add_text(element_tree, tvb, curr_offset, 1,
"Error C is 0, but A is not");
} else {
- tm = proto_tree_add_text(element_tree, tvb, curr_offset, 2,
- "Accepting a range");
- method_tree = proto_item_add_subtree(tm, ett);
+ method_tree = proto_tree_add_subtree(element_tree, tvb, curr_offset, 2,
+ ett, NULL, "Accepting a range");
proto_tree_add_item(method_tree, hf_capability_timer_scale_timeout_scale_upper_limit,
tvb, curr_offset, 1, ENC_BIG_ENDIAN);
@@ -2689,15 +2667,13 @@ dissect_timer_scale_capability(tvbuff_t *tvb, int curr_offset,
static gint
dissect_wccp2_value_element(tvbuff_t *tvb, int offset, gint length, int idx, packet_info *pinfo, proto_tree *info_tree)
{
- proto_item *tl;
proto_tree *element_tree;
if (length < 4)
return length - 16;
- tl = proto_tree_add_text(info_tree, tvb, offset, 16, "Value Element(%u) %s",
+ element_tree = proto_tree_add_subtree_format(info_tree, tvb, offset, 16, ett_value_element, NULL, "Value Element(%u) %s",
idx,decode_wccp_encoded_address(tvb, offset+4+4+2+2, pinfo, info_tree));
- element_tree = proto_item_add_subtree(tl, ett_value_element);
proto_tree_add_item(element_tree, hf_value_element_src_ip, tvb, offset, 4, ENC_BIG_ENDIAN);
EAT_AND_CHECK(4,4);
@@ -2726,9 +2702,8 @@ dissect_wccp2_mask_value_set_element(tvbuff_t *tvb, int offset, gint length, int
guint i;
gint new_length;
- tl = proto_tree_add_text(info_tree, tvb, offset, 0,
- "Mask/Value Set Element(%d)", idx);
- element_tree = proto_item_add_subtree(tl, ett_mv_set_element);
+ element_tree = proto_tree_add_subtree_format(info_tree, tvb, offset, 0,
+ ett_mv_set_element, &tl, "Mask/Value Set Element(%d)", idx);
new_length = dissect_wccp2_mask_element(tvb,offset,length,pinfo,element_tree);
NOTE_EATEN_LENGTH(new_length);
@@ -2767,7 +2742,6 @@ dissect_wccp2_alternate_assignment_info(tvbuff_t *tvb, int offset, gint length,
guint32 n_routers;
guint i;
- proto_item *te;
proto_tree *element_tree;
gint new_length;
@@ -2806,11 +2780,11 @@ dissect_wccp2_alternate_assignment_info(tvbuff_t *tvb, int offset, gint length,
if (length < 12)
return length - 12*(n_routers-i);
- te = proto_tree_add_text(info_tree, tvb, offset, 12,
+ element_tree = proto_tree_add_subtree_format(info_tree, tvb, offset, 12,
+ ett_router_alt_assignment_element, NULL,
"Router %d Assignment Element: IP address %s", i,
decode_wccp_encoded_address(tvb, offset, pinfo, info_tree));
- element_tree = proto_item_add_subtree(te, ett_router_alt_assignment_element);
dissect_wccp2_router_assignment_element(tvb, offset, length , pinfo, element_tree);
EAT(12);
}
diff --git a/epan/dissectors/packet-wifi-display.c b/epan/dissectors/packet-wifi-display.c
index 50f0c8c12a..0f23848378 100644
--- a/epan/dissectors/packet-wifi-display.c
+++ b/epan/dissectors/packet-wifi-display.c
@@ -225,9 +225,8 @@ dissect_wfd_subelem_session_info(packet_info *pinfo, proto_tree *tree,
guint8 dlen = tvb_get_guint8(tvb, offset);
next = offset + 1 + dlen;
- item = proto_tree_add_text(tree, tvb, offset, 1 + dlen,
- "WFD Device Info Descriptor");
- descr = proto_item_add_subtree(item, ett_wfd_dev_info_descr);
+ descr = proto_tree_add_subtree(tree, tvb, offset, 1 + dlen,
+ ett_wfd_dev_info_descr, &item, "WFD Device Info Descriptor");
if (offset + 1 + dlen > end || dlen < 23) {
expert_add_info(pinfo, item, &ei_wfd_subelem_session_descr_invalid);
break;
@@ -324,15 +323,14 @@ void dissect_wifi_display_ie(packet_info *pinfo, proto_tree *tree,
id = tvb_get_guint8(tvb, offset);
len = tvb_get_ntohs(tvb, offset + 1);
- subelem = proto_tree_add_text(tree, tvb, offset, 3 + len, "%s",
+ wfd_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + len,
+ ett_wfd_subelem, &subelem,
val_to_str(id, wfd_subelem_ids,
"Unknown subelement ID (%u)"));
if (offset + 3 + len > end) {
expert_add_info_format(pinfo, subelem, &ei_wfd_subelem_len_invalid, "Packet too short for Wi-Fi Display subelement payload");
}
- wfd_tree = proto_item_add_subtree(subelem, ett_wfd_subelem);
-
proto_tree_add_item(wfd_tree, hf_wfd_subelem_id, tvb, offset, 1,
ENC_BIG_ENDIAN);
offset++;
diff --git a/epan/dissectors/packet-wifi-p2p.c b/epan/dissectors/packet-wifi-p2p.c
index bf541597e0..561c4eb564 100644
--- a/epan/dissectors/packet-wifi-p2p.c
+++ b/epan/dissectors/packet-wifi-p2p.c
@@ -738,9 +738,8 @@ static void dissect_wifi_p2p_group_info(packet_info *pinfo,
}
ci_len = tvb_get_guint8(tvb, s_offset);
- item = proto_tree_add_text(tlv_root, tvb, s_offset, 1 + ci_len,
- "P2P Client Info Descriptor");
- tree = proto_item_add_subtree(item, ett_p2p_client_descr);
+ tree = proto_tree_add_subtree(tlv_root, tvb, s_offset, 1 + ci_len,
+ ett_p2p_client_descr, NULL, "P2P Client Info Descriptor");
item = proto_tree_add_item(tree, hf_p2p_attr_gi_length, tvb, s_offset,
1, ENC_BIG_ENDIAN);
@@ -896,10 +895,9 @@ void dissect_wifi_p2p_ie(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb,
stype = tvb_get_guint8(tvb, offset);
slen = tvb_get_letohs(tvb, offset + 1);
- tlv_item = proto_tree_add_text(tree, tvb, offset, 3 + slen, "%s",
+ tlv_root = proto_tree_add_subtree(tree, tvb, offset, 3 + slen, ett_p2p_tlv, &tlv_item,
val_to_str(stype, p2p_attr_types,
"Unknown attribute type (%u)"));
- tlv_root = proto_item_add_subtree(tlv_item, ett_p2p_tlv);
proto_tree_add_item(tlv_root, hf_p2p_attr_type, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_uint(tlv_root, hf_p2p_attr_len, tvb, offset + 1, 2,
@@ -1022,11 +1020,10 @@ void dissect_wifi_p2p_anqp(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb,
type = tvb_get_guint8(tvb, offset + 2);
id = tvb_get_guint8(tvb, offset + 3);
- item = proto_tree_add_text(tree, tvb, offset, 2 + len,
- "Service TLV (Transaction ID: %u Type: %s)",
+ tlv = proto_tree_add_subtree_format(tree, tvb, offset, 2 + len,
+ ett_p2p_service_tlv, &item, "Service TLV (Transaction ID: %u Type: %s)",
id, val_to_str(type, p2p_service_protocol_types,
"Unknown (%u)"));
- tlv = proto_item_add_subtree(item, ett_p2p_service_tlv);
proto_tree_add_item(tlv, hf_p2p_anqp_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
diff --git a/epan/dissectors/packet-windows-common.c b/epan/dissectors/packet-windows-common.c
index fd63f7518d..3b728dfe46 100644
--- a/epan/dissectors/packet-windows-common.c
+++ b/epan/dissectors/packet-windows-common.c
@@ -2010,27 +2010,23 @@ static const true_false_string flags_sec_info_owner = {
static int
dissect_nt_ace_object(tvbuff_t *tvb, int offset, proto_tree *parent_tree)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
- proto_item *flags_item = NULL;
- proto_tree *flags_tree = NULL;
+ proto_item *item;
+ proto_tree *tree;
+ proto_item *flags_item;
+ proto_tree *flags_tree;
guint32 flags;
int old_offset=offset;
const char *sep = " ";
- if(parent_tree){
- item = proto_tree_add_text(parent_tree, tvb, offset, 0,
- "ACE Object");
- tree = proto_item_add_subtree(item, ett_nt_ace_object);
- }
+ tree = proto_tree_add_subtree(parent_tree, tvb, offset, 0,
+ ett_nt_ace_object, &item, "ACE Object");
/* flags */
flags=tvb_get_letohl(tvb, offset);
- if(tree){
- flags_item = proto_tree_add_text(tree, tvb, offset, 4,
+ flags_item = proto_tree_add_text(tree, tvb, offset, 4,
"ACE Object Flags (0x%08x)", flags);
- flags_tree = proto_item_add_subtree(flags_item, ett_nt_ace_object_flags);
- }
+ flags_tree = proto_item_add_subtree(flags_item, ett_nt_ace_object_flags);
+
proto_tree_add_boolean(flags_tree, hf_nt_ace_flags_object_type_present,
tvb, offset, 4, flags);
APPEND_ACE_TEXT(flags&0x00000001, flags_item, "%sObject Type Present");
@@ -2116,8 +2112,8 @@ dissect_nt_v2_ace(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *parent_tree, guint8 *drep,
struct access_mask_info *ami)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
+ proto_item *item;
+ proto_tree *tree;
int old_offset = offset;
char *sid_str = NULL;
guint16 size;
@@ -2125,11 +2121,8 @@ dissect_nt_v2_ace(tvbuff_t *tvb, int offset, packet_info *pinfo,
guint8 flags;
guint32 perms = 0;
- if(parent_tree){
- item = proto_tree_add_text(parent_tree, tvb, offset, -1,
- "NT ACE: ");
- tree = proto_item_add_subtree(item, ett_nt_ace);
- }
+ tree = proto_tree_add_subtree(parent_tree, tvb, offset, -1,
+ ett_nt_ace, &item, "NT ACE: ");
/* type */
type = tvb_get_guint8(tvb, offset);
@@ -2219,8 +2212,8 @@ dissect_nt_acl(tvbuff_t *tvb, int offset_a, packet_info *pinfo,
proto_tree *parent_tree, guint8 *drep, const char *name,
struct access_mask_info *ami)
{
- proto_item *volatile item = NULL;
- proto_tree *volatile tree = NULL;
+ proto_item *item;
+ proto_tree *tree;
int old_offset = offset_a;
int pre_ace_offset;
guint16 revision;
@@ -2229,11 +2222,8 @@ dissect_nt_acl(tvbuff_t *tvb, int offset_a, packet_info *pinfo,
volatile gboolean missing_data = FALSE;
volatile gboolean bad_ace = FALSE;
- if(parent_tree) {
- item = proto_tree_add_text(parent_tree, tvb, offset_v, -1,
- "NT %s ACL", name);
- tree = proto_item_add_subtree(item, ett_nt_acl);
- }
+ tree = proto_tree_add_subtree_format(parent_tree, tvb, offset_v, -1,
+ ett_nt_acl, &item, "NT %s ACL", name);
/* revision */
/*
@@ -2485,9 +2475,8 @@ dissect_nt_sec_desc(tvbuff_t *tvb, int offset_a, packet_info *pinfo,
volatile guint32 sacl_offset;
volatile guint32 dacl_offset;
- item = proto_tree_add_text(parent_tree, tvb, offset_v, -1,
- "NT Security Descriptor");
- tree = proto_item_add_subtree(item, ett_nt_sec_desc);
+ tree = proto_tree_add_subtree(parent_tree, tvb, offset_v, -1,
+ ett_nt_sec_desc, &item, "NT Security Descriptor");
/* revision */
revision = tvb_get_letohs(tvb, offset_v);
diff --git a/epan/dissectors/packet-winsrepl.c b/epan/dissectors/packet-winsrepl.c
index b351f69996..1fcdd3c540 100644
--- a/epan/dissectors/packet-winsrepl.c
+++ b/epan/dissectors/packet-winsrepl.c
@@ -180,13 +180,10 @@ static int
dissect_winsrepl_start(tvbuff_t *winsrepl_tvb, _U_ packet_info *pinfo,
int winsrepl_offset, proto_tree *winsrepl_tree)
{
- proto_item *start_item = NULL;
- proto_tree *start_tree = NULL;
+ proto_tree *start_tree;
- if (winsrepl_tree) {
- start_item = proto_tree_add_text(winsrepl_tree, winsrepl_tvb, winsrepl_offset, -1 , "WREPL_START_ASSOCIATION");
- start_tree = proto_item_add_subtree(start_item, ett_winsrepl_start);
- }
+ start_tree = proto_tree_add_subtree(winsrepl_tree, winsrepl_tvb, winsrepl_offset, -1,
+ ett_winsrepl_start, NULL, "WREPL_START_ASSOCIATION");
/* ASSOC_CTX */
proto_tree_add_item(start_tree, hf_winsrepl_assoc_ctx, winsrepl_tvb, winsrepl_offset, 4, ENC_BIG_ENDIAN);
@@ -208,13 +205,11 @@ dissect_winsrepl_stop(tvbuff_t *winsrepl_tvb, _U_ packet_info *pinfo,
int winsrepl_offset, proto_tree *winsrepl_tree)
{
guint32 reason;
- proto_item *stop_item = NULL;
- proto_tree *stop_tree = NULL;
+ proto_item *stop_item;
+ proto_tree *stop_tree;
- if (winsrepl_tree) {
- stop_item = proto_tree_add_text(winsrepl_tree, winsrepl_tvb, winsrepl_offset, -1 , "WREPL_STOP_ASSOCIATION");
- stop_tree = proto_item_add_subtree(stop_item, ett_winsrepl_stop);
- }
+ stop_tree = proto_tree_add_subtree(winsrepl_tree, winsrepl_tvb, winsrepl_offset, -1,
+ ett_winsrepl_stop, &stop_item, "WREPL_STOP_ASSOCIATION");
/* REASON */
reason = tvb_get_ntohl(winsrepl_tvb, winsrepl_offset);
@@ -239,15 +234,14 @@ dissect_winsrepl_wins_owner(tvbuff_t *winsrepl_tvb, _U_ packet_info *pinfo,
int winsrepl_offset, proto_tree *winsrepl_tree,
proto_tree *sub_tree, guint32 idx)
{
- proto_item *owner_item = NULL;
proto_tree *owner_tree = NULL;
if (sub_tree) {
- owner_item = proto_tree_add_text(sub_tree, winsrepl_tvb, winsrepl_offset, 24 , "WINS Owner [%u]", idx);
- owner_tree = proto_item_add_subtree(owner_item, ett_winsrepl_owner);
+ owner_tree = proto_tree_add_subtree_format(sub_tree, winsrepl_tvb, winsrepl_offset, 24,
+ ett_winsrepl_owner, NULL, "WINS Owner [%u]", idx);
} else if (winsrepl_tree) {
- owner_item = proto_tree_add_text(winsrepl_tree, winsrepl_tvb, winsrepl_offset, 24 , "WINS Owner");
- owner_tree = proto_item_add_subtree(owner_item, ett_winsrepl_owner);
+ owner_tree = proto_tree_add_subtree(winsrepl_tree, winsrepl_tvb, winsrepl_offset, 24,
+ ett_winsrepl_owner, NULL, "WINS Owner");
}
/* ADDRESS */
@@ -273,15 +267,12 @@ static int
dissect_winsrepl_table_reply(tvbuff_t *winsrepl_tvb, packet_info *pinfo,
int winsrepl_offset, proto_tree *winsrepl_tree)
{
- proto_item *table_item = NULL;
- proto_tree *table_tree = NULL;
+ proto_tree *table_tree;
guint32 partner_count;
guint32 i;
- if (winsrepl_tree) {
- table_item = proto_tree_add_text(winsrepl_tree, winsrepl_tvb, winsrepl_offset, -1 , "WREPL_REPL_TABLE_REPLY");
- table_tree = proto_item_add_subtree(table_item, ett_winsrepl_table_reply);
- }
+ table_tree = proto_tree_add_subtree(winsrepl_tree, winsrepl_tvb, winsrepl_offset, -1,
+ ett_winsrepl_table_reply, NULL, "WREPL_REPL_TABLE_REPLY");
/* PARTNER COUNT */
partner_count = tvb_get_ntohl(winsrepl_tvb, winsrepl_offset);
@@ -321,11 +312,11 @@ dissect_winsrepl_wins_ip(tvbuff_t *winsrepl_tvb, _U_ packet_info *pinfo,
proto_tree *ip_tree = NULL;
if (sub_tree) {
- ip_item = proto_tree_add_text(sub_tree, winsrepl_tvb, winsrepl_offset, 8 , "WINS IP [%u]", idx);
- ip_tree = proto_item_add_subtree(ip_item, ett_winsrepl_ip);
+ ip_tree = proto_tree_add_subtree_format(sub_tree, winsrepl_tvb, winsrepl_offset, 8,
+ ett_winsrepl_ip, &ip_item, "WINS IP [%u]", idx);
} else if (winsrepl_tree) {
- ip_item = proto_tree_add_text(winsrepl_tree, winsrepl_tvb, winsrepl_offset, 8 , "WINS IP");
- ip_tree = proto_item_add_subtree(ip_item, ett_winsrepl_ip);
+ ip_tree = proto_tree_add_subtree(winsrepl_tree, winsrepl_tvb, winsrepl_offset, 8,
+ ett_winsrepl_ip, &ip_item, "WINS IP");
}
/* OWNER */
@@ -346,17 +337,15 @@ dissect_winsrepl_wins_address_list(tvbuff_t *winsrepl_tvb, packet_info *pinfo,
int winsrepl_offset, proto_tree *winsrepl_tree,
proto_item *parent_item)
{
- proto_item *addr_list_item = NULL;
- proto_tree *addr_list_tree = NULL;
+ proto_item *addr_list_item;
+ proto_tree *addr_list_tree;
int old_offset = winsrepl_offset;
guint32 num_ips;
guint32 ip;
guint32 i;
- if (winsrepl_tree) {
- addr_list_item = proto_tree_add_text(winsrepl_tree, winsrepl_tvb, winsrepl_offset, -1 , "WINS Address List");
- addr_list_tree = proto_item_add_subtree(addr_list_item, ett_winsrepl_addr_list);
- }
+ addr_list_tree = proto_tree_add_subtree(winsrepl_tree, winsrepl_tvb, winsrepl_offset, -1,
+ ett_winsrepl_addr_list, &addr_list_item, "WINS Address List");
/* NUM_IPS */
num_ips = tvb_get_letohl(winsrepl_tvb, winsrepl_offset);
@@ -399,11 +388,11 @@ dissect_winsrepl_wins_name(tvbuff_t *winsrepl_tvb, packet_info *pinfo,
guint32 addr;
if (sub_tree) {
- name_item = proto_tree_add_text(sub_tree, winsrepl_tvb, winsrepl_offset, -1 , "WINS Name [%u]", idx);
- name_tree = proto_item_add_subtree(name_item, ett_winsrepl_name);
+ name_tree = proto_tree_add_subtree_format(sub_tree, winsrepl_tvb, winsrepl_offset, -1,
+ ett_winsrepl_name, &name_item, "WINS Name [%u]", idx);
} else if (winsrepl_tree) {
- name_item = proto_tree_add_text(winsrepl_tree, winsrepl_tvb, winsrepl_offset, -1 , "WINS Name");
- name_tree = proto_item_add_subtree(name_item, ett_winsrepl_name);
+ name_tree = proto_tree_add_subtree(winsrepl_tree, winsrepl_tvb, winsrepl_offset, -1,
+ ett_winsrepl_name, &name_item, "WINS Name");
}
/* NAME_LEN */
@@ -495,15 +484,12 @@ static int
dissect_winsrepl_send_reply(tvbuff_t *winsrepl_tvb, packet_info *pinfo,
int winsrepl_offset, proto_tree *winsrepl_tree)
{
- proto_item *rep_item = NULL;
- proto_tree *rep_tree = NULL;
+ proto_tree *rep_tree;
guint32 num_names;
guint32 i;
- if (winsrepl_tree) {
- rep_item = proto_tree_add_text(winsrepl_tree, winsrepl_tvb, winsrepl_offset, -1 , "WREPL_REPL_SEND_REPLY");
- rep_tree = proto_item_add_subtree(rep_item, ett_winsrepl_send_reply);
- }
+ rep_tree = proto_tree_add_subtree(winsrepl_tree, winsrepl_tvb, winsrepl_offset, -1,
+ ett_winsrepl_send_reply, NULL, "WREPL_REPL_SEND_REPLY");
/* NUM NAMES */
num_names = tvb_get_ntohl(winsrepl_tvb, winsrepl_offset);
@@ -559,14 +545,12 @@ static int
dissect_winsrepl_replication(tvbuff_t *winsrepl_tvb, packet_info *pinfo,
int winsrepl_offset, proto_item *winsrepl_item, proto_tree *winsrepl_tree)
{
- proto_item *repl_item = NULL;
- proto_tree *repl_tree = NULL;
+ proto_item *repl_item;
+ proto_tree *repl_tree;
enum wrepl_replication_cmd command;
- if (winsrepl_tree) {
- repl_item = proto_tree_add_text(winsrepl_tree, winsrepl_tvb, winsrepl_offset, -1 , "WREPL_REPLICATION");
- repl_tree = proto_item_add_subtree(repl_item, ett_winsrepl_replication);
- }
+ repl_tree = proto_tree_add_subtree(winsrepl_tree, winsrepl_tvb, winsrepl_offset, -1,
+ ett_winsrepl_replication, &repl_item, "WREPL_REPLICATION");
/* REPLIICATION_CMD */
command = (enum wrepl_replication_cmd)tvb_get_ntohl(winsrepl_tvb, winsrepl_offset);
diff --git a/epan/dissectors/packet-wol.c b/epan/dissectors/packet-wol.c
index 046a301206..ca66821f0e 100644
--- a/epan/dissectors/packet-wol.c
+++ b/epan/dissectors/packet-wol.c
@@ -85,7 +85,6 @@ dissect_wol_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
/* Set up structures needed to add the protocol subtree and manage it */
proto_item *ti;
- proto_item *mti;
proto_tree *wol_tree;
proto_tree *mac_tree;
@@ -239,9 +238,9 @@ dissect_wol_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
proto_tree_add_item(wol_tree, hf_wol_sync, tvb, 0, 6, ENC_NA);
/* Continue adding tree items to process the packet here */
- mti = proto_tree_add_text(wol_tree, tvb, 6, 96, "MAC: %s (%s)",
+ mac_tree = proto_tree_add_subtree_format(wol_tree, tvb, 6, 96,
+ ett_wol_macblock, NULL, "MAC: %s (%s)",
get_ether_name(mac), ether_to_str(mac));
- mac_tree = proto_item_add_subtree(mti, ett_wol_macblock);
for ( offset = 6; offset < 102; offset += 6 )
proto_tree_add_ether(mac_tree, hf_wol_mac, tvb, offset, 6, mac);
diff --git a/epan/dissectors/packet-wow.c b/epan/dissectors/packet-wow.c
index f6006d29e4..1c3550446c 100644
--- a/epan/dissectors/packet-wow.c
+++ b/epan/dissectors/packet-wow.c
@@ -358,12 +358,11 @@ dissect_wow_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
offset + 3,
&len, ENC_ASCII);
- ti = proto_tree_add_text(wow_tree, tvb,
+ wow_realms_tree = proto_tree_add_subtree(wow_tree, tvb,
offset, 0,
- "%s",
+ ett_wow_realms, NULL,
realm_name);
- wow_realms_tree = proto_item_add_subtree(ti, ett_wow_realms);
proto_tree_add_item(wow_realms_tree, hf_wow_realm_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
diff --git a/epan/dissectors/packet-wps.c b/epan/dissectors/packet-wps.c
index b48fdf3250..ddbba5929c 100644
--- a/epan/dissectors/packet-wps.c
+++ b/epan/dissectors/packet-wps.c
@@ -802,10 +802,8 @@ add_wps_wfa_ext(guint8 id, proto_tree *tree, tvbuff_t *tvb,
proto_tree *elem;
guint8 val8;
- item = proto_tree_add_text(tree, tvb, offset - 2, 2 + size, "%s",
- val_to_str(id, eapwps_wfa_ext_types,
- "Unknown (%u)"));
- elem = proto_item_add_subtree(item, ett_wps_wfa_ext);
+ elem = proto_tree_add_subtree(tree, tvb, offset - 2, 2 + size, ett_wps_wfa_ext, &item,
+ val_to_str(id, eapwps_wfa_ext_types, "Unknown (%u)"));
proto_tree_add_item(elem, hf_eapwps_wfa_ext_id, tvb, offset - 2, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(elem, hf_eapwps_wfa_ext_len, tvb, offset - 1, 1, ENC_BIG_ENDIAN);
@@ -904,16 +902,14 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset,
break;
}
- tlv_item = NULL;
- tlv_root = NULL;
tmp_item = NULL;
tlv_type = tvb_get_ntohs(tvb, offset);
tlv_len = tvb_get_ntohs(tvb, offset+2);
/* TOP Node for each TLV-item */
- tlv_item = proto_tree_add_text(eap_tree, tvb, offset, tlv_len+4, "Unknown Type (0x%04x)", tlv_type);
- tlv_root = proto_item_add_subtree(tlv_item, ett_wps_tlv);
+ tlv_root = proto_tree_add_subtree_format(eap_tree, tvb, offset, tlv_len+4,
+ ett_wps_tlv, &tlv_item, "Unknown Type (0x%04x)", tlv_type);
/* analog to Tagged parameters in 802.11 */
proto_tree_add_item(tlv_root, hf_eapwps_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
diff --git a/epan/dissectors/packet-wsmp.c b/epan/dissectors/packet-wsmp.c
index a68988eeb1..c038ff0772 100644
--- a/epan/dissectors/packet-wsmp.c
+++ b/epan/dissectors/packet-wsmp.c
@@ -90,7 +90,7 @@ static void
dissect_wsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
/* Set up structures needed to add the protocol subtree and manage it */
- proto_item *ti, *wsmdata_item;
+ proto_item *ti;
proto_tree *wsmp_tree, *wsmdata_tree;
tvbuff_t *wsmdata_tvb;
guint16 wsmlength, offset;
@@ -191,9 +191,8 @@ dissect_wsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += supLen;
}
- wsmdata_item = proto_tree_add_text (wsmp_tree, tvb, offset, wsmlength,
- "Wave Short Message");
- wsmdata_tree = proto_item_add_subtree(wsmdata_item, ett_wsmdata);
+ wsmdata_tree = proto_tree_add_subtree(wsmp_tree, tvb, offset, wsmlength,
+ ett_wsmdata, NULL, "Wave Short Message");
wsmdata_tvb = tvb_new_subset(tvb, offset, -1, wsmlength);
diff --git a/epan/dissectors/packet-wsp.c b/epan/dissectors/packet-wsp.c
index 2c2fef9107..38c0642e2d 100644
--- a/epan/dissectors/packet-wsp.c
+++ b/epan/dissectors/packet-wsp.c
@@ -5872,9 +5872,8 @@ add_multipart_data (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo)
offset += count;
if (nEntries)
{
- ti = proto_tree_add_text(tree, tvb, offset - count, 0,
- "Multipart body");
- sub_tree = proto_item_add_subtree(ti, ett_mpartlist);
+ sub_tree = proto_tree_add_subtree(tree, tvb, offset - count, 0,
+ ett_mpartlist, NULL, "Multipart body");
}
while (nEntries--)
{
@@ -5886,12 +5885,12 @@ add_multipart_data (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo)
offset += count;
DataLen = tvb_get_guintvar (tvb, offset, &count);
offset += count;
- if (tree) {
- tvb_ensure_bytes_exist(tvb, part_start, HeadersLen + DataLen + (offset - part_start));
- ti = proto_tree_add_uint(sub_tree, hf_wsp_mpart, tvb, part_start,
+
+ tvb_ensure_bytes_exist(tvb, part_start, HeadersLen + DataLen + (offset - part_start));
+ ti = proto_tree_add_uint(sub_tree, hf_wsp_mpart, tvb, part_start,
HeadersLen + DataLen + (offset - part_start), partnr);
- mpart_tree = proto_item_add_subtree(ti, ett_multiparts);
- }
+ mpart_tree = proto_item_add_subtree(ti, ett_multiparts);
+
nextOffset = add_content_type (mpart_tree, tvb, offset,
&contentType, &contentTypeStr);