aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-canopen.c
diff options
context:
space:
mode:
authorEnrico Jorns <ejo@pengutronix.de>2014-11-25 10:08:05 +0100
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2014-11-25 11:19:15 +0000
commitb01ff09eb9e7550aa77e397178007333f94935b4 (patch)
treeb50cf8c5f66caa60366cc41077d6491d31f34584 /epan/dissectors/packet-canopen.c
parentc39776c9470ba82ad7511c19cd565f1952649ca4 (diff)
canopen: Fixed tree expansion
Previously the COB-ID and Type subtree also used the main ett_canopen variable. This made control of subtree expansion impossible as both parent and subtree nodes shared the same state. Change-Id: I3dabf7f399e83bfcfbf78bc0e633e3696776c043 Reviewed-on: https://code.wireshark.org/review/5480 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-canopen.c')
-rw-r--r--epan/dissectors/packet-canopen.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/epan/dissectors/packet-canopen.c b/epan/dissectors/packet-canopen.c
index 951bfcf928..d8d7de3fba 100644
--- a/epan/dissectors/packet-canopen.c
+++ b/epan/dissectors/packet-canopen.c
@@ -52,6 +52,8 @@ static int hf_canopen_time_stamp_days = -1;
/* Initialize the subtree pointers */
static gint ett_canopen = -1;
+static gint ett_canopen_cob = -1;
+static gint ett_canopen_type = -1;
/* broadcast messages */
#define FC_NMT 0x0
@@ -240,7 +242,7 @@ dissect_canopen(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
/* add COB-ID with function code and node id */
cob_ti = proto_tree_add_uint(canopen_tree, hf_canopen_cob_id, tvb, 0, 0, can_id.id);
- canopen_cob_tree = proto_item_add_subtree(cob_ti, ett_canopen);
+ canopen_cob_tree = proto_item_add_subtree(cob_ti, ett_canopen_cob);
/* add function code */
ti = proto_tree_add_uint(canopen_cob_tree, hf_canopen_function_code, tvb, 0, 0, can_id.id);
@@ -254,7 +256,7 @@ dissect_canopen(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
canopen_type_tree = proto_tree_add_subtree_format(canopen_tree, tvb, 0,
(msg_type_id == MT_SYNC) || (msg_type_id == MT_NMT_ERR_CTRL) ? 0 : -1,
- ett_canopen, NULL, "Type: %s", function_code_str);
+ ett_canopen_type, NULL, "Type: %s", function_code_str);
switch(msg_type_id)
{
case MT_NMT_CTRL:
@@ -435,7 +437,9 @@ proto_register_canopen(void)
};
static gint *ett[] = {
- &ett_canopen
+ &ett_canopen,
+ &ett_canopen_cob,
+ &ett_canopen_type
};
proto_canopen = proto_register_protocol("CANopen",