aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-10-24 23:40:58 +0000
committerMichael Mann <mmann78@netscape.net>2013-10-24 23:40:58 +0000
commite83fe18fcc80b5f2b08a9e9e4f156c6458f28ab0 (patch)
treeb2d543925a27940824386ac4467aee730bfe3da1
parent6131c003587f2259a99d38e3c02d9a9ed1850cd7 (diff)
Have ZigBee dissectors pass data through subdissector parameter instead of using struct _packet_info.
svn path=/trunk/; revision=52827
-rw-r--r--epan/dissectors/packet-zbee-aps.c111
-rw-r--r--epan/dissectors/packet-zbee-aps.h1
-rw-r--r--epan/dissectors/packet-zbee-nwk.c55
-rw-r--r--epan/dissectors/packet-zbee-nwk.h6
-rw-r--r--epan/dissectors/packet-zbee-zcl-general.c66
-rw-r--r--epan/dissectors/packet-zbee-zcl-ha.c20
-rw-r--r--epan/dissectors/packet-zbee-zcl-se.c10
-rw-r--r--epan/dissectors/packet-zbee-zcl.c17
-rw-r--r--epan/dissectors/packet-zbee-zdp-binding.c50
-rw-r--r--epan/dissectors/packet-zbee-zdp-discovery.c32
-rw-r--r--epan/dissectors/packet-zbee-zdp-management.c38
-rw-r--r--epan/dissectors/packet-zbee-zdp.c102
-rw-r--r--epan/dissectors/packet-zbee-zdp.h4
-rw-r--r--epan/packet_info.h6
14 files changed, 254 insertions, 264 deletions
diff --git a/epan/dissectors/packet-zbee-aps.c b/epan/dissectors/packet-zbee-aps.c
index a31874b1a0..e45dc68319 100644
--- a/epan/dissectors/packet-zbee-aps.c
+++ b/epan/dissectors/packet-zbee-aps.c
@@ -45,15 +45,13 @@
*************************
*/
/* Dissector Routines */
-static void dissect_zbee_aps (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-static void dissect_zbee_aps_cmd (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-static void dissect_zbee_apf (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+static void dissect_zbee_aps_cmd (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version);
/* Command Dissector Helpers */
static guint dissect_zbee_aps_skke_challenge (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset);
static guint dissect_zbee_aps_skke_data (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset);
static guint dissect_zbee_aps_transport_key (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset);
-static guint dissect_zbee_aps_update_device (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset);
+static guint dissect_zbee_aps_update_device (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, guint8 version);
static guint dissect_zbee_aps_remove_device (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset);
static guint dissect_zbee_aps_request_key (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset);
static guint dissect_zbee_aps_switch_key (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset);
@@ -597,19 +595,19 @@ const value_string zbee_aps_cid_names[] = {
* void
*---------------------------------------------------------------
*/
-static void
-dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tvbuff_t *payload_tvb = NULL;
dissector_handle_t profile_handle = NULL;
- proto_tree *aps_tree = NULL;
+ proto_tree *aps_tree;
proto_tree *field_tree = NULL;
- proto_item *proto_root = NULL;
+ proto_item *proto_root;
proto_item *ti;
zbee_aps_packet packet;
- zbee_nwk_packet *nwk = (zbee_nwk_packet *)pinfo->private_data;
+ zbee_nwk_packet *nwk = (zbee_nwk_packet *)data;
guint8 fcf;
guint8 offset = 0;
@@ -618,10 +616,9 @@ dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
memset(&packet, 0, sizeof(zbee_aps_packet));
/* Create the protocol tree */
- if(tree){
- proto_root = proto_tree_add_protocol_format(tree, proto_zbee_aps, tvb, offset, tvb_length(tvb), "ZigBee Application Support Layer");
- aps_tree = proto_item_add_subtree(proto_root, ett_zbee_aps);
- }
+ proto_root = proto_tree_add_protocol_format(tree, proto_zbee_aps, tvb, offset, tvb_length(tvb), "ZigBee Application Support Layer");
+ aps_tree = proto_item_add_subtree(proto_root, ett_zbee_aps);
+
/* Set the protocol column, if the NWK layer hasn't already done so. */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ZigBee");
@@ -654,7 +651,7 @@ dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_uint(field_tree, hf_zbee_aps_fcf_frame_type, tvb, offset, 1, fcf & ZBEE_APS_FCF_FRAME_TYPE);
proto_tree_add_uint(field_tree, hf_zbee_aps_fcf_delivery, tvb, offset, 1, fcf & ZBEE_APS_FCF_DELIVERY_MODE);
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (nwk->version >= ZBEE_VERSION_2007) {
/* ZigBee 2007 and later uses an ack mode flag. */
if (packet.type == ZBEE_APS_FCF_ACK) {
proto_tree_add_boolean(field_tree, hf_zbee_aps_fcf_ack_format, tvb, offset, 1,
@@ -683,7 +680,7 @@ dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
case ZBEE_APS_FCF_ACK:
- if ((pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) && (packet.ack_format)) {
+ if ((nwk->version >= ZBEE_VERSION_2007) && (packet.ack_format)) {
/* Command Ack: endpoint addressing does not exist. */
goto dissect_zbee_aps_no_endpt;
}
@@ -706,7 +703,7 @@ dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
packet.dst_present = TRUE;
packet.src_present = TRUE;
}
- else if ((packet.delivery == ZBEE_APS_FCF_INDIRECT) && (pinfo->zbee_stack_vers <= ZBEE_VERSION_2004)) {
+ else if ((packet.delivery == ZBEE_APS_FCF_INDIRECT) && (nwk->version <= ZBEE_VERSION_2004)) {
/* Indirect addressing was removed in ZigBee 2006, basically because it
* was a useless, broken feature which only complicated things. Treat
* this mode as invalid for ZigBee 2006 and later. When using indirect
@@ -716,7 +713,7 @@ dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
packet.dst_present = (!packet.indirect_mode);
packet.src_present = (packet.indirect_mode);
}
- else if ((packet.delivery == ZBEE_APS_FCF_GROUP) && (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)) {
+ else if ((packet.delivery == ZBEE_APS_FCF_GROUP) && (nwk->version >= ZBEE_VERSION_2007)) {
/* Group addressing was added in ZigBee 2006, and contains only the
* source endpoint. (IMO, Broacast deliveries should do the same).
*/
@@ -726,7 +723,7 @@ dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
else {
/* Illegal Delivery Mode. */
expert_add_info(pinfo, proto_root, &ei_zbee_aps_invalid_delivery_mode);
- return;
+ return tvb_length(tvb);
}
@@ -757,21 +754,17 @@ dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
/* Get and display the cluster ID. */
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (nwk->version >= ZBEE_VERSION_2007) {
/* Cluster ID is 16-bits long in ZigBee 2007 and later. */
- pinfo->zbee_cluster_id = packet.cluster = tvb_get_letohs(tvb, offset);
- if (tree) {
- proto_tree_add_uint(aps_tree, hf_zbee_aps_cluster, tvb, offset,2, packet.cluster);
- }
+ nwk->cluster_id = tvb_get_letohs(tvb, offset);
+ proto_tree_add_item(aps_tree, hf_zbee_aps_cluster, tvb, offset,2, ENC_LITTLE_ENDIAN);
offset +=2;
}
else {
/* Cluster ID is 8-bits long in ZigBee 2004 and earlier. */
- pinfo->zbee_cluster_id = packet.cluster = tvb_get_guint8(tvb, offset);
- if (tree) {
- proto_tree_add_uint_format_value(aps_tree, hf_zbee_aps_cluster, tvb, offset,
- 1, packet.cluster, "0x%02x", packet.cluster);
- }
+ nwk->cluster_id = tvb_get_guint8(tvb, offset);
+ proto_tree_add_uint_format_value(aps_tree, hf_zbee_aps_cluster, tvb, offset,
+ 1, nwk->cluster_id, "0x%02x", nwk->cluster_id);
offset += 1;
}
@@ -810,7 +803,7 @@ dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_zbee_aps_no_endpt:
/* Get and display the APS counter. Only present on ZigBee 2007 and later. */
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (nwk->version >= ZBEE_VERSION_2007) {
packet.counter = tvb_get_guint8(tvb, offset);
if (tree) {
proto_tree_add_uint(aps_tree, hf_zbee_aps_counter, tvb, offset, 1, packet.counter);
@@ -871,7 +864,7 @@ dissect_zbee_aps_no_endpt:
payload_tvb = dissect_zbee_secure(tvb, pinfo, aps_tree, offset);
if (payload_tvb == NULL) {
/* If Payload_tvb is NULL, then the security dissector cleaned up. */
- return;
+ return tvb_length(tvb);
}
}
/* If the payload exists, create a tvb subset. */
@@ -926,7 +919,7 @@ dissect_zbee_aps_no_endpt:
else {
/* The reassembly handler could not defragment the message. */
call_dissector(data_handle, payload_tvb, pinfo, tree);
- return;
+ return tvb_length(tvb);
}
}
@@ -936,30 +929,30 @@ dissect_zbee_aps_no_endpt:
if (!payload_tvb) {
break;
}
- if (pinfo->zbee_stack_vers <= ZBEE_VERSION_2004) {
+ if (nwk->version <= ZBEE_VERSION_2004) {
/*
* In ZigBee 2004, an "application framework" sits between the
* APS and application. Call a subdissector to handle it.
*/
- pinfo->private_data = profile_handle;
+ nwk->private_data = profile_handle;
profile_handle = zbee_apf_handle;
}
else if (profile_handle == NULL) {
/* Could not locate a profile dissector. */
break;
}
- call_dissector(profile_handle, payload_tvb, pinfo, tree);
- return;
+ call_dissector_with_data(profile_handle, payload_tvb, pinfo, tree, nwk);
+ return tvb_length(tvb);
case ZBEE_APS_FCF_CMD:
if (!payload_tvb) {
/* Command packets MUST contain a payload. */
expert_add_info(pinfo, proto_root, &ei_zbee_aps_missing_payload);
THROW(BoundsError);
- return;
+ return tvb_length(tvb);
}
- dissect_zbee_aps_cmd(payload_tvb, pinfo, aps_tree);
- return;
+ dissect_zbee_aps_cmd(payload_tvb, pinfo, aps_tree, nwk->version);
+ return tvb_length(tvb);
case ZBEE_APS_FCF_ACK:
/* Acks should never contain a payload. */
@@ -976,6 +969,8 @@ dissect_zbee_aps_no_endpt:
if (payload_tvb) {
call_dissector(data_handle, payload_tvb, pinfo, tree);
}
+
+ return tvb_length(tvb);
} /* dissect_zbee_aps */
/*FUNCTION:------------------------------------------------------
@@ -992,7 +987,7 @@ dissect_zbee_aps_no_endpt:
* void
*---------------------------------------------------------------
*/
-static void dissect_zbee_aps_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static void dissect_zbee_aps_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{
proto_item *cmd_root = NULL;
proto_tree *cmd_tree = NULL;
@@ -1032,7 +1027,7 @@ static void dissect_zbee_aps_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
case ZBEE_APS_CMD_UPDATE_DEVICE:
/* Update Device Command. */
- offset = dissect_zbee_aps_update_device(tvb, pinfo, cmd_tree, offset);
+ offset = dissect_zbee_aps_update_device(tvb, pinfo, cmd_tree, offset, version);
break;
case ZBEE_APS_CMD_REMOVE_DEVICE:
@@ -1334,31 +1329,20 @@ dissect_zbee_aps_transport_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree
*---------------------------------------------------------------
*/
static guint
-dissect_zbee_aps_update_device(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
+dissect_zbee_aps_update_device(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, guint8 version)
{
- guint16 short_addr;
- guint8 status;
-
/* Get and display the device address. */
- if (tree) {
- proto_tree_add_item(tree, hf_zbee_aps_cmd_device, tvb, offset, 8, ENC_LITTLE_ENDIAN);
- }
+ proto_tree_add_item(tree, hf_zbee_aps_cmd_device, tvb, offset, 8, ENC_LITTLE_ENDIAN);
offset += 8;
/* Get and display the short address. Only on ZigBee 2006 and later. */
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
- short_addr = tvb_get_letohs(tvb, offset);
- if (tree) {
- proto_tree_add_uint(tree, hf_zbee_aps_cmd_short_addr, tvb, offset, 2, short_addr);
- }
+ if (version >= ZBEE_VERSION_2007) {
+ proto_tree_add_item(tree, hf_zbee_aps_cmd_short_addr, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset +=2;
}
/* Get and display the status. */
- status = tvb_get_guint8(tvb, offset);
- if (tree) {
- proto_tree_add_uint(tree, hf_zbee_aps_cmd_device_status, tvb, offset, 1, status);
- }
+ proto_tree_add_item(tree, hf_zbee_aps_cmd_device_status, tvb, offset, 1, ENC_NA);
offset += 1;
/* Done */
@@ -1620,7 +1604,7 @@ dissect_zbee_aps_tunnel(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
* void
*---------------------------------------------------------------
*/
-static void dissect_zbee_apf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_zbee_apf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
proto_tree *apf_tree = NULL;
proto_item *proto_root;
@@ -1631,8 +1615,11 @@ static void dissect_zbee_apf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
guint i;
tvbuff_t *app_tvb;
+ dissector_handle_t app_dissector = NULL;
+ zbee_nwk_packet *nwk = (zbee_nwk_packet *)data;
- dissector_handle_t app_dissector = (dissector_handle_t)(pinfo->private_data);
+ if (nwk != NULL)
+ app_dissector = (dissector_handle_t)(nwk->private_data);
/* Create the tree for the application framework. */
if (tree) {
@@ -1665,7 +1652,7 @@ static void dissect_zbee_apf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
app_tvb = tvb_new_subset(tvb, offset, length, length);
/* Call the application dissector. */
- call_dissector(app_dissector, app_tvb, pinfo, tree);
+ call_dissector_with_data(app_dissector, app_tvb, pinfo, tree, data);
/* Adjust the offset. */
offset += length;
@@ -1677,6 +1664,8 @@ dissect_app_end:
app_tvb = tvb_new_subset_remaining(tvb, offset);
call_dissector(data_handle, app_tvb, pinfo, tree);
}
+
+ return tvb_length(tvb);
} /* dissect_zbee_apf */
/*FUNCTION:------------------------------------------------------
@@ -1994,7 +1983,7 @@ void proto_register_zbee_aps(void)
/* Register the APS dissector and subdissector list. */
zbee_aps_dissector_table = register_dissector_table("zbee.profile", "ZigBee Profile ID", FT_UINT16, BASE_HEX);
- zbee_aps_handle = register_dissector(ZBEE_PROTOABBREV_APS, dissect_zbee_aps, proto_zbee_aps);
+ zbee_aps_handle = new_register_dissector(ZBEE_PROTOABBREV_APS, dissect_zbee_aps, proto_zbee_aps);
/* Register the init routine. */
register_init_routine(proto_init_zbee_aps);
@@ -2005,7 +1994,7 @@ void proto_register_zbee_aps(void)
proto_register_subtree_array(ett_apf, array_length(ett_apf));
/* Register the App dissector. */
- zbee_apf_handle = register_dissector(ZBEE_PROTOABBREV_APF, dissect_zbee_apf, proto_zbee_apf);
+ zbee_apf_handle = new_register_dissector(ZBEE_PROTOABBREV_APF, dissect_zbee_apf, proto_zbee_apf);
} /* proto_register_zbee_aps */
/*FUNCTION:------------------------------------------------------
diff --git a/epan/dissectors/packet-zbee-aps.h b/epan/dissectors/packet-zbee-aps.h
index ae6f448975..daf1353393 100644
--- a/epan/dissectors/packet-zbee-aps.h
+++ b/epan/dissectors/packet-zbee-aps.h
@@ -229,7 +229,6 @@ typedef struct{
guint8 dst;
guint16 group; /* ZigBee 2006 and Later */
- guint16 cluster;
guint16 profile;
guint8 src;
guint8 counter;
diff --git a/epan/dissectors/packet-zbee-nwk.c b/epan/dissectors/packet-zbee-nwk.c
index e6826983be..5a0944423e 100644
--- a/epan/dissectors/packet-zbee-nwk.c
+++ b/epan/dissectors/packet-zbee-nwk.c
@@ -47,13 +47,13 @@
/*************************/
/* Dissector Routines */
static void dissect_zbee_nwk (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-static void dissect_zbee_nwk_cmd (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+static void dissect_zbee_nwk_cmd (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, zbee_nwk_packet* packet);
static void dissect_zbee_beacon (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
/* Command Dissector Helpers */
static guint dissect_zbee_nwk_route_req (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
zbee_nwk_packet * packet, guint offset);
-static guint dissect_zbee_nwk_route_rep (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset);
+static guint dissect_zbee_nwk_route_rep (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, guint8 version);
static guint dissect_zbee_nwk_status (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset);
static guint dissect_zbee_nwk_leave (tvbuff_t *tvb, proto_tree *tree, guint offset);
static guint dissect_zbee_nwk_route_rec (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
@@ -399,7 +399,6 @@ dissect_zbee_nwk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
packet.route = zbee_get_bit_field(fcf, ZBEE_NWK_FCF_SOURCE_ROUTE);
packet.ext_dst = zbee_get_bit_field(fcf, ZBEE_NWK_FCF_EXT_DEST);
packet.ext_src = zbee_get_bit_field(fcf, ZBEE_NWK_FCF_EXT_SOURCE);
- pinfo->zbee_stack_vers = packet.version;
/* Display the FCF. */
if (tree) {
@@ -415,13 +414,13 @@ dissect_zbee_nwk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
fcf & ZBEE_NWK_FCF_VERSION);
proto_tree_add_uint(field_tree, hf_zbee_nwk_discover_route, tvb, offset, 1,
fcf & ZBEE_NWK_FCF_DISCOVER_ROUTE);
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (packet.version >= ZBEE_VERSION_2007) {
proto_tree_add_boolean(field_tree, hf_zbee_nwk_multicast, tvb, offset+1,
1, fcf & ZBEE_NWK_FCF_MULTICAST);
}
proto_tree_add_boolean(field_tree, hf_zbee_nwk_security, tvb, offset+1,
1, fcf & ZBEE_NWK_FCF_SECURITY);
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (packet.version >= ZBEE_VERSION_2007) {
proto_tree_add_boolean(field_tree, hf_zbee_nwk_source_route, tvb, offset+1,
1, fcf & ZBEE_NWK_FCF_SOURCE_ROUTE);
proto_tree_add_boolean(field_tree, hf_zbee_nwk_ext_dst, tvb, offset+1,
@@ -440,9 +439,8 @@ dissect_zbee_nwk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Get the destination address. */
packet.dst = tvb_get_letohs(tvb, offset);
- if (tree) {
- proto_tree_add_uint(nwk_tree, hf_zbee_nwk_dst, tvb, offset, 2, packet.dst);
- }
+ proto_tree_add_uint(nwk_tree, hf_zbee_nwk_dst, tvb, offset, 2, packet.dst);
+
offset += 2;
/* Display the destination address. */
@@ -508,7 +506,7 @@ dissect_zbee_nwk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += 1;
/* Add Multicast control field. (ZigBee 2006 and later). */
- if ((pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) && packet.multicast) {
+ if ((packet.version >= ZBEE_VERSION_2007) && packet.multicast) {
guint8 mcast_control = tvb_get_guint8(tvb, offset);
packet.mcast_mode = zbee_get_bit_field(mcast_control, ZBEE_NWK_MCAST_MODE);
@@ -530,7 +528,7 @@ dissect_zbee_nwk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
/* Add the extended destination address (ZigBee 2006 and later). */
- if ((pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) && packet.ext_dst) {
+ if ((packet.version >= ZBEE_VERSION_2007) && packet.ext_dst) {
packet.dst64 = tvb_get_letoh64(tvb, offset);
if (tree) {
proto_tree_add_item(nwk_tree, hf_zbee_nwk_dst64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
@@ -539,7 +537,7 @@ dissect_zbee_nwk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
/* Display the extended source address. (ZigBee 2006 and later). */
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (packet.version >= ZBEE_VERSION_2007) {
addr16.pan = ieee_packet->src_pan;
if (packet.ext_src) {
@@ -613,7 +611,7 @@ dissect_zbee_nwk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} /* (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) */
/* Add the Source Route field. (ZigBee 2006 and later). */
- if ((pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) && packet.route) {
+ if ((packet.version >= ZBEE_VERSION_2007) && packet.route) {
guint8 relay_count;
guint8 relay_index;
guint16 relay_addr;
@@ -640,9 +638,8 @@ dissect_zbee_nwk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Get and display the relay index. */
relay_index = tvb_get_guint8(tvb, offset);
- if (tree) {
- proto_tree_add_uint(field_tree, hf_zbee_nwk_relay_index, tvb, offset, 1, relay_index);
- }
+ proto_tree_add_uint(field_tree, hf_zbee_nwk_relay_index, tvb, offset, 1, relay_index);
+
offset += 1;
/* Get and display the relay list. */
@@ -656,16 +653,6 @@ dissect_zbee_nwk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
/*
- * Link the packet structure into the private data pointer so the
- * APS layer can retrieve the network source address.
- *
- * BUGBUG: Ideally, the APS layer could just pull this out of the
- * pinfo structure. But there is no suitable address type to use
- * for ZigBee's 16-bit short address.
- */
- pinfo->private_data = (void *)&packet;
-
- /*
* Ensure that the payload exists. There are no valid ZigBee network
* packets that have no payload.
*/
@@ -689,11 +676,11 @@ dissect_zbee_nwk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (packet.type == ZBEE_NWK_FCF_CMD) {
/* Dissect the Network Command. */
- dissect_zbee_nwk_cmd(payload_tvb, pinfo, nwk_tree);
+ dissect_zbee_nwk_cmd(payload_tvb, pinfo, nwk_tree, &packet);
}
else if (packet.type == ZBEE_NWK_FCF_DATA) {
/* Dissect the Network Payload (APS layer). */
- call_dissector(aps_handle, payload_tvb, pinfo, tree);
+ call_dissector_with_data(aps_handle, payload_tvb, pinfo, tree, &packet);
}
else {
/* Invalid type. */
@@ -716,13 +703,11 @@ dissect_zbee_nwk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* void
*---------------------------------------------------------------
*/
-static void dissect_zbee_nwk_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static void dissect_zbee_nwk_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, zbee_nwk_packet* packet)
{
proto_tree *cmd_tree = NULL;
proto_item *cmd_root = NULL;
- zbee_nwk_packet *packet = (zbee_nwk_packet *)pinfo->private_data;
-
guint offset=0;
guint8 cmd_id = tvb_get_guint8(tvb, offset);
@@ -750,7 +735,7 @@ static void dissect_zbee_nwk_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
case ZBEE_NWK_CMD_ROUTE_REPLY:
/* Route Reply Command. */
- offset = dissect_zbee_nwk_route_rep(tvb, pinfo, cmd_tree, offset);
+ offset = dissect_zbee_nwk_route_rep(tvb, pinfo, cmd_tree, offset, packet->version);
break;
case ZBEE_NWK_CMD_NWK_STATUS:
@@ -849,7 +834,7 @@ dissect_zbee_nwk_route_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
ti = proto_tree_add_text(tree, tvb, offset, 1, "Command Options (0x%02x)", route_options);
field_tree = proto_item_add_subtree(ti, ett_zbee_nwk_cmd_options);
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (packet->version >= ZBEE_VERSION_2007) {
proto_tree_add_boolean(field_tree, hf_zbee_nwk_cmd_route_opt_multicast, tvb, offset,
1, route_options & ZBEE_NWK_CMD_ROUTE_OPTION_MCAST);
proto_tree_add_boolean(field_tree, hf_zbee_nwk_cmd_route_opt_dest_ext, tvb, offset,
@@ -915,7 +900,7 @@ dissect_zbee_nwk_route_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
*---------------------------------------------------------------
*/
static guint
-dissect_zbee_nwk_route_rep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
+dissect_zbee_nwk_route_rep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, guint8 version)
{
proto_tree *field_tree;
proto_item *ti;
@@ -933,7 +918,7 @@ dissect_zbee_nwk_route_rep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
ti = proto_tree_add_text(tree, tvb, offset, 1, "Command Options (0x%02x)", route_options);
field_tree = proto_item_add_subtree(ti, ett_zbee_nwk_cmd_options);
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (version >= ZBEE_VERSION_2007) {
proto_tree_add_boolean(field_tree, hf_zbee_nwk_cmd_route_opt_multicast, tvb, offset, 1, route_options & ZBEE_NWK_CMD_ROUTE_OPTION_MCAST);
proto_tree_add_boolean(field_tree, hf_zbee_nwk_cmd_route_opt_resp_ext, tvb, offset, 1, route_options & ZBEE_NWK_CMD_ROUTE_OPTION_RESP_EXT);
proto_tree_add_boolean(field_tree, hf_zbee_nwk_cmd_route_opt_orig_ext, tvb, offset, 1, route_options & ZBEE_NWK_CMD_ROUTE_OPTION_ORIG_EXT);
@@ -1437,7 +1422,7 @@ static void dissect_zbee_beacon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
/* Get and display the stack profile and protocol version. */
temp = tvb_get_guint8(tvb, offset);
- pinfo->zbee_stack_vers = version = zbee_get_bit_field(temp, ZBEE_NWK_BEACON_PROTOCOL_VERSION);
+ version = zbee_get_bit_field(temp, ZBEE_NWK_BEACON_PROTOCOL_VERSION);
if (tree) {
proto_tree_add_uint(beacon_tree, hf_zbee_beacon_stack_profile, tvb, offset, 1,
zbee_get_bit_field(temp, ZBEE_NWK_BEACON_STACK_PROFILE));
diff --git a/epan/dissectors/packet-zbee-nwk.h b/epan/dissectors/packet-zbee-nwk.h
index afd59d2294..db08efd5d2 100644
--- a/epan/dissectors/packet-zbee-nwk.h
+++ b/epan/dissectors/packet-zbee-nwk.h
@@ -147,6 +147,12 @@ typedef struct{
guint8 payload_offset;
guint8 payload_len;
+
+ guint16 cluster_id; /* an application-specific message identifier that
+ * happens to be included in the transport (APS) layer header.
+ */
+
+ void *private_data; /* For ZigBee (sub)dissector specific data */
} zbee_nwk_packet;
/* Key used for link key hash table. */
diff --git a/epan/dissectors/packet-zbee-zcl-general.c b/epan/dissectors/packet-zbee-zcl-general.c
index e304830d54..6f3f65ff43 100644
--- a/epan/dissectors/packet-zbee-zcl-general.c
+++ b/epan/dissectors/packet-zbee-zcl-general.c
@@ -182,10 +182,10 @@ static const value_string zbee_zcl_basic_dev_en_names[] = {
* none
*---------------------------------------------------------------
*/
-static void
-dissect_zbee_zcl_basic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_zbee_zcl_basic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- zbee_zcl_packet *zcl = (zbee_zcl_packet *)pinfo->private_data;
+ zbee_zcl_packet *zcl = (zbee_zcl_packet *)data;
guint offset = 0;
guint8 cmd_id = zcl->cmd_id;
@@ -213,6 +213,8 @@ dissect_zbee_zcl_basic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
}
+
+ return tvb_length(tvb);
} /*dissect_zbee_zcl_basic*/
@@ -387,7 +389,7 @@ proto_register_zbee_zcl_basic(void)
proto_register_subtree_array(ett, array_length(ett));
/* Register the ZigBee ZCL Basic dissector. */
- register_dissector(ZBEE_PROTOABBREV_ZCL_BASIC, dissect_zbee_zcl_basic, proto_zbee_zcl_basic);
+ new_register_dissector(ZBEE_PROTOABBREV_ZCL_BASIC, dissect_zbee_zcl_basic, proto_zbee_zcl_basic);
} /*proto_register_zbee_zcl_basic*/
/*FUNCTION:------------------------------------------------------
@@ -503,12 +505,12 @@ static const value_string zbee_zcl_identify_srv_tx_cmd_names[] = {
* none
*---------------------------------------------------------------
*/
-static void
-dissect_zbee_zcl_identify(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_zbee_zcl_identify(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
proto_item *payload_root;
proto_tree *payload_tree;
- zbee_zcl_packet *zcl = (zbee_zcl_packet *)pinfo->private_data;
+ zbee_zcl_packet *zcl = (zbee_zcl_packet *)data;
guint offset = 0;
guint8 cmd_id = zcl->cmd_id;
gint rem_len;
@@ -570,6 +572,8 @@ dissect_zbee_zcl_identify(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
}
+
+ return tvb_length(tvb);
} /*dissect_zbee_zcl_identify*/
@@ -725,7 +729,7 @@ proto_register_zbee_zcl_identify(void)
proto_register_subtree_array(ett, array_length(ett));
/* Register the ZigBee ZCL Identify dissector. */
- register_dissector(ZBEE_PROTOABBREV_ZCL_IDENTIFY, dissect_zbee_zcl_identify, proto_zbee_zcl_identify);
+ new_register_dissector(ZBEE_PROTOABBREV_ZCL_IDENTIFY, dissect_zbee_zcl_identify, proto_zbee_zcl_identify);
} /*proto_register_zbee_zcl_identify*/
@@ -838,10 +842,10 @@ static const value_string zbee_zcl_on_off_onoff_names[] = {
* none
*---------------------------------------------------------------
*/
-static void
-dissect_zbee_zcl_on_off(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_zbee_zcl_on_off(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- zbee_zcl_packet *zcl = (zbee_zcl_packet *)pinfo->private_data;
+ zbee_zcl_packet *zcl = (zbee_zcl_packet *)data;
guint offset = 0;
guint8 cmd_id = zcl->cmd_id;
@@ -852,12 +856,12 @@ dissect_zbee_zcl_on_off(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
val_to_str_const(cmd_id, zbee_zcl_on_off_srv_rx_cmd_names, "Unknown Command"),
zcl->tran_seqno);
- if (tree) {
- /* Add the command ID. */
- proto_tree_add_item(tree, hf_zbee_zcl_on_off_srv_rx_cmd_id, tvb, offset, 1, cmd_id);
- }
+ /* Add the command ID. */
+ proto_tree_add_item(tree, hf_zbee_zcl_on_off_srv_rx_cmd_id, tvb, offset, 1, cmd_id);
/*offset++;*/
}
+
+ return tvb_length(tvb);
} /*dissect_zbee_zcl_on_off*/
/*FUNCTION:------------------------------------------------------
@@ -953,7 +957,7 @@ proto_register_zbee_zcl_on_off(void)
proto_register_field_array(proto_zbee_zcl_on_off, hf, array_length(hf));
/* Register the ZigBee ZCL OnOff dissector. */
- register_dissector(ZBEE_PROTOABBREV_ZCL_ONOFF, dissect_zbee_zcl_on_off, proto_zbee_zcl_on_off);
+ new_register_dissector(ZBEE_PROTOABBREV_ZCL_ONOFF, dissect_zbee_zcl_on_off, proto_zbee_zcl_on_off);
} /* proto_register_zbee_zcl_on_off */
/*FUNCTION:------------------------------------------------------
@@ -1126,12 +1130,12 @@ static const value_string zbee_zcl_part_id_length_names[] = {
* none
*---------------------------------------------------------------
*/
-static void
-dissect_zbee_zcl_part(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_zbee_zcl_part(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
proto_item *payload_root;
proto_tree *payload_tree;
- zbee_zcl_packet *zcl = (zbee_zcl_packet *)pinfo->private_data;
+ zbee_zcl_packet *zcl = (zbee_zcl_packet *)data;
guint offset = 0;
guint8 cmd_id = zcl->cmd_id;
gint rem_len;
@@ -1201,6 +1205,8 @@ dissect_zbee_zcl_part(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
}
+
+ return tvb_length(tvb);
} /*dissect_zbee_zcl_part*/
/*FUNCTION:------------------------------------------------------
@@ -1551,7 +1557,7 @@ void proto_register_zbee_zcl_part(void)
proto_register_subtree_array(ett, array_length(ett));
/* Register the ZigBee ZCL Partition dissector. */
- register_dissector(ZBEE_PROTOABBREV_ZCL_PART, dissect_zbee_zcl_part, proto_zbee_zcl_part);
+ new_register_dissector(ZBEE_PROTOABBREV_ZCL_PART, dissect_zbee_zcl_part, proto_zbee_zcl_part);
} /* proto_register_zbee_zcl_pwr_prof */
@@ -1815,12 +1821,12 @@ static const value_string zbee_zcl_options_types[] = {
* none
*---------------------------------------------------------------
*/
-static void
-dissect_zbee_zcl_pwr_prof (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_zbee_zcl_pwr_prof (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
proto_item *payload_root;
proto_tree *payload_tree;
- zbee_zcl_packet *zcl = (zbee_zcl_packet *)pinfo->private_data;
+ zbee_zcl_packet *zcl = (zbee_zcl_packet *)data;
guint offset = 0;
guint8 cmd_id = zcl->cmd_id;
gint rem_len;
@@ -1927,6 +1933,8 @@ dissect_zbee_zcl_pwr_prof (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
}
+
+ return tvb_length(tvb);
} /*dissect_zbee_zcl_pwr_prof*/
/*FUNCTION:------------------------------------------------------
@@ -2707,7 +2715,7 @@ proto_register_zbee_zcl_pwr_prof(void)
proto_register_subtree_array(ett, array_length(ett));
/* Register the ZigBee ZCL Power Profile dissector. */
- register_dissector(ZBEE_PROTOABBREV_ZCL_PWRPROF, dissect_zbee_zcl_pwr_prof, proto_zbee_zcl_pwr_prof);
+ new_register_dissector(ZBEE_PROTOABBREV_ZCL_PWRPROF, dissect_zbee_zcl_pwr_prof, proto_zbee_zcl_pwr_prof);
} /* proto_register_zbee_zcl_pwr_prof */
@@ -2988,12 +2996,12 @@ static const value_string zbee_zcl_appl_ctrl_time_encoding_type_names[] = {
* none
*---------------------------------------------------------------
*/
-static void
-dissect_zbee_zcl_appl_ctrl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_zbee_zcl_appl_ctrl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
proto_item *payload_root;
proto_tree *payload_tree;
- zbee_zcl_packet *zcl = (zbee_zcl_packet *)pinfo->private_data;
+ zbee_zcl_packet *zcl = (zbee_zcl_packet *)data;
guint offset = 0;
guint8 cmd_id = zcl->cmd_id;
gint rem_len;
@@ -3066,6 +3074,8 @@ dissect_zbee_zcl_appl_ctrl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
}
+
+ return tvb_length(tvb);
}
@@ -3392,7 +3402,7 @@ proto_register_zbee_zcl_appl_ctrl(void)
proto_register_subtree_array(ett, array_length(ett));
/* Register the ZigBee ZCL Appliance Control dissector. */
- register_dissector(ZBEE_PROTOABBREV_ZCL_APPLCTRL, dissect_zbee_zcl_appl_ctrl, proto_zbee_zcl_appl_ctrl);
+ new_register_dissector(ZBEE_PROTOABBREV_ZCL_APPLCTRL, dissect_zbee_zcl_appl_ctrl, proto_zbee_zcl_appl_ctrl);
} /*proto_register_zbee_zcl_appl_ctrl*/
diff --git a/epan/dissectors/packet-zbee-zcl-ha.c b/epan/dissectors/packet-zbee-zcl-ha.c
index 95674e3327..341e9b8728 100644
--- a/epan/dissectors/packet-zbee-zcl-ha.c
+++ b/epan/dissectors/packet-zbee-zcl-ha.c
@@ -807,12 +807,12 @@ static const value_string zbee_zcl_appl_evtalt_status_names[] = {
* none
*---------------------------------------------------------------
*/
-static void
-dissect_zbee_zcl_appl_evtalt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_zbee_zcl_appl_evtalt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
proto_item *payload_root;
proto_tree *payload_tree;
- zbee_zcl_packet *zcl = (zbee_zcl_packet *)pinfo->private_data;
+ zbee_zcl_packet *zcl = (zbee_zcl_packet *)data;
guint offset = 0;
guint8 cmd_id = zcl->cmd_id;
gint rem_len;
@@ -875,6 +875,8 @@ dissect_zbee_zcl_appl_evtalt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
}
}
}
+
+ return tvb_length(tvb);
} /*dissect_zbee_zcl_appl_evtalt*/
/*FUNCTION:------------------------------------------------------
@@ -1052,7 +1054,7 @@ void proto_register_zbee_zcl_appl_evtalt
proto_register_subtree_array(ett, array_length(ett));
/* Register the ZigBee ZCL Appliance Control dissector. */
- register_dissector(ZBEE_PROTOABBREV_ZCL_APPLEVTALT, dissect_zbee_zcl_appl_evtalt, proto_zbee_zcl_appl_evtalt);
+ new_register_dissector(ZBEE_PROTOABBREV_ZCL_APPLEVTALT, dissect_zbee_zcl_appl_evtalt, proto_zbee_zcl_appl_evtalt);
} /*proto_register_zbee_zcl_appl_evtalt*/
@@ -1188,12 +1190,12 @@ static const value_string zbee_zcl_appl_stats_srv_tx_cmd_names[] = {
* none
*---------------------------------------------------------------
*/
-static void
-dissect_zbee_zcl_appl_stats (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_zbee_zcl_appl_stats (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
proto_item *payload_root;
proto_tree *payload_tree;
- zbee_zcl_packet *zcl = (zbee_zcl_packet *)pinfo->private_data;
+ zbee_zcl_packet *zcl = (zbee_zcl_packet *)data;
guint offset = 0;
guint8 cmd_id = zcl->cmd_id;
gint rem_len;
@@ -1261,6 +1263,8 @@ dissect_zbee_zcl_appl_stats (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
}
}
}
+
+ return tvb_length(tvb);
} /*dissect_zbee_zcl_appl_stats*/
/*FUNCTION:------------------------------------------------------
@@ -1476,7 +1480,7 @@ proto_register_zbee_zcl_appl_stats(void)
proto_register_subtree_array(ett, array_length(ett));
/* Register the ZigBee ZCL Appliance Statistics dissector. */
- register_dissector(ZBEE_PROTOABBREV_ZCL_APPLSTATS, dissect_zbee_zcl_appl_stats, proto_zbee_zcl_appl_stats);
+ new_register_dissector(ZBEE_PROTOABBREV_ZCL_APPLSTATS, dissect_zbee_zcl_appl_stats, proto_zbee_zcl_appl_stats);
} /* proto_register_zbee_zcl_appl_stats */
diff --git a/epan/dissectors/packet-zbee-zcl-se.c b/epan/dissectors/packet-zbee-zcl-se.c
index ba2b5ac1de..5be5e69fe9 100644
--- a/epan/dissectors/packet-zbee-zcl-se.c
+++ b/epan/dissectors/packet-zbee-zcl-se.c
@@ -159,12 +159,12 @@ static const value_string zbee_zcl_msg_ctrl_importance_names[] = {
* none
*---------------------------------------------------------------
*/
-static void
-dissect_zbee_zcl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_zbee_zcl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
proto_item *payload_root;
proto_tree *payload_tree;
- zbee_zcl_packet *zcl = (zbee_zcl_packet *)pinfo->private_data;
+ zbee_zcl_packet *zcl = (zbee_zcl_packet *)data;
guint offset = 0;
guint8 cmd_id = zcl->cmd_id;
gint rem_len;
@@ -232,6 +232,8 @@ dissect_zbee_zcl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
}
+
+ return tvb_length(tvb);
} /*dissect_zbee_zcl_msg*/
/*FUNCTION:------------------------------------------------------
@@ -480,7 +482,7 @@ proto_register_zbee_zcl_msg(void)
proto_register_subtree_array(ett, array_length(ett));
/* Register the ZigBee ZCL Messaging dissector. */
- register_dissector(ZBEE_PROTOABBREV_ZCL_MSG, dissect_zbee_zcl_msg, proto_zbee_zcl_msg);
+ new_register_dissector(ZBEE_PROTOABBREV_ZCL_MSG, dissect_zbee_zcl_msg, proto_zbee_zcl_msg);
} /*proto_register_zbee_zcl_msg*/
diff --git a/epan/dissectors/packet-zbee-zcl.c b/epan/dissectors/packet-zbee-zcl.c
index 0afde81eb8..d432fd9446 100644
--- a/epan/dissectors/packet-zbee-zcl.c
+++ b/epan/dissectors/packet-zbee-zcl.c
@@ -34,6 +34,7 @@
#include <epan/packet.h>
#include "packet-zbee.h"
+#include "packet-zbee-nwk.h"
#include "packet-zbee-aps.h"
#include "packet-zbee-zcl.h"
@@ -41,8 +42,6 @@
* Function Declarations *
*************************
*/
-/* Dissector Routines */
-static void dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
/* Command Dissector Helpers */
static void dissect_zcl_read_attr (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset);
@@ -694,7 +693,7 @@ static const value_string zbee_zcl_dis_names[] = {
* void
*---------------------------------------------------------------
*/
-static void dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tvbuff_t *payload_tvb = NULL;
dissector_handle_t cluster_handle = NULL;
@@ -705,6 +704,7 @@ static void dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
proto_item *proto_root = NULL;
proto_item *ti;
+ zbee_nwk_packet *nwk = (zbee_nwk_packet *)data;
zbee_zcl_packet packet;
zbee_zcl_cluster_desc *desc;
@@ -715,7 +715,7 @@ static void dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
memset(&packet, 0, sizeof(zbee_zcl_packet));
/* Fill the zcl cluster id */
- zcl_cluster_id = pinfo->zbee_cluster_id;
+ zcl_cluster_id = nwk->cluster_id;
cluster_handle = dissector_get_uint_handle(zbee_zcl_dissector_table, zcl_cluster_id);
/* Create the protocol tree */
@@ -816,8 +816,7 @@ static void dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
if (cluster_handle != NULL) {
/* Call the specific cluster dissector registered */
- pinfo->private_data = (void *)&packet;
- call_dissector(cluster_handle, payload_tvb, pinfo, zcl_tree);
+ call_dissector_with_data(cluster_handle, payload_tvb, pinfo, zcl_tree, &packet);
}
else {
proto_item_append_text(proto_root, ", Cluster-specific Command: 0x%02x, Seq: %u",
@@ -833,7 +832,7 @@ static void dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
/* Don't decode cluster-specific commands */
zcl_dump_data(tvb, offset, pinfo, zcl_tree);
}
- return;
+ return tvb_length(tvb);
}
if ( zcl_tree ) {
@@ -896,7 +895,7 @@ static void dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
} /* switch */
}
- return;
+ return tvb_length(tvb);
} /* dissect_zbee_zcl */
/*FUNCTION:------------------------------------------------------
@@ -2380,7 +2379,7 @@ void proto_register_zbee_zcl(void)
/* Register the ZCL dissector and subdissector list. */
zbee_zcl_dissector_table = register_dissector_table("zbee.zcl.cluster", "ZigBee ZCL Cluster ID", FT_UINT16, BASE_HEX);
- register_dissector(ZBEE_PROTOABBREV_ZCL, dissect_zbee_zcl, proto_zbee_zcl);
+ new_register_dissector(ZBEE_PROTOABBREV_ZCL, dissect_zbee_zcl, proto_zbee_zcl);
} /* proto_register_zbee_zcl */
diff --git a/epan/dissectors/packet-zbee-zdp-binding.c b/epan/dissectors/packet-zbee-zdp-binding.c
index 5ae79ef356..3620c3fd1c 100644
--- a/epan/dissectors/packet-zbee-zdp-binding.c
+++ b/epan/dissectors/packet-zbee-zdp-binding.c
@@ -54,7 +54,7 @@
*---------------------------------------------------------------
*/
void
-zdp_parse_bind_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, packet_info *pinfo)
+zdp_parse_bind_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint8 version)
{
proto_item *ti = NULL;
guint len = 0;
@@ -78,7 +78,7 @@ zdp_parse_bind_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, packe
len += (int)sizeof(guint8);
/* Add the cluster ID. */
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (version >= ZBEE_VERSION_2007) {
cluster = tvb_get_letohs(tvb, *offset + len);
len += (int)sizeof(guint16);
}
@@ -89,7 +89,7 @@ zdp_parse_bind_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, packe
if (tree) proto_item_append_text(ti, ", Cluster: %d", cluster);
/* Get the destination address mode. */
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (version >= ZBEE_VERSION_2007) {
mode = tvb_get_guint8(tvb, *offset + len);
len += (int)sizeof(guint8);
}
@@ -142,9 +142,9 @@ zdp_parse_bind_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, packe
*---------------------------------------------------------------
*/
void
-dissect_zbee_zdp_req_end_device_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_zbee_zdp_req_end_device_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{
- guint sizeof_cluster = (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8);
+ guint sizeof_cluster = (version >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8);
guint i;
proto_item *ti;
proto_tree *field_tree = NULL;
@@ -158,7 +158,7 @@ dissect_zbee_zdp_req_end_device_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tr
guint8 out_count;
target = zbee_parse_uint(tree, hf_zbee_zdp_target, tvb, &offset, (guint)sizeof(guint16), NULL);
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (version >= ZBEE_VERSION_2007) {
/* Extended address present on ZigBee 2006 & later. */
ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (guint)sizeof(guint64), NULL);
}
@@ -179,7 +179,7 @@ dissect_zbee_zdp_req_end_device_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tr
}
for (i=0; i<out_count; i++) zbee_parse_uint(field_tree, hf_zbee_zdp_out_cluster, tvb, &offset, sizeof_cluster, NULL);
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (version >= ZBEE_VERSION_2007) {
zbee_append_info(tree, pinfo, " Src: %s", get_eui64_name(ext_addr));
}
zbee_append_info(tree, pinfo, ", Target: 0x%04x", target);
@@ -203,7 +203,7 @@ dissect_zbee_zdp_req_end_device_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tr
*---------------------------------------------------------------
*/
void
-dissect_zbee_zdp_req_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_zbee_zdp_req_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{
proto_item *ti;
@@ -218,8 +218,8 @@ dissect_zbee_zdp_req_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(guint64), NULL);
/*src_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, (int)sizeof(guint8), NULL);
- /*cluster =*/ zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, ZBEE_HAS_2006(pinfo->zbee_stack_vers)?(int)sizeof(guint16):(int)sizeof(guint8), NULL);
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ /*cluster =*/ zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, ZBEE_HAS_2006(version)?(int)sizeof(guint16):(int)sizeof(guint8), NULL);
+ if (version >= ZBEE_VERSION_2007) {
dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, (int)sizeof(guint8), &ti);
if (tree) {
if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) proto_item_append_text(ti, " (Group)");
@@ -240,7 +240,7 @@ dissect_zbee_zdp_req_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, (int)sizeof(guint8), NULL);
}
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (version >= ZBEE_VERSION_2007) {
zbee_append_info(tree, pinfo, " Src: %s", get_eui64_name(src64));
}
if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) {
@@ -269,7 +269,7 @@ dissect_zbee_zdp_req_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*---------------------------------------------------------------
*/
void
-dissect_zbee_zdp_req_unbind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_zbee_zdp_req_unbind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{
proto_item *ti;
@@ -284,8 +284,8 @@ dissect_zbee_zdp_req_unbind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(guint64), NULL);
/*src_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, (int)sizeof(guint8), NULL);
- /*cluster =*/ zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8), NULL);
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ /*cluster =*/ zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, (version >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8), NULL);
+ if (version >= ZBEE_VERSION_2007) {
dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, (int)sizeof(guint8), &ti);
if (tree) {
if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) proto_item_append_text(ti, " (Group)");
@@ -306,7 +306,7 @@ dissect_zbee_zdp_req_unbind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, (int)sizeof(guint8), NULL);
}
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (version >= ZBEE_VERSION_2007) {
zbee_append_info(tree, pinfo, " Src: %s", get_eui64_name(src64));
}
if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) {
@@ -398,7 +398,7 @@ dissect_zbee_zdp_req_replace_device(tvbuff_t *tvb, packet_info *pinfo, proto_tre
*---------------------------------------------------------------
*/
void
-dissect_zbee_zdp_req_store_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_zbee_zdp_req_store_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{
proto_item *ti;
@@ -410,7 +410,7 @@ dissect_zbee_zdp_req_store_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, pro
src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(guint64), NULL);
src_ep = zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, (int)sizeof(guint8), NULL);
- cluster = zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8), NULL);
+ cluster = zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, (version >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8), NULL);
dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, (int)sizeof(guint8), &ti);
if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) {
@@ -450,7 +450,7 @@ dissect_zbee_zdp_req_store_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, pro
*---------------------------------------------------------------
*/
void
-dissect_zbee_zdp_req_remove_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_zbee_zdp_req_remove_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{
proto_item *ti;
@@ -462,7 +462,7 @@ dissect_zbee_zdp_req_remove_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, pr
src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(guint64), NULL);
src_ep = zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, (int)sizeof(guint8), NULL);
- cluster = zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8), NULL);
+ cluster = zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, (version >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8), NULL);
dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, (int)sizeof(guint8), &ti);
if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) {
@@ -502,7 +502,7 @@ dissect_zbee_zdp_req_remove_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, pr
*---------------------------------------------------------------
*/
void
-dissect_zbee_zdp_req_backup_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_zbee_zdp_req_backup_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{
proto_item *ti;
proto_tree *field_tree = NULL;
@@ -522,7 +522,7 @@ dissect_zbee_zdp_req_backup_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_
field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_bind);
}
for (i=0; i<table_count; i++) {
- zdp_parse_bind_table_entry(field_tree, tvb, &offset, pinfo);
+ zdp_parse_bind_table_entry(field_tree, tvb, &offset, version);
} /* for */
/* Dump any leftover bytes. */
@@ -724,7 +724,7 @@ dissect_zbee_zdp_rsp_unbind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*---------------------------------------------------------------
*/
void
-dissect_zbee_zdp_rsp_bind_register(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_zbee_zdp_rsp_bind_register(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{
proto_item *ti;
proto_tree *field_tree = NULL;
@@ -744,7 +744,7 @@ dissect_zbee_zdp_rsp_bind_register(tvbuff_t *tvb, packet_info *pinfo, proto_tree
field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_bind);
}
for (i=0; i<table_count; i++) {
- zdp_parse_bind_table_entry(field_tree, tvb, &offset, pinfo);
+ zdp_parse_bind_table_entry(field_tree, tvb, &offset, version);
} /* for */
zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
@@ -882,7 +882,7 @@ dissect_zbee_zdp_rsp_backup_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_
*---------------------------------------------------------------
*/
void
-dissect_zbee_zdp_rsp_recover_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_zbee_zdp_rsp_recover_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{
proto_item *ti;
proto_tree *field_tree = NULL;
@@ -904,7 +904,7 @@ dissect_zbee_zdp_rsp_recover_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto
field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_bind);
}
for (i=0; i<table_count; i++) {
- zdp_parse_bind_table_entry(field_tree, tvb, &offset, pinfo);
+ zdp_parse_bind_table_entry(field_tree, tvb, &offset, version);
} /* for */
zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
diff --git a/epan/dissectors/packet-zbee-zdp-discovery.c b/epan/dissectors/packet-zbee-zdp-discovery.c
index f743637b5e..57a76bfd73 100644
--- a/epan/dissectors/packet-zbee-zdp-discovery.c
+++ b/epan/dissectors/packet-zbee-zdp-discovery.c
@@ -234,12 +234,12 @@ dissect_zbee_zdp_req_active_ep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
*---------------------------------------------------------------
*/
void
-dissect_zbee_zdp_req_match_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_zbee_zdp_req_match_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{
proto_item *ti;
proto_tree *field_tree = NULL;
guint offset = 0, i;
- guint sizeof_cluster = (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8);
+ guint sizeof_cluster = (version >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8);
guint16 device;
guint16 profile;
@@ -404,7 +404,7 @@ dissect_zbee_zdp_device_annce(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
*---------------------------------------------------------------
*/
void
-dissect_zbee_zdp_req_set_user_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_zbee_zdp_req_set_user_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{
guint offset = 0;
guint16 device;
@@ -412,7 +412,7 @@ dissect_zbee_zdp_req_set_user_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree
gchar *user;
device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL);
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (version >= ZBEE_VERSION_2007) {
user_length = zbee_parse_uint(tree, hf_zbee_zdp_user_length, tvb, &offset, (int)sizeof(guint8), NULL);
}
else {
@@ -524,7 +524,7 @@ dissect_zbee_zdp_req_store_discovery(tvbuff_t *tvb, packet_info *pinfo, proto_tr
*---------------------------------------------------------------
*/
void
-dissect_zbee_zdp_req_store_node_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_zbee_zdp_req_store_node_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{
guint offset = 0;
/*guint16 device;*/
@@ -532,7 +532,7 @@ dissect_zbee_zdp_req_store_node_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tr
/*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL);
ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL);
- zdp_parse_node_desc(tree, ett_zbee_zdp_node, tvb, &offset, pinfo);
+ zdp_parse_node_desc(tree, ett_zbee_zdp_node, tvb, &offset, version);
zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr));
@@ -630,7 +630,7 @@ dissect_zbee_zdp_req_store_active_ep(tvbuff_t *tvb, packet_info *pinfo, proto_tr
*---------------------------------------------------------------
*/
void
-dissect_zbee_zdp_req_store_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_zbee_zdp_req_store_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{
guint offset = 0;
/*guint16 device;*/
@@ -640,7 +640,7 @@ dissect_zbee_zdp_req_store_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_
/*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL);
ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL);
/*simple_len =*/ zbee_parse_uint(tree, hf_zbee_zdp_simple_length, tvb, &offset, (int)sizeof(guint8), NULL);
- zdp_parse_simple_desc(tree, ett_zbee_zdp_simple, tvb, &offset, pinfo);
+ zdp_parse_simple_desc(tree, ett_zbee_zdp_simple, tvb, &offset, version);
zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr));
@@ -899,7 +899,7 @@ dissect_zbee_zdp_rsp_ext_addr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
*---------------------------------------------------------------
*/
void
-dissect_zbee_zdp_rsp_node_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_zbee_zdp_rsp_node_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{
guint offset = 0;
@@ -909,7 +909,7 @@ dissect_zbee_zdp_rsp_node_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
status = zdp_parse_status(tree, tvb, &offset);
device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL);
if (status == ZBEE_ZDP_STATUS_SUCCESS) {
- zdp_parse_node_desc(tree, ett_zbee_zdp_node, tvb, &offset, pinfo);
+ zdp_parse_node_desc(tree, ett_zbee_zdp_node, tvb, &offset, version);
}
zbee_append_info(tree, pinfo, ", Device: 0x%04x", device);
@@ -969,7 +969,7 @@ dissect_zbee_zdp_rsp_power_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
*---------------------------------------------------------------
*/
void
-dissect_zbee_zdp_rsp_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_zbee_zdp_rsp_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{
guint offset = 0;
@@ -981,7 +981,7 @@ dissect_zbee_zdp_rsp_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL);
/*length =*/ zbee_parse_uint(tree, hf_zbee_zdp_simple_length, tvb, &offset, (int)sizeof(guint8), NULL);
if (status == ZBEE_ZDP_STATUS_SUCCESS) {
- zdp_parse_simple_desc(tree, ett_zbee_zdp_simple, tvb, &offset, pinfo);
+ zdp_parse_simple_desc(tree, ett_zbee_zdp_simple, tvb, &offset, version);
}
zbee_append_info(tree, pinfo, ", Device: 0x%04x", device);
@@ -1133,7 +1133,7 @@ dissect_zbee_zdp_rsp_complex_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree
*---------------------------------------------------------------
*/
void
-dissect_zbee_zdp_rsp_user_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_zbee_zdp_rsp_user_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{
guint offset = 0;
guint8 status;
@@ -1143,7 +1143,7 @@ dissect_zbee_zdp_rsp_user_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
status = zdp_parse_status(tree, tvb, &offset);
device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL);
- if ((pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) || (status == ZBEE_ZDP_STATUS_SUCCESS)) {
+ if ((version >= ZBEE_VERSION_2007) || (status == ZBEE_ZDP_STATUS_SUCCESS)) {
/* In ZigBee 2003 & earlier, the length field is omitted if not successful. */
user_length = zbee_parse_uint(tree, hf_zbee_zdp_user_length, tvb, &offset, (int)sizeof(guint8), NULL);
}
@@ -1180,14 +1180,14 @@ dissect_zbee_zdp_rsp_user_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
*---------------------------------------------------------------
*/
void
-dissect_zbee_zdp_rsp_user_desc_conf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_zbee_zdp_rsp_user_desc_conf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{
guint offset = 0;
guint8 status;
guint16 device = 0;
status = zdp_parse_status(tree, tvb, &offset);
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (version >= ZBEE_VERSION_2007) {
/* Device address present only on ZigBee 2006 & later. */
device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL);
}
diff --git a/epan/dissectors/packet-zbee-zdp-management.c b/epan/dissectors/packet-zbee-zdp-management.c
index 8d9395888f..3e9a2ae0ed 100644
--- a/epan/dissectors/packet-zbee-zdp-management.c
+++ b/epan/dissectors/packet-zbee-zdp-management.c
@@ -53,7 +53,7 @@
*---------------------------------------------------------------
*/
void
-zdp_parse_nwk_desc(proto_tree *tree, tvbuff_t *tvb, guint *offset, packet_info *pinfo)
+zdp_parse_nwk_desc(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint8 version)
{
proto_item *ti = NULL;
guint len = 0;
@@ -62,12 +62,12 @@ zdp_parse_nwk_desc(proto_tree *tree, tvbuff_t *tvb, guint *offset, packet_info *
guint16 pan;
guint8 channel;
guint8 profile;
- guint8 version;
+ guint8 profile_version;
guint8 beacon;
guint8 superframe;
gboolean permit;
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (version >= ZBEE_VERSION_2007) {
/* Extended PAN Identifiers are used in ZigBee 2006 & later. */
ext_pan = tvb_get_letoh64(tvb, *offset + len);
if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "{Pan: %s", eui64_to_str(ext_pan));
@@ -85,8 +85,8 @@ zdp_parse_nwk_desc(proto_tree *tree, tvbuff_t *tvb, guint *offset, packet_info *
len += (int)sizeof(guint8);
profile = (tvb_get_guint8(tvb, *offset + len) & 0x0f) >> 0;
- version = (tvb_get_guint8(tvb, *offset + len) & 0xf0) >> 4;
- if (tree) proto_item_append_text(ti, ", Profile: 0x%01x, Version: %d", profile, version);
+ profile_version = (tvb_get_guint8(tvb, *offset + len) & 0xf0) >> 4;
+ if (tree) proto_item_append_text(ti, ", Profile: 0x%01x, Version: %d", profile, profile_version);
len += (int)sizeof(guint8);
beacon = (tvb_get_guint8(tvb, *offset + len) & 0x0f) >> 0;
@@ -121,7 +121,7 @@ zdp_parse_nwk_desc(proto_tree *tree, tvbuff_t *tvb, guint *offset, packet_info *
*---------------------------------------------------------------
*/
void
-zdp_parse_neighbor_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, packet_info *pinfo)
+zdp_parse_neighbor_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint8 version)
{
proto_item *ti = NULL;
guint len = 0;
@@ -137,7 +137,7 @@ zdp_parse_neighbor_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, p
guint8 depth;
guint8 lqi;
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (version >= ZBEE_VERSION_2007) {
/* ZigBee 2006 & later use an extended PAN Identifier. */
ext_pan = tvb_get_letoh64(tvb, *offset + len);
if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "{Extended PAN: %s", eui64_to_str(ext_pan));
@@ -158,7 +158,7 @@ zdp_parse_neighbor_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, p
if (tree) proto_item_append_text(ti, ", Addr: 0x%04x", device);
len += (int)sizeof(guint16);
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (version >= ZBEE_VERSION_2007) {
type = (tvb_get_guint8(tvb, *offset + len) & 0x03) >> 0;
idle_rx = (tvb_get_guint8(tvb, *offset + len) & 0x0c) >> 2;
rel = (tvb_get_guint8(tvb, *offset + len) & 0x70) >> 4;
@@ -187,7 +187,7 @@ zdp_parse_neighbor_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, p
}
len += (int)sizeof(guint8);
- if (pinfo->zbee_stack_vers <= ZBEE_VERSION_2004) {
+ if (version <= ZBEE_VERSION_2004) {
/* In ZigBee 2003 & earlier, the depth field is before the permit joining field. */
depth = tvb_get_guint8(tvb, *offset + len);
if (tree) proto_item_append_text(ti, ", Depth: %d", depth);
@@ -202,7 +202,7 @@ zdp_parse_neighbor_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, p
}
len += (int)sizeof(guint8);
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (version >= ZBEE_VERSION_2007) {
/* In ZigBee 2006 & later, the depth field is after the permit joining field. */
depth = tvb_get_guint8(tvb, *offset + len);
if (tree) proto_item_append_text(ti, ", Depth: %d", depth);
@@ -273,7 +273,7 @@ zdp_parse_routing_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset)
* void
*---------------------------------------------------------------
*/
-extern void zdp_parse_bind_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, packet_info *pinfo);
+extern void zdp_parse_bind_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint8 version);
/**************************************
* MANAGEMENT REQUESTS
@@ -425,14 +425,14 @@ dissect_zbee_zdp_req_mgmt_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
*---------------------------------------------------------------
*/
void
-dissect_zbee_zdp_req_mgmt_leave(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_zbee_zdp_req_mgmt_leave(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{
guint offset = 0;
guint64 ext_addr;
guint8 flags;
ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL);
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (version >= ZBEE_VERSION_2007) {
/* Flags present on ZigBee 2006 & later. */
flags = tvb_get_guint8(tvb, offset);
if (tree) {
@@ -592,7 +592,7 @@ dissect_zbee_zdp_req_mgmt_nwkupdate(tvbuff_t *tvb, packet_info *pinfo, proto_tre
*---------------------------------------------------------------
*/
void
-dissect_zbee_zdp_rsp_mgmt_nwk_disc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_zbee_zdp_rsp_mgmt_nwk_disc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{
proto_item *ti;
proto_tree *field_tree = NULL;
@@ -614,7 +614,7 @@ dissect_zbee_zdp_rsp_mgmt_nwk_disc(tvbuff_t *tvb, packet_info *pinfo, proto_tree
field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_nwk);
}
for (i=0; i<table_count; i++) {
- zdp_parse_nwk_desc(field_tree, tvb, &offset, pinfo);
+ zdp_parse_nwk_desc(field_tree, tvb, &offset, version);
} /* for */
zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
@@ -638,7 +638,7 @@ dissect_zbee_zdp_rsp_mgmt_nwk_disc(tvbuff_t *tvb, packet_info *pinfo, proto_tree
*---------------------------------------------------------------
*/
void
-dissect_zbee_zdp_rsp_mgmt_lqi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_zbee_zdp_rsp_mgmt_lqi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{
proto_item *ti;
proto_tree *field_tree = NULL;
@@ -660,7 +660,7 @@ dissect_zbee_zdp_rsp_mgmt_lqi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_lqi);
}
for (i=0; i<table_count; i++) {
- zdp_parse_neighbor_table_entry(field_tree, tvb, &offset, pinfo);
+ zdp_parse_neighbor_table_entry(field_tree, tvb, &offset, version);
} /* for */
zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
@@ -730,7 +730,7 @@ dissect_zbee_zdp_rsp_mgmt_rtg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
*---------------------------------------------------------------
*/
void
-dissect_zbee_zdp_rsp_mgmt_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_zbee_zdp_rsp_mgmt_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
{
proto_item *ti;
proto_tree *field_tree = NULL;
@@ -752,7 +752,7 @@ dissect_zbee_zdp_rsp_mgmt_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_bind);
}
for (i=0; i<table_count; i++) {
- zdp_parse_bind_table_entry(field_tree, tvb, &offset, pinfo);
+ zdp_parse_bind_table_entry(field_tree, tvb, &offset, version);
} /* for */
zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
diff --git a/epan/dissectors/packet-zbee-zdp.c b/epan/dissectors/packet-zbee-zdp.c
index e3120e5ee0..0337dbd03a 100644
--- a/epan/dissectors/packet-zbee-zdp.c
+++ b/epan/dissectors/packet-zbee-zdp.c
@@ -34,6 +34,7 @@
#include <epan/expert.h>
#include "packet-zbee.h"
+#include "packet-zbee-nwk.h"
#include "packet-zbee-zdp.h"
/*************************/
@@ -49,30 +50,30 @@ extern void dissect_zbee_zdp_req_node_desc (tvbuff_t *tvb, packet_info
extern void dissect_zbee_zdp_req_power_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_req_simple_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_req_active_ep (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-extern void dissect_zbee_zdp_req_match_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+extern void dissect_zbee_zdp_req_match_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version);
extern void dissect_zbee_zdp_req_complex_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_req_user_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_req_discovery_cache (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_device_annce (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-extern void dissect_zbee_zdp_req_set_user_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+extern void dissect_zbee_zdp_req_set_user_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version);
extern void dissect_zbee_zdp_req_system_server_disc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_req_store_discovery (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_req_store_node_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_req_store_power_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_req_store_active_ep (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-extern void dissect_zbee_zdp_req_store_simple_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+extern void dissect_zbee_zdp_req_store_simple_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version);
extern void dissect_zbee_zdp_req_remove_node_cache (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_req_find_node_cache (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_req_ext_simple_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_req_ext_active_ep (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-extern void dissect_zbee_zdp_req_end_device_bind (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-extern void dissect_zbee_zdp_req_bind (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-extern void dissect_zbee_zdp_req_unbind (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+extern void dissect_zbee_zdp_req_end_device_bind (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version);
+extern void dissect_zbee_zdp_req_bind (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version);
+extern void dissect_zbee_zdp_req_unbind (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version);
extern void dissect_zbee_zdp_req_bind_register (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_req_replace_device (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-extern void dissect_zbee_zdp_req_store_bak_bind_entry (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-extern void dissect_zbee_zdp_req_remove_bak_bind_entry (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+extern void dissect_zbee_zdp_req_store_bak_bind_entry (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version);
+extern void dissect_zbee_zdp_req_remove_bak_bind_entry (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version);
extern void dissect_zbee_zdp_req_backup_bind_table (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_req_recover_bind_table (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_req_backup_source_bind (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
@@ -82,7 +83,7 @@ extern void dissect_zbee_zdp_req_mgmt_nwk_disc (tvbuff_t *tvb, packet_info
extern void dissect_zbee_zdp_req_mgmt_lqi (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_req_mgmt_rtg (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_req_mgmt_bind (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-extern void dissect_zbee_zdp_req_mgmt_leave (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+extern void dissect_zbee_zdp_req_mgmt_leave (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version);
extern void dissect_zbee_zdp_req_mgmt_direct_join (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_req_mgmt_permit_join (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_req_mgmt_cache (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
@@ -90,14 +91,14 @@ extern void dissect_zbee_zdp_req_mgmt_nwkupdate (tvbuff_t *tvb, packet_info
extern void dissect_zbee_zdp_rsp_nwk_addr (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_rsp_ext_addr (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-extern void dissect_zbee_zdp_rsp_node_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+extern void dissect_zbee_zdp_rsp_node_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version);
extern void dissect_zbee_zdp_rsp_power_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-extern void dissect_zbee_zdp_rsp_simple_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+extern void dissect_zbee_zdp_rsp_simple_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version);
extern void dissect_zbee_zdp_rsp_active_ep (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_rsp_match_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_rsp_complex_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-extern void dissect_zbee_zdp_rsp_user_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-extern void dissect_zbee_zdp_rsp_user_desc_conf (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+extern void dissect_zbee_zdp_rsp_user_desc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version);
+extern void dissect_zbee_zdp_rsp_user_desc_conf (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version);
extern void dissect_zbee_zdp_rsp_discovery_cache (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_rsp_system_server_disc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_rsp_discovery_store (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
@@ -122,10 +123,10 @@ extern void dissect_zbee_zdp_rsp_recover_bind_table (tvbuff_t *tvb, packet_info
extern void dissect_zbee_zdp_rsp_backup_source_bind (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_rsp_recover_source_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-extern void dissect_zbee_zdp_rsp_mgmt_nwk_disc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-extern void dissect_zbee_zdp_rsp_mgmt_lqi (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+extern void dissect_zbee_zdp_rsp_mgmt_nwk_disc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version);
+extern void dissect_zbee_zdp_rsp_mgmt_lqi (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version);
extern void dissect_zbee_zdp_rsp_mgmt_rtg (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-extern void dissect_zbee_zdp_rsp_mgmt_bind (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+extern void dissect_zbee_zdp_rsp_mgmt_bind (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version);
extern void dissect_zbee_zdp_rsp_mgmt_leave (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_rsp_mgmt_direct_join (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_rsp_mgmt_permit_join (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
@@ -781,7 +782,7 @@ zdp_parse_server_flags(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *of
*---------------------------------------------------------------
*/
void
-zdp_parse_node_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offset, packet_info *pinfo)
+zdp_parse_node_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offset, guint8 version)
{
proto_item *ti;
proto_item *field_root = NULL;
@@ -825,7 +826,7 @@ zdp_parse_node_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offse
/*max_transfer =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_node_max_transfer, tvb, offset, (int)sizeof(guint16), NULL);
/* Get and display the server flags. */
- if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
+ if (version >= ZBEE_VERSION_2007) {
zdp_parse_server_flags(field_tree, ett_zbee_zdp_server, tvb, offset);
}
@@ -918,7 +919,7 @@ zdp_parse_power_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offs
*---------------------------------------------------------------
*/
void
-zdp_parse_simple_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offset, packet_info *pinfo)
+zdp_parse_simple_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offset, guint8 version)
{
proto_item *ti;
proto_item *field_root = NULL;
@@ -943,7 +944,7 @@ zdp_parse_simple_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *off
/*app_device =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_simple_app_device, tvb, offset, (int)sizeof(guint16), NULL);
/*app_version =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_simple_app_version, tvb, offset, (int)sizeof(guint8), NULL);
- sizeof_cluster = (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8);
+ sizeof_cluster = (version >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8);
in_count = zbee_parse_uint(field_tree, hf_zbee_zdp_in_count, tvb, offset, (int)sizeof(guint8), NULL);
if ((tree) && (in_count)) {
@@ -1074,40 +1075,39 @@ zdp_parse_complex_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *of
* void
*---------------------------------------------------------------
*/
-static void
-dissect_zbee_zdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_zbee_zdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- proto_tree *zdp_tree = NULL;
+ proto_tree *zdp_tree;
proto_item *proto_root;
tvbuff_t *zdp_tvb;
guint8 seqno;
guint16 cluster;
guint offset = 0;
+ zbee_nwk_packet *nwk = (zbee_nwk_packet *)data;
/* Create the protocol tree. */
- if (tree) {
- proto_root = proto_tree_add_protocol_format(tree, proto_zbee_zdp, tvb, offset, tvb_length(tvb), "ZigBee Device Profile");
- zdp_tree = proto_item_add_subtree(proto_root, ett_zbee_zdp);
- }
+ proto_root = proto_tree_add_protocol_format(tree, proto_zbee_zdp, tvb, offset, tvb_length(tvb), "ZigBee Device Profile");
+ zdp_tree = proto_item_add_subtree(proto_root, ett_zbee_zdp);
+
#if 0
/* Overwrite the protocol column */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ZigBee ZDP");
#endif
/* Get and display the sequence number. */
seqno = tvb_get_guint8(tvb, offset);
- if (tree) {
- proto_tree_add_uint(zdp_tree, hf_zbee_zdp_seqno, tvb, offset, (int)sizeof(guint8), seqno);
- }
+ proto_tree_add_uint(zdp_tree, hf_zbee_zdp_seqno, tvb, offset, (int)sizeof(guint8), seqno);
+
offset += (int)sizeof(guint8);
- if (pinfo->zbee_stack_vers <= ZBEE_VERSION_2004) {
+ if (nwk->version <= ZBEE_VERSION_2004) {
/* ZigBee 2004 and earlier had different cluster identifiers, need to convert
* them into the ZigBee 2006 & later values. */
- cluster = zdp_convert_2003cluster((guint8)pinfo->zbee_cluster_id);
+ cluster = zdp_convert_2003cluster((guint8)nwk->cluster_id);
}
else {
- cluster = pinfo->zbee_cluster_id;
+ cluster = nwk->cluster_id;
}
/* Update info. */
@@ -1137,7 +1137,7 @@ dissect_zbee_zdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_zbee_zdp_req_active_ep(zdp_tvb, pinfo, zdp_tree);
break;
case ZBEE_ZDP_REQ_MATCH_DESC:
- dissect_zbee_zdp_req_match_desc(zdp_tvb, pinfo, zdp_tree);
+ dissect_zbee_zdp_req_match_desc(zdp_tvb, pinfo, zdp_tree, nwk->version);
break;
case ZBEE_ZDP_REQ_COMPLEX_DESC:
dissect_zbee_zdp_req_complex_desc(zdp_tvb, pinfo, zdp_tree);
@@ -1152,7 +1152,7 @@ dissect_zbee_zdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_zbee_zdp_device_annce(zdp_tvb, pinfo, zdp_tree);
break;
case ZBEE_ZDP_REQ_SET_USER_DESC:
- dissect_zbee_zdp_req_set_user_desc(zdp_tvb, pinfo, zdp_tree);
+ dissect_zbee_zdp_req_set_user_desc(zdp_tvb, pinfo, zdp_tree, nwk->version);
break;
case ZBEE_ZDP_REQ_SYSTEM_SERVER_DISC:
dissect_zbee_zdp_req_system_server_disc(zdp_tvb, pinfo, zdp_tree);
@@ -1170,7 +1170,7 @@ dissect_zbee_zdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_zbee_zdp_req_store_active_ep(zdp_tvb, pinfo, zdp_tree);
break;
case ZBEE_ZDP_REQ_STORE_SIMPLE_DESC:
- dissect_zbee_zdp_req_store_simple_desc(zdp_tvb, pinfo, zdp_tree);
+ dissect_zbee_zdp_req_store_simple_desc(zdp_tvb, pinfo, zdp_tree, nwk->version);
break;
case ZBEE_ZDP_REQ_REMOVE_NODE_CACHE:
dissect_zbee_zdp_req_remove_node_cache(zdp_tvb, pinfo, zdp_tree);
@@ -1185,13 +1185,13 @@ dissect_zbee_zdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_zbee_zdp_req_ext_active_ep(zdp_tvb, pinfo, zdp_tree);
break;
case ZBEE_ZDP_REQ_END_DEVICE_BIND:
- dissect_zbee_zdp_req_end_device_bind(zdp_tvb, pinfo, zdp_tree);
+ dissect_zbee_zdp_req_end_device_bind(zdp_tvb, pinfo, zdp_tree, nwk->version);
break;
case ZBEE_ZDP_REQ_BIND:
- dissect_zbee_zdp_req_bind(zdp_tvb, pinfo, zdp_tree);
+ dissect_zbee_zdp_req_bind(zdp_tvb, pinfo, zdp_tree, nwk->version);
break;
case ZBEE_ZDP_REQ_UNBIND:
- dissect_zbee_zdp_req_unbind(zdp_tvb, pinfo, zdp_tree);
+ dissect_zbee_zdp_req_unbind(zdp_tvb, pinfo, zdp_tree, nwk->version);
break;
case ZBEE_ZDP_REQ_BIND_REGISTER:
dissect_zbee_zdp_req_bind_register(zdp_tvb, pinfo, zdp_tree);
@@ -1200,10 +1200,10 @@ dissect_zbee_zdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_zbee_zdp_req_replace_device(zdp_tvb, pinfo, zdp_tree);
break;
case ZBEE_ZDP_REQ_STORE_BAK_BIND_ENTRY:
- dissect_zbee_zdp_req_store_bak_bind_entry(zdp_tvb, pinfo, zdp_tree);
+ dissect_zbee_zdp_req_store_bak_bind_entry(zdp_tvb, pinfo, zdp_tree, nwk->version);
break;
case ZBEE_ZDP_REQ_REMOVE_BAK_BIND_ENTRY:
- dissect_zbee_zdp_req_remove_bak_bind_entry(zdp_tvb, pinfo, zdp_tree);
+ dissect_zbee_zdp_req_remove_bak_bind_entry(zdp_tvb, pinfo, zdp_tree, nwk->version);
break;
case ZBEE_ZDP_REQ_BACKUP_BIND_TABLE:
dissect_zbee_zdp_req_backup_bind_table(zdp_tvb, pinfo, zdp_tree);
@@ -1230,7 +1230,7 @@ dissect_zbee_zdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_zbee_zdp_req_mgmt_bind(zdp_tvb, pinfo, zdp_tree);
break;
case ZBEE_ZDP_REQ_MGMT_LEAVE:
- dissect_zbee_zdp_req_mgmt_leave(zdp_tvb, pinfo, zdp_tree);
+ dissect_zbee_zdp_req_mgmt_leave(zdp_tvb, pinfo, zdp_tree, nwk->version);
break;
case ZBEE_ZDP_REQ_MGMT_DIRECT_JOIN:
dissect_zbee_zdp_req_mgmt_direct_join(zdp_tvb, pinfo, zdp_tree);
@@ -1251,13 +1251,13 @@ dissect_zbee_zdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_zbee_zdp_rsp_ext_addr(zdp_tvb, pinfo, zdp_tree);
break;
case ZBEE_ZDP_RSP_NODE_DESC:
- dissect_zbee_zdp_rsp_node_desc(zdp_tvb, pinfo, zdp_tree);
+ dissect_zbee_zdp_rsp_node_desc(zdp_tvb, pinfo, zdp_tree, nwk->version);
break;
case ZBEE_ZDP_RSP_POWER_DESC:
dissect_zbee_zdp_rsp_power_desc(zdp_tvb, pinfo, zdp_tree);
break;
case ZBEE_ZDP_RSP_SIMPLE_DESC:
- dissect_zbee_zdp_rsp_simple_desc(zdp_tvb, pinfo, zdp_tree);
+ dissect_zbee_zdp_rsp_simple_desc(zdp_tvb, pinfo, zdp_tree, nwk->version);
break;
case ZBEE_ZDP_RSP_ACTIVE_EP:
dissect_zbee_zdp_rsp_active_ep(zdp_tvb, pinfo, zdp_tree);
@@ -1269,13 +1269,13 @@ dissect_zbee_zdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_zbee_zdp_rsp_complex_desc(zdp_tvb, pinfo, zdp_tree);
break;
case ZBEE_ZDP_RSP_USER_DESC:
- dissect_zbee_zdp_rsp_user_desc(zdp_tvb, pinfo, zdp_tree);
+ dissect_zbee_zdp_rsp_user_desc(zdp_tvb, pinfo, zdp_tree, nwk->version);
break;
case ZBEE_ZDP_RSP_DISCOVERY_CACHE:
dissect_zbee_zdp_rsp_discovery_cache(zdp_tvb, pinfo, zdp_tree);
break;
case ZBEE_ZDP_RSP_CONF_USER_DESC:
- dissect_zbee_zdp_rsp_user_desc_conf(zdp_tvb, pinfo, zdp_tree);
+ dissect_zbee_zdp_rsp_user_desc_conf(zdp_tvb, pinfo, zdp_tree, nwk->version);
break;
case ZBEE_ZDP_RSP_SYSTEM_SERVER_DISC:
dissect_zbee_zdp_rsp_system_server_disc(zdp_tvb, pinfo, zdp_tree);
@@ -1341,16 +1341,16 @@ dissect_zbee_zdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_zbee_zdp_rsp_recover_source_bind(zdp_tvb, pinfo, zdp_tree);
break;
case ZBEE_ZDP_RSP_MGMT_NWK_DISC:
- dissect_zbee_zdp_rsp_mgmt_nwk_disc(zdp_tvb, pinfo, zdp_tree);
+ dissect_zbee_zdp_rsp_mgmt_nwk_disc(zdp_tvb, pinfo, zdp_tree, nwk->version);
break;
case ZBEE_ZDP_RSP_MGMT_LQI:
- dissect_zbee_zdp_rsp_mgmt_lqi(zdp_tvb, pinfo, zdp_tree);
+ dissect_zbee_zdp_rsp_mgmt_lqi(zdp_tvb, pinfo, zdp_tree, nwk->version);
break;
case ZBEE_ZDP_RSP_MGMT_RTG:
dissect_zbee_zdp_rsp_mgmt_rtg(zdp_tvb, pinfo, zdp_tree);
break;
case ZBEE_ZDP_RSP_MGMT_BIND:
- dissect_zbee_zdp_rsp_mgmt_bind(zdp_tvb, pinfo, zdp_tree);
+ dissect_zbee_zdp_rsp_mgmt_bind(zdp_tvb, pinfo, zdp_tree, nwk->version);
break;
case ZBEE_ZDP_RSP_MGMT_LEAVE:
dissect_zbee_zdp_rsp_mgmt_leave(zdp_tvb, pinfo, zdp_tree);
@@ -1372,6 +1372,8 @@ dissect_zbee_zdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
call_dissector(data_handle, zdp_tvb, pinfo, tree);
break;
} /* switch */
+
+ return tvb_length(tvb);
} /* dissect_zbee_zdp */
/*FUNCTION:------------------------------------------------------
@@ -1747,7 +1749,7 @@ void proto_register_zbee_zdp(void)
proto_register_subtree_array(ett, array_length(ett));
/* Register the ZDP dissector. */
- register_dissector("zbee_zdp", dissect_zbee_zdp, proto_zbee_zdp);
+ new_register_dissector("zbee_zdp", dissect_zbee_zdp, proto_zbee_zdp);
} /* proto_register_zbee_zdp */
/*FUNCTION:------------------------------------------------------
diff --git a/epan/dissectors/packet-zbee-zdp.h b/epan/dissectors/packet-zbee-zdp.h
index c5c5b4ec4f..eb7b48c403 100644
--- a/epan/dissectors/packet-zbee-zdp.h
+++ b/epan/dissectors/packet-zbee-zdp.h
@@ -275,9 +275,9 @@ extern guint zbee_parse_uint (proto_tree *tree, int hfindex, tvbuff_t
extern guint64 zbee_parse_eui64 (proto_tree *tree, int hfindex, tvbuff_t *tvb, guint *offset, guint length, proto_item **ti);
extern void zbee_append_info (proto_item *item, packet_info *pinfo, const gchar *format, ...) G_GNUC_PRINTF(3, 4);
-extern void zdp_parse_node_desc (proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offset, packet_info *pinfo);
+extern void zdp_parse_node_desc (proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offset, guint8 version);
extern void zdp_parse_power_desc (proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offset);
-extern void zdp_parse_simple_desc (proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offset, packet_info *pinfo);
+extern void zdp_parse_simple_desc (proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offset, guint8 version);
extern void zdp_parse_complex_desc (proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offset, guint length);
extern guint8 zdp_parse_status (proto_tree *tree, tvbuff_t *tvb, guint *offset);
diff --git a/epan/packet_info.h b/epan/packet_info.h
index 8b0dac019e..aaf6a5b3db 100644
--- a/epan/packet_info.h
+++ b/epan/packet_info.h
@@ -211,12 +211,6 @@ typedef struct _packet_info {
guint16 clnp_srcref; /**< clnp/cotp source reference (can't use srcport, this would confuse tpkt) */
guint16 clnp_dstref; /**< clnp/cotp destination reference (can't use dstport, this would confuse tpkt) */
- guint16 zbee_cluster_id; /**< ZigBee cluster ID, an application-specific message identifier that
- * happens to be included in the transport (APS) layer header.
- */
- guint8 zbee_stack_vers; /**< ZigBee stack version number, present in the ZigBee network layer, but
- * impacts the packet format at all layers of the ZigBee stack.
- */
int link_dir; /**< 3GPP messages are sometime different UP link(UL) or Downlink(DL) */
GSList* dependent_frames; /**< A list of frames which this one depends on */