aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Staub <atsju2@yahoo.fr>2018-05-30 16:29:05 +0200
committerAnders Broman <a.broman58@gmail.com>2018-06-05 04:18:03 +0000
commit6440a33fdf5f6ac3eccf15f4a00d1dd3af52d6ce (patch)
tree1d861ff2bb29d6734de6f3c7d215be18c14c4c4a
parent447ffdf042e0eebf87ea9d33a9823e6d24345a0e (diff)
ZBEE-NWK-GP:add support for some ZGP commands
the new dissected commands are: manufacturer specific attribute reporting multicluster reporting manufacturer specific multicluster reporting read attribute and request attribute (have same format) read attribute response write attribute Change-Id: I3125f6acbfb35a72771186f933b0db0798e409f2 Reviewed-on: https://code.wireshark.org/review/27892 Petri-Dish: Anders Broman <a.broman58@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/dissectors/packet-zbee-nwk-gp.c422
-rw-r--r--epan/dissectors/packet-zbee-zcl.c9
-rw-r--r--epan/dissectors/packet-zbee-zcl.h3
3 files changed, 408 insertions, 26 deletions
diff --git a/epan/dissectors/packet-zbee-nwk-gp.c b/epan/dissectors/packet-zbee-nwk-gp.c
index e9bffd48fb..48ae0d160c 100644
--- a/epan/dissectors/packet-zbee-nwk-gp.c
+++ b/epan/dissectors/packet-zbee-nwk-gp.c
@@ -139,6 +139,10 @@ typedef struct {
#define ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_SEC_LEVEL 0x18
#define ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_KEY_TYPE 0xE0
+/* Definition for GP read attributes command opt field (bitmask). */
+#define ZBEE_NWK_GP_CMD_READ_ATTRIBUTE_OPT_MULTI_RECORD 0x01
+#define ZBEE_NWK_GP_CMD_READ_ATTRIBUTE_OPT_MAN_FIELD_PRESENT 0x02
+
/* Definitions for GP Channel Request command. */
#define ZBEE_NWK_GP_CMD_CHANNEL_REQUEST_1ST 0x0F
#define ZBEE_NWK_GP_CMD_CHANNEL_REQUEST_2ND 0xF0
@@ -265,8 +269,19 @@ static int hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_type = -1;
static int hf_zbee_nwk_gp_cmd_comm_rep_pan_id = -1;
static int hf_zbee_nwk_gp_cmd_comm_rep_frame_counter = -1;
-/* Attribute reporting. */
-static int hf_zbee_nwk_gp_cmd_attr_report_cluster_id = -1;
+/* Read attribute and read attribute response. */
+static int hf_zbee_nwk_gp_cmd_read_att_opt_multi_rec = -1;
+static int hf_zbee_nwk_gp_cmd_read_att_opt_man_field_present = -1;
+static int hf_zbee_nwk_gp_cmd_read_att_opt = -1;
+static int hf_zbee_nwk_gp_cmd_read_att_record_len = -1;
+
+/* Common to commands returning data */
+static int hf_zbee_nwk_gp_zcl_attr_status = -1;
+static int hf_zbee_nwk_gp_zcl_attr_data_type = -1;
+static int hf_zbee_nwk_gp_zcl_attr_cluster_id = -1;
+
+/* Common to all manufacturer specific commands */
+static int hf_zbee_zcl_gp_cmd_ms_manufacturer_code = -1;
/* Channel request. */
static int hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour = -1;
@@ -305,6 +320,8 @@ static gint ett_zbee_nwk_cmd_appli_info = -1;
static gint ett_zbee_nwk_cmd_options = -1;
static gint ett_zbee_nwk_fcf = -1;
static gint ett_zbee_nwk_fcf_ext = -1;
+static gint ett_zbee_nwk_clu_rec = -1;
+static gint ett_zbee_nwk_att_rec = -1;
static gint ett_zbee_nwk_cmd_comm_gpd_cmd_id_list = -1;
static gint ett_zbee_nwk_cmd_comm_length_of_clid_list = -1;
static gint ett_zbee_nwk_cmd_comm_clid_list_server = -1;
@@ -880,29 +897,60 @@ dissect_zbee_nwk_gp_cmd_channel_configuration(tvbuff_t *tvb, packet_info *pinfo
*@param tree pointer to data tree Wireshark uses to display packet.
*@param packet packet data.
*@param offset current payload offset.
+ *@param mfr_code manufacturer code.
*@return payload processed offset.
*/
static guint
dissect_zbee_nwk_gp_cmd_attr_reporting(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
- zbee_nwk_green_power_packet *packet _U_, guint offset)
+ zbee_nwk_green_power_packet *packet _U_, guint offset, guint16 mfr_code)
{
guint16 cluster_id;
proto_tree *field_tree;
/* Get cluster ID and add it into the tree. */
cluster_id = tvb_get_letohs(tvb, offset);
- proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_attr_report_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ proto_tree_add_item(tree, hf_zbee_nwk_gp_zcl_attr_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
/* Create subtree and parse ZCL Write Attribute Payload. */
field_tree = proto_tree_add_subtree_format(tree, tvb, offset, 2, ett_zbee_nwk_cmd_options, NULL,
"Attribute reporting command for cluster: 0x%04X", cluster_id);
- dissect_zcl_report_attr(tvb, pinfo, field_tree, &offset, cluster_id, ZBEE_MFG_CODE_NONE, ZBEE_ZCL_FCF_TO_CLIENT);
+ dissect_zcl_report_attr(tvb, pinfo, field_tree, &offset, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT);
return offset;
} /* dissect_zbee_nwk_gp_cmd_attr_reporting */
+
+/**
+ * Dissector for ZigBee Green Power manufacturer specific attribute reporting.
+ *
+ *@param tvb pointer to buffer containing raw packet.
+ *@param pinfo pointer to packet information fields.
+ *@param tree pointer to data tree Wireshark uses to display packet.
+ *@param packet packet data.
+ *@param offset current payload offset.
+ *@return payload processed offset.
+ */
+static guint
+dissect_zbee_nwk_gp_cmd_MS_attr_reporting(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
+ zbee_nwk_green_power_packet *packet _U_, guint offset)
+{
+ guint16 mfr_code;
+
+ /*dissect manufacturer ID*/
+ proto_tree_add_item(tree, hf_zbee_zcl_gp_cmd_ms_manufacturer_code, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ mfr_code = tvb_get_letohs(tvb, offset);
+ offset += 2;
+
+ offset = dissect_zbee_nwk_gp_cmd_attr_reporting(tvb, pinfo, tree, packet, offset, mfr_code);
+
+ return offset;
+}/*dissect_zbee_nwk_gp_cmd_MS_attr_reporting*/
+
+
+
+
/**
*Dissector for ZigBee Green Power commissioning reply.
*
@@ -970,6 +1018,301 @@ dissect_zbee_nwk_gp_cmd_commissioning_reply(tvbuff_t *tvb, packet_info *pinfo _U
} /* dissect_zbee_nwk_gp_cmd_commissioning_reply */
/**
+ * Dissector for ZigBee Green Power read attributes and request attributes commands.
+ *
+ *@param tvb pointer to buffer containing raw packet.
+ *@param pinfo pointer to packet information fields.
+ *@param tree pointer to data tree Wireshark uses to display packet.
+ *@param packet packet data.
+ *@param offset current payload offset.
+ *@return payload processed offset.
+ */
+static guint
+dissect_zbee_nwk_gp_cmd_read_attributes(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
+ zbee_nwk_green_power_packet *packet _U_, guint offset)
+{
+ guint8 cr_options = 0;
+ proto_tree *subtree = NULL;
+ guint16 cluster_id;
+ guint16 mfr_code = ZBEE_MFG_CODE_NONE;
+ guint8 record_list_len;
+ guint tvb_len;
+ guint8 i;
+
+ static const int * options[] = {
+ &hf_zbee_nwk_gp_cmd_read_att_opt_multi_rec,
+ &hf_zbee_nwk_gp_cmd_read_att_opt_man_field_present,
+ NULL
+ };
+
+ /* Get Options Field, build subtree and display the results. */
+ cr_options = tvb_get_guint8(tvb, offset);
+ subtree = proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_read_att_opt, ett_zbee_nwk_cmd_options, options, ENC_NA);
+
+ offset += 1;
+ /* Parse and display manufacturer ID value. */
+ if (cr_options & ZBEE_NWK_GP_CMD_READ_ATTRIBUTE_OPT_MAN_FIELD_PRESENT) {
+ proto_tree_add_item(tree, hf_zbee_zcl_gp_cmd_ms_manufacturer_code, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ mfr_code = tvb_get_letohs(tvb, offset);
+ offset += 2;
+ }
+
+ tvb_len = tvb_captured_length(tvb);
+ while (offset < tvb_len)
+ {
+ /* Create subtree and parse attributes list. */
+ subtree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_zbee_nwk_clu_rec, NULL, "Cluster Record Request");
+
+ /* Get cluster ID and add it into the subtree. */
+ cluster_id = tvb_get_letohs(tvb, offset);
+ proto_tree_add_item(subtree, hf_zbee_nwk_gp_zcl_attr_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ offset += 2;
+ /* Get length of record list (number of attributes * 2). */
+ record_list_len = tvb_get_guint8(tvb, offset);
+ proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_read_att_record_len, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+
+ for(i=0 ; i<record_list_len ; i+=2)
+ {
+ /* Dissect the attribute identifier */
+ dissect_zcl_attr_id(tvb, subtree, &offset, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT);
+ }
+ }
+ return offset;
+} /* dissect_zbee_nwk_gp_cmd_read_attributes */
+/**
+ * Dissector for ZigBee Green Power write attributes commands.
+ *
+ *@param tvb pointer to buffer containing raw packet.
+ *@param pinfo pointer to packet information fields.
+ *@param tree pointer to data tree Wireshark uses to display packet.
+ *@param packet packet data.
+ *@param offset current payload offset.
+ *@return payload processed offset.
+ */
+static guint
+dissect_zbee_nwk_gp_cmd_write_attributes(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
+ zbee_nwk_green_power_packet *packet _U_, guint offset)
+{
+ guint8 cr_options = 0;
+ proto_tree *subtree = NULL;
+ proto_tree *att_tree = NULL;
+ guint16 mfr_code = ZBEE_MFG_CODE_NONE;
+ guint16 cluster_id;
+ guint8 record_list_len;
+ guint tvb_len;
+ guint16 attr_id;
+ guint end_byte;
+ //guint8 i;
+
+ static const int * options[] = {
+ &hf_zbee_nwk_gp_cmd_read_att_opt_multi_rec,
+ &hf_zbee_nwk_gp_cmd_read_att_opt_man_field_present,
+ NULL
+ };
+
+ /* Get Options Field, build subtree and display the results. */
+ cr_options = tvb_get_guint8(tvb, offset);
+ subtree = proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_read_att_opt, ett_zbee_nwk_cmd_options, options, ENC_NA);
+
+ offset += 1;
+ /* Parse and display manufacturer ID value. */
+ if (cr_options & ZBEE_NWK_GP_CMD_READ_ATTRIBUTE_OPT_MAN_FIELD_PRESENT) {
+ proto_tree_add_item(tree, hf_zbee_zcl_gp_cmd_ms_manufacturer_code, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ mfr_code = tvb_get_letohs(tvb, offset);
+ offset += 2;
+ }
+
+ tvb_len = tvb_captured_length(tvb);
+ while (offset < tvb_len)
+ {
+ /* Create subtree and parse attributes list. */
+ subtree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_zbee_nwk_clu_rec, NULL, "Write Cluster Record");
+
+ /* Get cluster ID and add it into the subtree. */
+ cluster_id = tvb_get_letohs(tvb, offset);
+ proto_tree_add_item(subtree, hf_zbee_nwk_gp_zcl_attr_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ offset += 2;
+ /* Get length of record list. */
+ record_list_len = tvb_get_guint8(tvb, offset);
+ proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_read_att_record_len, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+
+ end_byte = offset + record_list_len;
+ while ( offset < end_byte)
+ {
+ /* Create subtree for attribute status field */
+ att_tree = proto_tree_add_subtree_format(subtree, tvb, offset, 0, ett_zbee_nwk_att_rec, NULL, "Write Attribute record");
+
+ /* Dissect the attribute identifier */
+ attr_id = tvb_get_letohs(tvb, offset);
+ dissect_zcl_attr_id(tvb, att_tree, &offset, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT);
+
+ /* Dissect the attribute data type and data */
+ dissect_zcl_attr_data_type_val(tvb, att_tree, &offset, attr_id, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT);
+ }
+ }
+ return offset;
+} /* dissect_zbee_nwk_gp_cmd_write_attributes */
+
+
+/**
+ * Dissector for ZigBee Green Power read attribute response command.
+ *
+ *@param tvb pointer to buffer containing raw packet.
+ *@param pinfo pointer to packet information fields.
+ *@param tree pointer to data tree Wireshark uses to display packet.
+ *@param packet packet data.
+ *@param offset current payload offset.
+ *@return payload processed offset.
+ */
+static guint
+dissect_zbee_nwk_gp_cmd_read_attributes_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
+ zbee_nwk_green_power_packet *packet _U_, guint offset)
+{
+ guint8 cr_options;
+ proto_tree *subtree = NULL;
+ proto_tree *att_tree = NULL;
+ guint16 cluster_id;
+ guint16 attr_id;
+ guint16 mfr_code = ZBEE_MFG_CODE_NONE;
+ guint8 record_list_len;
+ guint tvb_len;
+ guint end_byte;
+
+ static const int * options[] = {
+ &hf_zbee_nwk_gp_cmd_read_att_opt_multi_rec,
+ &hf_zbee_nwk_gp_cmd_read_att_opt_man_field_present,
+ NULL
+ };
+
+ /* Get Options Field, build subtree and display the results. */
+ cr_options = tvb_get_guint8(tvb, offset);
+ subtree = proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_read_att_opt, ett_zbee_nwk_cmd_options, options, ENC_NA);
+ offset += 1;
+
+ /* Parse and display manufacturer ID value. */
+ if (cr_options & ZBEE_NWK_GP_CMD_READ_ATTRIBUTE_OPT_MAN_FIELD_PRESENT) {
+ proto_tree_add_item(tree, hf_zbee_zcl_gp_cmd_ms_manufacturer_code, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ mfr_code = tvb_get_letohs(tvb, offset);
+ offset += 2;
+ }
+
+ tvb_len = tvb_captured_length(tvb);
+ while (offset < tvb_len) //TODO not secure with malformed packets
+ {
+ /* Create subtree and parse attributes list. */
+ subtree = proto_tree_add_subtree_format(tree, tvb, offset,0, ett_zbee_nwk_clu_rec, NULL, "Cluster record");
+
+ /* Get cluster ID and add it into the subtree. */
+ cluster_id = tvb_get_letohs(tvb, offset);
+ proto_tree_add_item(subtree, hf_zbee_nwk_gp_zcl_attr_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ offset += 2;
+ /* Get length of record list in bytes. */
+ record_list_len = tvb_get_guint8(tvb, offset);
+ proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_read_att_record_len, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+
+ end_byte = offset + record_list_len;
+ while ( offset < end_byte)
+ {
+ /* Create subtree for attribute status field */
+ /* TODO ett_ could be an array to permit not to unroll all always */
+ att_tree = proto_tree_add_subtree_format(subtree, tvb, offset, 0, ett_zbee_nwk_att_rec, NULL, "Read Attribute record");
+
+ /* Dissect the attribute identifier */
+ attr_id = tvb_get_letohs(tvb, offset);
+ dissect_zcl_attr_id(tvb, att_tree, &offset, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT);
+
+ /* Dissect the status and optionally the data type and value */
+ if(dissect_zcl_attr_uint8(tvb, att_tree, &offset, &hf_zbee_nwk_gp_zcl_attr_status)
+ == ZBEE_ZCL_STAT_SUCCESS)
+ {
+ /* Dissect the attribute data type and data */
+ dissect_zcl_attr_data_type_val(tvb, att_tree, &offset, attr_id, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT);
+ }
+ else
+ {
+ /* Data type field is always present (not like in ZCL read attribute response command) */
+ dissect_zcl_attr_data(tvb, att_tree, &offset,
+ dissect_zcl_attr_uint8(tvb, att_tree, &offset, &hf_zbee_nwk_gp_zcl_attr_data_type), ZBEE_ZCL_FCF_TO_CLIENT );
+ }
+ }
+ }
+ return offset;
+} /* dissect_zbee_nwk_gp_cmd_read_attributes_response */
+
+
+/**
+ *Dissector for ZigBee Green Power multi-cluster reporting command.
+ *
+ *@param tvb pointer to buffer containing raw packet.
+ *@param pinfo pointer to packet information fields.
+ *@param tree pointer to data tree Wireshark uses to display packet.
+ *@param packet packet data.
+ *@param offset current payload offset.
+ *@param mfr_code manufacturer code.
+ *@return payload processed offset.
+ */
+static guint
+dissect_zbee_nwk_gp_cmd_multi_cluster_reporting(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
+ zbee_nwk_green_power_packet *packet _U_, guint offset, guint16 mfr_code)
+{
+ proto_tree *subtree = NULL;
+ guint16 cluster_id;
+ guint16 attr_id;
+ guint tvb_len;
+
+ tvb_len = tvb_captured_length(tvb);
+ while (offset < tvb_len)
+ {
+ /* Create subtree and parse attributes list. */
+ subtree = proto_tree_add_subtree_format(tree, tvb, offset, 0, ett_zbee_nwk_clu_rec, NULL, "Cluster record"); //TODO for cluster %% blabla
+
+ /* Get cluster ID and add it into the subtree. */
+ cluster_id = tvb_get_letohs(tvb, offset);
+ proto_tree_add_item(subtree, hf_zbee_nwk_gp_zcl_attr_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ offset += 2;
+
+ /* Dissect the attribute identifier */
+ attr_id = tvb_get_letohs(tvb, offset);
+ dissect_zcl_attr_id(tvb, subtree, &offset, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT);
+
+ /* Dissect the attribute data type and data */
+ dissect_zcl_attr_data_type_val(tvb, subtree, &offset, attr_id, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT);
+ // TODO how to dissect when data type is different from expected one for this attribute ? this shouldn't happen
+ }
+ return offset;
+} /* dissect_zbee_nwk_gp_cmd_multi_cluster_reporting */
+
+
+/**
+ *Dissector for ZigBee Green Power commands manufacturer specific attrib reporting.
+ *
+ *@param tvb pointer to buffer containing raw packet.
+ *@param pinfo pointer to packet information fields.
+ *@param tree pointer to data tree Wireshark uses to display packet.
+ *@param packet packet data.
+ *@param offset current payload offset.
+ *@return payload processed offset.
+ */
+static guint
+dissect_zbee_nwk_gp_cmd_MS_multi_cluster_reporting(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
+ zbee_nwk_green_power_packet *packet _U_, guint offset)
+{
+ guint16 mfr_code;
+
+ /*dissect manufacturer ID*/
+ proto_tree_add_item(tree, hf_zbee_zcl_gp_cmd_ms_manufacturer_code, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ mfr_code = tvb_get_letohs(tvb, offset);
+ offset += 2;
+
+ offset = dissect_zbee_nwk_gp_cmd_multi_cluster_reporting(tvb, pinfo, tree, packet, offset, mfr_code);
+
+ return offset;
+}/*dissect_zbee_nwk_gp_cmd_MS_multi_cluster_reporting*/
+
+/**
*Dissector for ZigBee Green Power Move Color.
*
*@param tvb pointer to buffer containing raw packet.
@@ -1157,13 +1500,20 @@ dissect_zbee_nwk_gp_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
offset = dissect_zbee_nwk_gp_cmd_step_color(tvb, pinfo, cmd_tree, packet, offset);
break;
case ZB_GP_CMD_ID_ATTRIBUTE_REPORTING:
- offset = dissect_zbee_nwk_gp_cmd_attr_reporting(tvb, pinfo, cmd_tree, packet, offset);
+ offset = dissect_zbee_nwk_gp_cmd_attr_reporting(tvb, pinfo, cmd_tree, packet, offset, ZBEE_MFG_CODE_NONE);
break;
case ZB_GP_CMD_ID_MANUFACTURE_SPECIFIC_ATTR_REPORTING:
+ offset = dissect_zbee_nwk_gp_cmd_MS_attr_reporting(tvb, pinfo, cmd_tree, packet, offset);
+ break;
case ZB_GP_CMD_ID_MULTI_CLUSTER_REPORTING:
+ offset = dissect_zbee_nwk_gp_cmd_multi_cluster_reporting(tvb, pinfo, cmd_tree, packet, offset, ZBEE_MFG_CODE_NONE);
+ break;
case ZB_GP_CMD_ID_MANUFACTURER_SPECIFIC_MCLUSTER_REPORTING:
- case ZB_GP_CMD_ID_REQUEST_ATTRIBUTES:
+ offset = dissect_zbee_nwk_gp_cmd_MS_multi_cluster_reporting(tvb, pinfo, cmd_tree, packet, offset);
+ break;
case ZB_GP_CMD_ID_READ_ATTRIBUTES_RESPONSE:
+ offset = dissect_zbee_nwk_gp_cmd_read_attributes_response(tvb, pinfo, cmd_tree, packet, offset);
+ break;
case ZB_GP_CMD_ID_ANY_SENSOR_COMMAND_A0_A3:
/* TODO: implement it. */
break;
@@ -1173,13 +1523,16 @@ dissect_zbee_nwk_gp_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
case ZB_GP_CMD_ID_CHANNEL_REQUEST:
offset = dissect_zbee_nwk_gp_cmd_channel_request(tvb, pinfo, cmd_tree, packet, offset);
break;
+ case ZB_GP_CMD_ID_REQUEST_ATTRIBUTES:
/* GPDF commands sent to GPD. */
+ case ZB_GP_CMD_ID_READ_ATTRIBUTES:
+ offset = dissect_zbee_nwk_gp_cmd_read_attributes(tvb, pinfo, cmd_tree, packet, offset);
+ break;
case ZB_GP_CMD_ID_COMMISSIONING_REPLY:
offset = dissect_zbee_nwk_gp_cmd_commissioning_reply(tvb, pinfo, cmd_tree, packet, offset);
break;
case ZB_GP_CMD_ID_WRITE_ATTRIBUTES:
- case ZB_GP_CMD_ID_READ_ATTRIBUTES:
- /* TODO: implement it. */
+ offset = dissect_zbee_nwk_gp_cmd_write_attributes(tvb, pinfo, cmd_tree, packet, offset);
break;
case ZB_GP_CMD_ID_CHANNEL_CONFIGURATION:
offset = dissect_zbee_nwk_gp_cmd_channel_configuration(tvb, pinfo, cmd_tree, packet, offset);
@@ -1695,17 +2048,17 @@ proto_register_zbee_nwk_gp(void)
{ "GPD CommandID list", "zbee_nwk_gp.cmd.comm.gpd_cmd_id_list", FT_NONE, BASE_NONE, NULL,
0x0 , NULL, HFILL }},
- { &hf_zbee_nwk_gp_cmd_comm_length_of_clid_list,
- { "Length of ClusterID list", "zbee_nwk_gp.cmd.comm.length_of_clid_list", FT_UINT8, BASE_HEX, NULL,
- 0x0 , NULL, HFILL }},
+ { &hf_zbee_nwk_gp_cmd_comm_length_of_clid_list,
+ { "Length of ClusterID list", "zbee_nwk_gp.cmd.comm.length_of_clid_list", FT_UINT8, BASE_HEX, NULL,
+ 0x0 , NULL, HFILL }},
- { &hf_zbee_nwk_gp_cmd_comm_length_of_clid_list_server,
- { "Number of server ClusterIDs", "zbee_nwk_gp.cmd.comm.length_of_clid_list_srv", FT_UINT8, BASE_DEC, NULL,
- ZBEE_NWK_GP_CMD_COMMISSIONING_CLID_LIST_LEN_SRV, NULL, HFILL }},
+ { &hf_zbee_nwk_gp_cmd_comm_length_of_clid_list_server,
+ { "Number of server ClusterIDs", "zbee_nwk_gp.cmd.comm.length_of_clid_list_srv", FT_UINT8, BASE_DEC, NULL,
+ ZBEE_NWK_GP_CMD_COMMISSIONING_CLID_LIST_LEN_SRV, NULL, HFILL }},
- { &hf_zbee_nwk_gp_cmd_comm_length_of_clid_list_client,
- { "Number of client ClusterIDs", "zbee_nwk_gp.cmd.comm.length_of_clid_list_cli", FT_UINT8, BASE_DEC, NULL,
- ZBEE_NWK_GP_CMD_COMMISSIONING_CLID_LIST_LEN_CLI, NULL, HFILL }},
+ { &hf_zbee_nwk_gp_cmd_comm_length_of_clid_list_client,
+ { "Number of client ClusterIDs", "zbee_nwk_gp.cmd.comm.length_of_clid_list_cli", FT_UINT8, BASE_DEC, NULL,
+ ZBEE_NWK_GP_CMD_COMMISSIONING_CLID_LIST_LEN_CLI, NULL, HFILL }},
{ &hf_zbee_nwk_cmd_comm_clid_list_server,
{ "Cluster ID List Server", "zbee_nwk_gp.cmd.comm.clid_list_server", FT_NONE, BASE_NONE, NULL,
@@ -1749,8 +2102,35 @@ proto_register_zbee_nwk_gp(void)
{ &hf_zbee_nwk_gp_cmd_comm_rep_frame_counter,
{ "Frame Counter", "zbee_nwk_gp.cmd.comm_reply.frame_counter", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
- { &hf_zbee_nwk_gp_cmd_attr_report_cluster_id,
- { "ZigBee Cluster ID", "zbee_nwk_gp.cmd.comm.attr_report", FT_UINT16, BASE_HEX, VALS(zbee_aps_cid_names),
+ { &hf_zbee_nwk_gp_cmd_read_att_opt_multi_rec,
+ { "Multi-record", "zbee_nwk_gp.cmd.read_att.opt.multi_record", FT_BOOLEAN, 8, NULL,
+ ZBEE_NWK_GP_CMD_READ_ATTRIBUTE_OPT_MULTI_RECORD, NULL, HFILL }},
+
+ { &hf_zbee_nwk_gp_cmd_read_att_opt_man_field_present,
+ { "Manufacturer field present", "zbee_nwk_gp.cmd.read_att.opt.man_field_present", FT_BOOLEAN, 8, NULL,
+ ZBEE_NWK_GP_CMD_READ_ATTRIBUTE_OPT_MAN_FIELD_PRESENT, NULL, HFILL }},
+
+ { &hf_zbee_nwk_gp_cmd_read_att_opt,
+ { "Option field", "zbee_nwk_gp.cmd.read_att.opt", FT_UINT8, BASE_HEX, NULL,
+ 0x0, NULL, HFILL }},
+
+ { &hf_zbee_zcl_gp_cmd_ms_manufacturer_code,
+ { "Manufacturer Code", "zbee_nwk_gp.cmd.manufacturer_code", FT_UINT16, BASE_HEX, VALS(zbee_mfr_code_names),
+ 0x0, NULL, HFILL }},
+
+ { &hf_zbee_nwk_gp_cmd_read_att_record_len,
+ { "Length of Record List", "zbee_nwk_gp.cmd.read_att.record_len", FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
+ { &hf_zbee_nwk_gp_zcl_attr_status,
+ { "Status", "zbee_nwk_gp.zcl.attr.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_status_names),
+ 0x0, NULL, HFILL }},
+
+ { &hf_zbee_nwk_gp_zcl_attr_data_type,
+ { "Data Type", "zbee_nwk_gp.zcl.attr.datatype", FT_UINT8, BASE_HEX, VALS(zbee_zcl_short_data_type_names),
+ 0x0, NULL, HFILL } },
+
+ { &hf_zbee_nwk_gp_zcl_attr_cluster_id,
+ { "ZigBee Cluster ID", "zbee_nwk_gp.zcl.attr.cluster_id", FT_UINT16, BASE_HEX, VALS(zbee_aps_cid_names),
0x0, NULL, HFILL }},
{ &hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour,
@@ -1820,6 +2200,8 @@ proto_register_zbee_nwk_gp(void)
&ett_zbee_nwk_cmd_options,
&ett_zbee_nwk_fcf,
&ett_zbee_nwk_fcf_ext,
+ &ett_zbee_nwk_clu_rec,
+ &ett_zbee_nwk_att_rec,
&ett_zbee_nwk_cmd_comm_gpd_cmd_id_list,
&ett_zbee_nwk_cmd_comm_length_of_clid_list,
&ett_zbee_nwk_cmd_comm_clid_list_server,
diff --git a/epan/dissectors/packet-zbee-zcl.c b/epan/dissectors/packet-zbee-zcl.c
index 0363b1f797..8defb551b1 100644
--- a/epan/dissectors/packet-zbee-zcl.c
+++ b/epan/dissectors/packet-zbee-zcl.c
@@ -42,9 +42,6 @@ static void dissect_zcl_discover_attr_resp (tvbuff_t *tvb, packet_info *pinfo, p
/* Helper routines */
static void dissect_zcl_attr_data_general(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint16 attr_id, guint data_type, guint16 cluster_id, guint16 mfr_code, gboolean client_attr);
-static void dissect_zcl_attr_data_type_val (tvbuff_t *tvb, proto_tree *tree, guint *offset, guint16 cmd_id, guint16 cluster_id, guint16 mfr_code, gboolean client_attr);
-static guint dissect_zcl_attr_uint8 (tvbuff_t *tvb, proto_tree *tree, guint *offset, int *length);
-static void dissect_zcl_attr_id (tvbuff_t *tvb, proto_tree *tree, guint *offset, guint16 cluster_id, guint16 mfr_code, gboolean client_attr);
static void zcl_dump_data(tvbuff_t *tvb, guint offset, packet_info *pinfo, proto_tree *tree);
static void dissect_zcl_array_type(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint8 elements_type, guint16 elements_num, gboolean client_attr);
@@ -1452,7 +1449,7 @@ static void dissect_zcl_discover_attr_resp(tvbuff_t *tvb, packet_info *pinfo _U_
*@param mfr_code manufacturer code.
*@param client_attr ZCL client
*/
-static void dissect_zcl_attr_id(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint16 cluster_id, guint16 mfr_code, gboolean client_attr)
+void dissect_zcl_attr_id(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint16 cluster_id, guint16 mfr_code, gboolean client_attr)
{
zbee_zcl_cluster_desc *desc;
int hf_attr_id = hf_zbee_zcl_attr_id;
@@ -1489,7 +1486,7 @@ static void dissect_zcl_attr_id(tvbuff_t *tvb, proto_tree *tree, guint *offset,
*@param mfr_code manufacturer code.
*@param client_attr ZCL client
*/
-static void dissect_zcl_attr_data_type_val(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint16 attr_id, guint16 cluster_id, guint16 mfr_code, gboolean client_attr)
+void dissect_zcl_attr_data_type_val(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint16 attr_id, guint16 cluster_id, guint16 mfr_code, gboolean client_attr)
{
zbee_zcl_cluster_desc *desc;
@@ -1941,7 +1938,7 @@ void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint
*@param hf_zbee_zcl pointer to header field index
*@return dissected data
*/
-static guint dissect_zcl_attr_uint8(tvbuff_t *tvb, proto_tree *tree, guint *offset, int *hf_zbee_zcl)
+guint dissect_zcl_attr_uint8(tvbuff_t *tvb, proto_tree *tree, guint *offset, int *hf_zbee_zcl)
{
guint attr_uint;
diff --git a/epan/dissectors/packet-zbee-zcl.h b/epan/dissectors/packet-zbee-zcl.h
index ed83aa38ba..ed2c18520c 100644
--- a/epan/dissectors/packet-zbee-zcl.h
+++ b/epan/dissectors/packet-zbee-zcl.h
@@ -203,6 +203,9 @@ extern void dissect_zcl_read_attr (tvbuff_t *tvb, packet_info *pinfo, proto_tree
extern void dissect_zcl_write_attr (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset, guint16 cluster_id, guint16 mfr_code, gboolean direction);
extern void dissect_zcl_report_attr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset, guint16 cluster_id, guint16 mfr_code, gboolean direction);
extern void dissect_zcl_read_attr_resp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset, guint16 cluster_id, guint16 mfr_code, gboolean direction);
+extern void dissect_zcl_attr_id(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint16 cluster_id, guint16 mfr_code, gboolean client_attr);
+extern void dissect_zcl_attr_data_type_val(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint16 attr_id, guint16 cluster_id, guint16 mfr_code, gboolean client_attr);
+extern guint dissect_zcl_attr_uint8 (tvbuff_t *tvb, proto_tree *tree, guint *offset, int *length);
/* Helper functions */
zbee_zcl_cluster_desc *zbee_zcl_get_cluster_desc(guint16 cluster_id, guint16 mfr_code);